From 8ca4517f84a240fe8d9d9ad5a5118d41fe97814e Mon Sep 17 00:00:00 2001 From: wtx-labs Date: Mon, 23 Jun 2025 12:38:44 +0200 Subject: [PATCH 1/3] The Allegro REST API client for Java - release 1.0.0 --- README.md | 151 +- pom.xml | 305 + .../java/pl/wtx/allegro/AllegroApiClient.java | 47 + .../allegro/AllegroApiClientUsageDemo.java | 53 + .../api/client/AdditionalServicesApi.java | 759 + .../AdditionalServicesTranslationsApi.java | 519 + .../api/client/AdvanceShipNoticesApi.java | 1722 + .../api/client/AfterSaleServicesApi.java | 2279 ++ .../allegro/api/client/AlleDiscountApi.java | 1119 + .../allegro/api/client/AllegroPricesApi.java | 636 + .../api/client/AuctionsAndBiddingApi.java | 357 + .../api/client/AutomaticPricingApi.java | 916 + .../allegro/api/client/BadgeCampaignsApi.java | 1125 + .../api/client/BatchOfferModificationApi.java | 1870 + .../pl/wtx/allegro/api/client/BillingApi.java | 403 + .../client/CategoriesAndParametersApi.java | 952 + .../pl/wtx/allegro/api/client/CharityApi.java | 230 + .../allegro/api/client/ClassifiedsApi.java | 975 + .../api/client/CommissionRefundsApi.java | 699 + .../api/client/CompatibilityListApi.java | 731 + .../wtx/allegro/api/client/ContactsApi.java | 649 + .../api/client/CustomerReturnsApi.java | 668 + .../wtx/allegro/api/client/DeliveryApi.java | 1054 + .../wtx/allegro/api/client/DisputesApi.java | 1134 + .../api/client/FulfillmentParcelsApi.java | 211 + .../api/client/FulfillmentProductsApi.java | 231 + .../api/client/FulfillmentRemovalApi.java | 346 + .../api/client/FulfillmentStockApi.java | 297 + .../api/client/ImagesAndAttachmentsApi.java | 657 + .../InformationAboutMarketplacesApi.java | 192 + .../api/client/InformationAboutUserApi.java | 1642 + .../allegro/api/client/MessageCenterApi.java | 1682 + .../allegro/api/client/OfferBundlesApi.java | 799 + .../api/client/OfferManagementApi.java | 2485 ++ .../allegro/api/client/OfferRatingApi.java | 215 + .../wtx/allegro/api/client/OfferTagsApi.java | 941 + .../api/client/OfferTranslationsApi.java | 542 + .../allegro/api/client/OfferVariantsApi.java | 787 + .../api/client/OrderManagementApi.java | 2082 + .../wtx/allegro/api/client/PaymentsApi.java | 631 + .../api/client/PointsOfServiceApi.java | 809 + .../pl/wtx/allegro/api/client/PricingApi.java | 364 + .../wtx/allegro/api/client/ProductsApi.java | 1040 + .../api/client/PublicOfferInformationApi.java | 346 + .../api/client/PublicUserInformationApi.java | 217 + .../api/client/RebatesAndPromotionsApi.java | 1256 + .../api/client/ResponsiblePersonsApi.java | 599 + .../api/client/ResponsibleProducersApi.java | 757 + .../api/client/ShipmentManagementApi.java | 1677 + .../wtx/allegro/api/client/SizeTablesApi.java | 760 + .../client/TaxIdentificationNumberApi.java | 484 + .../allegro/api/client/TaxSettingsApi.java | 235 + .../api/client/UsersOfferInformationApi.java | 999 + .../allegro/api/client/config/GsonConfig.java | 21 + .../client/config/OffsetDateTimeAdapter.java | 44 + .../api/client/config/OkHttpClientConfig.java | 17 + .../api/client/invoker/ApiCallback.java | 62 + .../allegro/api/client/invoker/ApiClient.java | 1692 + .../api/client/invoker/ApiException.java | 167 + .../api/client/invoker/ApiResponse.java | 76 + .../api/client/invoker/Configuration.java | 63 + .../invoker/GzipRequestInterceptor.java | 85 + .../wtx/allegro/api/client/invoker/JSON.java | 2286 ++ .../wtx/allegro/api/client/invoker/Pair.java | 57 + .../client/invoker/ProgressRequestBody.java | 73 + .../client/invoker/ProgressResponseBody.java | 70 + .../client/invoker/ServerConfiguration.java | 72 + .../api/client/invoker/ServerVariable.java | 37 + .../api/client/invoker/StringUtil.java | 83 + .../api/client/invoker/auth/ApiKeyAuth.java | 80 + .../client/invoker/auth/Authentication.java | 37 + .../client/invoker/auth/HttpBasicAuth.java | 55 + .../client/invoker/auth/HttpBearerAuth.java | 75 + .../api/client/invoker/auth/OAuth.java | 42 + .../api/client/invoker/auth/OAuthFlow.java | 25 + .../invoker/auth/OAuthOkHttpClient.java | 82 + .../client/invoker/auth/RetryingOAuth.java | 223 + .../client/model/AbstractOpenApiSchema.java | 146 + .../api/client/model/AdditionalEmail.java | 276 + .../client/model/AdditionalEmailRequest.java | 214 + .../model/AdditionalEmailsResponse.java | 232 + ...tplacePromoOptionsCommandModification.java | 238 + ...alMarketplacePromoOptionsModification.java | 258 + .../AdditionalMarketplacePublication.java | 208 + ...AdditionalMarketplacePublicationState.java | 84 + ...dditionalMarketplacePublicationStatus.java | 84 + .../AdditionalMarketplaceSellingMode.java | 214 + ...onalMarketplacesRefusalReasonResponse.java | 274 + .../AdditionalMarketplacesRequestValue.java | 208 + ...alMarketplacesRequestValueSellingMode.java | 208 + .../AdditionalMarketplacesResponseValue.java | 240 + ...lMarketplacesResponseValuePublication.java | 320 + .../AdditionalMarketplacesVisibility.java | 353 + .../client/model/AdditionalPropertyDto.java | 332 + .../AdditionalServiceDefinitionRequest.java | 214 + .../client/model/AdditionalServiceDto.java | 275 + .../AdditionalServiceGroupTranslation.java | 238 + ...lServiceGroupTranslationPatchResponse.java | 238 + ...tionalServiceGroupTranslationResponse.java | 228 + .../model/AdditionalServiceRequest.java | 294 + .../model/AdditionalServiceResponse.java | 290 + .../model/AdditionalServiceTranslation.java | 238 + .../client/model/AdditionalServicesGroup.java | 206 + .../model/AdditionalServicesGroupRequest.java | 294 + .../AdditionalServicesGroupResponse.java | 417 + ...tionalServicesGroupTranslationRequest.java | 208 + ...tionalServicesGroupTranslationWrapper.java | 228 + ...rvicesGroupTranslationWrapperWithType.java | 314 + .../model/AdditionalServicesGroups.java | 228 + .../wtx/allegro/api/client/model/Address.java | 369 + .../allegro/api/client/model/AddressDto.java | 489 + .../api/client/model/AdvanceShipNotice.java | 296 + .../client/model/AdvanceShipNoticeList.java | 289 + .../model/AdvanceShipNoticeResponse.java | 506 + .../client/model/AdvanceShipNoticeStatus.java | 84 + .../api/client/model/AfterSalesServices.java | 272 + .../model/AfterSalesServicesAddress.java | 338 + .../model/AfterSalesServicesAttachment.java | 267 + ...AfterSalesServicesProductOfferRequest.java | 272 + ...cesProductOfferRequestImpliedWarranty.java | 237 + ...rvicesProductOfferRequestReturnPolicy.java | 237 + ...esServicesProductOfferRequestWarranty.java | 237 + .../api/client/model/AiCoCreatedContent.java | 227 + .../model/AlleDiscountEligibleOfferDto.java | 314 + ...eDiscountEligibleOfferDtoAlleDiscount.java | 272 + ...fferDtoAlleDiscountCampaignConditions.java | 255 + ...ountCampaignConditionsViolationsInner.java | 236 + ...AlleDiscountMinimumGuaranteedDiscount.java | 206 + ...AlleDiscountEligibleOfferDtoBasePrice.java | 236 + .../AlleDiscountEligibleOfferDtoProduct.java | 206 + .../AlleDiscountGetSubmitCommandResponse.java | 270 + ...iscountGetSubmitCommandResponseOutput.java | 417 + ...ndResponseOutputNewOfferParticipation.java | 206 + ...lleDiscountGetWithdrawCommandResponse.java | 270 + ...scountGetWithdrawCommandResponseInput.java | 206 + ...countGetWithdrawCommandResponseOutput.java | 417 + ...onseOutputWithdrawnOfferParticipation.java | 206 + .../AlleDiscountListCampaignsResponse.java | 228 + ...gnsResponseAlleDiscountCampaignsInner.java | 450 + ...AlleDiscountCampaignsInnerApplication.java | 315 + ...AlleDiscountCampaignsInnerMarketplace.java | 206 + ...AlleDiscountCampaignsInnerPublication.java | 315 + ...eAlleDiscountCampaignsInnerVisibility.java | 315 + .../AlleDiscountListEligibleResponse.java | 282 + .../AlleDiscountListSubmittedResponse.java | 282 + .../AlleDiscountRequiredMerchantPriceDto.java | 236 + .../AlleDiscountSubmitCommandRequest.java | 250 + ...AlleDiscountSubmitCommandRequestInput.java | 272 + ...ountSubmitCommandRequestInputCampaign.java | 206 + ...iscountSubmitCommandRequestInputOffer.java | 206 + ...ubmitCommandRequestInputProposedPrice.java | 236 + .../AlleDiscountSubmitCommandResponse.java | 270 + ...lleDiscountSubmitCommandResponseInput.java | 272 + ...untSubmitCommandResponseInputCampaign.java | 206 + ...scountSubmitCommandResponseInputOffer.java | 206 + ...bmitCommandResponseInputProposedPrice.java | 236 + ...leDiscountSubmitCommandResponseOutput.java | 315 + .../model/AlleDiscountSubmittedOfferDto.java | 361 + ...AlleDiscountSubmittedOfferDtoCampaign.java | 206 + .../AlleDiscountSubmittedOfferDtoOffer.java | 206 + .../AlleDiscountSubmittedOfferDtoPrices.java | 272 + ...ttedOfferDtoPricesMaximumSellingPrice.java | 236 + ...edOfferDtoPricesMinimalPriceReduction.java | 236 + ...tSubmittedOfferDtoPricesProposedPrice.java | 236 + .../AlleDiscountSubmittedOfferDtoProcess.java | 320 + ...ntSubmittedOfferDtoProcessErrorsInner.java | 236 + .../AlleDiscountWithdrawCommandRequest.java | 250 + ...leDiscountWithdrawCommandRequestInput.java | 206 + .../AlleDiscountWithdrawCommandResponse.java | 270 + ...eDiscountWithdrawCommandResponseInput.java | 206 + ...DiscountWithdrawCommandResponseOutput.java | 315 + .../api/client/model/AllegroCarrier.java | 80 + .../api/client/model/AllegroMarketplaces.java | 228 + .../model/AllegroParcelTrackingHistory.java | 246 + ...oParcelTrackingHistoryTrackingDetails.java | 289 + .../model/AllegroParcelTrackingStatus.java | 366 + .../model/AllegroPickupDropOffPoint.java | 624 + .../AllegroPickupDropOffPointAddress.java | 338 + ...AllegroPickupDropOffPointOpeningInner.java | 276 + ...llegroPickupDropOffPointPaymentsInner.java | 268 + ...roPickupDropOffPointRestrictionsInner.java | 266 + ...llegroPickupDropOffPointServicesInner.java | 268 + .../AllegroPickupDropOffPointsResponse.java | 228 + .../AllegroPricesAccountChangeRequest.java | 300 + ...ngeRequestAdditionalMarketplacesValue.java | 262 + ...groPricesAccountConsentChangeResponse.java | 300 + .../AllegroPricesEligibilityResponse.java | 332 + ...tyResponseAdditionalMarketplacesValue.java | 294 + .../AllegroPricesOfferChangeRequest.java | 300 + ...legroPricesOfferConsentChangeResponse.java | 300 + .../AllegroPricesQualificationResponse.java | 262 + .../model/AlreadyInWarehouseShipping.java | 261 + .../wtx/allegro/api/client/model/Answer.java | 245 + .../api/client/model/AnswerVBeta1.java | 276 + .../client/model/ApplicationTimePolicy.java | 334 + .../allegro/api/client/model/Attachment.java | 206 + .../client/model/AttachmentDeclaration.java | 243 + .../api/client/model/AttachmentFile.java | 236 + .../client/model/AttachmentFileRequest.java | 206 + .../api/client/model/AttachmentType.java | 96 + .../api/client/model/AuctionDetails.java | 214 + .../allegro/api/client/model/AuthError.java | 244 + ...utomaticPricingOfferRuleConfiguration.java | 208 + ...icingOfferRuleConfigurationPriceRange.java | 329 + .../AutomaticPricingRuleConfiguration.java | 282 + ...ricingRuleConfigurationChangeByAmount.java | 214 + ...igurationChangeByAmountChangeByAmount.java | 317 + ...angeByAmountChangeByAmountValuesInner.java | 246 + ...ngRuleConfigurationChangeByPercentage.java | 214 + ...nChangeByPercentageChangeByPercentage.java | 299 + .../AutomaticPricingRulePostRequest.java | 289 + .../model/AutomaticPricingRulePutRequest.java | 258 + .../model/AutomaticPricingRuleResponse.java | 377 + .../model/AutomaticPricingRuleType.java | 82 + .../model/AutomaticPricingRulesResponse.java | 232 + .../api/client/model/AvailableConstraint.java | 259 + .../model/AvailableProductResponse.java | 308 + .../client/model/AvailableProductsList.java | 283 + .../model/AvailablePromotionPackage.java | 266 + .../model/AvailablePromotionPackages.java | 357 + .../api/client/model/AverageRates.java | 292 + .../pl/wtx/allegro/api/client/model/B2b.java | 203 + .../wtx/allegro/api/client/model/Badge.java | 352 + .../api/client/model/BadgeApplication.java | 445 + .../model/BadgeApplicationBargainPrice.java | 236 + .../model/BadgeApplicationCampaign.java | 214 + .../client/model/BadgeApplicationOffer.java | 214 + .../client/model/BadgeApplicationPrices.java | 220 + .../client/model/BadgeApplicationProcess.java | 319 + .../BadgeApplicationPurchaseConstraints.java | 208 + ...geApplicationPurchaseConstraintsLimit.java | 208 + ...cationPurchaseConstraintsLimitPerUser.java | 204 + .../BadgeApplicationRejectionReason.java | 263 + ...adgeApplicationRejectionReasonMessage.java | 256 + .../client/model/BadgeApplicationRequest.java | 321 + .../BadgeApplicationSubsidySellerPrice.java | 236 + .../BadgeApplicationSubsidyTargetPrice.java | 236 + .../api/client/model/BadgeApplications.java | 232 + .../api/client/model/BadgeCampaign.java | 518 + .../api/client/model/BadgeMarketPrice.java | 236 + .../api/client/model/BadgeOperation.java | 454 + .../client/model/BadgeOperationProcess.java | 319 + .../api/client/model/BadgePatchPrices.java | 220 + .../client/model/BadgePatchPricesPrices.java | 208 + .../model/BadgePatchPricesPricesBargain.java | 220 + .../api/client/model/BadgePatchProcess.java | 208 + .../model/BadgePatchProcessProcess.java | 260 + .../api/client/model/BadgePatchRequest.java | 270 + .../allegro/api/client/model/BadgePrices.java | 284 + .../api/client/model/BadgeProcess.java | 323 + .../model/BadgePublicationTimePolicy.java | 346 + .../api/client/model/BadgeSubsidyPrices.java | 240 + .../allegro/api/client/model/BadgesList.java | 232 + .../api/client/model/BaseOperation.java | 417 + .../model/BaseSaleProductResponseDto.java | 604 + .../client/model/BasicDefinitionResponse.java | 206 + .../wtx/allegro/api/client/model/Benefit.java | 214 + .../client/model/BenefitSpecification.java | 183 + .../allegro/api/client/model/BidRequest.java | 214 + .../api/client/model/BillingEntries.java | 228 + .../api/client/model/BillingEntry.java | 479 + .../BillingEntryAdditionalInfoInner.java | 266 + .../api/client/model/BillingEntryBalance.java | 236 + .../api/client/model/BillingEntryOffer.java | 236 + .../api/client/model/BillingEntryOrder.java | 207 + .../api/client/model/BillingEntryTax.java | 236 + .../api/client/model/BillingEntryType.java | 236 + .../api/client/model/BillingEntryValue.java | 236 + .../allegro/api/client/model/BillingType.java | 236 + .../api/client/model/BlockadeOperation.java | 254 + .../model/BlockadeReleaseOperation.java | 254 + .../api/client/model/BundleDiscountDTO.java | 276 + .../client/model/BundleMarketplaceDTO.java | 214 + .../api/client/model/BundledOfferDTO.java | 270 + .../allegro/api/client/model/BuyNowPrice.java | 245 + .../api/client/model/BuyerParticipant.java | 369 + .../model/BuyerPreferencesReference.java | 206 + .../api/client/model/BuyerReference.java | 336 + .../client/model/CampaignRefusalReason.java | 263 + .../api/client/model/CampaignRequestDto.java | 214 + .../api/client/model/CampaignResponseDto.java | 214 + .../model/CancelShipmentCommandStatusDto.java | 376 + .../wtx/allegro/api/client/model/Caption.java | 245 + .../model/CarrierParcelTrackingResponse.java | 263 + .../api/client/model/CashOnDeliveryDto.java | 305 + .../client/model/CashOnDeliveryLimitDto.java | 347 + .../api/client/model/CategoriesDto.java | 228 + .../api/client/model/CategoriesResponse.java | 228 + .../allegro/api/client/model/Category.java | 206 + .../api/client/model/CategoryBaseEvent.java | 243 + .../client/model/CategoryCreatedEvent.java | 247 + ...CategoryDefinitionDescriptionResponse.java | 275 + .../model/CategoryDefinitionResponse.java | 392 + .../client/model/CategoryDeletedEvent.java | 275 + ...goryDeletedEventAllOfRedirectCategory.java | 206 + .../allegro/api/client/model/CategoryDto.java | 327 + .../api/client/model/CategoryDtoParent.java | 206 + .../model/CategoryEventBaseCategory.java | 295 + .../CategoryEventBaseCategoryParent.java | 206 + .../client/model/CategoryEventsResponse.java | 232 + .../api/client/model/CategoryMovedEvent.java | 247 + .../api/client/model/CategoryOptionsDto.java | 365 + .../api/client/model/CategoryParameter.java | 417 + .../CategoryParameterDisplayConditions.java | 232 + .../client/model/CategoryParameterList.java | 228 + .../model/CategoryParameterOptions.java | 356 + ...ategoryParameterRequirementConditions.java | 279 + .../model/CategoryParameterWithValue.java | 258 + .../model/CategoryParameterWithoutValue.java | 214 + ...CategoryParametersScheduledBaseChange.java | 234 + ...ParametersScheduledBaseChangeCategory.java | 206 + ...arametersScheduledBaseChangeParameter.java | 206 + ...oryParametersScheduledChangesResponse.java | 232 + .../model/CategoryProductParameter.java | 362 + .../model/CategoryProductParameterList.java | 228 + .../client/model/CategoryRenamedEvent.java | 247 + .../api/client/model/CategoryResponse.java | 258 + .../model/CategorySuggestionCategoryNode.java | 276 + .../model/CategorySuggestionResponse.java | 232 + .../api/client/model/CategoryTaxSettings.java | 328 + .../wtx/allegro/api/client/model/Cells.java | 227 + .../allegro/api/client/model/ChangePrice.java | 277 + .../api/client/model/ChangePriceInput.java | 214 + .../model/ChangePriceWithoutOutput.java | 245 + .../api/client/model/ChangedParameterDto.java | 236 + .../api/client/model/ChangedTranslation.java | 206 + .../api/client/model/CharityOrganization.java | 206 + .../model/CheckFormsNewOrderInvoice.java | 244 + .../model/CheckFormsNewOrderInvoiceFile.java | 214 + .../model/CheckFormsNewOrderInvoiceId.java | 206 + .../api/client/model/CheckoutForm.java | 737 + .../model/CheckoutFormAddWaybillCreated.java | 378 + ...utFormAddWaybillCreatedLineItemsInner.java | 206 + .../model/CheckoutFormAddWaybillRequest.java | 327 + ...utFormAddWaybillRequestLineItemsInner.java | 214 + .../model/CheckoutFormAdditionalService.java | 296 + .../CheckoutFormBuyerAddressReference.java | 296 + .../model/CheckoutFormBuyerReference.java | 518 + .../model/CheckoutFormDeliveryAddress.java | 459 + .../CheckoutFormDeliveryCancellation.java | 212 + .../model/CheckoutFormDeliveryMethod.java | 236 + .../CheckoutFormDeliveryPickupPoint.java | 298 + ...heckoutFormDeliveryPickupPointAddress.java | 296 + .../model/CheckoutFormDeliveryReference.java | 423 + .../model/CheckoutFormDeliveryTime.java | 300 + .../CheckoutFormDeliveryTimeDispatch.java | 231 + .../CheckoutFormDeliveryTimeGuaranteed.java | 233 + .../client/model/CheckoutFormDiscount.java | 276 + .../client/model/CheckoutFormFulfillment.java | 240 + ...heckoutFormFulfillmentShipmentSummary.java | 208 + ...lfillmentShipmentSummaryLineItemsSent.java | 80 + .../model/CheckoutFormFulfillmentStatus.java | 92 + .../model/CheckoutFormInvoiceAddress.java | 371 + .../CheckoutFormInvoiceAddressCompany.java | 388 + .../CheckoutFormInvoiceAddressCompanyId.java | 311 + ...eckoutFormInvoiceAddressNaturalPerson.java | 245 + .../client/model/CheckoutFormInvoiceInfo.java | 314 + .../client/model/CheckoutFormLineItem.java | 581 + .../client/model/CheckoutFormLineItemTax.java | 278 + .../client/model/CheckoutFormMarketplace.java | 214 + .../model/CheckoutFormNoteReference.java | 206 + .../CheckoutFormOrderWaybillResponse.java | 228 + .../model/CheckoutFormPaymentProvider.java | 84 + .../model/CheckoutFormPaymentReference.java | 410 + .../client/model/CheckoutFormPaymentType.java | 84 + .../client/model/CheckoutFormReference.java | 244 + .../api/client/model/CheckoutFormStatus.java | 82 + .../api/client/model/CheckoutFormSummary.java | 214 + .../model/CheckoutFormSummaryTotalToPay.java | 245 + .../api/client/model/CheckoutForms.java | 291 + .../model/CheckoutFormsOrderInvoice.java | 296 + .../model/CheckoutFormsOrderInvoiceFile.java | 266 + ...sOrderInvoiceFileSecurityVerification.java | 292 + .../model/CheckoutFormsOrderInvoices.java | 255 + .../ClassifiedDailyEventStatResponseDto.java | 258 + .../api/client/model/ClassifiedEventStat.java | 235 + .../api/client/model/ClassifiedExtension.java | 236 + .../client/model/ClassifiedExtraPackage.java | 233 + .../api/client/model/ClassifiedPackage.java | 206 + .../client/model/ClassifiedPackageConfig.java | 464 + .../model/ClassifiedPackageConfigs.java | 232 + .../api/client/model/ClassifiedPackages.java | 265 + .../api/client/model/ClassifiedPromotion.java | 245 + .../client/model/ClassifiedPublication.java | 214 + .../api/client/model/ClassifiedResponse.java | 263 + .../client/model/ClassifiedStatEventType.java | 84 + .../api/client/model/ClassifiedsPackages.java | 260 + .../api/client/model/CommandOutput.java | 260 + .../allegro/api/client/model/CommandTask.java | 350 + .../api/client/model/CommentVBeta1.java | 236 + .../api/client/model/CommissionResponse.java | 268 + .../wtx/allegro/api/client/model/Company.java | 236 + .../api/client/model/CompatibilityList.java | 183 + .../client/model/CompatibilityListIdItem.java | 306 + ...CompatibilityListIdItemAdditionalInfo.java | 214 + .../client/model/CompatibilityListItem.java | 180 + .../CompatibilityListItemProductBased.java | 206 + .../client/model/CompatibilityListManual.java | 227 + .../model/CompatibilityListManualType.java | 232 + .../model/CompatibilityListProductBased.java | 254 + ...yListProductBasedProductOfferResponse.java | 226 + ...CompatibilityListProductOfferResponse.java | 211 + ...mpatibilityListSupportedCategoriesDto.java | 228 + ...CategoriesDtoSupportedCategoriesInner.java | 384 + ...pportedCategoriesInnerValidationRules.java | 232 + .../model/CompatibilityListTextItem.java | 241 + .../client/model/CompatibleProductDto.java | 320 + .../CompatibleProductDtoAttributesInner.java | 247 + .../model/CompatibleProductDtoGroup.java | 206 + .../model/CompatibleProductsGroupsDto.java | 284 + ...ompatibleProductsGroupsDtoGroupsInner.java | 236 + .../model/CompatibleProductsListDto.java | 284 + .../client/model/CompensationOperation.java | 225 + .../api/client/model/ConstraintCriteria.java | 344 + .../wtx/allegro/api/client/model/Contact.java | 206 + .../api/client/model/ContactRequest.java | 308 + .../api/client/model/ContactResponse.java | 338 + .../api/client/model/ContactResponseList.java | 228 + .../client/model/ContributionOperation.java | 283 + .../allegro/api/client/model/Coordinates.java | 243 + .../api/client/model/CorrectionOperation.java | 225 + .../wtx/allegro/api/client/model/Courier.java | 277 + .../client/model/CourierBySellerShipping.java | 289 + .../model/CreateAdvanceShipNoticeRequest.java | 296 + .../CreateAdvanceShipNoticeResponse.java | 479 + ...eConditionsAttachmentUsingPOSTRequest.java | 206 + .../client/model/CreateOfferBundleDTO.java | 294 + .../model/CreatePickupCommandStatusDto.java | 406 + .../model/CreateProductOffers422Response.java | 228 + .../model/CreateResponsiblePersonRequest.java | 238 + ...eResponsiblePersonRequestPersonalData.java | 270 + .../CreateResponsibleProducerRequest.java | 238 + .../model/CreateShipmentCommandStatusDto.java | 376 + .../api/client/model/CurrentPrice.java | 245 + .../api/client/model/CustomerReturn.java | 552 + .../api/client/model/CustomerReturnBuyer.java | 236 + .../api/client/model/CustomerReturnItem.java | 357 + .../model/CustomerReturnItemReason.java | 236 + .../model/CustomerReturnParcelSender.java | 206 + .../client/model/CustomerReturnRefund.java | 208 + .../CustomerReturnRefundBankAccount.java | 328 + ...ustomerReturnRefundBankAccountAddress.java | 296 + .../CustomerReturnRefundRejectionRequest.java | 214 + ...ReturnRefundRejectionRequestRejection.java | 302 + .../client/model/CustomerReturnRejection.java | 324 + .../client/model/CustomerReturnResponse.java | 260 + .../model/CustomerReturnReturnParcel.java | 368 + .../allegro/api/client/model/Deduction.java | 215 + .../model/DeductionChargeOperation.java | 254 + .../model/DeductionIncreaseOperation.java | 254 + .../api/client/model/DeliveryBasic.java | 273 + .../api/client/model/DeliveryFull.java | 301 + .../api/client/model/DeliveryMethodId.java | 206 + .../model/DeliveryProductOfferRequest.java | 273 + ...iveryProductOfferRequestShippingRates.java | 236 + .../model/DeliveryProductOfferResponse.java | 301 + .../api/client/model/DeliveryServiceDto.java | 691 + .../client/model/DeliveryServiceIdDto.java | 236 + .../api/client/model/DeliveryServicesDto.java | 228 + .../client/model/DeliverySettingsRequest.java | 341 + ...verySettingsRequestAbroadFreeDelivery.java | 245 + .../DeliverySettingsRequestFreeDelivery.java | 245 + .../DeliverySettingsRequestMarketplace.java | 214 + .../model/DeliverySettingsResponse.java | 371 + ...erySettingsResponseAbroadFreeDelivery.java | 245 + .../DeliverySettingsResponseCustomCost.java | 211 + .../DeliverySettingsResponseFreeDelivery.java | 245 + .../DeliverySettingsResponseJoinPolicy.java | 270 + .../DeliverySettingsResponseMarketplace.java | 214 + .../api/client/model/DescribesListingFee.java | 307 + .../model/DescribesSuccessCommissionFee.java | 276 + .../api/client/model/DescriptionSection.java | 228 + .../client/model/DescriptionSectionItem.java | 180 + .../model/DescriptionSectionItemImage.java | 233 + .../model/DescriptionSectionItemText.java | 233 + .../model/DictionaryCategoryParameter.java | 295 + ...onaryCategoryParameterAllOfDictionary.java | 277 + .../DictionaryCategoryProductParameter.java | 292 + ...tegoryProductParameterAllOfDictionary.java | 236 + ...goryProductParameterAllOfRestrictions.java | 203 + .../api/client/model/DimensionValue.java | 295 + .../allegro/api/client/model/Discounts.java | 208 + .../model/DiscountsProductOfferRequest.java | 208 + ...ProductOfferRequestWholesalePriceList.java | 236 + .../model/DiscountsProductOfferResponse.java | 208 + .../model/DiscountsWholesalePriceList.java | 206 + .../wtx/allegro/api/client/model/Dispute.java | 631 + .../api/client/model/DisputeAttachment.java | 245 + .../api/client/model/DisputeAttachmentId.java | 214 + .../api/client/model/DisputeAuthor.java | 244 + .../api/client/model/DisputeAuthorRole.java | 82 + .../api/client/model/DisputeCheckoutForm.java | 243 + .../api/client/model/DisputeClaim.java | 248 + .../api/client/model/DisputeFirstMessage.java | 336 + .../api/client/model/DisputeListResponse.java | 228 + .../api/client/model/DisputeMessage.java | 336 + .../client/model/DisputeMessageAuthor.java | 244 + .../api/client/model/DisputeMessageList.java | 228 + .../allegro/api/client/model/DisputeUser.java | 236 + .../api/client/model/EmailRequest.java | 206 + .../api/client/model/EmailResponse.java | 206 + .../wtx/allegro/api/client/model/Error.java | 375 + .../allegro/api/client/model/Error200.java | 338 + .../allegro/api/client/model/Error400.java | 338 + .../allegro/api/client/model/Error403.java | 338 + .../allegro/api/client/model/Error404.java | 338 + .../allegro/api/client/model/Error504.java | 338 + .../api/client/model/ErrorsHolder.java | 228 + .../allegro/api/client/model/Exclusion.java | 206 + .../allegro/api/client/model/ExternalId.java | 206 + .../pl/wtx/allegro/api/client/model/Fee.java | 236 + .../api/client/model/FeePreviewResponse.java | 278 + .../client/model/FloatCategoryParameter.java | 257 + .../model/FloatCategoryProductParameter.java | 254 + ...goryProductParameterAllOfRestrictions.java | 286 + .../api/client/model/FulfillmentOrder.java | 258 + .../client/model/FulfillmentOrderParcel.java | 258 + .../model/FulfillmentOrderParcelItem.java | 332 + .../model/FulfillmentRemovalPreference.java | 300 + .../model/FulfillmentWithdrawalAddress.java | 399 + .../api/client/model/FundraisingCampaign.java | 268 + .../client/model/FundraisingCampaigns.java | 228 + .../api/client/model/GeneralReport.java | 305 + .../client/model/GetBadgeCampaignsList.java | 232 + .../model/GetDeliveryServices504Response.java | 228 + ...tOfDeliveryMethodsUsingGET200Response.java | 228 + ...ingGET200ResponseDeliveryMethodsInner.java | 494 + ...yMethodsInnerShippingRatesConstraints.java | 363 + ...ShippingRatesConstraintsFirstItemRate.java | 266 + ...ppingRatesConstraintsMaxPackageWeight.java | 305 + ...RatesConstraintsMaxQuantityPerPackage.java | 205 + ...rShippingRatesConstraintsNextItemRate.java | 266 + ...rShippingRatesConstraintsShippingTime.java | 235 + ...ngRatesConstraintsShippingTimeDefault.java | 236 + ...stOfShippingRatestUsingGET200Response.java | 228 + ...UsingGET200ResponseShippingRatesInner.java | 288 + ...seShippingRatesInnerMarketplacesInner.java | 206 + ...fferSmartClassificationGET400Response.java | 228 + ...fferSmartClassificationGET403Response.java | 228 + .../GetRefundApplications200Response.java | 256 + .../model/GetRefundedPayments200Response.java | 284 + .../client/model/GetSaleProductsResponse.java | 346 + .../GetSaleProductsResponseNextPage.java | 206 + .../model/GetShipmentDetails404Response.java | 228 + .../api/client/model/HandlingUnit.java | 264 + .../wtx/allegro/api/client/model/Header.java | 214 + .../allegro/api/client/model/ImageUrl.java | 206 + ...iedWarrantiesListImpliedWarrantyBasic.java | 256 + .../api/client/model/ImpliedWarranty.java | 207 + .../client/model/ImpliedWarrantyBasic.java | 236 + .../client/model/ImpliedWarrantyPeriod.java | 206 + .../client/model/ImpliedWarrantyRequest.java | 331 + .../client/model/ImpliedWarrantyResponse.java | 394 + .../api/client/model/InitializeRefund.java | 599 + .../InitializeRefundAdditionalServices.java | 208 + .../model/InitializeRefundDelivery.java | 208 + .../model/InitializeRefundOverpaid.java | 208 + .../api/client/model/InsuranceDto.java | 245 + .../model/IntegerCategoryParameter.java | 257 + .../IntegerCategoryProductParameter.java | 254 + ...goryProductParameterAllOfRestrictions.java | 257 + .../api/client/model/Interlocutor.java | 245 + .../wtx/allegro/api/client/model/JustId.java | 206 + .../api/client/model/Justification.java | 233 + .../api/client/model/LabelRequestDto.java | 340 + .../wtx/allegro/api/client/model/Labels.java | 206 + ...argeOrderDiscountBenefitSpecification.java | 252 + ...ountBenefitSpecificationAllOfDiscount.java | 214 + ...ntBenefitSpecificationAllOfOrderValue.java | 214 + ...ntBenefitSpecificationAllOfThresholds.java | 245 + .../api/client/model/LatestOrderEvent.java | 243 + .../client/model/LimitWithCurrencyDto.java | 234 + .../api/client/model/LineItemDiscount.java | 272 + .../client/model/LineItemReconciliation.java | 322 + .../api/client/model/LineItemVoucher.java | 444 + .../client/model/LineItemVoucherValue.java | 245 + .../api/client/model/ListingCategory.java | 236 + .../model/ListingCategoryWithCount.java | 264 + .../api/client/model/ListingOffer.java | 544 + .../api/client/model/ListingResponse.java | 374 + .../model/ListingResponseCategories.java | 278 + .../client/model/ListingResponseFilters.java | 465 + .../model/ListingResponseFiltersValues.java | 321 + .../client/model/ListingResponseOffers.java | 277 + .../model/ListingResponseSearchMeta.java | 259 + .../api/client/model/ListingResponseSort.java | 293 + .../allegro/api/client/model/Location.java | 296 + .../model/ManualDescriptionTranslation.java | 208 + ...fetyInformationDescriptionTranslation.java | 237 + .../ManualSafetyInformationTranslation.java | 228 + .../client/model/ManualTitleTranslation.java | 206 + .../model/ManualTranslationUpdateRequest.java | 272 + .../model/MarketedBeforeGPSRObligation.java | 215 + ...MarketplaceAvailablePromotionPackages.java | 307 + .../api/client/model/MarketplaceItem.java | 322 + .../model/MarketplaceItemCurrencies.java | 259 + .../client/model/MarketplaceItemCurrency.java | 206 + .../client/model/MarketplaceItemLanguage.java | 206 + .../model/MarketplaceItemLanguages.java | 277 + .../model/MarketplaceItemShippingCountry.java | 206 + .../model/MarketplaceOfferPromoOption.java | 321 + .../client/model/MarketplaceReference.java | 214 + .../client/model/MarketplacesVisibility.java | 266 + .../allegro/api/client/model/MaxPrice.java | 245 + .../allegro/api/client/model/MeResponse.java | 431 + .../model/MeResponseBaseMarketplace.java | 206 + .../wtx/allegro/api/client/model/Message.java | 696 + .../model/MessageAdditionalInformation.java | 218 + .../api/client/model/MessageAttachmentId.java | 214 + .../client/model/MessageAttachmentInfo.java | 363 + .../api/client/model/MessageAuthor.java | 242 + .../api/client/model/MessageAuthorRole.java | 84 + .../api/client/model/MessageOffer.java | 214 + .../api/client/model/MessageOrder.java | 214 + .../client/model/MessageRelatedObject.java | 252 + .../api/client/model/MessageRequest.java | 330 + .../client/model/MessageToSellerSettings.java | 294 + .../api/client/model/MessagesList.java | 290 + .../api/client/model/MinimalPrice.java | 245 + .../api/client/model/ModelConfiguration.java | 240 + .../api/client/model/Modification.java | 540 + ...dificationAttachmentSafetyInformation.java | 226 + ...mentSafetyInformationAllOfAttachments.java | 206 + .../client/model/ModificationDelivery.java | 334 + .../client/model/ModificationDiscounts.java | 208 + ...dificationDiscountsWholesalePriceList.java | 206 + .../ModificationNoSafetyInformation.java | 211 + .../client/model/ModificationPayments.java | 298 + .../client/model/ModificationPublication.java | 309 + .../model/ModificationResponsiblePerson.java | 206 + .../ModificationResponsibleProducer.java | 206 + .../model/ModificationSafetyInformation.java | 183 + .../ModificationTextSafetyInformation.java | 215 + .../model/MultiPackBenefitSpecification.java | 271 + ...enefitSpecificationAllOfConfiguration.java | 213 + ...iPackBenefitSpecificationAllOfTrigger.java | 242 + .../api/client/model/MyBidResponse.java | 300 + .../allegro/api/client/model/NetPrice.java | 245 + .../model/NewAttachmentDeclaration.java | 244 + .../allegro/api/client/model/NewMessage.java | 340 + .../api/client/model/NewMessageInThread.java | 278 + .../client/model/NewProductParameterDto.java | 318 + .../model/NullableTurnoverDiscountDto.java | 358 + .../api/client/model/OfferActivatedEvent.java | 247 + .../model/OfferAdditionalMarketplace.java | 240 + .../client/model/OfferAdditionalServices.java | 207 + .../api/client/model/OfferArchivedEvent.java | 247 + .../api/client/model/OfferAttachment.java | 270 + .../client/model/OfferAttachmentRequest.java | 240 + .../model/OfferAutomaticPricingCommand.java | 294 + ...erAutomaticPricingCommandModification.java | 279 + ...ferAutomaticPricingModificationRemove.java | 228 + ...cPricingModificationRemoveRemoveInner.java | 214 + .../OfferAutomaticPricingModificationSet.java | 228 + ...tomaticPricingModificationSetSetInner.java | 277 + ...ticPricingModificationSetSetInnerRule.java | 214 + .../api/client/model/OfferBadgeCampaign.java | 244 + .../client/model/OfferBidCanceledEvent.java | 247 + .../api/client/model/OfferBidPlacedEvent.java | 247 + .../api/client/model/OfferBundleDTO.java | 455 + .../model/OfferBundleDTOPublication.java | 299 + .../api/client/model/OfferBundlesDTO.java | 264 + .../client/model/OfferBundlesDTONextPage.java | 214 + .../api/client/model/OfferCategory.java | 206 + .../client/model/OfferCategoryRequest.java | 206 + .../api/client/model/OfferChangeCommand.java | 260 + .../api/client/model/OfferChangedEvent.java | 247 + .../api/client/model/OfferCriterium.java | 312 + .../api/client/model/OfferDelivery.java | 235 + .../model/OfferDescriptionTranslation.java | 240 + .../api/client/model/OfferEndedEvent.java | 247 + .../api/client/model/OfferEventBaseOffer.java | 214 + .../client/model/OfferEventEndedOffer.java | 277 + .../OfferEventEndedOfferAllOfPublication.java | 278 + .../client/model/OfferEventExternalOffer.java | 246 + ...fferEventExternalOfferForPriceChanges.java | 297 + ...fferEventExternalOfferWithPublication.java | 277 + .../api/client/model/OfferFixedPrice.java | 236 + .../wtx/allegro/api/client/model/OfferId.java | 206 + .../model/OfferImageLinkUploadRequest.java | 214 + .../model/OfferImageUploadResponse.java | 234 + .../allegro/api/client/model/OfferImages.java | 206 + .../api/client/model/OfferListingDto.java | 702 + .../client/model/OfferListingDtoImage.java | 206 + ...fferListingDtoV1AdditionalMarketplace.java | 316 + ...DtoV1AdditionalMarketplacePublication.java | 208 + ...DtoV1AdditionalMarketplaceSellingMode.java | 240 + ...istingDtoV1AdditionalMarketplaceStock.java | 204 + .../client/model/OfferListingDtoV1B2b.java | 203 + .../model/OfferListingDtoV1Delivery.java | 208 + .../model/OfferListingDtoV1Publication.java | 360 + ...erListingDtoV1PublicationMarketplaces.java | 259 + .../model/OfferListingDtoV1SaleInfo.java | 236 + .../model/OfferListingDtoV1SellingMode.java | 336 + .../client/model/OfferListingDtoV1Stats.java | 232 + .../client/model/OfferListingDtoV1Stock.java | 232 + .../api/client/model/OfferLowestPrice.java | 236 + .../model/OfferMarketplacesPriceChanges.java | 236 + .../model/OfferMarketplacesPublication.java | 258 + .../allegro/api/client/model/OfferPrice.java | 236 + .../client/model/OfferPriceChangeCommand.java | 260 + .../client/model/OfferPriceChangedEvent.java | 247 + .../OfferProductSetProductReference.java | 244 + .../model/OfferProductSetReference.java | 232 + .../api/client/model/OfferPromoOption.java | 288 + .../api/client/model/OfferPromoOptions.java | 401 + .../model/OfferPromoOptionsForSeller.java | 284 + .../OfferPromoOptionsPendingChanges.java | 208 + .../api/client/model/OfferPromotion.java | 257 + .../api/client/model/OfferPublication.java | 206 + .../model/OfferQuantityChangeCommand.java | 260 + .../api/client/model/OfferQuoteDto.java | 355 + .../api/client/model/OfferQuotesDto.java | 256 + .../allegro/api/client/model/OfferRating.java | 336 + .../OfferRatingScoreDistributionInner.java | 234 + .../model/OfferRatingSizeFeedbackInner.java | 234 + .../api/client/model/OfferReference.java | 309 + .../api/client/model/OfferRequirements.java | 258 + .../allegro/api/client/model/OfferRules.java | 261 + .../client/model/OfferRulesRulesInner.java | 306 + .../OfferRulesRulesInnerMarketplace.java | 214 + .../model/OfferRulesRulesInnerRule.java | 245 + .../OfferSafetyInformationTranslation.java | 228 + .../allegro/api/client/model/OfferSeller.java | 290 + .../api/client/model/OfferSellingMode.java | 358 + .../api/client/model/OfferShippingRates.java | 228 + .../api/client/model/OfferStatModelDto.java | 206 + .../client/model/OfferStatResponseDto.java | 310 + .../client/model/OfferStatsResponseDto.java | 228 + .../allegro/api/client/model/OfferStatus.java | 82 + .../allegro/api/client/model/OfferStock.java | 292 + .../client/model/OfferStockChangedEvent.java | 247 + .../api/client/model/OfferTaxRate.java | 236 + .../api/client/model/OfferTaxSettings.java | 292 + .../client/model/OfferTitleTranslation.java | 238 + .../api/client/model/OfferTranslation.java | 310 + .../client/model/OfferTranslationType.java | 80 + .../model/OfferTranslationUpdatedEvent.java | 285 + .../api/client/model/OfferTranslations.java | 228 + .../allegro/api/client/model/OfferVendor.java | 298 + .../model/OfferVisibilityChangedEvent.java | 247 + .../client/model/OffersSearchResultDto.java | 284 + .../allegro/api/client/model/OpenHour.java | 276 + .../model/OperationParticipantAddress.java | 276 + .../api/client/model/OperationPayment.java | 215 + .../api/client/model/OperationValue.java | 245 + .../wtx/allegro/api/client/model/Order.java | 263 + .../allegro/api/client/model/OrderEvent.java | 305 + .../api/client/model/OrderEventData.java | 358 + .../api/client/model/OrderEventStats.java | 208 + .../api/client/model/OrderEventType.java | 88 + .../api/client/model/OrderEventsList.java | 232 + .../api/client/model/OrderLineItem.java | 366 + .../model/OrderLineItemOfferReference.java | 277 + .../api/client/model/OrderMarketplace.java | 214 + .../api/client/model/OrderOffersInner.java | 275 + .../client/model/OrdersShippingCarrier.java | 236 + .../model/OrdersShippingCarriersResponse.java | 228 + .../client/model/OwnTransportShipping.java | 288 + .../allegro/api/client/model/PackageDto.java | 452 + .../api/client/model/PackageRequestDto.java | 366 + .../allegro/api/client/model/Parameter.java | 326 + .../model/ParameterProductOfferRequest.java | 348 + .../model/ParameterProductOfferResponse.java | 348 + .../api/client/model/ParameterRangeValue.java | 245 + .../model/ParametersForPreviewPrice.java | 844 + .../ParcelAdditionalServicesAvailability.java | 260 + ...nalServicesCashOnDeliveryAvailability.java | 230 + ...lAdditionalServicesOptionAvailability.java | 236 + .../client/model/ParcelCreationAddress.java | 326 + ...rcelCreationAddressWithMandatoryPlace.java | 336 + .../client/model/ParcelTrackingHistory.java | 246 + .../ParcelTrackingHistoryTrackingDetails.java | 289 + .../client/model/ParcelTrackingStatus.java | 339 + .../allegro/api/client/model/Participant.java | 338 + .../client/model/PatchBadge202Response.java | 206 + .../wtx/allegro/api/client/model/Payment.java | 214 + .../api/client/model/PaymentOperations.java | 290 + .../allegro/api/client/model/Payments.java | 266 + .../api/client/model/PaymentsSurcharge.java | 239 + .../wtx/allegro/api/client/model/Payout.java | 214 + .../api/client/model/PayoutOperation.java | 254 + .../client/model/PayoutOperationCancel.java | 254 + .../model/PhoneNumberWithCountryCode.java | 245 + .../api/client/model/PhonesRequest.java | 206 + .../api/client/model/PhonesResponse.java | 206 + .../api/client/model/PickupAddressDto.java | 489 + .../client/model/PickupCreateCommandDto.java | 244 + .../client/model/PickupCreateRequestDto.java | 290 + .../client/model/PickupDateProposalDto.java | 275 + .../client/model/PickupDateProposalsDto.java | 258 + .../model/PickupProposalsRequestDto.java | 289 + .../model/PickupProposalsResponseDto.java | 260 + .../pl/wtx/allegro/api/client/model/Pos.java | 729 + .../allegro/api/client/model/PosLocation.java | 214 + .../wtx/allegro/api/client/model/Price.java | 245 + .../api/client/model/PriceAutomation.java | 208 + .../api/client/model/PriceAutomationRule.java | 238 + .../api/client/model/PriceModification.java | 228 + .../model/PriceModificationFixedPrice.java | 247 + .../PriceModificationFixedPriceHolder.java | 245 + ...eModificationPercentageChangeDecrease.java | 246 + ...eModificationPercentageChangeIncrease.java | 246 + .../PriceModificationValueChangeDecrease.java | 247 + .../PriceModificationValueChangeHolder.java | 245 + .../PriceModificationValueChangeIncrease.java | 247 + .../api/client/model/PricingOffer.java | 418 + .../api/client/model/PricingPublication.java | 206 + .../api/client/model/ProcessingStatus.java | 88 + .../wtx/allegro/api/client/model/Product.java | 215 + .../api/client/model/ProductCategory.java | 206 + .../client/model/ProductCategoryProposal.java | 354 + .../client/model/ProductCategoryWithPath.java | 308 + .../api/client/model/ProductChangeDto.java | 260 + .../client/model/ProductChangeDtoProduct.java | 206 + .../model/ProductChangeProposalDto.java | 459 + .../model/ProductChangeProposalRequest.java | 429 + .../client/model/ProductChangesResponse.java | 228 + .../client/model/ProductImageProposal.java | 354 + .../allegro/api/client/model/ProductItem.java | 245 + .../api/client/model/ProductNameProposal.java | 354 + .../api/client/model/ProductOffer.java | 445 + ...ProductOfferAdditionalServicesRequest.java | 236 + ...roductOfferAdditionalServicesResponse.java | 206 + .../model/ProductOfferAttachmentInner.java | 206 + .../api/client/model/ProductOfferBase.java | 383 + ...roductOfferFundraisingCampaignRequest.java | 236 + ...oductOfferFundraisingCampaignResponse.java | 206 + .../client/model/ProductOfferResponse.java | 238 + .../ProductOfferResponsePublication.java | 266 + .../api/client/model/ProductParameter.java | 427 + .../api/client/model/ProductParameterDto.java | 457 + .../model/ProductParameterDtoOptions.java | 265 + .../client/model/ProductParameterOptions.java | 203 + .../model/ProductParameterProposal.java | 258 + .../model/ProductParameterValueProposal.java | 354 + .../client/model/ProductProposalsRequest.java | 404 + .../model/ProductProposalsResponse.java | 526 + .../ProductProposalsResponseCategory.java | 258 + .../ProductProposalsResponsePublication.java | 262 + .../api/client/model/ProductSafetyDto.java | 299 + .../ProductSafetyInformationDescription.java | 269 + .../api/client/model/ProductSetElement.java | 208 + ...SetElementAttachmentSafetyInformation.java | 244 + ...mentSafetyInformationAllOfAttachments.java | 206 + .../ProductSetElementNoSafetyInformation.java | 211 + .../model/ProductSetElementQuantity.java | 208 + .../ProductSetElementQuantityQuantity.java | 204 + ...uctSetElementResponsiblePersonRequest.java | 208 + ...onsiblePersonRequestResponsiblePerson.java | 236 + ...etElementResponsibleProducerIdRequest.java | 233 + ...ElementResponsibleProducerNameRequest.java | 233 + ...tSetElementResponsibleProducerRequest.java | 180 + ...mentResponsibleProducerRequestWrapper.java | 208 + .../ProductSetElementSafetyInformation.java | 183 + ...uctSetElementSafetyInformationWrapper.java | 208 + ...roductSetElementTextSafetyInformation.java | 233 + .../model/ProductSimilarCategoryWithPath.java | 258 + .../client/model/ProductsCategoryPath.java | 236 + .../model/ProductsCategorySubcategories.java | 264 + .../api/client/model/PromoGeneralReport.java | 238 + .../client/model/PromoModificationReport.java | 310 + .../client/model/PromoModificationTask.java | 433 + .../api/client/model/PromoOptionsCommand.java | 310 + .../PromoOptionsCommandModification.java | 345 + ...romoOptionsCommandModificationPackage.java | 206 + .../model/PromoOptionsModification.java | 380 + .../model/PromoOptionsModifications.java | 278 + .../allegro/api/client/model/Promotion.java | 284 + .../model/PromotionCampaignResponseDto.java | 371 + .../model/PromotionCampaignsResponseDto.java | 261 + .../api/client/model/PromotionRequestDto.java | 214 + .../client/model/PromotionResponseDto.java | 214 + ...ProviderRefundTransferChargeOperation.java | 254 + ...oviderRefundTransferIncreaseOperation.java | 254 + .../model/PublicOfferPreviewRequest.java | 282 + .../api/client/model/PublicTableDto.java | 372 + .../api/client/model/PublicTablesDto.java | 232 + .../allegro/api/client/model/Publication.java | 413 + .../model/PublicationChangeCommandDto.java | 260 + .../client/model/PublicationModification.java | 290 + .../api/client/model/PublicationRequest.java | 293 + .../client/model/PublicationTimePolicy.java | 334 + .../client/model/QuantityModification.java | 289 + .../api/client/model/QuoteResponse.java | 330 + .../wtx/allegro/api/client/model/Rates.java | 536 + .../api/client/model/ReceiverAddressDto.java | 489 + .../api/client/model/ReceivingEntry.java | 288 + .../api/client/model/ReceivingState.java | 372 + .../api/client/model/ReceivingStatus.java | 394 + .../allegro/api/client/model/Recipient.java | 214 + .../allegro/api/client/model/Reference.java | 206 + .../model/RefundAdditionalServicesValue.java | 245 + .../client/model/RefundCancelOperation.java | 254 + .../client/model/RefundChargeOperation.java | 283 + .../allegro/api/client/model/RefundClaim.java | 541 + .../api/client/model/RefundClaimBuyer.java | 236 + .../client/model/RefundClaimCommission.java | 234 + .../api/client/model/RefundClaimLineItem.java | 294 + .../model/RefundClaimLineItemOffer.java | 236 + .../api/client/model/RefundClaimRequest.java | 236 + .../model/RefundClaimRequestLineItem.java | 206 + .../api/client/model/RefundClaimResponse.java | 206 + .../api/client/model/RefundDeliveryValue.java | 245 + .../api/client/model/RefundDetails.java | 756 + .../client/model/RefundIncreaseOperation.java | 283 + .../api/client/model/RefundLineItem.java | 373 + .../api/client/model/RefundLineItemValue.java | 245 + .../allegro/api/client/model/RefundOrder.java | 207 + .../api/client/model/RefundOverpaidValue.java | 245 + .../api/client/model/RefundPayment.java | 207 + .../client/model/RefundSurchargeValue.java | 245 + .../api/client/model/RefundTotalValue.java | 245 + .../api/client/model/RefusalMessage.java | 256 + .../api/client/model/RefusalReason.java | 303 + .../api/client/model/RelatedReason.java | 252 + .../wtx/allegro/api/client/model/Removal.java | 246 + .../api/client/model/RemovalRequest.java | 331 + .../api/client/model/RequirementChange.java | 276 + .../allegro/api/client/model/ReserveInfo.java | 294 + .../model/ResponsiblePersonAddress.java | 402 + .../model/ResponsiblePersonContact.java | 266 + .../model/ResponsiblePersonResponse.java | 269 + ...ResponsiblePersonResponsePersonalData.java | 270 + .../ResponsiblePersonsGET200Response.java | 284 + .../model/ResponsibleProducerAddress.java | 296 + .../model/ResponsibleProducerContact.java | 266 + .../model/ResponsibleProducerResponse.java | 269 + ...sponsibleProducerResponseProducerData.java | 270 + .../ResponsibleProducersGET200Response.java | 284 + .../api/client/model/RestrictionCause.java | 312 + .../model/ReturnPoliciesListReturnPolicy.java | 256 + .../api/client/model/ReturnPolicy.java | 207 + .../api/client/model/ReturnPolicyAddress.java | 338 + .../model/ReturnPolicyAvailability.java | 314 + .../api/client/model/ReturnPolicyContact.java | 248 + .../api/client/model/ReturnPolicyOptions.java | 323 + .../api/client/model/ReturnPolicyRequest.java | 412 + .../client/model/ReturnPolicyResponse.java | 478 + .../client/model/ReturnPolicyReturnCost.java | 262 + .../SalePartialProductOfferResponse.java | 308 + ...erResponseAdditionalMarketplacesValue.java | 208 + ...dditionalMarketplacesValueSellingMode.java | 208 + ...artialProductOfferResponseSellingMode.java | 208 + .../SalePartialProductOfferResponseStock.java | 204 + .../model/SaleProductCompatibilityList.java | 297 + .../api/client/model/SaleProductDto.java | 700 + .../model/SaleProductDtoPublication.java | 262 + .../api/client/model/SaleProductOffer.java | 503 + .../model/SaleProductOfferPatchRequestV1.java | 1068 + ...oductOfferPatchRequestV1AllOfDelivery.java | 308 + ...uctOfferPatchRequestV1AllOfProductSet.java | 375 + ...tOfferPublicationMarketplacesResponse.java | 259 + .../SaleProductOfferPublicationRequest.java | 293 + .../SaleProductOfferPublicationResponse.java | 445 + .../model/SaleProductOfferRequestBase.java | 740 + ...leProductOfferRequestBaseAllOfContact.java | 236 + ...eProductOfferRequestBaseAllOfDelivery.java | 280 + ...oductOfferRequestBaseAllOfPublication.java | 266 + ...ProductOfferRequestBaseAllOfSizeTable.java | 236 + .../model/SaleProductOfferRequestV1.java | 1074 + ...aleProductOfferRequestV1AllOfDelivery.java | 308 + ...eProductOfferRequestV1AllOfProductSet.java | 375 + .../model/SaleProductOfferResponseV1.java | 1222 + ...ProductOfferResponseV1AllOfProductSet.java | 375 + ...ResponseV1AllOfProductSetAllOfProduct.java | 290 + ...AllOfProductSetAllOfResponsiblePerson.java | 206 + ...lOfProductSetAllOfResponsibleProducer.java | 206 + ...leProductOfferResponseV1AllOfWarnings.java | 170 + .../model/SaleProductOfferStatusResponse.java | 240 + ...leProductOfferStatusResponseOperation.java | 324 + .../model/SaleProductOffersRequestStock.java | 292 + .../SaleProductResponseCategoriesDto.java | 278 + .../api/client/model/SalesQualityForDay.java | 349 + .../model/SalesQualityHistoryResponse.java | 232 + .../api/client/model/SalesQualityMetric.java | 301 + .../api/client/model/SearchResult.java | 228 + .../wtx/allegro/api/client/model/Seller.java | 214 + .../model/SellerCreateRebateRequestDto.java | 279 + .../client/model/SellerOfferBaseEvent.java | 261 + .../model/SellerOfferEventsResponse.java | 232 + .../model/SellerOfferStatsResponseDto.java | 278 + .../api/client/model/SellerParticipant.java | 369 + .../api/client/model/SellerRebateDto.java | 425 + .../model/SellerRebateOfferCriterion.java | 322 + ...SellerRebateOfferCriterionOffersInner.java | 214 + .../api/client/model/SellerRebatesDto.java | 261 + .../api/client/model/SellerReference.java | 214 + .../allegro/api/client/model/SellingMode.java | 304 + .../api/client/model/SellingModeFormat.java | 80 + .../client/model/SellingModeWithNetPrice.java | 336 + .../api/client/model/SenderAddressDto.java | 489 + .../model/ShipmentCancelCommandDto.java | 244 + .../model/ShipmentCancelRequestDto.java | 214 + .../model/ShipmentCreateCommandDto.java | 244 + .../model/ShipmentCreateRequestDto.java | 648 + .../allegro/api/client/model/ShipmentDto.java | 833 + .../api/client/model/ShipmentIdsDto.java | 227 + .../model/ShipmentPickupAddressDto.java | 491 + .../allegro/api/client/model/Shipping.java | 183 + .../api/client/model/ShippingExtended.java | 186 + .../api/client/model/ShippingRate.java | 369 + .../model/ShippingRateDeliveryMethod.java | 206 + .../model/ShippingRateFirstItemRate.java | 236 + .../model/ShippingRateMaxPackageWeight.java | 248 + .../model/ShippingRateNextItemRate.java | 236 + .../model/ShippingRateShippingTime.java | 236 + .../api/client/model/ShippingRates.java | 206 + .../api/client/model/ShippingRatesSet.java | 322 + .../SinglePromotionCampaignResponseDto.java | 332 + .../allegro/api/client/model/SizeTable.java | 206 + .../client/model/SizeTablePostRequest.java | 341 + .../api/client/model/SizeTablePutRequest.java | 310 + .../model/SizeTableTemplateImageResponse.java | 263 + .../model/SizeTableTemplateResponse.java | 373 + .../model/SizeTableTemplatesResponse.java | 232 + .../api/client/model/SmartDeliveryMethod.java | 206 + .../model/SmartOfferClassificationReport.java | 337 + ...ferClassificationReportClassification.java | 231 + ...erClassificationReportConditionsInner.java | 394 + .../SmartSellerClassificationReport.java | 310 + ...lerClassificationReportClassification.java | 231 + ...erClassificationReportConditionsInner.java | 375 + .../client/model/StandardizedDescription.java | 228 + .../api/client/model/StartingPrice.java | 245 + .../wtx/allegro/api/client/model/Stock.java | 292 + .../api/client/model/StockProduct.java | 308 + .../api/client/model/StockProductItem.java | 366 + .../api/client/model/StockProductList.java | 283 + .../api/client/model/StockQuantity.java | 285 + .../api/client/model/StockSellingStats.java | 231 + .../api/client/model/StockStorageFee.java | 328 + .../client/model/StockStorageFeeDetails.java | 291 + .../client/model/StringCategoryParameter.java | 257 + .../model/StringCategoryProductParameter.java | 254 + ...goryProductParameterAllOfRestrictions.java | 260 + .../wtx/allegro/api/client/model/Subject.java | 206 + .../api/client/model/SubmitCommand.java | 277 + .../api/client/model/SubmitCommandInput.java | 215 + .../api/client/model/SubmitCommandOutput.java | 183 + .../model/SubmitFailedCommandOutput.java | 252 + .../model/SubmitRunningCommandOutput.java | 206 + .../model/SubmitSuccessfulCommandOutput.java | 206 + .../allegro/api/client/model/SupplierDto.java | 206 + .../allegro/api/client/model/Surcharge.java | 215 + .../api/client/model/SurchargeOperation.java | 312 + .../wtx/allegro/api/client/model/TagId.java | 214 + .../api/client/model/TagIdsRequest.java | 232 + .../api/client/model/TagListResponse.java | 232 + .../allegro/api/client/model/TagRequest.java | 241 + .../allegro/api/client/model/TagResponse.java | 273 + .../allegro/api/client/model/TaskCount.java | 260 + .../allegro/api/client/model/TaskReport.java | 228 + .../pl/wtx/allegro/api/client/model/Tax.java | 206 + .../api/client/model/TaxExemption.java | 236 + .../api/client/model/TaxIdRequest.java | 206 + .../api/client/model/TaxIdResponse.java | 236 + .../wtx/allegro/api/client/model/TaxRate.java | 258 + .../api/client/model/TaxRateValue.java | 263 + .../allegro/api/client/model/TaxSubject.java | 236 + .../api/client/model/TecdocSpecification.java | 266 + .../client/model/TecdocSpecificationItem.java | 247 + .../allegro/api/client/model/ThirdParty.java | 236 + .../model/ThirdPartyDeliveryShipping.java | 289 + .../wtx/allegro/api/client/model/Thread.java | 314 + .../allegro/api/client/model/ThreadId.java | 214 + .../api/client/model/ThreadReadFlag.java | 211 + .../allegro/api/client/model/ThreadsList.java | 290 + .../api/client/model/TrustedContent.java | 227 + .../model/TurnoverDiscountDefinitionDto.java | 404 + .../api/client/model/TurnoverDiscountDto.java | 346 + .../client/model/TurnoverDiscountRequest.java | 228 + .../model/TurnoverDiscountThresholdDto.java | 240 + .../TurnoverDiscountThresholdDtoDiscount.java | 206 + ...erDiscountThresholdDtoMinimumTurnover.java | 236 + .../model/UnfilledParametersResponse.java | 284 + ...UnfilledParametersResponseOffersInner.java | 290 + ...ParametersResponseOffersInnerCategory.java | 206 + ...ersResponseOffersInnerParametersInner.java | 206 + .../model/UpdateOfferBundleDiscountDTO.java | 240 + .../model/UpdateResponsiblePersonRequest.java | 269 + .../UpdateResponsibleProducerRequest.java | 269 + ...dateSubmittedAdvanceShipNoticeRequest.java | 292 + .../UpdateSubmittedHandlingUnitInput.java | 204 + .../model/UpdateSubmittedShippingInput.java | 298 + .../pl/wtx/allegro/api/client/model/User.java | 245 + .../client/model/UserCampaignEligibility.java | 260 + .../allegro/api/client/model/UserRating.java | 579 + .../client/model/UserRatingAnswerRequest.java | 214 + .../client/model/UserRatingListResponse.java | 232 + .../model/UserRatingListResponseVBeta1.java | 232 + .../model/UserRatingRemovalRequest.java | 214 + .../UserRatingRemovalRequestRequest.java | 214 + .../model/UserRatingSummaryResponse.java | 308 + ...erRatingSummaryResponseNotRecommended.java | 241 + .../UserRatingSummaryResponseRecommended.java | 241 + .../model/UserRatingSummaryResponseV2.java | 340 + ...RatingSummaryResponseV2NotRecommended.java | 241 + ...serRatingSummaryResponseV2Recommended.java | 241 + ...UserRatingSummaryResponseV2Statistics.java | 276 + ...ngSummaryResponseV2StatisticsExcluded.java | 212 + ...ngSummaryResponseV2StatisticsReceived.java | 212 + ...ingSummaryResponseV2StatisticsRemoved.java | 299 + .../UserRatingSummaryResponseV2User.java | 241 + .../api/client/model/UserRatingVBeta1.java | 575 + .../allegro/api/client/model/Validation.java | 310 + .../api/client/model/ValidationError.java | 375 + .../api/client/model/ValidationWarning.java | 375 + .../allegro/api/client/model/VariantSet.java | 310 + .../api/client/model/VariantSetOffer.java | 244 + .../api/client/model/VariantSetParameter.java | 214 + .../api/client/model/VariantSetResponse.java | 340 + .../allegro/api/client/model/VariantSets.java | 256 + .../client/model/VariantSetsVariantSet.java | 236 + .../client/model/VisibilityTimePolicy.java | 334 + .../wtx/allegro/api/client/model/Wallet.java | 390 + .../api/client/model/WalletBalance.java | 245 + .../model/WarrantiesListWarrantyBasic.java | 256 + .../allegro/api/client/model/Warranty.java | 207 + .../api/client/model/WarrantyAttachment.java | 237 + .../api/client/model/WarrantyBasic.java | 236 + .../api/client/model/WarrantyPeriod.java | 233 + .../api/client/model/WarrantyRequest.java | 363 + .../api/client/model/WarrantyResponse.java | 426 + .../api/client/model/WarrantyType.java | 78 + .../allegro/api/client/model/WeightValue.java | 295 + ...holesalePriceListBenefitSpecification.java | 280 + ...ListBenefitSpecificationAllOfQuantity.java | 214 + ...stBenefitSpecificationAllOfThresholds.java | 245 + .../WrapperTypeForPreviewConditions.java | 235 + .../model/WrapsListingAndCommissionsFees.java | 279 + src/main/resources/openapi.yaml | 32266 ++++++++++++++++ 1132 files changed, 371044 insertions(+), 2 deletions(-) create mode 100644 pom.xml create mode 100644 src/main/java/pl/wtx/allegro/AllegroApiClient.java create mode 100644 src/main/java/pl/wtx/allegro/AllegroApiClientUsageDemo.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/AdditionalServicesApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/AdditionalServicesTranslationsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/AdvanceShipNoticesApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/AfterSaleServicesApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/AlleDiscountApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/AllegroPricesApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/AuctionsAndBiddingApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/AutomaticPricingApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/BadgeCampaignsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/BatchOfferModificationApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/BillingApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/CategoriesAndParametersApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/CharityApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/ClassifiedsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/CommissionRefundsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/CompatibilityListApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/ContactsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/CustomerReturnsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/DeliveryApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/DisputesApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/FulfillmentParcelsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/FulfillmentProductsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/FulfillmentRemovalApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/FulfillmentStockApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/ImagesAndAttachmentsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/InformationAboutMarketplacesApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/InformationAboutUserApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/MessageCenterApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/OfferBundlesApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/OfferManagementApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/OfferRatingApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/OfferTagsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/OfferTranslationsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/OfferVariantsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/OrderManagementApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/PaymentsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/PointsOfServiceApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/PricingApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/ProductsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/PublicOfferInformationApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/PublicUserInformationApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/RebatesAndPromotionsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/ResponsiblePersonsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/ResponsibleProducersApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/ShipmentManagementApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/SizeTablesApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/TaxIdentificationNumberApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/TaxSettingsApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/UsersOfferInformationApi.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/config/GsonConfig.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/config/OffsetDateTimeAdapter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/config/OkHttpClientConfig.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/ApiCallback.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/ApiClient.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/ApiException.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/ApiResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/Configuration.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/GzipRequestInterceptor.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/JSON.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/Pair.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/ProgressRequestBody.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/ProgressResponseBody.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/ServerConfiguration.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/ServerVariable.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/StringUtil.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/auth/ApiKeyAuth.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/auth/Authentication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/auth/HttpBasicAuth.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/auth/HttpBearerAuth.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuth.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuthFlow.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuthOkHttpClient.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/invoker/auth/RetryingOAuth.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AbstractOpenApiSchema.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmail.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmailRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmailsResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePromoOptionsCommandModification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePromoOptionsModification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublicationState.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublicationStatus.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplaceSellingMode.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRefusalReasonResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRequestValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRequestValueSellingMode.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesResponseValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesResponseValuePublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesVisibility.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalPropertyDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceDefinitionRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslationPatchResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslationResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceTranslation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroup.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationWrapper.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationWrapperWithType.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroups.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Address.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AddressDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNotice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeStatus.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServices.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesAttachment.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestImpliedWarranty.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestReturnPolicy.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestWarranty.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AiCoCreatedContent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscount.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoBasePrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoProduct.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponseOutput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseInput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseOutput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListEligibleResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListSubmittedResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountRequiredMerchantPriceDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputCampaign.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputProposedPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputCampaign.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputProposedPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseOutput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoCampaign.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPrices.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesProposedPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoProcess.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoProcessErrorsInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandRequestInput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponseInput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponseOutput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroCarrier.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroMarketplaces.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingHistory.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingHistoryTrackingDetails.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingStatus.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPoint.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointOpeningInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointPaymentsInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointRestrictionsInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointServicesInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointsResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountChangeRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountChangeRequestAdditionalMarketplacesValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountConsentChangeResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesEligibilityResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesEligibilityResponseAdditionalMarketplacesValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesOfferChangeRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesOfferConsentChangeResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesQualificationResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AlreadyInWarehouseShipping.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Answer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AnswerVBeta1.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ApplicationTimePolicy.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Attachment.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AttachmentDeclaration.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AttachmentFile.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AttachmentFileRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AttachmentType.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AuctionDetails.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AuthError.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingOfferRuleConfiguration.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingOfferRuleConfigurationPriceRange.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfiguration.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmount.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByPercentage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulePostRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulePutRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleType.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulesResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AvailableConstraint.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AvailableProductResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AvailableProductsList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AvailablePromotionPackage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AvailablePromotionPackages.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/AverageRates.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/B2b.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Badge.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationBargainPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationCampaign.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPrices.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationProcess.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraints.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraintsLimit.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraintsLimitPerUser.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRejectionReason.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRejectionReasonMessage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationSubsidySellerPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationSubsidyTargetPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeApplications.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeCampaign.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeMarketPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeOperationProcess.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPrices.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPricesPrices.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPricesPricesBargain.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgePatchProcess.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgePatchProcessProcess.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgePatchRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgePrices.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeProcess.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgePublicationTimePolicy.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgeSubsidyPrices.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BadgesList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BaseOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BaseSaleProductResponseDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BasicDefinitionResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Benefit.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BenefitSpecification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BidRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BillingEntries.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BillingEntry.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BillingEntryAdditionalInfoInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BillingEntryBalance.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BillingEntryOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BillingEntryOrder.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BillingEntryTax.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BillingEntryType.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BillingEntryValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BillingType.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BlockadeOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BlockadeReleaseOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BundleDiscountDTO.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BundleMarketplaceDTO.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BundledOfferDTO.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BuyNowPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BuyerParticipant.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BuyerPreferencesReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/BuyerReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CampaignRefusalReason.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CampaignRequestDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CampaignResponseDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CancelShipmentCommandStatusDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Caption.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CarrierParcelTrackingResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CashOnDeliveryDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CashOnDeliveryLimitDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoriesDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoriesResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Category.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryBaseEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryCreatedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryDefinitionDescriptionResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryDefinitionResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryDeletedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryDeletedEventAllOfRedirectCategory.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryDtoParent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryEventBaseCategory.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryEventBaseCategoryParent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryEventsResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryMovedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryOptionsDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterDisplayConditions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterOptions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterRequirementConditions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterWithValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterWithoutValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChange.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChangeCategory.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChangeParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledChangesResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryProductParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryProductParameterList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryRenamedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategorySuggestionCategoryNode.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategorySuggestionResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CategoryTaxSettings.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Cells.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ChangePrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ChangePriceInput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ChangePriceWithoutOutput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ChangedParameterDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ChangedTranslation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CharityOrganization.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoiceFile.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoiceId.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutForm.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillCreated.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillCreatedLineItemsInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillRequestLineItemsInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAdditionalService.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormBuyerAddressReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormBuyerReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryCancellation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryMethod.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryPickupPoint.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryPickupPointAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTime.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTimeDispatch.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTimeGuaranteed.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDiscount.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillment.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentShipmentSummary.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentShipmentSummaryLineItemsSent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentStatus.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressCompany.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressCompanyId.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressNaturalPerson.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceInfo.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormLineItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormLineItemTax.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormMarketplace.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormNoteReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormOrderWaybillResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentProvider.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentType.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormStatus.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormSummary.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormSummaryTotalToPay.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutForms.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoiceFile.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoiceFileSecurityVerification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoices.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedDailyEventStatResponseDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedEventStat.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedExtension.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedExtraPackage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackageConfig.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackageConfigs.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackages.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPromotion.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedStatEventType.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ClassifiedsPackages.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CommandOutput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CommandTask.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CommentVBeta1.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CommissionResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Company.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListIdItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListIdItemAdditionalInfo.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListItemProductBased.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListManual.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListManualType.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductBased.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductBasedProductOfferResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductOfferResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListTextItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDtoAttributesInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDtoGroup.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsGroupsDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsGroupsDtoGroupsInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsListDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CompensationOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ConstraintCriteria.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Contact.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ContactRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ContactResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ContactResponseList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ContributionOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Coordinates.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CorrectionOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Courier.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CourierBySellerShipping.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CreateAdvanceShipNoticeRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CreateAdvanceShipNoticeResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CreateOfferBundleDTO.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CreatePickupCommandStatusDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CreateProductOffers422Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CreateResponsiblePersonRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CreateResponsiblePersonRequestPersonalData.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CreateResponsibleProducerRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CreateShipmentCommandStatusDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CurrentPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturn.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnBuyer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnItemReason.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnParcelSender.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefund.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundBankAccount.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundBankAccountAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundRejectionRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundRejectionRequestRejection.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRejection.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnReturnParcel.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Deduction.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeductionChargeOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeductionIncreaseOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliveryBasic.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliveryFull.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliveryMethodId.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferRequestShippingRates.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliveryServiceDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliveryServiceIdDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliveryServicesDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestAbroadFreeDelivery.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestFreeDelivery.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestMarketplace.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseAbroadFreeDelivery.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseCustomCost.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseFreeDelivery.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseJoinPolicy.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseMarketplace.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DescribesListingFee.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DescribesSuccessCommissionFee.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DescriptionSection.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItemImage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItemText.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryParameterAllOfDictionary.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameterAllOfDictionary.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameterAllOfRestrictions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DimensionValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Discounts.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferRequestWholesalePriceList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DiscountsWholesalePriceList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Dispute.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeAttachment.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeAttachmentId.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeAuthor.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeAuthorRole.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeCheckoutForm.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeClaim.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeFirstMessage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeListResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeMessage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeMessageAuthor.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeMessageList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/DisputeUser.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/EmailRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/EmailResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Error.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Error200.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Error400.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Error403.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Error404.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Error504.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ErrorsHolder.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Exclusion.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ExternalId.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Fee.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/FeePreviewResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryProductParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryProductParameterAllOfRestrictions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrder.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrderParcel.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrderParcelItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/FulfillmentRemovalPreference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/FulfillmentWithdrawalAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/FundraisingCampaign.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/FundraisingCampaigns.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GeneralReport.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetBadgeCampaignsList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetDeliveryServices504Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetOfferSmartClassificationGET400Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetOfferSmartClassificationGET403Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetRefundApplications200Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetRefundedPayments200Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetSaleProductsResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetSaleProductsResponseNextPage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/GetShipmentDetails404Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/HandlingUnit.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Header.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ImageUrl.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantiesListImpliedWarrantyBasic.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarranty.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyBasic.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyPeriod.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/InitializeRefund.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundAdditionalServices.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundDelivery.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundOverpaid.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/InsuranceDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryProductParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryProductParameterAllOfRestrictions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Interlocutor.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/JustId.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Justification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/LabelRequestDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Labels.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfDiscount.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfOrderValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfThresholds.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/LatestOrderEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/LimitWithCurrencyDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/LineItemDiscount.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/LineItemReconciliation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/LineItemVoucher.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/LineItemVoucherValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ListingCategory.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ListingCategoryWithCount.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ListingOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ListingResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ListingResponseCategories.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ListingResponseFilters.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ListingResponseFiltersValues.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ListingResponseOffers.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ListingResponseSearchMeta.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ListingResponseSort.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Location.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ManualDescriptionTranslation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ManualProductSafetyInformationDescriptionTranslation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ManualSafetyInformationTranslation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ManualTitleTranslation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ManualTranslationUpdateRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MarketedBeforeGPSRObligation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MarketplaceAvailablePromotionPackages.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemCurrencies.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemCurrency.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemLanguage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemLanguages.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemShippingCountry.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MarketplaceOfferPromoOption.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MarketplaceReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MarketplacesVisibility.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MaxPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MeResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MeResponseBaseMarketplace.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Message.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MessageAdditionalInformation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MessageAttachmentId.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MessageAttachmentInfo.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MessageAuthor.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MessageAuthorRole.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MessageOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MessageOrder.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MessageRelatedObject.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MessageRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MessageToSellerSettings.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MessagesList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MinimalPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModelConfiguration.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Modification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationAttachmentSafetyInformation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationAttachmentSafetyInformationAllOfAttachments.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationDelivery.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationDiscounts.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationDiscountsWholesalePriceList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationNoSafetyInformation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationPayments.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationPublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationResponsiblePerson.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationResponsibleProducer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationSafetyInformation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ModificationTextSafetyInformation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecificationAllOfConfiguration.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecificationAllOfTrigger.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/MyBidResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/NetPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/NewAttachmentDeclaration.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/NewMessage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/NewMessageInThread.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/NewProductParameterDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/NullableTurnoverDiscountDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferActivatedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferAdditionalMarketplace.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferAdditionalServices.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferArchivedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferAttachment.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferAttachmentRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingCommand.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingCommandModification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationRemove.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationRemoveRemoveInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSet.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSetSetInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSetSetInnerRule.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferBadgeCampaign.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferBidCanceledEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferBidPlacedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferBundleDTO.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferBundleDTOPublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferBundlesDTO.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferBundlesDTONextPage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferCategory.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferCategoryRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferChangeCommand.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferChangedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferCriterium.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferDelivery.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferDescriptionTranslation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferEndedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferEventBaseOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferEventEndedOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferEventEndedOfferAllOfPublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOfferForPriceChanges.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOfferWithPublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferFixedPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferId.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferImageLinkUploadRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferImageUploadResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferImages.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoImage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplace.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplacePublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplaceSellingMode.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplaceStock.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1B2b.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Delivery.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Publication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1PublicationMarketplaces.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1SaleInfo.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1SellingMode.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Stats.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Stock.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferLowestPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferMarketplacesPriceChanges.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferMarketplacesPublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferPriceChangeCommand.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferPriceChangedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferProductSetProductReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferProductSetReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOption.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptionsForSeller.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptionsPendingChanges.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferPromotion.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferPublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferQuantityChangeCommand.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferQuoteDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferQuotesDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferRating.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferRatingScoreDistributionInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferRatingSizeFeedbackInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferRequirements.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferRules.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInnerMarketplace.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInnerRule.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferSafetyInformationTranslation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferSeller.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferSellingMode.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferShippingRates.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferStatModelDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferStatResponseDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferStatsResponseDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferStatus.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferStock.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferStockChangedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferTaxRate.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferTaxSettings.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferTitleTranslation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferTranslation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferTranslationType.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferTranslationUpdatedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferTranslations.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferVendor.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OfferVisibilityChangedEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OffersSearchResultDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OpenHour.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OperationParticipantAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OperationPayment.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OperationValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Order.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OrderEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OrderEventData.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OrderEventStats.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OrderEventType.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OrderEventsList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OrderLineItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OrderLineItemOfferReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OrderMarketplace.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OrderOffersInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OrdersShippingCarrier.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OrdersShippingCarriersResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/OwnTransportShipping.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PackageDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PackageRequestDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Parameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParameterProductOfferRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParameterProductOfferResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParameterRangeValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParametersForPreviewPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesAvailability.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesCashOnDeliveryAvailability.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesOptionAvailability.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParcelCreationAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParcelCreationAddressWithMandatoryPlace.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingHistory.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingHistoryTrackingDetails.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingStatus.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Participant.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PatchBadge202Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Payment.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PaymentOperations.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Payments.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PaymentsSurcharge.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Payout.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PayoutOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PayoutOperationCancel.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PhoneNumberWithCountryCode.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PhonesRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PhonesResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PickupAddressDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PickupCreateCommandDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PickupCreateRequestDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PickupDateProposalDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PickupDateProposalsDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PickupProposalsRequestDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PickupProposalsResponseDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Pos.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PosLocation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Price.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PriceAutomation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PriceAutomationRule.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PriceModification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PriceModificationFixedPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PriceModificationFixedPriceHolder.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PriceModificationPercentageChangeDecrease.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PriceModificationPercentageChangeIncrease.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeDecrease.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeHolder.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeIncrease.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PricingOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PricingPublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProcessingStatus.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Product.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductCategory.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductCategoryProposal.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductCategoryWithPath.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductChangeDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductChangeDtoProduct.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductChangeProposalDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductChangeProposalRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductChangesResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductImageProposal.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductNameProposal.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAdditionalServicesRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAdditionalServicesResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAttachmentInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductOfferBase.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductOfferFundraisingCampaignRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductOfferFundraisingCampaignResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductOfferResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductOfferResponsePublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductParameterDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductParameterDtoOptions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductParameterOptions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductParameterProposal.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductParameterValueProposal.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponseCategory.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponsePublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSafetyDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSafetyInformationDescription.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElement.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementAttachmentSafetyInformation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementAttachmentSafetyInformationAllOfAttachments.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementNoSafetyInformation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementQuantity.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementQuantityQuantity.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsiblePersonRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsiblePersonRequestResponsiblePerson.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerIdRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerNameRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerRequestWrapper.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementSafetyInformation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementSafetyInformationWrapper.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementTextSafetyInformation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductSimilarCategoryWithPath.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductsCategoryPath.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProductsCategorySubcategories.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromoGeneralReport.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromoModificationReport.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromoModificationTask.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommand.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommandModification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommandModificationPackage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsModification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsModifications.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Promotion.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromotionCampaignResponseDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromotionCampaignsResponseDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromotionRequestDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PromotionResponseDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProviderRefundTransferChargeOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ProviderRefundTransferIncreaseOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PublicOfferPreviewRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PublicTableDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PublicTablesDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Publication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PublicationChangeCommandDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PublicationModification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PublicationRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/PublicationTimePolicy.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/QuantityModification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/QuoteResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Rates.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReceiverAddressDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReceivingEntry.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReceivingState.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReceivingStatus.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Recipient.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Reference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundAdditionalServicesValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundCancelOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundChargeOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundClaim.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundClaimBuyer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundClaimCommission.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundClaimLineItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundClaimLineItemOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundClaimRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundClaimRequestLineItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundClaimResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundDeliveryValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundDetails.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundIncreaseOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundLineItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundLineItemValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundOrder.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundOverpaidValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundPayment.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundSurchargeValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefundTotalValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefusalMessage.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RefusalReason.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RelatedReason.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Removal.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RemovalRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RequirementChange.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReserveInfo.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonContact.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonResponsePersonalData.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonsGET200Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerContact.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerResponseProducerData.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducersGET200Response.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/RestrictionCause.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReturnPoliciesListReturnPolicy.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicy.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyAddress.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyAvailability.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyContact.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyOptions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyReturnCost.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseAdditionalMarketplacesValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseSellingMode.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseStock.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductCompatibilityList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductDtoPublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1AllOfDelivery.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1AllOfProductSet.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationMarketplacesResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBase.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfContact.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfDelivery.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfPublication.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfSizeTable.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1AllOfDelivery.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1AllOfProductSet.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSet.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfProduct.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfWarnings.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferStatusResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferStatusResponseOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductOffersRequestStock.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SaleProductResponseCategoriesDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SalesQualityForDay.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SalesQualityHistoryResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SalesQualityMetric.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SearchResult.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Seller.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellerCreateRebateRequestDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellerOfferBaseEvent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellerOfferEventsResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellerOfferStatsResponseDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellerParticipant.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellerRebateDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellerRebateOfferCriterion.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellerRebateOfferCriterionOffersInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellerRebatesDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellerReference.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellingMode.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellingModeFormat.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SellingModeWithNetPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SenderAddressDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShipmentCancelCommandDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShipmentCancelRequestDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShipmentCreateCommandDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShipmentCreateRequestDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShipmentDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShipmentIdsDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShipmentPickupAddressDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Shipping.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShippingExtended.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShippingRate.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShippingRateDeliveryMethod.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShippingRateFirstItemRate.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShippingRateMaxPackageWeight.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShippingRateNextItemRate.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShippingRateShippingTime.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShippingRates.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ShippingRatesSet.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SinglePromotionCampaignResponseDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SizeTable.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SizeTablePostRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SizeTablePutRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplateImageResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplateResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplatesResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SmartDeliveryMethod.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReport.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReportClassification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReportConditionsInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReport.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReportClassification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReportConditionsInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StandardizedDescription.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StartingPrice.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Stock.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StockProduct.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StockProductItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StockProductList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StockQuantity.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StockSellingStats.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StockStorageFee.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StockStorageFeeDetails.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StringCategoryParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StringCategoryProductParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/StringCategoryProductParameterAllOfRestrictions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Subject.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SubmitCommand.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SubmitCommandInput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SubmitCommandOutput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SubmitFailedCommandOutput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SubmitRunningCommandOutput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SubmitSuccessfulCommandOutput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SupplierDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Surcharge.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/SurchargeOperation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TagId.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TagIdsRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TagListResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TagRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TagResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TaskCount.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TaskReport.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Tax.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TaxExemption.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TaxIdRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TaxIdResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TaxRate.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TaxRateValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TaxSubject.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TecdocSpecification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TecdocSpecificationItem.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ThirdParty.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ThirdPartyDeliveryShipping.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Thread.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ThreadId.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ThreadReadFlag.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ThreadsList.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TrustedContent.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountDefinitionDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDto.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDtoDiscount.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDtoMinimumTurnover.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInnerCategory.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInnerParametersInner.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UpdateOfferBundleDiscountDTO.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UpdateResponsiblePersonRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UpdateResponsibleProducerRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedAdvanceShipNoticeRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedHandlingUnitInput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedShippingInput.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/User.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserCampaignEligibility.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRating.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingAnswerRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingListResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingListResponseVBeta1.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingRemovalRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingRemovalRequestRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseNotRecommended.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseRecommended.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2NotRecommended.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2Recommended.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2Statistics.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsExcluded.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsReceived.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsRemoved.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2User.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/UserRatingVBeta1.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Validation.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ValidationError.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/ValidationWarning.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/VariantSet.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/VariantSetOffer.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/VariantSetParameter.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/VariantSetResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/VariantSets.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/VariantSetsVariantSet.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/VisibilityTimePolicy.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Wallet.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WalletBalance.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WarrantiesListWarrantyBasic.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/Warranty.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WarrantyAttachment.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WarrantyBasic.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WarrantyPeriod.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WarrantyRequest.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WarrantyResponse.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WarrantyType.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WeightValue.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecification.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecificationAllOfQuantity.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecificationAllOfThresholds.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WrapperTypeForPreviewConditions.java create mode 100644 src/main/java/pl/wtx/allegro/api/client/model/WrapsListingAndCommissionsFees.java create mode 100644 src/main/resources/openapi.yaml diff --git a/README.md b/README.md index 3ed09ea..185bec5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,149 @@ -# allegro-rest-api-client-java -Klient Allegro REST API umożliwia szybką i łatwą integrację z aplikacjami wykorzystującymi język Java +# Klient Allegro REST API dla aplikacji Java +### Allegro REST API Java Client for Java +*** +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Java Version](https://img.shields.io/badge/Java-17%2B-blue)](https://www.java.com) +[![Maven Central](https://img.shields.io/maven-central/v/pl.wtx.allegro/qualtrics-api-client?label=Maven%20Central&logo=apache-maven&color=blue)] + +Lekka biblioteka kliencka w języku Java do integracji z Allegro REST API. Stworzona dla programistów Java, którzy potrzebują zintegrować swoje aplikacje z API platformy Allegro. 🚀 + +Biblioteka Java do łatwej współpracy z [Allegro REST API](https://developer.allegro.pl/). +Klient ułatwia uwierzytelnianie, wysyłanie zapytań i odbieranie odpowiedzi, dzięki czemu możesz szybko korzystać z funkcji Allegro w swojej aplikacji. + +## Najważniejsze możliwości, jakie daje klient Allegro REST API: + +- Wystawianie i edytowanie wielu ofert jednocześnie, w tym zmiana cen, ilości i opcji promowania +- Masowe wyróżnianie wielu ofert, aby zwiększyć ich widoczność +- Pobieranie i filtrowanie listy własnych ofert na Allegro +- Uzyskiwanie aktualnych danych o sprzedaży i statusach zamówień +- Zarządzanie przesyłkami w ramach usługi „Wysyłam z Allegro” +- Pobieranie szczegółowych informacji o sprzedanych produktach oraz kupujących +- Zarządzanie komunikacją z klientami, w tym obsługa dyskusji i wiadomości +- Obsługa kampanii promocyjnych i programów marketingowych +- Monitorowanie i automatyczna zmiana cen ofert +- Automatyzacja procesów rozliczeniowych i płatniczych + +## ✨ Dlaczego warto wybrać tego klienta? + +- 💡 **Typowane interfejsy Java** – w pełni typowane interfejsy dla endpointów Allegro REST API +- 🛡️ **Uwierzytelnianie sesyjne** – bezpieczny dostęp do API Allegro +- 📚 **Przejrzysta dokumentacja** – przykłady integracji w Javie +- 🚀 **Nowoczesne wsparcie Java** – kompatybilność z Java 17 i nowszymi wersjami + +## 📦 Informacje o wersji + +- **Aktualna wersja**: `1.0.0` +- **Wymagana wersja Java**: Java 17+ + +## 🔓 Licencja + +**Licencja MIT** + +Niniejszym udziela się zgody na bezpłatne korzystanie z tego oprogramowania i powiązanych plików dokumentacji ("Oprogramowanie"), do korzystania z Oprogramowania bez ograniczeń, w tym bez ograniczeń praw do używania, kopiowania, modyfikowania, łączenia, publikowania, dystrybuowania, sublicencjonowania i/lub sprzedaży kopii Oprogramowania. + +Jedynym wymogiem jest zachowanie oryginalnych informacji o autorze w kodzie źródłowym i dokumentacji. + +## 🚀 Szybki start + +### 1️⃣ Instalacja + +Możesz dodać bibliotekę do swojego projektu, dołączając zależność z Maven Central: + +```xml + + pl.wtx.allegro + allegro-rest-api-client + 1.0.0 + +``` + +Alternatywnie, możesz sklonować i zbudować bibliotekę ze źródeł: + +```sh +git clone https://github.com/wtx-labs/allegro-rest-api-client-java.git +cd allegro-rest-api-client-java +mvn clean install +``` + +Następnie dodaj zbudowany artefakt do swojego projektu: + +```xml + + pl.wtx.allegro + allegro-rest-api-client + 1.0.0 + +``` + +### 2️⃣ Przykład integracji w Javie + +Oto jak używać klienta Allegro REST API: + +```java +package pl.wtx.allegro; + +import pl.wtx.allegro.api.client.ContactsApi; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.model.ContactResponse; +import pl.wtx.allegro.api.client.model.EmailResponse; + +/** + * Allegro REST API Client - Usage Demo. + * Demonstrates basic usage of AllegroApiClient. + * + * @author WTX Labs + * @see https://github.com/wtx-labs/allegro-rest-api-client-java + * @license MIT + */ +public class AllegroApiClientUsageDemo { + + private static final String API_BASE_PATH = "https://api.allegro.pl"; + + // TODO: Set your Allegro API credentials! + private static final String API_CLIENT_ID = "TODO_SET_YOUR_CLIENT_ID"; + private static final String API_CLIENT_SECRET = "TODO_SET_YOUR_CLIENT_SECRET"; + + public static void main(String[] args) { + + System.out.println(">>> Start running the AllegroApiClientUsageDemo..."); + + AllegroApiClient apiClient = new AllegroApiClient(API_BASE_PATH, API_CLIENT_ID, API_CLIENT_SECRET, false); + + ContactsApi contactsApi = new ContactsApi(apiClient); + + try { + + // Example request for contact with identifier eg. 12345. + ContactResponse contact = contactsApi.getContactUsingGET("12345"); + + // Example contact's name and emails: + System.out.println("Name: " + contact.getName()); + System.out.println("Emails:"); + + for (EmailResponse email : contact.getEmails()) { + System.out.println("- " + email.getAddress()); + } + + } catch (ApiException exception) { + System.err.println("Error occurred during API call: " + exception); + } + + System.out.println("<<< The AllegroApiClientUsageDemo has been finished."); + + } + +} + +``` + +## 🤝 Współpraca + +- ✨ Sprawdź nasze [GitHub Issues](https://github.com/wtx-labs/allegro-rest-api-client-java/issues) po najnowsze aktualizacje + +- 💡 Masz sugestie? Otwórz zgłoszenie lub dołącz do projektu + +- 🌟 Oznacz to repozytorium gwiazdką, jeśli uważasz je za pomocne + +## 📝 Licencja + +Ten projekt jest udostępniany na licencji MIT - szczegóły znajdują się w pliku [LICENSE](LICENSE). \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..4015249 --- /dev/null +++ b/pom.xml @@ -0,0 +1,305 @@ + + + 4.0.0 + + pl.wtx.allegro + allegro-rest-api-client + 1.0.0 + jar + + Allegro REST API Client for Java + Allegro REST API Client for Java – Simple access to the Allegro platform API + https://github.com/wtx-labs/allegro-rest-api-client-java + + + 17 + 17 + 17 + UTF-8 + + + + + ossrh + https://central.sonatype.com/api/v1/publisher/upload + + + ossrh + https://central.sonatype.com/api/v1/publisher/upload + + + + + + + com.fasterxml.jackson.core + jackson-annotations + 2.19.0 + + + + javax.annotation + javax.annotation-api + 1.3.2 + + + + com.squareup.okhttp3 + okhttp + 4.12.0 + + + + com.squareup.okhttp3 + logging-interceptor + 4.12.0 + + + + com.google.code.gson + gson + 2.13.1 + + + + com.squareup.okio + okio + 3.13.0 + + + + io.gsonfire + gson-fire + 1.9.0 + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.2 + + + + org.openapitools + jackson-databind-nullable + 0.2.6 + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.6.3 + + none + false + + + + attach-javadocs + package + + jar + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.3.0 + + + jar-with-dependencies + + false + + + + assemble-jar-with-dependencies + package + + single + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + ${gpg.keyname} + ${gpg.passphrase} + + --batch + --yes + --pinentry-mode + loopback + + + + + + + + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 + true + + central + https://central.sonatype.com + Allegro REST API Client for Java - ${project.version} + required + false + + + + + org.apache.maven.plugins + maven-deploy-plugin + 3.1.1 + + ossrh::default::https://central.sonatype.com/api/v1/publisher/upload + + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.6.3 + + + + + + scm:git:git://github.com/wtx-labs/allegro-rest-api-client-java.git + scm:git:ssh://github.com/wtx-labs/allegro-rest-api-client-java.git + https://github.com/wtx-labs/allegro-rest-api-client-java + + + + GitHub + https://github.com/wtx-labs/allegro-rest-api-client-java/issues + + + + GitHub Actions + https://github.com/wtx-labs/allegro-rest-api-client-java/actions + + + + + WTX Labs Team + WTX Labs + https://github.com/wtx-labs + + + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + + + + + + + + MIT License + https://opensource.org/licenses/MIT + repo + + + + diff --git a/src/main/java/pl/wtx/allegro/AllegroApiClient.java b/src/main/java/pl/wtx/allegro/AllegroApiClient.java new file mode 100644 index 0000000..0340c74 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/AllegroApiClient.java @@ -0,0 +1,47 @@ +package pl.wtx.allegro; + +import java.util.HashMap; + +import pl.wtx.allegro.api.client.config.GsonConfig; +import pl.wtx.allegro.api.client.config.OkHttpClientConfig; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroApiClient is a specialized API client for interacting with the Allegro platform. + *

+ * This client extends the generic {@link ApiClient} and provides default configuration, + * including custom Gson serialization settings and optional HTTP logging. + *

+ *

+ * By default, it ignores unrecognized fields in API responses to improve robustness. + *

+ */ +public class AllegroApiClient extends ApiClient { + + /** + * Constructs a new AllegroApiClient instance with the specified parameters. + *

+ * The client is initialized with a base API path, client credentials, and an option to enable HTTP message logging. + * It configures JSON serialization to ignore unknown fields and sets a custom User-Agent header. + *

+ * + * @param basePath the base URL path of the Allegro API + * @param clientId the OAuth2 client ID for authentication + * @param clientSecret the OAuth2 client secret for authentication + * @param enableLoggingApiMessages if {@code true}, enables HTTP client logging for API messages + */ + public AllegroApiClient(String basePath, String clientId, String clientSecret, boolean enableLoggingApiMessages) { + + super(basePath, clientId, clientSecret, new HashMap()); + + JSON.setGson(GsonConfig.createGson()); + setUserAgent("AllegroApiClient (by wtx-labs)"); + + if (enableLoggingApiMessages) { + setHttpClient(OkHttpClientConfig.configureClient(getHttpClient())); + } + + } + +} diff --git a/src/main/java/pl/wtx/allegro/AllegroApiClientUsageDemo.java b/src/main/java/pl/wtx/allegro/AllegroApiClientUsageDemo.java new file mode 100644 index 0000000..5e983c2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/AllegroApiClientUsageDemo.java @@ -0,0 +1,53 @@ +package pl.wtx.allegro; + +import pl.wtx.allegro.api.client.ContactsApi; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.model.ContactResponse; +import pl.wtx.allegro.api.client.model.EmailResponse; + +/** + * Allegro REST API Client - Usage Demo. + * Demonstrates basic usage of AllegroApiClient. + * + * @author WTX Labs + * @see https://github.com/wtx-labs/allegro-rest-api-client-java + * @license MIT + */ +public class AllegroApiClientUsageDemo { + + private static final String API_BASE_PATH = "https://api.allegro.pl"; + + // TODO: Set your Allegro API credentials! + private static final String API_CLIENT_ID = "TODO_SET_YOUR_CLIENT_ID"; + private static final String API_CLIENT_SECRET = "TODO_SET_YOUR_CLIENT_SECRET"; + + public static void main(String[] args) { + + System.out.println(">>> Start running the AllegroApiClientUsageDemo..."); + + AllegroApiClient apiClient = new AllegroApiClient(API_BASE_PATH, API_CLIENT_ID, API_CLIENT_SECRET, false); + + ContactsApi contactsApi = new ContactsApi(apiClient); + + try { + + // Example request for contact with identifier eg. 12345. + ContactResponse contact = contactsApi.getContactUsingGET("12345"); + + // Example contact's name and emails: + System.out.println("Name: " + contact.getName()); + System.out.println("Emails:"); + + for (EmailResponse email : contact.getEmails()) { + System.out.println("- " + email.getAddress()); + } + + } catch (ApiException exception) { + System.err.println("Error occurred during API call: " + exception); + } + + System.out.println("<<< The AllegroApiClientUsageDemo has been finished."); + + } + +} diff --git a/src/main/java/pl/wtx/allegro/api/client/AdditionalServicesApi.java b/src/main/java/pl/wtx/allegro/api/client/AdditionalServicesApi.java new file mode 100644 index 0000000..580add4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/AdditionalServicesApi.java @@ -0,0 +1,759 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AdditionalServicesGroupRequest; +import pl.wtx.allegro.api.client.model.AdditionalServicesGroupResponse; +import pl.wtx.allegro.api.client.model.AdditionalServicesGroups; +import pl.wtx.allegro.api.client.model.CategoriesResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AdditionalServicesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AdditionalServicesApi() { + this(Configuration.getDefaultApiClient()); + } + + public AdditionalServicesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createAdditionalServicesGroupUsingPOST + * @param additionalServicesGroupRequest Additional service group body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createAdditionalServicesGroupUsingPOSTCall(@javax.annotation.Nonnull AdditionalServicesGroupRequest additionalServicesGroupRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = additionalServicesGroupRequest; + + // create path and map variables + String localVarPath = "/sale/offer-additional-services/groups"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createAdditionalServicesGroupUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull AdditionalServicesGroupRequest additionalServicesGroupRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'additionalServicesGroupRequest' is set + if (additionalServicesGroupRequest == null) { + throw new ApiException("Missing the required parameter 'additionalServicesGroupRequest' when calling createAdditionalServicesGroupUsingPOST(Async)"); + } + + return createAdditionalServicesGroupUsingPOSTCall(additionalServicesGroupRequest, _callback); + + } + + /** + * Create additional services group + * Use this resource to create a group of additional services. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-nowa-grupe-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-a-new-additional-service-group\" target=\"_blank\">EN</a>. + * @param additionalServicesGroupRequest Additional service group body (required) + * @return AdditionalServicesGroupResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public AdditionalServicesGroupResponse createAdditionalServicesGroupUsingPOST(@javax.annotation.Nonnull AdditionalServicesGroupRequest additionalServicesGroupRequest) throws ApiException { + ApiResponse localVarResp = createAdditionalServicesGroupUsingPOSTWithHttpInfo(additionalServicesGroupRequest); + return localVarResp.getData(); + } + + /** + * Create additional services group + * Use this resource to create a group of additional services. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-nowa-grupe-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-a-new-additional-service-group\" target=\"_blank\">EN</a>. + * @param additionalServicesGroupRequest Additional service group body (required) + * @return ApiResponse<AdditionalServicesGroupResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public ApiResponse createAdditionalServicesGroupUsingPOSTWithHttpInfo(@javax.annotation.Nonnull AdditionalServicesGroupRequest additionalServicesGroupRequest) throws ApiException { + okhttp3.Call localVarCall = createAdditionalServicesGroupUsingPOSTValidateBeforeCall(additionalServicesGroupRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create additional services group (asynchronously) + * Use this resource to create a group of additional services. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-nowa-grupe-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-a-new-additional-service-group\" target=\"_blank\">EN</a>. + * @param additionalServicesGroupRequest Additional service group body (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createAdditionalServicesGroupUsingPOSTAsync(@javax.annotation.Nonnull AdditionalServicesGroupRequest additionalServicesGroupRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createAdditionalServicesGroupUsingPOSTValidateBeforeCall(additionalServicesGroupRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAdditionalServicesGroupUsingGET + * @param groupId Additional Service Group ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call getAdditionalServicesGroupUsingGETCall(@javax.annotation.Nonnull String groupId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-additional-services/groups/{groupId}" + .replace("{" + "groupId" + "}", localVarApiClient.escapeString(groupId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAdditionalServicesGroupUsingGETValidateBeforeCall(@javax.annotation.Nonnull String groupId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'groupId' is set + if (groupId == null) { + throw new ApiException("Missing the required parameter 'groupId' when calling getAdditionalServicesGroupUsingGET(Async)"); + } + + return getAdditionalServicesGroupUsingGETCall(groupId, _callback); + + } + + /** + * Get the details of an additional services group + * Use this resource to get additional services group for a given ID. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-wybrana-grupe-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-a-group-of-additional-services-for-a-given-id\" target=\"_blank\">EN</a>. + * @param groupId Additional Service Group ID. (required) + * @return AdditionalServicesGroupResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public AdditionalServicesGroupResponse getAdditionalServicesGroupUsingGET(@javax.annotation.Nonnull String groupId) throws ApiException { + ApiResponse localVarResp = getAdditionalServicesGroupUsingGETWithHttpInfo(groupId); + return localVarResp.getData(); + } + + /** + * Get the details of an additional services group + * Use this resource to get additional services group for a given ID. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-wybrana-grupe-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-a-group-of-additional-services-for-a-given-id\" target=\"_blank\">EN</a>. + * @param groupId Additional Service Group ID. (required) + * @return ApiResponse<AdditionalServicesGroupResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public ApiResponse getAdditionalServicesGroupUsingGETWithHttpInfo(@javax.annotation.Nonnull String groupId) throws ApiException { + okhttp3.Call localVarCall = getAdditionalServicesGroupUsingGETValidateBeforeCall(groupId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the details of an additional services group (asynchronously) + * Use this resource to get additional services group for a given ID. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-wybrana-grupe-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-a-group-of-additional-services-for-a-given-id\" target=\"_blank\">EN</a>. + * @param groupId Additional Service Group 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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call getAdditionalServicesGroupUsingGETAsync(@javax.annotation.Nonnull String groupId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAdditionalServicesGroupUsingGETValidateBeforeCall(groupId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getListOfAdditionalServicesDefinitionsCategoriesUsingGET + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getListOfAdditionalServicesDefinitionsCategoriesUsingGETCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-additional-services/categories"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getListOfAdditionalServicesDefinitionsCategoriesUsingGETValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getListOfAdditionalServicesDefinitionsCategoriesUsingGETCall(_callback); + + } + + /** + * Get the additional services definitions by categories + * Use this resource to get additional services definitions, grouped by additional services categories, available on given marketplace. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-liste-dostepnych-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-a-list-of-available-additional-services\" target=\"_blank\">EN</a>. + * @return CategoriesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public CategoriesResponse getListOfAdditionalServicesDefinitionsCategoriesUsingGET() throws ApiException { + ApiResponse localVarResp = getListOfAdditionalServicesDefinitionsCategoriesUsingGETWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get the additional services definitions by categories + * Use this resource to get additional services definitions, grouped by additional services categories, available on given marketplace. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-liste-dostepnych-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-a-list-of-available-additional-services\" target=\"_blank\">EN</a>. + * @return ApiResponse<CategoriesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse getListOfAdditionalServicesDefinitionsCategoriesUsingGETWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getListOfAdditionalServicesDefinitionsCategoriesUsingGETValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the additional services definitions by categories (asynchronously) + * Use this resource to get additional services definitions, grouped by additional services categories, available on given marketplace. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-liste-dostepnych-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-a-list-of-available-additional-services\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getListOfAdditionalServicesDefinitionsCategoriesUsingGETAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getListOfAdditionalServicesDefinitionsCategoriesUsingGETValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getListOfAdditionalServicesGroupsUsingGET + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getListOfAdditionalServicesGroupsUsingGETCall(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-additional-services/groups"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getListOfAdditionalServicesGroupsUsingGETValidateBeforeCall(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + return getListOfAdditionalServicesGroupsUsingGETCall(offset, limit, _callback); + + } + + /** + * Get the user's additional services groups + * Use this resource to retrieve a list of groups with additional services available to a given user which you may assign to offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-liste-grup-uslug-dodatkowych-na-koncie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-a-list-of-additional-services-groups-for-the-account\" target=\"_blank\">EN</a>. + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 100) + * @return AdditionalServicesGroups + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public AdditionalServicesGroups getListOfAdditionalServicesGroupsUsingGET(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + ApiResponse localVarResp = getListOfAdditionalServicesGroupsUsingGETWithHttpInfo(offset, limit); + return localVarResp.getData(); + } + + /** + * Get the user's additional services groups + * Use this resource to retrieve a list of groups with additional services available to a given user which you may assign to offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-liste-grup-uslug-dodatkowych-na-koncie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-a-list-of-additional-services-groups-for-the-account\" target=\"_blank\">EN</a>. + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 100) + * @return ApiResponse<AdditionalServicesGroups> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse getListOfAdditionalServicesGroupsUsingGETWithHttpInfo(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + okhttp3.Call localVarCall = getListOfAdditionalServicesGroupsUsingGETValidateBeforeCall(offset, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's additional services groups (asynchronously) + * Use this resource to retrieve a list of groups with additional services available to a given user which you may assign to offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-liste-grup-uslug-dodatkowych-na-koncie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-a-list-of-additional-services-groups-for-the-account\" target=\"_blank\">EN</a>. + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getListOfAdditionalServicesGroupsUsingGETAsync(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getListOfAdditionalServicesGroupsUsingGETValidateBeforeCall(offset, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for modifyAdditionalServicesGroupUsingPUT + * @param groupId Additional service group ID. (required) + * @param additionalServicesGroupRequest Additional service group body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call modifyAdditionalServicesGroupUsingPUTCall(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull AdditionalServicesGroupRequest additionalServicesGroupRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = additionalServicesGroupRequest; + + // create path and map variables + String localVarPath = "/sale/offer-additional-services/groups/{groupId}" + .replace("{" + "groupId" + "}", localVarApiClient.escapeString(groupId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call modifyAdditionalServicesGroupUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull AdditionalServicesGroupRequest additionalServicesGroupRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'groupId' is set + if (groupId == null) { + throw new ApiException("Missing the required parameter 'groupId' when calling modifyAdditionalServicesGroupUsingPUT(Async)"); + } + + // verify the required parameter 'additionalServicesGroupRequest' is set + if (additionalServicesGroupRequest == null) { + throw new ApiException("Missing the required parameter 'additionalServicesGroupRequest' when calling modifyAdditionalServicesGroupUsingPUT(Async)"); + } + + return modifyAdditionalServicesGroupUsingPUTCall(groupId, additionalServicesGroupRequest, _callback); + + } + + /** + * Modify an additional services group + * Use this resource to modify existing additional service group. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-zaktualizowac-grupe-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-additional-service-group\" target=\"_blank\">EN</a>. + * @param groupId Additional service group ID. (required) + * @param additionalServicesGroupRequest Additional service group body (required) + * @return AdditionalServicesGroupResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public AdditionalServicesGroupResponse modifyAdditionalServicesGroupUsingPUT(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull AdditionalServicesGroupRequest additionalServicesGroupRequest) throws ApiException { + ApiResponse localVarResp = modifyAdditionalServicesGroupUsingPUTWithHttpInfo(groupId, additionalServicesGroupRequest); + return localVarResp.getData(); + } + + /** + * Modify an additional services group + * Use this resource to modify existing additional service group. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-zaktualizowac-grupe-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-additional-service-group\" target=\"_blank\">EN</a>. + * @param groupId Additional service group ID. (required) + * @param additionalServicesGroupRequest Additional service group body (required) + * @return ApiResponse<AdditionalServicesGroupResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public ApiResponse modifyAdditionalServicesGroupUsingPUTWithHttpInfo(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull AdditionalServicesGroupRequest additionalServicesGroupRequest) throws ApiException { + okhttp3.Call localVarCall = modifyAdditionalServicesGroupUsingPUTValidateBeforeCall(groupId, additionalServicesGroupRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Modify an additional services group (asynchronously) + * Use this resource to modify existing additional service group. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-zaktualizowac-grupe-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-additional-service-group\" target=\"_blank\">EN</a>. + * @param groupId Additional service group ID. (required) + * @param additionalServicesGroupRequest Additional service group body (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call modifyAdditionalServicesGroupUsingPUTAsync(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull AdditionalServicesGroupRequest additionalServicesGroupRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = modifyAdditionalServicesGroupUsingPUTValidateBeforeCall(groupId, additionalServicesGroupRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/AdditionalServicesTranslationsApi.java b/src/main/java/pl/wtx/allegro/api/client/AdditionalServicesTranslationsApi.java new file mode 100644 index 0000000..b7deed4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/AdditionalServicesTranslationsApi.java @@ -0,0 +1,519 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AdditionalServiceGroupTranslationPatchResponse; +import pl.wtx.allegro.api.client.model.AdditionalServiceGroupTranslationResponse; +import pl.wtx.allegro.api.client.model.AdditionalServicesGroupTranslationRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AdditionalServicesTranslationsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AdditionalServicesTranslationsApi() { + this(Configuration.getDefaultApiClient()); + } + + public AdditionalServicesTranslationsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteAdditionalServiceGroupTranslation + * @param groupId Additional service group ID. (required) + * @param language IETF Language tag. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Translation deleted successfully -
401 Unauthorized -
403 Forbidden -
404 Additional service group or translation not found -
+ */ + public okhttp3.Call deleteAdditionalServiceGroupTranslationCall(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull String language, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-additional-services/groups/{groupId}/translations/{language}" + .replace("{" + "groupId" + "}", localVarApiClient.escapeString(groupId.toString())) + .replace("{" + "language" + "}", localVarApiClient.escapeString(language.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteAdditionalServiceGroupTranslationValidateBeforeCall(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull String language, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'groupId' is set + if (groupId == null) { + throw new ApiException("Missing the required parameter 'groupId' when calling deleteAdditionalServiceGroupTranslation(Async)"); + } + + // verify the required parameter 'language' is set + if (language == null) { + throw new ApiException("Missing the required parameter 'language' when calling deleteAdditionalServiceGroupTranslation(Async)"); + } + + return deleteAdditionalServiceGroupTranslationCall(groupId, language, _callback); + + } + + /** + * Delete a translation for a specified group and language + * Use this resource to delete the translation for specified additional service group and language. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#additional-services-translations\" target=\"_blank\">EN</a>. + * @param groupId Additional service group ID. (required) + * @param language IETF Language tag. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Translation deleted successfully -
401 Unauthorized -
403 Forbidden -
404 Additional service group or translation not found -
+ */ + public void deleteAdditionalServiceGroupTranslation(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull String language) throws ApiException { + deleteAdditionalServiceGroupTranslationWithHttpInfo(groupId, language); + } + + /** + * Delete a translation for a specified group and language + * Use this resource to delete the translation for specified additional service group and language. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#additional-services-translations\" target=\"_blank\">EN</a>. + * @param groupId Additional service group ID. (required) + * @param language IETF Language tag. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Translation deleted successfully -
401 Unauthorized -
403 Forbidden -
404 Additional service group or translation not found -
+ */ + public ApiResponse deleteAdditionalServiceGroupTranslationWithHttpInfo(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull String language) throws ApiException { + okhttp3.Call localVarCall = deleteAdditionalServiceGroupTranslationValidateBeforeCall(groupId, language, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a translation for a specified group and language (asynchronously) + * Use this resource to delete the translation for specified additional service group and language. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#additional-services-translations\" target=\"_blank\">EN</a>. + * @param groupId Additional service group ID. (required) + * @param language IETF Language tag. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Translation deleted successfully -
401 Unauthorized -
403 Forbidden -
404 Additional service group or translation not found -
+ */ + public okhttp3.Call deleteAdditionalServiceGroupTranslationAsync(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull String language, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteAdditionalServiceGroupTranslationValidateBeforeCall(groupId, language, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getAdditionalServiceGroupTranslations + * @param groupId Additional Service Group ID. (required) + * @param language IETF language tag. When provided, the response will contain translations in only that language (if exists). (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call getAdditionalServiceGroupTranslationsCall(@javax.annotation.Nonnull String groupId, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-additional-services/groups/{groupId}/translations" + .replace("{" + "groupId" + "}", localVarApiClient.escapeString(groupId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (language != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("language", language)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAdditionalServiceGroupTranslationsValidateBeforeCall(@javax.annotation.Nonnull String groupId, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'groupId' is set + if (groupId == null) { + throw new ApiException("Missing the required parameter 'groupId' when calling getAdditionalServiceGroupTranslations(Async)"); + } + + return getAdditionalServiceGroupTranslationsCall(groupId, language, _callback); + + } + + /** + * Get translations for specified group + * Use this resource to get translations for additional service group. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#additional-services-translations\" target=\"_blank\">EN</a>. + * @param groupId Additional Service Group ID. (required) + * @param language IETF language tag. When provided, the response will contain translations in only that language (if exists). (optional) + * @return AdditionalServiceGroupTranslationResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public AdditionalServiceGroupTranslationResponse getAdditionalServiceGroupTranslations(@javax.annotation.Nonnull String groupId, @javax.annotation.Nullable String language) throws ApiException { + ApiResponse localVarResp = getAdditionalServiceGroupTranslationsWithHttpInfo(groupId, language); + return localVarResp.getData(); + } + + /** + * Get translations for specified group + * Use this resource to get translations for additional service group. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#additional-services-translations\" target=\"_blank\">EN</a>. + * @param groupId Additional Service Group ID. (required) + * @param language IETF language tag. When provided, the response will contain translations in only that language (if exists). (optional) + * @return ApiResponse<AdditionalServiceGroupTranslationResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public ApiResponse getAdditionalServiceGroupTranslationsWithHttpInfo(@javax.annotation.Nonnull String groupId, @javax.annotation.Nullable String language) throws ApiException { + okhttp3.Call localVarCall = getAdditionalServiceGroupTranslationsValidateBeforeCall(groupId, language, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get translations for specified group (asynchronously) + * Use this resource to get translations for additional service group. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#additional-services-translations\" target=\"_blank\">EN</a>. + * @param groupId Additional Service Group ID. (required) + * @param language IETF language tag. When provided, the response will contain translations in only that language (if exists). (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call getAdditionalServiceGroupTranslationsAsync(@javax.annotation.Nonnull String groupId, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAdditionalServiceGroupTranslationsValidateBeforeCall(groupId, language, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateAdditionalServiceGroupTranslation + * @param groupId Additional Service Group ID. (required) + * @param language IETF Language tag. (required) + * @param additionalServicesGroupTranslationRequest Additonal service group translation. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Translation created/updated for group and language. -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call updateAdditionalServiceGroupTranslationCall(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull String language, @javax.annotation.Nonnull AdditionalServicesGroupTranslationRequest additionalServicesGroupTranslationRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = additionalServicesGroupTranslationRequest; + + // create path and map variables + String localVarPath = "/sale/offer-additional-services/groups/{groupId}/translations/{language}" + .replace("{" + "groupId" + "}", localVarApiClient.escapeString(groupId.toString())) + .replace("{" + "language" + "}", localVarApiClient.escapeString(language.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateAdditionalServiceGroupTranslationValidateBeforeCall(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull String language, @javax.annotation.Nonnull AdditionalServicesGroupTranslationRequest additionalServicesGroupTranslationRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'groupId' is set + if (groupId == null) { + throw new ApiException("Missing the required parameter 'groupId' when calling updateAdditionalServiceGroupTranslation(Async)"); + } + + // verify the required parameter 'language' is set + if (language == null) { + throw new ApiException("Missing the required parameter 'language' when calling updateAdditionalServiceGroupTranslation(Async)"); + } + + // verify the required parameter 'additionalServicesGroupTranslationRequest' is set + if (additionalServicesGroupTranslationRequest == null) { + throw new ApiException("Missing the required parameter 'additionalServicesGroupTranslationRequest' when calling updateAdditionalServiceGroupTranslation(Async)"); + } + + return updateAdditionalServiceGroupTranslationCall(groupId, language, additionalServicesGroupTranslationRequest, _callback); + + } + + /** + * Create/Update translations for specified group and language + * Use this resource to create/update translation for additional service group and specified language. It is allowed to provide an incomplete list of services that belong to the group. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#additional-services-translations\" target=\"_blank\">EN</a>. + * @param groupId Additional Service Group ID. (required) + * @param language IETF Language tag. (required) + * @param additionalServicesGroupTranslationRequest Additonal service group translation. (required) + * @return AdditionalServiceGroupTranslationPatchResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Translation created/updated for group and language. -
401 Unauthorized -
404 Not Found -
+ */ + public AdditionalServiceGroupTranslationPatchResponse updateAdditionalServiceGroupTranslation(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull String language, @javax.annotation.Nonnull AdditionalServicesGroupTranslationRequest additionalServicesGroupTranslationRequest) throws ApiException { + ApiResponse localVarResp = updateAdditionalServiceGroupTranslationWithHttpInfo(groupId, language, additionalServicesGroupTranslationRequest); + return localVarResp.getData(); + } + + /** + * Create/Update translations for specified group and language + * Use this resource to create/update translation for additional service group and specified language. It is allowed to provide an incomplete list of services that belong to the group. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#additional-services-translations\" target=\"_blank\">EN</a>. + * @param groupId Additional Service Group ID. (required) + * @param language IETF Language tag. (required) + * @param additionalServicesGroupTranslationRequest Additonal service group translation. (required) + * @return ApiResponse<AdditionalServiceGroupTranslationPatchResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Translation created/updated for group and language. -
401 Unauthorized -
404 Not Found -
+ */ + public ApiResponse updateAdditionalServiceGroupTranslationWithHttpInfo(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull String language, @javax.annotation.Nonnull AdditionalServicesGroupTranslationRequest additionalServicesGroupTranslationRequest) throws ApiException { + okhttp3.Call localVarCall = updateAdditionalServiceGroupTranslationValidateBeforeCall(groupId, language, additionalServicesGroupTranslationRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create/Update translations for specified group and language (asynchronously) + * Use this resource to create/update translation for additional service group and specified language. It is allowed to provide an incomplete list of services that belong to the group. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-uslug-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#additional-services-translations\" target=\"_blank\">EN</a>. + * @param groupId Additional Service Group ID. (required) + * @param language IETF Language tag. (required) + * @param additionalServicesGroupTranslationRequest Additonal service group translation. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Translation created/updated for group and language. -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call updateAdditionalServiceGroupTranslationAsync(@javax.annotation.Nonnull String groupId, @javax.annotation.Nonnull String language, @javax.annotation.Nonnull AdditionalServicesGroupTranslationRequest additionalServicesGroupTranslationRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateAdditionalServiceGroupTranslationValidateBeforeCall(groupId, language, additionalServicesGroupTranslationRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/AdvanceShipNoticesApi.java b/src/main/java/pl/wtx/allegro/api/client/AdvanceShipNoticesApi.java new file mode 100644 index 0000000..fabcdf1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/AdvanceShipNoticesApi.java @@ -0,0 +1,1722 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AdvanceShipNotice; +import pl.wtx.allegro.api.client.model.AdvanceShipNoticeList; +import pl.wtx.allegro.api.client.model.AdvanceShipNoticeResponse; +import pl.wtx.allegro.api.client.model.AdvanceShipNoticeStatus; +import pl.wtx.allegro.api.client.model.CreateAdvanceShipNoticeRequest; +import pl.wtx.allegro.api.client.model.CreateAdvanceShipNoticeResponse; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import java.io.File; +import pl.wtx.allegro.api.client.model.ReceivingState; +import pl.wtx.allegro.api.client.model.SubmitCommand; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.UpdateSubmittedAdvanceShipNoticeRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AdvanceShipNoticesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AdvanceShipNoticesApi() { + this(Configuration.getDefaultApiClient()); + } + + public AdvanceShipNoticesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for cancelAdvanceShipNotice + * @param id An identifier of the Advance Ship Notice to cancel. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice was cancelled. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 ASN cannot be cancelled - it is not in IN_TRANSIT status. -
+ */ + public okhttp3.Call cancelAdvanceShipNoticeCall(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/advance-ship-notices/{id}/cancel" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call cancelAdvanceShipNoticeValidateBeforeCall(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling cancelAdvanceShipNotice(Async)"); + } + + return cancelAdvanceShipNoticeCall(id, _callback); + + } + + /** + * Cancel Advance Ship Notice + * Use this resource to cancel an Advance Ship Notice in IN_TRANSIT status. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#anuluj-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#cancel-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of the Advance Ship Notice to cancel. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice was cancelled. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 ASN cannot be cancelled - it is not in IN_TRANSIT status. -
+ */ + public void cancelAdvanceShipNotice(@javax.annotation.Nonnull UUID id) throws ApiException { + cancelAdvanceShipNoticeWithHttpInfo(id); + } + + /** + * Cancel Advance Ship Notice + * Use this resource to cancel an Advance Ship Notice in IN_TRANSIT status. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#anuluj-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#cancel-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of the Advance Ship Notice to cancel. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice was cancelled. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 ASN cannot be cancelled - it is not in IN_TRANSIT status. -
+ */ + public ApiResponse cancelAdvanceShipNoticeWithHttpInfo(@javax.annotation.Nonnull UUID id) throws ApiException { + okhttp3.Call localVarCall = cancelAdvanceShipNoticeValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Cancel Advance Ship Notice (asynchronously) + * Use this resource to cancel an Advance Ship Notice in IN_TRANSIT status. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#anuluj-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#cancel-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of the Advance Ship Notice to cancel. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice was cancelled. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 ASN cannot be cancelled - it is not in IN_TRANSIT status. -
+ */ + public okhttp3.Call cancelAdvanceShipNoticeAsync(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = cancelAdvanceShipNoticeValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createAdvanceShipNotice + * @param createAdvanceShipNoticeRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Advance Ship Notice created. * location - A location to created command (URI).
* etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 Invalid request body. -
401 Unauthorized -
403 Forbidden -
422 Advance Ship Notice cannot be created due to improper input data. -
+ */ + public okhttp3.Call createAdvanceShipNoticeCall(@javax.annotation.Nonnull CreateAdvanceShipNoticeRequest createAdvanceShipNoticeRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createAdvanceShipNoticeRequest; + + // create path and map variables + String localVarPath = "/fulfillment/advance-ship-notices"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createAdvanceShipNoticeValidateBeforeCall(@javax.annotation.Nonnull CreateAdvanceShipNoticeRequest createAdvanceShipNoticeRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createAdvanceShipNoticeRequest' is set + if (createAdvanceShipNoticeRequest == null) { + throw new ApiException("Missing the required parameter 'createAdvanceShipNoticeRequest' when calling createAdvanceShipNotice(Async)"); + } + + return createAdvanceShipNoticeCall(createAdvanceShipNoticeRequest, _callback); + + } + + /** + * Create an Advance Ship Notice + * Use this resource to create an Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#utworz-draft-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#create-a-draft-of-the-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param createAdvanceShipNoticeRequest (required) + * @return CreateAdvanceShipNoticeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Advance Ship Notice created. * location - A location to created command (URI).
* etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 Invalid request body. -
401 Unauthorized -
403 Forbidden -
422 Advance Ship Notice cannot be created due to improper input data. -
+ */ + public CreateAdvanceShipNoticeResponse createAdvanceShipNotice(@javax.annotation.Nonnull CreateAdvanceShipNoticeRequest createAdvanceShipNoticeRequest) throws ApiException { + ApiResponse localVarResp = createAdvanceShipNoticeWithHttpInfo(createAdvanceShipNoticeRequest); + return localVarResp.getData(); + } + + /** + * Create an Advance Ship Notice + * Use this resource to create an Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#utworz-draft-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#create-a-draft-of-the-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param createAdvanceShipNoticeRequest (required) + * @return ApiResponse<CreateAdvanceShipNoticeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Advance Ship Notice created. * location - A location to created command (URI).
* etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 Invalid request body. -
401 Unauthorized -
403 Forbidden -
422 Advance Ship Notice cannot be created due to improper input data. -
+ */ + public ApiResponse createAdvanceShipNoticeWithHttpInfo(@javax.annotation.Nonnull CreateAdvanceShipNoticeRequest createAdvanceShipNoticeRequest) throws ApiException { + okhttp3.Call localVarCall = createAdvanceShipNoticeValidateBeforeCall(createAdvanceShipNoticeRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create an Advance Ship Notice (asynchronously) + * Use this resource to create an Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#utworz-draft-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#create-a-draft-of-the-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param createAdvanceShipNoticeRequest (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Advance Ship Notice created. * location - A location to created command (URI).
* etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 Invalid request body. -
401 Unauthorized -
403 Forbidden -
422 Advance Ship Notice cannot be created due to improper input data. -
+ */ + public okhttp3.Call createAdvanceShipNoticeAsync(@javax.annotation.Nonnull CreateAdvanceShipNoticeRequest createAdvanceShipNoticeRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createAdvanceShipNoticeValidateBeforeCall(createAdvanceShipNoticeRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteAdvanceShipNotice + * @param id An identifier of the Advance Ship Notice to delete. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Advance Ship Notice was deleted. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 ASN cannot be deleted - it is not in DRAFT status. -
+ */ + public okhttp3.Call deleteAdvanceShipNoticeCall(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/advance-ship-notices/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteAdvanceShipNoticeValidateBeforeCall(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling deleteAdvanceShipNotice(Async)"); + } + + return deleteAdvanceShipNoticeCall(id, _callback); + + } + + /** + * Delete Advance Ship Notice + * Use this resource to delete an Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-usunac-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-delete-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of the Advance Ship Notice to delete. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Advance Ship Notice was deleted. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 ASN cannot be deleted - it is not in DRAFT status. -
+ */ + public void deleteAdvanceShipNotice(@javax.annotation.Nonnull UUID id) throws ApiException { + deleteAdvanceShipNoticeWithHttpInfo(id); + } + + /** + * Delete Advance Ship Notice + * Use this resource to delete an Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-usunac-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-delete-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of the Advance Ship Notice to delete. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Advance Ship Notice was deleted. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 ASN cannot be deleted - it is not in DRAFT status. -
+ */ + public ApiResponse deleteAdvanceShipNoticeWithHttpInfo(@javax.annotation.Nonnull UUID id) throws ApiException { + okhttp3.Call localVarCall = deleteAdvanceShipNoticeValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete Advance Ship Notice (asynchronously) + * Use this resource to delete an Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-usunac-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-delete-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of the Advance Ship Notice to delete. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Advance Ship Notice was deleted. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 ASN cannot be deleted - it is not in DRAFT status. -
+ */ + public okhttp3.Call deleteAdvanceShipNoticeAsync(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteAdvanceShipNoticeValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getAdvanceShipNotice + * @param id The identifier of returned Advance Ship Notice. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns single Advance Ship Notice. * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAdvanceShipNoticeCall(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/advance-ship-notices/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAdvanceShipNoticeValidateBeforeCall(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getAdvanceShipNotice(Async)"); + } + + return getAdvanceShipNoticeCall(id, _callback); + + } + + /** + * Get single Advance Ship Notice + * Use this resource to get an Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-przegladac-utworzone-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-get-created-advance-ship-notices\" target=\"_blank\">EN</a>. + * @param id The identifier of returned Advance Ship Notice. (required) + * @return AdvanceShipNoticeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns single Advance Ship Notice. * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public AdvanceShipNoticeResponse getAdvanceShipNotice(@javax.annotation.Nonnull UUID id) throws ApiException { + ApiResponse localVarResp = getAdvanceShipNoticeWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get single Advance Ship Notice + * Use this resource to get an Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-przegladac-utworzone-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-get-created-advance-ship-notices\" target=\"_blank\">EN</a>. + * @param id The identifier of returned Advance Ship Notice. (required) + * @return ApiResponse<AdvanceShipNoticeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns single Advance Ship Notice. * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getAdvanceShipNoticeWithHttpInfo(@javax.annotation.Nonnull UUID id) throws ApiException { + okhttp3.Call localVarCall = getAdvanceShipNoticeValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get single Advance Ship Notice (asynchronously) + * Use this resource to get an Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-przegladac-utworzone-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-get-created-advance-ship-notices\" target=\"_blank\">EN</a>. + * @param id The identifier of returned Advance Ship Notice. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns single Advance Ship Notice. * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAdvanceShipNoticeAsync(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAdvanceShipNoticeValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAdvanceShipNoticeLabels + * @param id An identifier of the Advance Ship Notice. (required) + * @param accept Content-type of generated labels. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns PDF or ZPL file with labels. * content-disposition - The header contains filename directive with indicative file name.
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAdvanceShipNoticeLabelsCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/advance-ship-notices/{id}/labels" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/pdf", + "x-application/zpl" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (accept != null) { + localVarHeaderParams.put("accept", localVarApiClient.parameterToString(accept)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAdvanceShipNoticeLabelsValidateBeforeCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getAdvanceShipNoticeLabels(Async)"); + } + + // verify the required parameter 'accept' is set + if (accept == null) { + throw new ApiException("Missing the required parameter 'accept' when calling getAdvanceShipNoticeLabels(Async)"); + } + + return getAdvanceShipNoticeLabelsCall(id, accept, _callback); + + } + + /** + * Get labels for Advance Ship Notice + * Use this resource to get labels for Advance Ship Notice after being created with \"create labels command\". Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#wygeneruj-oznaczenia-na-kartony\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#create-labels-for-boxes\" target=\"_blank\">EN</a>. + * @param id An identifier of the Advance Ship Notice. (required) + * @param accept Content-type of generated labels. (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns PDF or ZPL file with labels. * content-disposition - The header contains filename directive with indicative file name.
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public File getAdvanceShipNoticeLabels(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept) throws ApiException { + ApiResponse localVarResp = getAdvanceShipNoticeLabelsWithHttpInfo(id, accept); + return localVarResp.getData(); + } + + /** + * Get labels for Advance Ship Notice + * Use this resource to get labels for Advance Ship Notice after being created with \"create labels command\". Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#wygeneruj-oznaczenia-na-kartony\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#create-labels-for-boxes\" target=\"_blank\">EN</a>. + * @param id An identifier of the Advance Ship Notice. (required) + * @param accept Content-type of generated labels. (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns PDF or ZPL file with labels. * content-disposition - The header contains filename directive with indicative file name.
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getAdvanceShipNoticeLabelsWithHttpInfo(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept) throws ApiException { + okhttp3.Call localVarCall = getAdvanceShipNoticeLabelsValidateBeforeCall(id, accept, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get labels for Advance Ship Notice (asynchronously) + * Use this resource to get labels for Advance Ship Notice after being created with \"create labels command\". Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#wygeneruj-oznaczenia-na-kartony\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#create-labels-for-boxes\" target=\"_blank\">EN</a>. + * @param id An identifier of the Advance Ship Notice. (required) + * @param accept Content-type of generated labels. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns PDF or ZPL file with labels. * content-disposition - The header contains filename directive with indicative file name.
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAdvanceShipNoticeLabelsAsync(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAdvanceShipNoticeLabelsValidateBeforeCall(id, accept, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAdvanceShipNoticeReceivingState + * @param id An identifier of advance ship notice. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns the state of Advance Ship Notice receiving in Fulfillment Center -
401 Unauthorized -
403 Forbidden -
404 Not Found (ASN doesn't exist or is in state DRAFT or IN_TRANSIT) -
+ */ + public okhttp3.Call getAdvanceShipNoticeReceivingStateCall(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/advance-ship-notices/{id}/receiving-state" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAdvanceShipNoticeReceivingStateValidateBeforeCall(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getAdvanceShipNoticeReceivingState(Async)"); + } + + return getAdvanceShipNoticeReceivingStateCall(id, _callback); + + } + + /** + * Check current state and details of Advance Ship Notice receiving + * Use this resource to check the state of Advance Ship Notice receiving in Fulfillment Center in real time. The response contains a receiving progress and information about particular items - their quantities and conditions. While the Advance Ship Notice is in UNPACKING state, report is updated dynamically, which might result in different responses even at short time intervals. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#sprawdz-postep-odbioru-awizo-przez-magazyn\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#check-current-state-and-details-of-advance-ship-notice-receiving\" target=\"_blank\">EN</a>. + * @param id An identifier of advance ship notice. (required) + * @return ReceivingState + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns the state of Advance Ship Notice receiving in Fulfillment Center -
401 Unauthorized -
403 Forbidden -
404 Not Found (ASN doesn't exist or is in state DRAFT or IN_TRANSIT) -
+ */ + public ReceivingState getAdvanceShipNoticeReceivingState(@javax.annotation.Nonnull UUID id) throws ApiException { + ApiResponse localVarResp = getAdvanceShipNoticeReceivingStateWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Check current state and details of Advance Ship Notice receiving + * Use this resource to check the state of Advance Ship Notice receiving in Fulfillment Center in real time. The response contains a receiving progress and information about particular items - their quantities and conditions. While the Advance Ship Notice is in UNPACKING state, report is updated dynamically, which might result in different responses even at short time intervals. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#sprawdz-postep-odbioru-awizo-przez-magazyn\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#check-current-state-and-details-of-advance-ship-notice-receiving\" target=\"_blank\">EN</a>. + * @param id An identifier of advance ship notice. (required) + * @return ApiResponse<ReceivingState> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns the state of Advance Ship Notice receiving in Fulfillment Center -
401 Unauthorized -
403 Forbidden -
404 Not Found (ASN doesn't exist or is in state DRAFT or IN_TRANSIT) -
+ */ + public ApiResponse getAdvanceShipNoticeReceivingStateWithHttpInfo(@javax.annotation.Nonnull UUID id) throws ApiException { + okhttp3.Call localVarCall = getAdvanceShipNoticeReceivingStateValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Check current state and details of Advance Ship Notice receiving (asynchronously) + * Use this resource to check the state of Advance Ship Notice receiving in Fulfillment Center in real time. The response contains a receiving progress and information about particular items - their quantities and conditions. While the Advance Ship Notice is in UNPACKING state, report is updated dynamically, which might result in different responses even at short time intervals. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#sprawdz-postep-odbioru-awizo-przez-magazyn\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#check-current-state-and-details-of-advance-ship-notice-receiving\" target=\"_blank\">EN</a>. + * @param id An identifier of advance ship notice. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns the state of Advance Ship Notice receiving in Fulfillment Center -
401 Unauthorized -
403 Forbidden -
404 Not Found (ASN doesn't exist or is in state DRAFT or IN_TRANSIT) -
+ */ + public okhttp3.Call getAdvanceShipNoticeReceivingStateAsync(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAdvanceShipNoticeReceivingStateValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAdvanceShipNotices + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit Maximum number of elements in response. (optional, default to 50) + * @param status A status of the Advance Ship Notices in the response. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of Advance Ship Notices that belong to a seller. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public okhttp3.Call getAdvanceShipNoticesCall(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/advance-ship-notices"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "status", status)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAdvanceShipNoticesValidateBeforeCall(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List status, final ApiCallback _callback) throws ApiException { + return getAdvanceShipNoticesCall(offset, limit, status, _callback); + + } + + /** + * Get list of Advance Ship Notices + * Use this resource to get a list of Advance Ship Notices. The list is ordered by **createdAt** property. Default **offset** is 0, default **limit** is 50. A list can be filtered by statuses. Multiple status query parameters are allowed. In such cases, filters are joined with **OR** logical operator. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-przegladac-utworzone-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-get-created-advance-ship-notices\" target=\"_blank\">EN</a>. + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit Maximum number of elements in response. (optional, default to 50) + * @param status A status of the Advance Ship Notices in the response. (optional) + * @return AdvanceShipNoticeList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of Advance Ship Notices that belong to a seller. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public AdvanceShipNoticeList getAdvanceShipNotices(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List status) throws ApiException { + ApiResponse localVarResp = getAdvanceShipNoticesWithHttpInfo(offset, limit, status); + return localVarResp.getData(); + } + + /** + * Get list of Advance Ship Notices + * Use this resource to get a list of Advance Ship Notices. The list is ordered by **createdAt** property. Default **offset** is 0, default **limit** is 50. A list can be filtered by statuses. Multiple status query parameters are allowed. In such cases, filters are joined with **OR** logical operator. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-przegladac-utworzone-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-get-created-advance-ship-notices\" target=\"_blank\">EN</a>. + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit Maximum number of elements in response. (optional, default to 50) + * @param status A status of the Advance Ship Notices in the response. (optional) + * @return ApiResponse<AdvanceShipNoticeList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of Advance Ship Notices that belong to a seller. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public ApiResponse getAdvanceShipNoticesWithHttpInfo(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List status) throws ApiException { + okhttp3.Call localVarCall = getAdvanceShipNoticesValidateBeforeCall(offset, limit, status, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get list of Advance Ship Notices (asynchronously) + * Use this resource to get a list of Advance Ship Notices. The list is ordered by **createdAt** property. Default **offset** is 0, default **limit** is 50. A list can be filtered by statuses. Multiple status query parameters are allowed. In such cases, filters are joined with **OR** logical operator. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-przegladac-utworzone-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-get-created-advance-ship-notices\" target=\"_blank\">EN</a>. + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit Maximum number of elements in response. (optional, default to 50) + * @param status A status of the Advance Ship Notices in the response. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of Advance Ship Notices that belong to a seller. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public okhttp3.Call getAdvanceShipNoticesAsync(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAdvanceShipNoticesValidateBeforeCall(offset, limit, status, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getSubmitCommand + * @param commandId An identifier of the command. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public okhttp3.Call getSubmitCommandCall(@javax.annotation.Nonnull UUID commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/submit-commands/{command-id}" + .replace("{" + "command-id" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSubmitCommandValidateBeforeCall(@javax.annotation.Nonnull UUID commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getSubmitCommand(Async)"); + } + + return getSubmitCommandCall(commandId, _callback); + + } + + /** + * Get submit status + * Use this resource to get submit status of the Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#zakoncz-edycje-i-wyslij-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#finish-editing-and-submit-the-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param commandId An identifier of the command. (required) + * @return SubmitCommand + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public SubmitCommand getSubmitCommand(@javax.annotation.Nonnull UUID commandId) throws ApiException { + ApiResponse localVarResp = getSubmitCommandWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Get submit status + * Use this resource to get submit status of the Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#zakoncz-edycje-i-wyslij-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#finish-editing-and-submit-the-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param commandId An identifier of the command. (required) + * @return ApiResponse<SubmitCommand> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public ApiResponse getSubmitCommandWithHttpInfo(@javax.annotation.Nonnull UUID commandId) throws ApiException { + okhttp3.Call localVarCall = getSubmitCommandValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get submit status (asynchronously) + * Use this resource to get submit status of the Advance Ship Notice. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#zakoncz-edycje-i-wyslij-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#finish-editing-and-submit-the-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param commandId An identifier of the command. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public okhttp3.Call getSubmitCommandAsync(@javax.annotation.Nonnull UUID commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSubmitCommandValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for submitCommand + * @param commandId The identifier of the command. (required) + * @param submitCommand (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 Returns command output with status and possible errors. The command could fail with following error codes: * ASN_NOT_FOUND - Cannot find ASN with id given in command input. * COMMAND_FORBIDDEN - Requester has no access to run commands on given ASN. * INVALID_ASN_STATE - Such command cannot be run on current ASN state e.g. ASN has no shipping information. * COMMAND_FAILED - Any other error. * location - A location to created command (URI).
401 Unauthorized -
422 Invalid request parameters. -
+ */ + public okhttp3.Call submitCommandCall(@javax.annotation.Nonnull UUID commandId, @javax.annotation.Nonnull SubmitCommand submitCommand, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = submitCommand; + + // create path and map variables + String localVarPath = "/fulfillment/submit-commands/{command-id}" + .replace("{" + "command-id" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call submitCommandValidateBeforeCall(@javax.annotation.Nonnull UUID commandId, @javax.annotation.Nonnull SubmitCommand submitCommand, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling submitCommand(Async)"); + } + + // verify the required parameter 'submitCommand' is set + if (submitCommand == null) { + throw new ApiException("Missing the required parameter 'submitCommand' when calling submitCommand(Async)"); + } + + return submitCommandCall(commandId, submitCommand, _callback); + + } + + /** + * Submit the Advance Ship Notice + * Use this resource to submit the Advance Ship Notice. After this operation, updates of the Advance Ship Notice are limited to selected properties only. See <a href=\"../../documentation#operation/updateSubmittedAdvanceShipNotice\">PUT /fulfillment/advance-ship-notices/{id}/submitted</a>. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#zakoncz-edycje-i-wyslij-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#finish-editing-and-submit-the-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param commandId The identifier of the command. (required) + * @param submitCommand (required) + * @return SubmitCommand + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 Returns command output with status and possible errors. The command could fail with following error codes: * ASN_NOT_FOUND - Cannot find ASN with id given in command input. * COMMAND_FORBIDDEN - Requester has no access to run commands on given ASN. * INVALID_ASN_STATE - Such command cannot be run on current ASN state e.g. ASN has no shipping information. * COMMAND_FAILED - Any other error. * location - A location to created command (URI).
401 Unauthorized -
422 Invalid request parameters. -
+ */ + public SubmitCommand submitCommand(@javax.annotation.Nonnull UUID commandId, @javax.annotation.Nonnull SubmitCommand submitCommand) throws ApiException { + ApiResponse localVarResp = submitCommandWithHttpInfo(commandId, submitCommand); + return localVarResp.getData(); + } + + /** + * Submit the Advance Ship Notice + * Use this resource to submit the Advance Ship Notice. After this operation, updates of the Advance Ship Notice are limited to selected properties only. See <a href=\"../../documentation#operation/updateSubmittedAdvanceShipNotice\">PUT /fulfillment/advance-ship-notices/{id}/submitted</a>. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#zakoncz-edycje-i-wyslij-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#finish-editing-and-submit-the-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param commandId The identifier of the command. (required) + * @param submitCommand (required) + * @return ApiResponse<SubmitCommand> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 Returns command output with status and possible errors. The command could fail with following error codes: * ASN_NOT_FOUND - Cannot find ASN with id given in command input. * COMMAND_FORBIDDEN - Requester has no access to run commands on given ASN. * INVALID_ASN_STATE - Such command cannot be run on current ASN state e.g. ASN has no shipping information. * COMMAND_FAILED - Any other error. * location - A location to created command (URI).
401 Unauthorized -
422 Invalid request parameters. -
+ */ + public ApiResponse submitCommandWithHttpInfo(@javax.annotation.Nonnull UUID commandId, @javax.annotation.Nonnull SubmitCommand submitCommand) throws ApiException { + okhttp3.Call localVarCall = submitCommandValidateBeforeCall(commandId, submitCommand, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Submit the Advance Ship Notice (asynchronously) + * Use this resource to submit the Advance Ship Notice. After this operation, updates of the Advance Ship Notice are limited to selected properties only. See <a href=\"../../documentation#operation/updateSubmittedAdvanceShipNotice\">PUT /fulfillment/advance-ship-notices/{id}/submitted</a>. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#zakoncz-edycje-i-wyslij-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#finish-editing-and-submit-the-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param commandId The identifier of the command. (required) + * @param submitCommand (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 Returns command output with status and possible errors. The command could fail with following error codes: * ASN_NOT_FOUND - Cannot find ASN with id given in command input. * COMMAND_FORBIDDEN - Requester has no access to run commands on given ASN. * INVALID_ASN_STATE - Such command cannot be run on current ASN state e.g. ASN has no shipping information. * COMMAND_FAILED - Any other error. * location - A location to created command (URI).
401 Unauthorized -
422 Invalid request parameters. -
+ */ + public okhttp3.Call submitCommandAsync(@javax.annotation.Nonnull UUID commandId, @javax.annotation.Nonnull SubmitCommand submitCommand, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = submitCommandValidateBeforeCall(commandId, submitCommand, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateAdvanceShipNotice + * @param id An identifier of Advance Ship Notice. (required) + * @param ifMatch A current version of Advance Ship Notice (e.g. from etag header obtained via get). (required) + * @param advanceShipNotice (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice updated * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 If-match header missing -
401 Unauthorized -
403 Forbidden -
412 Concurrent modification of ASN -
422 ASN is invalid or attempting to update read-only property -
+ */ + public okhttp3.Call updateAdvanceShipNoticeCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String ifMatch, @javax.annotation.Nonnull AdvanceShipNotice advanceShipNotice, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = advanceShipNotice; + + // create path and map variables + String localVarPath = "/fulfillment/advance-ship-notices/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (ifMatch != null) { + localVarHeaderParams.put("if-match", localVarApiClient.parameterToString(ifMatch)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateAdvanceShipNoticeValidateBeforeCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String ifMatch, @javax.annotation.Nonnull AdvanceShipNotice advanceShipNotice, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling updateAdvanceShipNotice(Async)"); + } + + // verify the required parameter 'ifMatch' is set + if (ifMatch == null) { + throw new ApiException("Missing the required parameter 'ifMatch' when calling updateAdvanceShipNotice(Async)"); + } + + // verify the required parameter 'advanceShipNotice' is set + if (advanceShipNotice == null) { + throw new ApiException("Missing the required parameter 'advanceShipNotice' when calling updateAdvanceShipNotice(Async)"); + } + + return updateAdvanceShipNoticeCall(id, ifMatch, advanceShipNotice, _callback); + + } + + /** + * Update Advance Ship Notice + * Use this resource to update an Advance Ship Notice. Any content property update will clear labels property. Use Create labels command to create new labels for provided content. If a client wants to update read-only property, an error is returned (only in cases when sent value will be different than actual on the server). Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#uzupelnij-dane-o-awizo\" target=\"_blank\">PL</a> / <a href=\"../../one-fulfillment-by-allegro-4R9dXyMPlc9#complete-the-data-of-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of Advance Ship Notice. (required) + * @param ifMatch A current version of Advance Ship Notice (e.g. from etag header obtained via get). (required) + * @param advanceShipNotice (required) + * @return AdvanceShipNoticeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice updated * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 If-match header missing -
401 Unauthorized -
403 Forbidden -
412 Concurrent modification of ASN -
422 ASN is invalid or attempting to update read-only property -
+ */ + public AdvanceShipNoticeResponse updateAdvanceShipNotice(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String ifMatch, @javax.annotation.Nonnull AdvanceShipNotice advanceShipNotice) throws ApiException { + ApiResponse localVarResp = updateAdvanceShipNoticeWithHttpInfo(id, ifMatch, advanceShipNotice); + return localVarResp.getData(); + } + + /** + * Update Advance Ship Notice + * Use this resource to update an Advance Ship Notice. Any content property update will clear labels property. Use Create labels command to create new labels for provided content. If a client wants to update read-only property, an error is returned (only in cases when sent value will be different than actual on the server). Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#uzupelnij-dane-o-awizo\" target=\"_blank\">PL</a> / <a href=\"../../one-fulfillment-by-allegro-4R9dXyMPlc9#complete-the-data-of-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of Advance Ship Notice. (required) + * @param ifMatch A current version of Advance Ship Notice (e.g. from etag header obtained via get). (required) + * @param advanceShipNotice (required) + * @return ApiResponse<AdvanceShipNoticeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice updated * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 If-match header missing -
401 Unauthorized -
403 Forbidden -
412 Concurrent modification of ASN -
422 ASN is invalid or attempting to update read-only property -
+ */ + public ApiResponse updateAdvanceShipNoticeWithHttpInfo(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String ifMatch, @javax.annotation.Nonnull AdvanceShipNotice advanceShipNotice) throws ApiException { + okhttp3.Call localVarCall = updateAdvanceShipNoticeValidateBeforeCall(id, ifMatch, advanceShipNotice, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Advance Ship Notice (asynchronously) + * Use this resource to update an Advance Ship Notice. Any content property update will clear labels property. Use Create labels command to create new labels for provided content. If a client wants to update read-only property, an error is returned (only in cases when sent value will be different than actual on the server). Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#uzupelnij-dane-o-awizo\" target=\"_blank\">PL</a> / <a href=\"../../one-fulfillment-by-allegro-4R9dXyMPlc9#complete-the-data-of-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of Advance Ship Notice. (required) + * @param ifMatch A current version of Advance Ship Notice (e.g. from etag header obtained via get). (required) + * @param advanceShipNotice (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice updated * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 If-match header missing -
401 Unauthorized -
403 Forbidden -
412 Concurrent modification of ASN -
422 ASN is invalid or attempting to update read-only property -
+ */ + public okhttp3.Call updateAdvanceShipNoticeAsync(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String ifMatch, @javax.annotation.Nonnull AdvanceShipNotice advanceShipNotice, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateAdvanceShipNoticeValidateBeforeCall(id, ifMatch, advanceShipNotice, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateSubmittedAdvanceShipNotice + * @param id An identifier of Advance Ship Notice. (required) + * @param ifMatch A current version of Advance Ship Notice (e.g. from etag header obtained via get). (required) + * @param updateSubmittedAdvanceShipNoticeRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice updated * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 If-match header missing -
401 Unauthorized -
403 Forbidden -
412 Concurrent modification of ASN -
422 Validation error -
+ */ + public okhttp3.Call updateSubmittedAdvanceShipNoticeCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String ifMatch, @javax.annotation.Nonnull UpdateSubmittedAdvanceShipNoticeRequest updateSubmittedAdvanceShipNoticeRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateSubmittedAdvanceShipNoticeRequest; + + // create path and map variables + String localVarPath = "/fulfillment/advance-ship-notices/{id}/submitted" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (ifMatch != null) { + localVarHeaderParams.put("if-match", localVarApiClient.parameterToString(ifMatch)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateSubmittedAdvanceShipNoticeValidateBeforeCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String ifMatch, @javax.annotation.Nonnull UpdateSubmittedAdvanceShipNoticeRequest updateSubmittedAdvanceShipNoticeRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling updateSubmittedAdvanceShipNotice(Async)"); + } + + // verify the required parameter 'ifMatch' is set + if (ifMatch == null) { + throw new ApiException("Missing the required parameter 'ifMatch' when calling updateSubmittedAdvanceShipNotice(Async)"); + } + + // verify the required parameter 'updateSubmittedAdvanceShipNoticeRequest' is set + if (updateSubmittedAdvanceShipNoticeRequest == null) { + throw new ApiException("Missing the required parameter 'updateSubmittedAdvanceShipNoticeRequest' when calling updateSubmittedAdvanceShipNotice(Async)"); + } + + return updateSubmittedAdvanceShipNoticeCall(id, ifMatch, updateSubmittedAdvanceShipNoticeRequest, _callback); + + } + + /** + * Update submitted Advance Ship Notice + * Use this resource to update already submitted Advance Ship Notice. Update is allowed only when Advance Ship Notice is in \"IN_TRANSIT\" status. Modifications are limited to: - changing items quantity - removing items - changing handling unit amount - changing shipping courier id, name, tracking numbers or vehicle licence plate or third party delivery details (depending on the selected shipping method in the submitted advance ship notice) Handling unit's amount property update clears labels property. Use Create labels command to create new labels for provided content. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#edytuj-zakonczone-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#edit-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of Advance Ship Notice. (required) + * @param ifMatch A current version of Advance Ship Notice (e.g. from etag header obtained via get). (required) + * @param updateSubmittedAdvanceShipNoticeRequest (required) + * @return AdvanceShipNoticeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice updated * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 If-match header missing -
401 Unauthorized -
403 Forbidden -
412 Concurrent modification of ASN -
422 Validation error -
+ */ + public AdvanceShipNoticeResponse updateSubmittedAdvanceShipNotice(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String ifMatch, @javax.annotation.Nonnull UpdateSubmittedAdvanceShipNoticeRequest updateSubmittedAdvanceShipNoticeRequest) throws ApiException { + ApiResponse localVarResp = updateSubmittedAdvanceShipNoticeWithHttpInfo(id, ifMatch, updateSubmittedAdvanceShipNoticeRequest); + return localVarResp.getData(); + } + + /** + * Update submitted Advance Ship Notice + * Use this resource to update already submitted Advance Ship Notice. Update is allowed only when Advance Ship Notice is in \"IN_TRANSIT\" status. Modifications are limited to: - changing items quantity - removing items - changing handling unit amount - changing shipping courier id, name, tracking numbers or vehicle licence plate or third party delivery details (depending on the selected shipping method in the submitted advance ship notice) Handling unit's amount property update clears labels property. Use Create labels command to create new labels for provided content. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#edytuj-zakonczone-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#edit-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of Advance Ship Notice. (required) + * @param ifMatch A current version of Advance Ship Notice (e.g. from etag header obtained via get). (required) + * @param updateSubmittedAdvanceShipNoticeRequest (required) + * @return ApiResponse<AdvanceShipNoticeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice updated * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 If-match header missing -
401 Unauthorized -
403 Forbidden -
412 Concurrent modification of ASN -
422 Validation error -
+ */ + public ApiResponse updateSubmittedAdvanceShipNoticeWithHttpInfo(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String ifMatch, @javax.annotation.Nonnull UpdateSubmittedAdvanceShipNoticeRequest updateSubmittedAdvanceShipNoticeRequest) throws ApiException { + okhttp3.Call localVarCall = updateSubmittedAdvanceShipNoticeValidateBeforeCall(id, ifMatch, updateSubmittedAdvanceShipNoticeRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update submitted Advance Ship Notice (asynchronously) + * Use this resource to update already submitted Advance Ship Notice. Update is allowed only when Advance Ship Notice is in \"IN_TRANSIT\" status. Modifications are limited to: - changing items quantity - removing items - changing handling unit amount - changing shipping courier id, name, tracking numbers or vehicle licence plate or third party delivery details (depending on the selected shipping method in the submitted advance ship notice) Handling unit's amount property update clears labels property. Use Create labels command to create new labels for provided content. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#edytuj-zakonczone-awizo\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#edit-advance-ship-notice\" target=\"_blank\">EN</a>. + * @param id An identifier of Advance Ship Notice. (required) + * @param ifMatch A current version of Advance Ship Notice (e.g. from etag header obtained via get). (required) + * @param updateSubmittedAdvanceShipNoticeRequest (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Advance Ship Notice updated * etag - A current version of ASN. Use this value in combination with If-Match header to update ASN.
400 If-match header missing -
401 Unauthorized -
403 Forbidden -
412 Concurrent modification of ASN -
422 Validation error -
+ */ + public okhttp3.Call updateSubmittedAdvanceShipNoticeAsync(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String ifMatch, @javax.annotation.Nonnull UpdateSubmittedAdvanceShipNoticeRequest updateSubmittedAdvanceShipNoticeRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateSubmittedAdvanceShipNoticeValidateBeforeCall(id, ifMatch, updateSubmittedAdvanceShipNoticeRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/AfterSaleServicesApi.java b/src/main/java/pl/wtx/allegro/api/client/AfterSaleServicesApi.java new file mode 100644 index 0000000..aed6c8d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/AfterSaleServicesApi.java @@ -0,0 +1,2279 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AfterSalesServicesAttachment; +import pl.wtx.allegro.api.client.model.CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest; +import java.io.File; +import pl.wtx.allegro.api.client.model.ImpliedWarrantiesListImpliedWarrantyBasic; +import pl.wtx.allegro.api.client.model.ImpliedWarrantyRequest; +import pl.wtx.allegro.api.client.model.ImpliedWarrantyResponse; +import pl.wtx.allegro.api.client.model.ReturnPoliciesListReturnPolicy; +import pl.wtx.allegro.api.client.model.ReturnPolicyRequest; +import pl.wtx.allegro.api.client.model.ReturnPolicyResponse; +import pl.wtx.allegro.api.client.model.WarrantiesListWarrantyBasic; +import pl.wtx.allegro.api.client.model.WarrantyRequest; +import pl.wtx.allegro.api.client.model.WarrantyResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AfterSaleServicesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AfterSaleServicesApi() { + this(Configuration.getDefaultApiClient()); + } + + public AfterSaleServicesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createAfterSalesServiceConditionsAttachmentUsingPOST + * @param createAfterSalesServiceConditionsAttachmentUsingPOSTRequest After sale services attachment (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment created successfully. -
400 Syntactically incorrect request. -
401 Invalid or missing bearer token. -
403 Forbidden -
415 Unsupported media type. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call createAfterSalesServiceConditionsAttachmentUsingPOSTCall(@javax.annotation.Nonnull CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest createAfterSalesServiceConditionsAttachmentUsingPOSTRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createAfterSalesServiceConditionsAttachmentUsingPOSTRequest; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/attachments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createAfterSalesServiceConditionsAttachmentUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest createAfterSalesServiceConditionsAttachmentUsingPOSTRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createAfterSalesServiceConditionsAttachmentUsingPOSTRequest' is set + if (createAfterSalesServiceConditionsAttachmentUsingPOSTRequest == null) { + throw new ApiException("Missing the required parameter 'createAfterSalesServiceConditionsAttachmentUsingPOSTRequest' when calling createAfterSalesServiceConditionsAttachmentUsingPOST(Async)"); + } + + return createAfterSalesServiceConditionsAttachmentUsingPOSTCall(createAfterSalesServiceConditionsAttachmentUsingPOSTRequest, _callback); + + } + + /** + * Create a warranty attachment metadata + * You can attach PDF files to warranties. Uploading attachments flow: 1. Create an attachment object to receive an upload URL (*POST /after-sales-service-conditions/attachments*), 2. Use the upload URL to submit the PDF file (*PUT /after-sales-service-conditions/attachments/{attachmentId}*), 3. Create (or update) warranty with attachment (*POST /after-sales-service-conditions/warranties*). Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-zalacznik-do-informacji-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-attachment-to-warranty-information\" target=\"_blank\">EN</a>. + * @param createAfterSalesServiceConditionsAttachmentUsingPOSTRequest After sale services attachment (required) + * @return AfterSalesServicesAttachment + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment created successfully. -
400 Syntactically incorrect request. -
401 Invalid or missing bearer token. -
403 Forbidden -
415 Unsupported media type. -
422 Unprocessable Entity. -
+ */ + public AfterSalesServicesAttachment createAfterSalesServiceConditionsAttachmentUsingPOST(@javax.annotation.Nonnull CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest createAfterSalesServiceConditionsAttachmentUsingPOSTRequest) throws ApiException { + ApiResponse localVarResp = createAfterSalesServiceConditionsAttachmentUsingPOSTWithHttpInfo(createAfterSalesServiceConditionsAttachmentUsingPOSTRequest); + return localVarResp.getData(); + } + + /** + * Create a warranty attachment metadata + * You can attach PDF files to warranties. Uploading attachments flow: 1. Create an attachment object to receive an upload URL (*POST /after-sales-service-conditions/attachments*), 2. Use the upload URL to submit the PDF file (*PUT /after-sales-service-conditions/attachments/{attachmentId}*), 3. Create (or update) warranty with attachment (*POST /after-sales-service-conditions/warranties*). Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-zalacznik-do-informacji-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-attachment-to-warranty-information\" target=\"_blank\">EN</a>. + * @param createAfterSalesServiceConditionsAttachmentUsingPOSTRequest After sale services attachment (required) + * @return ApiResponse<AfterSalesServicesAttachment> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment created successfully. -
400 Syntactically incorrect request. -
401 Invalid or missing bearer token. -
403 Forbidden -
415 Unsupported media type. -
422 Unprocessable Entity. -
+ */ + public ApiResponse createAfterSalesServiceConditionsAttachmentUsingPOSTWithHttpInfo(@javax.annotation.Nonnull CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest createAfterSalesServiceConditionsAttachmentUsingPOSTRequest) throws ApiException { + okhttp3.Call localVarCall = createAfterSalesServiceConditionsAttachmentUsingPOSTValidateBeforeCall(createAfterSalesServiceConditionsAttachmentUsingPOSTRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a warranty attachment metadata (asynchronously) + * You can attach PDF files to warranties. Uploading attachments flow: 1. Create an attachment object to receive an upload URL (*POST /after-sales-service-conditions/attachments*), 2. Use the upload URL to submit the PDF file (*PUT /after-sales-service-conditions/attachments/{attachmentId}*), 3. Create (or update) warranty with attachment (*POST /after-sales-service-conditions/warranties*). Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-zalacznik-do-informacji-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-attachment-to-warranty-information\" target=\"_blank\">EN</a>. + * @param createAfterSalesServiceConditionsAttachmentUsingPOSTRequest After sale services attachment (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment created successfully. -
400 Syntactically incorrect request. -
401 Invalid or missing bearer token. -
403 Forbidden -
415 Unsupported media type. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call createAfterSalesServiceConditionsAttachmentUsingPOSTAsync(@javax.annotation.Nonnull CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest createAfterSalesServiceConditionsAttachmentUsingPOSTRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createAfterSalesServiceConditionsAttachmentUsingPOSTValidateBeforeCall(createAfterSalesServiceConditionsAttachmentUsingPOSTRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createAfterSalesServiceImpliedWarrantyUsingPOST + * @param impliedWarrantyRequest Implied warranty (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createAfterSalesServiceImpliedWarrantyUsingPOSTCall(@javax.annotation.Nonnull ImpliedWarrantyRequest impliedWarrantyRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = impliedWarrantyRequest; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/implied-warranties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createAfterSalesServiceImpliedWarrantyUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull ImpliedWarrantyRequest impliedWarrantyRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'impliedWarrantyRequest' is set + if (impliedWarrantyRequest == null) { + throw new ApiException("Missing the required parameter 'impliedWarrantyRequest' when calling createAfterSalesServiceImpliedWarrantyUsingPOST(Async)"); + } + + return createAfterSalesServiceImpliedWarrantyUsingPOSTCall(impliedWarrantyRequest, _callback); + + } + + /** + * Create new user's implied warranty + * Use this resource to create an implied warranty definition. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-informacje-o-warunkach-reklamacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-implied-warranty-information\" target=\"_blank\">EN</a>. + * @param impliedWarrantyRequest Implied warranty (required) + * @return ImpliedWarrantyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ImpliedWarrantyResponse createAfterSalesServiceImpliedWarrantyUsingPOST(@javax.annotation.Nonnull ImpliedWarrantyRequest impliedWarrantyRequest) throws ApiException { + ApiResponse localVarResp = createAfterSalesServiceImpliedWarrantyUsingPOSTWithHttpInfo(impliedWarrantyRequest); + return localVarResp.getData(); + } + + /** + * Create new user's implied warranty + * Use this resource to create an implied warranty definition. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-informacje-o-warunkach-reklamacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-implied-warranty-information\" target=\"_blank\">EN</a>. + * @param impliedWarrantyRequest Implied warranty (required) + * @return ApiResponse<ImpliedWarrantyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse createAfterSalesServiceImpliedWarrantyUsingPOSTWithHttpInfo(@javax.annotation.Nonnull ImpliedWarrantyRequest impliedWarrantyRequest) throws ApiException { + okhttp3.Call localVarCall = createAfterSalesServiceImpliedWarrantyUsingPOSTValidateBeforeCall(impliedWarrantyRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new user's implied warranty (asynchronously) + * Use this resource to create an implied warranty definition. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-informacje-o-warunkach-reklamacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-implied-warranty-information\" target=\"_blank\">EN</a>. + * @param impliedWarrantyRequest Implied warranty (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createAfterSalesServiceImpliedWarrantyUsingPOSTAsync(@javax.annotation.Nonnull ImpliedWarrantyRequest impliedWarrantyRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createAfterSalesServiceImpliedWarrantyUsingPOSTValidateBeforeCall(impliedWarrantyRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createAfterSalesServiceReturnPolicyUsingPOST + * @param returnPolicyRequest Return Policy (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createAfterSalesServiceReturnPolicyUsingPOSTCall(@javax.annotation.Nonnull ReturnPolicyRequest returnPolicyRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = returnPolicyRequest; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/return-policies"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createAfterSalesServiceReturnPolicyUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull ReturnPolicyRequest returnPolicyRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'returnPolicyRequest' is set + if (returnPolicyRequest == null) { + throw new ApiException("Missing the required parameter 'returnPolicyRequest' when calling createAfterSalesServiceReturnPolicyUsingPOST(Async)"); + } + + return createAfterSalesServiceReturnPolicyUsingPOSTCall(returnPolicyRequest, _callback); + + } + + /** + * Create new user's return policy + * Use this resource to create a return policy definition. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-informacje-o-warunkach-zwrotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-return-policy-information\" target=\"_blank\">EN</a>. + * @param returnPolicyRequest Return Policy (required) + * @return ReturnPolicyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ReturnPolicyResponse createAfterSalesServiceReturnPolicyUsingPOST(@javax.annotation.Nonnull ReturnPolicyRequest returnPolicyRequest) throws ApiException { + ApiResponse localVarResp = createAfterSalesServiceReturnPolicyUsingPOSTWithHttpInfo(returnPolicyRequest); + return localVarResp.getData(); + } + + /** + * Create new user's return policy + * Use this resource to create a return policy definition. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-informacje-o-warunkach-zwrotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-return-policy-information\" target=\"_blank\">EN</a>. + * @param returnPolicyRequest Return Policy (required) + * @return ApiResponse<ReturnPolicyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse createAfterSalesServiceReturnPolicyUsingPOSTWithHttpInfo(@javax.annotation.Nonnull ReturnPolicyRequest returnPolicyRequest) throws ApiException { + okhttp3.Call localVarCall = createAfterSalesServiceReturnPolicyUsingPOSTValidateBeforeCall(returnPolicyRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new user's return policy (asynchronously) + * Use this resource to create a return policy definition. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-informacje-o-warunkach-zwrotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-return-policy-information\" target=\"_blank\">EN</a>. + * @param returnPolicyRequest Return Policy (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createAfterSalesServiceReturnPolicyUsingPOSTAsync(@javax.annotation.Nonnull ReturnPolicyRequest returnPolicyRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createAfterSalesServiceReturnPolicyUsingPOSTValidateBeforeCall(returnPolicyRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createAfterSalesServiceWarrantyUsingPOST + * @param warrantyRequest Warranty (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createAfterSalesServiceWarrantyUsingPOSTCall(@javax.annotation.Nonnull WarrantyRequest warrantyRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = warrantyRequest; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/warranties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createAfterSalesServiceWarrantyUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull WarrantyRequest warrantyRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'warrantyRequest' is set + if (warrantyRequest == null) { + throw new ApiException("Missing the required parameter 'warrantyRequest' when calling createAfterSalesServiceWarrantyUsingPOST(Async)"); + } + + return createAfterSalesServiceWarrantyUsingPOSTCall(warrantyRequest, _callback); + + } + + /** + * Create new user's warranty + * Use this resource to create a warranty definition. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-informacje-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-warranty-information\" target=\"_blank\">EN</a>. + * @param warrantyRequest Warranty (required) + * @return WarrantyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public WarrantyResponse createAfterSalesServiceWarrantyUsingPOST(@javax.annotation.Nonnull WarrantyRequest warrantyRequest) throws ApiException { + ApiResponse localVarResp = createAfterSalesServiceWarrantyUsingPOSTWithHttpInfo(warrantyRequest); + return localVarResp.getData(); + } + + /** + * Create new user's warranty + * Use this resource to create a warranty definition. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-informacje-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-warranty-information\" target=\"_blank\">EN</a>. + * @param warrantyRequest Warranty (required) + * @return ApiResponse<WarrantyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse createAfterSalesServiceWarrantyUsingPOSTWithHttpInfo(@javax.annotation.Nonnull WarrantyRequest warrantyRequest) throws ApiException { + okhttp3.Call localVarCall = createAfterSalesServiceWarrantyUsingPOSTValidateBeforeCall(warrantyRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new user's warranty (asynchronously) + * Use this resource to create a warranty definition. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-informacje-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-warranty-information\" target=\"_blank\">EN</a>. + * @param warrantyRequest Warranty (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createAfterSalesServiceWarrantyUsingPOSTAsync(@javax.annotation.Nonnull WarrantyRequest warrantyRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createAfterSalesServiceWarrantyUsingPOSTValidateBeforeCall(warrantyRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteAfterSalesServiceReturnPolicyUsingDELETE + * @param returnPolicyId The ID of the return policy. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call deleteAfterSalesServiceReturnPolicyUsingDELETECall(@javax.annotation.Nonnull String returnPolicyId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/return-policies/{returnPolicyId}" + .replace("{" + "returnPolicyId" + "}", localVarApiClient.escapeString(returnPolicyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteAfterSalesServiceReturnPolicyUsingDELETEValidateBeforeCall(@javax.annotation.Nonnull String returnPolicyId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'returnPolicyId' is set + if (returnPolicyId == null) { + throw new ApiException("Missing the required parameter 'returnPolicyId' when calling deleteAfterSalesServiceReturnPolicyUsingDELETE(Async)"); + } + + return deleteAfterSalesServiceReturnPolicyUsingDELETECall(returnPolicyId, _callback); + + } + + /** + * Delete the user's return policy + * Use this resource to delete a return policy definition. + * @param returnPolicyId The ID of the return policy. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public void deleteAfterSalesServiceReturnPolicyUsingDELETE(@javax.annotation.Nonnull String returnPolicyId) throws ApiException { + deleteAfterSalesServiceReturnPolicyUsingDELETEWithHttpInfo(returnPolicyId); + } + + /** + * Delete the user's return policy + * Use this resource to delete a return policy definition. + * @param returnPolicyId The ID of the return policy. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse deleteAfterSalesServiceReturnPolicyUsingDELETEWithHttpInfo(@javax.annotation.Nonnull String returnPolicyId) throws ApiException { + okhttp3.Call localVarCall = deleteAfterSalesServiceReturnPolicyUsingDELETEValidateBeforeCall(returnPolicyId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete the user's return policy (asynchronously) + * Use this resource to delete a return policy definition. + * @param returnPolicyId The ID of the return policy. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call deleteAfterSalesServiceReturnPolicyUsingDELETEAsync(@javax.annotation.Nonnull String returnPolicyId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteAfterSalesServiceReturnPolicyUsingDELETEValidateBeforeCall(returnPolicyId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getAfterSalesServiceImpliedWarrantyUsingGET + * @param impliedWarrantyId The ID of the implied warranty. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAfterSalesServiceImpliedWarrantyUsingGETCall(@javax.annotation.Nonnull String impliedWarrantyId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/implied-warranties/{impliedWarrantyId}" + .replace("{" + "impliedWarrantyId" + "}", localVarApiClient.escapeString(impliedWarrantyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAfterSalesServiceImpliedWarrantyUsingGETValidateBeforeCall(@javax.annotation.Nonnull String impliedWarrantyId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'impliedWarrantyId' is set + if (impliedWarrantyId == null) { + throw new ApiException("Missing the required parameter 'impliedWarrantyId' when calling getAfterSalesServiceImpliedWarrantyUsingGET(Async)"); + } + + return getAfterSalesServiceImpliedWarrantyUsingGETCall(impliedWarrantyId, _callback); + + } + + /** + * Get the user's implied warranty + * Use this resource to get an implied warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-reklamacji-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-implied-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param impliedWarrantyId The ID of the implied warranty. (required) + * @return ImpliedWarrantyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ImpliedWarrantyResponse getAfterSalesServiceImpliedWarrantyUsingGET(@javax.annotation.Nonnull String impliedWarrantyId) throws ApiException { + ApiResponse localVarResp = getAfterSalesServiceImpliedWarrantyUsingGETWithHttpInfo(impliedWarrantyId); + return localVarResp.getData(); + } + + /** + * Get the user's implied warranty + * Use this resource to get an implied warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-reklamacji-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-implied-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param impliedWarrantyId The ID of the implied warranty. (required) + * @return ApiResponse<ImpliedWarrantyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getAfterSalesServiceImpliedWarrantyUsingGETWithHttpInfo(@javax.annotation.Nonnull String impliedWarrantyId) throws ApiException { + okhttp3.Call localVarCall = getAfterSalesServiceImpliedWarrantyUsingGETValidateBeforeCall(impliedWarrantyId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's implied warranty (asynchronously) + * Use this resource to get an implied warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-reklamacji-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-implied-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param impliedWarrantyId The ID of the implied warranty. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAfterSalesServiceImpliedWarrantyUsingGETAsync(@javax.annotation.Nonnull String impliedWarrantyId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAfterSalesServiceImpliedWarrantyUsingGETValidateBeforeCall(impliedWarrantyId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAfterSalesServiceReturnPolicyUsingGET + * @param returnPolicyId The ID of the return policy. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAfterSalesServiceReturnPolicyUsingGETCall(@javax.annotation.Nonnull String returnPolicyId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/return-policies/{returnPolicyId}" + .replace("{" + "returnPolicyId" + "}", localVarApiClient.escapeString(returnPolicyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAfterSalesServiceReturnPolicyUsingGETValidateBeforeCall(@javax.annotation.Nonnull String returnPolicyId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'returnPolicyId' is set + if (returnPolicyId == null) { + throw new ApiException("Missing the required parameter 'returnPolicyId' when calling getAfterSalesServiceReturnPolicyUsingGET(Async)"); + } + + return getAfterSalesServiceReturnPolicyUsingGETCall(returnPolicyId, _callback); + + } + + /** + * Get the user's return policy + * Use this resource to get a return policy details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-zwrotow-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-return-policies-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param returnPolicyId The ID of the return policy. (required) + * @return ReturnPolicyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ReturnPolicyResponse getAfterSalesServiceReturnPolicyUsingGET(@javax.annotation.Nonnull String returnPolicyId) throws ApiException { + ApiResponse localVarResp = getAfterSalesServiceReturnPolicyUsingGETWithHttpInfo(returnPolicyId); + return localVarResp.getData(); + } + + /** + * Get the user's return policy + * Use this resource to get a return policy details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-zwrotow-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-return-policies-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param returnPolicyId The ID of the return policy. (required) + * @return ApiResponse<ReturnPolicyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getAfterSalesServiceReturnPolicyUsingGETWithHttpInfo(@javax.annotation.Nonnull String returnPolicyId) throws ApiException { + okhttp3.Call localVarCall = getAfterSalesServiceReturnPolicyUsingGETValidateBeforeCall(returnPolicyId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's return policy (asynchronously) + * Use this resource to get a return policy details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-zwrotow-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-return-policies-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param returnPolicyId The ID of the return policy. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAfterSalesServiceReturnPolicyUsingGETAsync(@javax.annotation.Nonnull String returnPolicyId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAfterSalesServiceReturnPolicyUsingGETValidateBeforeCall(returnPolicyId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAfterSalesServiceWarrantyUsingGET + * @param warrantyId The ID of the warranty. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAfterSalesServiceWarrantyUsingGETCall(@javax.annotation.Nonnull String warrantyId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/warranties/{warrantyId}" + .replace("{" + "warrantyId" + "}", localVarApiClient.escapeString(warrantyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAfterSalesServiceWarrantyUsingGETValidateBeforeCall(@javax.annotation.Nonnull String warrantyId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'warrantyId' is set + if (warrantyId == null) { + throw new ApiException("Missing the required parameter 'warrantyId' when calling getAfterSalesServiceWarrantyUsingGET(Async)"); + } + + return getAfterSalesServiceWarrantyUsingGETCall(warrantyId, _callback); + + } + + /** + * Get the user's warranty + * Use this resource to get a warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-informacje-o-gwarancjach-przypisanych-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param warrantyId The ID of the warranty. (required) + * @return WarrantyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public WarrantyResponse getAfterSalesServiceWarrantyUsingGET(@javax.annotation.Nonnull String warrantyId) throws ApiException { + ApiResponse localVarResp = getAfterSalesServiceWarrantyUsingGETWithHttpInfo(warrantyId); + return localVarResp.getData(); + } + + /** + * Get the user's warranty + * Use this resource to get a warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-informacje-o-gwarancjach-przypisanych-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param warrantyId The ID of the warranty. (required) + * @return ApiResponse<WarrantyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getAfterSalesServiceWarrantyUsingGETWithHttpInfo(@javax.annotation.Nonnull String warrantyId) throws ApiException { + okhttp3.Call localVarCall = getAfterSalesServiceWarrantyUsingGETValidateBeforeCall(warrantyId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's warranty (asynchronously) + * Use this resource to get a warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-informacje-o-gwarancjach-przypisanych-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param warrantyId The ID of the warranty. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAfterSalesServiceWarrantyUsingGETAsync(@javax.annotation.Nonnull String warrantyId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAfterSalesServiceWarrantyUsingGETValidateBeforeCall(warrantyId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPublicSellerListingUsingGET + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getPublicSellerListingUsingGETCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/implied-warranties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPublicSellerListingUsingGETValidateBeforeCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + return getPublicSellerListingUsingGETCall(limit, offset, _callback); + + } + + /** + * Get the user's implied warranties + * Use this resource to get seller implied warranties listing. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-reklamacji-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-implied-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ImpliedWarrantiesListImpliedWarrantyBasic + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ImpliedWarrantiesListImpliedWarrantyBasic getPublicSellerListingUsingGET(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getPublicSellerListingUsingGETWithHttpInfo(limit, offset); + return localVarResp.getData(); + } + + /** + * Get the user's implied warranties + * Use this resource to get seller implied warranties listing. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-reklamacji-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-implied-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ApiResponse<ImpliedWarrantiesListImpliedWarrantyBasic> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getPublicSellerListingUsingGETWithHttpInfo(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getPublicSellerListingUsingGETValidateBeforeCall(limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's implied warranties (asynchronously) + * Use this resource to get seller implied warranties listing. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-reklamacji-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-implied-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getPublicSellerListingUsingGETAsync(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPublicSellerListingUsingGETValidateBeforeCall(limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPublicSellerListingUsingGET1 + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getPublicSellerListingUsingGET1Call(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/return-policies"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPublicSellerListingUsingGET1ValidateBeforeCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + return getPublicSellerListingUsingGET1Call(limit, offset, _callback); + + } + + /** + * Get the user's return policies + * Use this resource to get seller return policies listing. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-zwrotow-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-return-policies-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ReturnPoliciesListReturnPolicy + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ReturnPoliciesListReturnPolicy getPublicSellerListingUsingGET1(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getPublicSellerListingUsingGET1WithHttpInfo(limit, offset); + return localVarResp.getData(); + } + + /** + * Get the user's return policies + * Use this resource to get seller return policies listing. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-zwrotow-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-return-policies-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ApiResponse<ReturnPoliciesListReturnPolicy> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getPublicSellerListingUsingGET1WithHttpInfo(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getPublicSellerListingUsingGET1ValidateBeforeCall(limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's return policies (asynchronously) + * Use this resource to get seller return policies listing. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-warunki-zwrotow-przypisane-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-return-policies-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getPublicSellerListingUsingGET1Async(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPublicSellerListingUsingGET1ValidateBeforeCall(limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPublicSellerListingUsingGET2 + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getPublicSellerListingUsingGET2Call(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/warranties"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPublicSellerListingUsingGET2ValidateBeforeCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + return getPublicSellerListingUsingGET2Call(limit, offset, _callback); + + } + + /** + * Get the user's warranties + * Use this resource to get seller warranties listing. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-informacje-o-gwarancjach-przypisanych-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return WarrantiesListWarrantyBasic + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public WarrantiesListWarrantyBasic getPublicSellerListingUsingGET2(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getPublicSellerListingUsingGET2WithHttpInfo(limit, offset); + return localVarResp.getData(); + } + + /** + * Get the user's warranties + * Use this resource to get seller warranties listing. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-informacje-o-gwarancjach-przypisanych-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ApiResponse<WarrantiesListWarrantyBasic> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getPublicSellerListingUsingGET2WithHttpInfo(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getPublicSellerListingUsingGET2ValidateBeforeCall(limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's warranties (asynchronously) + * Use this resource to get seller warranties listing. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-informacje-o-gwarancjach-przypisanych-do-konta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-warranties-assigned-to-the-account\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 60) + * @param offset The offset of elements in the response. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getPublicSellerListingUsingGET2Async(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPublicSellerListingUsingGET2ValidateBeforeCall(limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateAfterSalesServiceImpliedWarrantyUsingPUT + * @param impliedWarrantyId The ID of the implied warranty. (required) + * @param impliedWarrantyRequest Implied warranty (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateAfterSalesServiceImpliedWarrantyUsingPUTCall(@javax.annotation.Nonnull String impliedWarrantyId, @javax.annotation.Nonnull ImpliedWarrantyRequest impliedWarrantyRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = impliedWarrantyRequest; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/implied-warranties/{impliedWarrantyId}" + .replace("{" + "impliedWarrantyId" + "}", localVarApiClient.escapeString(impliedWarrantyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateAfterSalesServiceImpliedWarrantyUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String impliedWarrantyId, @javax.annotation.Nonnull ImpliedWarrantyRequest impliedWarrantyRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'impliedWarrantyId' is set + if (impliedWarrantyId == null) { + throw new ApiException("Missing the required parameter 'impliedWarrantyId' when calling updateAfterSalesServiceImpliedWarrantyUsingPUT(Async)"); + } + + // verify the required parameter 'impliedWarrantyRequest' is set + if (impliedWarrantyRequest == null) { + throw new ApiException("Missing the required parameter 'impliedWarrantyRequest' when calling updateAfterSalesServiceImpliedWarrantyUsingPUT(Async)"); + } + + return updateAfterSalesServiceImpliedWarrantyUsingPUTCall(impliedWarrantyId, impliedWarrantyRequest, _callback); + + } + + /** + * Change the user's implied warranty + * Use this resource to modify the implied warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-informacje-o-warunkach-reklamacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-implied-warranty-information\" target=\"_blank\">EN</a>. + * @param impliedWarrantyId The ID of the implied warranty. (required) + * @param impliedWarrantyRequest Implied warranty (required) + * @return ImpliedWarrantyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ImpliedWarrantyResponse updateAfterSalesServiceImpliedWarrantyUsingPUT(@javax.annotation.Nonnull String impliedWarrantyId, @javax.annotation.Nonnull ImpliedWarrantyRequest impliedWarrantyRequest) throws ApiException { + ApiResponse localVarResp = updateAfterSalesServiceImpliedWarrantyUsingPUTWithHttpInfo(impliedWarrantyId, impliedWarrantyRequest); + return localVarResp.getData(); + } + + /** + * Change the user's implied warranty + * Use this resource to modify the implied warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-informacje-o-warunkach-reklamacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-implied-warranty-information\" target=\"_blank\">EN</a>. + * @param impliedWarrantyId The ID of the implied warranty. (required) + * @param impliedWarrantyRequest Implied warranty (required) + * @return ApiResponse<ImpliedWarrantyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ApiResponse updateAfterSalesServiceImpliedWarrantyUsingPUTWithHttpInfo(@javax.annotation.Nonnull String impliedWarrantyId, @javax.annotation.Nonnull ImpliedWarrantyRequest impliedWarrantyRequest) throws ApiException { + okhttp3.Call localVarCall = updateAfterSalesServiceImpliedWarrantyUsingPUTValidateBeforeCall(impliedWarrantyId, impliedWarrantyRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Change the user's implied warranty (asynchronously) + * Use this resource to modify the implied warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-informacje-o-warunkach-reklamacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-implied-warranty-information\" target=\"_blank\">EN</a>. + * @param impliedWarrantyId The ID of the implied warranty. (required) + * @param impliedWarrantyRequest Implied warranty (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateAfterSalesServiceImpliedWarrantyUsingPUTAsync(@javax.annotation.Nonnull String impliedWarrantyId, @javax.annotation.Nonnull ImpliedWarrantyRequest impliedWarrantyRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateAfterSalesServiceImpliedWarrantyUsingPUTValidateBeforeCall(impliedWarrantyId, impliedWarrantyRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateAfterSalesServiceReturnPolicyUsingPUT + * @param returnPolicyId The ID of the return policy. (required) + * @param returnPolicyRequest Return Policy (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateAfterSalesServiceReturnPolicyUsingPUTCall(@javax.annotation.Nonnull String returnPolicyId, @javax.annotation.Nonnull ReturnPolicyRequest returnPolicyRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = returnPolicyRequest; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/return-policies/{returnPolicyId}" + .replace("{" + "returnPolicyId" + "}", localVarApiClient.escapeString(returnPolicyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateAfterSalesServiceReturnPolicyUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String returnPolicyId, @javax.annotation.Nonnull ReturnPolicyRequest returnPolicyRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'returnPolicyId' is set + if (returnPolicyId == null) { + throw new ApiException("Missing the required parameter 'returnPolicyId' when calling updateAfterSalesServiceReturnPolicyUsingPUT(Async)"); + } + + // verify the required parameter 'returnPolicyRequest' is set + if (returnPolicyRequest == null) { + throw new ApiException("Missing the required parameter 'returnPolicyRequest' when calling updateAfterSalesServiceReturnPolicyUsingPUT(Async)"); + } + + return updateAfterSalesServiceReturnPolicyUsingPUTCall(returnPolicyId, returnPolicyRequest, _callback); + + } + + /** + * Change the user's return policy + * Use this resource to modify the return policy details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-informacje-o-warunkach-zwrotu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-return-policy-information\" target=\"_blank\">EN</a>. + * @param returnPolicyId The ID of the return policy. (required) + * @param returnPolicyRequest Return Policy (required) + * @return ReturnPolicyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ReturnPolicyResponse updateAfterSalesServiceReturnPolicyUsingPUT(@javax.annotation.Nonnull String returnPolicyId, @javax.annotation.Nonnull ReturnPolicyRequest returnPolicyRequest) throws ApiException { + ApiResponse localVarResp = updateAfterSalesServiceReturnPolicyUsingPUTWithHttpInfo(returnPolicyId, returnPolicyRequest); + return localVarResp.getData(); + } + + /** + * Change the user's return policy + * Use this resource to modify the return policy details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-informacje-o-warunkach-zwrotu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-return-policy-information\" target=\"_blank\">EN</a>. + * @param returnPolicyId The ID of the return policy. (required) + * @param returnPolicyRequest Return Policy (required) + * @return ApiResponse<ReturnPolicyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ApiResponse updateAfterSalesServiceReturnPolicyUsingPUTWithHttpInfo(@javax.annotation.Nonnull String returnPolicyId, @javax.annotation.Nonnull ReturnPolicyRequest returnPolicyRequest) throws ApiException { + okhttp3.Call localVarCall = updateAfterSalesServiceReturnPolicyUsingPUTValidateBeforeCall(returnPolicyId, returnPolicyRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Change the user's return policy (asynchronously) + * Use this resource to modify the return policy details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-informacje-o-warunkach-zwrotu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-return-policy-information\" target=\"_blank\">EN</a>. + * @param returnPolicyId The ID of the return policy. (required) + * @param returnPolicyRequest Return Policy (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateAfterSalesServiceReturnPolicyUsingPUTAsync(@javax.annotation.Nonnull String returnPolicyId, @javax.annotation.Nonnull ReturnPolicyRequest returnPolicyRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateAfterSalesServiceReturnPolicyUsingPUTValidateBeforeCall(returnPolicyId, returnPolicyRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateAfterSalesServiceWarrantyUsingPUT + * @param warrantyId The ID of the warranty. (required) + * @param warrantyRequest Warranty (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateAfterSalesServiceWarrantyUsingPUTCall(@javax.annotation.Nonnull String warrantyId, @javax.annotation.Nonnull WarrantyRequest warrantyRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = warrantyRequest; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/warranties/{warrantyId}" + .replace("{" + "warrantyId" + "}", localVarApiClient.escapeString(warrantyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateAfterSalesServiceWarrantyUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String warrantyId, @javax.annotation.Nonnull WarrantyRequest warrantyRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'warrantyId' is set + if (warrantyId == null) { + throw new ApiException("Missing the required parameter 'warrantyId' when calling updateAfterSalesServiceWarrantyUsingPUT(Async)"); + } + + // verify the required parameter 'warrantyRequest' is set + if (warrantyRequest == null) { + throw new ApiException("Missing the required parameter 'warrantyRequest' when calling updateAfterSalesServiceWarrantyUsingPUT(Async)"); + } + + return updateAfterSalesServiceWarrantyUsingPUTCall(warrantyId, warrantyRequest, _callback); + + } + + /** + * Change the user's warranty + * Use this resource to modify the warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-informacje-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-warranty-information\" target=\"_blank\">EN</a>. + * @param warrantyId The ID of the warranty. (required) + * @param warrantyRequest Warranty (required) + * @return WarrantyResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public WarrantyResponse updateAfterSalesServiceWarrantyUsingPUT(@javax.annotation.Nonnull String warrantyId, @javax.annotation.Nonnull WarrantyRequest warrantyRequest) throws ApiException { + ApiResponse localVarResp = updateAfterSalesServiceWarrantyUsingPUTWithHttpInfo(warrantyId, warrantyRequest); + return localVarResp.getData(); + } + + /** + * Change the user's warranty + * Use this resource to modify the warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-informacje-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-warranty-information\" target=\"_blank\">EN</a>. + * @param warrantyId The ID of the warranty. (required) + * @param warrantyRequest Warranty (required) + * @return ApiResponse<WarrantyResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ApiResponse updateAfterSalesServiceWarrantyUsingPUTWithHttpInfo(@javax.annotation.Nonnull String warrantyId, @javax.annotation.Nonnull WarrantyRequest warrantyRequest) throws ApiException { + okhttp3.Call localVarCall = updateAfterSalesServiceWarrantyUsingPUTValidateBeforeCall(warrantyId, warrantyRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Change the user's warranty (asynchronously) + * Use this resource to modify the warranty details. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-informacje-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-update-warranty-information\" target=\"_blank\">EN</a>. + * @param warrantyId The ID of the warranty. (required) + * @param warrantyRequest Warranty (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateAfterSalesServiceWarrantyUsingPUTAsync(@javax.annotation.Nonnull String warrantyId, @javax.annotation.Nonnull WarrantyRequest warrantyRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateAfterSalesServiceWarrantyUsingPUTValidateBeforeCall(warrantyId, warrantyRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadAfterSalesServiceConditionsAttachmentUsingPUT + * @param attachmentId The ID of the attachment. (required) + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly. -
400 Syntactically incorrect request. -
401 Invalid or missing bearer token. -
403 Forbidden -
404 Not found. -
413 Payload too large. -
422 Invalid file content. -
+ */ + public okhttp3.Call uploadAfterSalesServiceConditionsAttachmentUsingPUTCall(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://upload.{environment}" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/after-sales-service-conditions/attachments/{attachmentId}" + .replace("{" + "attachmentId" + "}", localVarApiClient.escapeString(attachmentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/pdf" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadAfterSalesServiceConditionsAttachmentUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'attachmentId' is set + if (attachmentId == null) { + throw new ApiException("Missing the required parameter 'attachmentId' when calling uploadAfterSalesServiceConditionsAttachmentUsingPUT(Async)"); + } + + return uploadAfterSalesServiceConditionsAttachmentUsingPUTCall(attachmentId, body, _callback); + + } + + /** + * Upload an warranty attachment + * Upload an after sale services attachment. This operation should be used after creating an offer attachment with *POST /sale/offer-attachments* **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /after-sales-service-conditions/attachments*. The URL is unique and one-time. As its format may change in time, you should always use the address from the header. Do not compose the address on your own. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-zalacznik-do-informacji-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-attachment-to-warranty-information\" target=\"_blank\">EN</a>. + * @param attachmentId The ID of the attachment. (required) + * @param body (optional) + * @return AfterSalesServicesAttachment + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly. -
400 Syntactically incorrect request. -
401 Invalid or missing bearer token. -
403 Forbidden -
404 Not found. -
413 Payload too large. -
422 Invalid file content. -
+ */ + public AfterSalesServicesAttachment uploadAfterSalesServiceConditionsAttachmentUsingPUT(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nullable File body) throws ApiException { + ApiResponse localVarResp = uploadAfterSalesServiceConditionsAttachmentUsingPUTWithHttpInfo(attachmentId, body); + return localVarResp.getData(); + } + + /** + * Upload an warranty attachment + * Upload an after sale services attachment. This operation should be used after creating an offer attachment with *POST /sale/offer-attachments* **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /after-sales-service-conditions/attachments*. The URL is unique and one-time. As its format may change in time, you should always use the address from the header. Do not compose the address on your own. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-zalacznik-do-informacji-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-attachment-to-warranty-information\" target=\"_blank\">EN</a>. + * @param attachmentId The ID of the attachment. (required) + * @param body (optional) + * @return ApiResponse<AfterSalesServicesAttachment> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly. -
400 Syntactically incorrect request. -
401 Invalid or missing bearer token. -
403 Forbidden -
404 Not found. -
413 Payload too large. -
422 Invalid file content. -
+ */ + public ApiResponse uploadAfterSalesServiceConditionsAttachmentUsingPUTWithHttpInfo(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nullable File body) throws ApiException { + okhttp3.Call localVarCall = uploadAfterSalesServiceConditionsAttachmentUsingPUTValidateBeforeCall(attachmentId, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upload an warranty attachment (asynchronously) + * Upload an after sale services attachment. This operation should be used after creating an offer attachment with *POST /sale/offer-attachments* **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /after-sales-service-conditions/attachments*. The URL is unique and one-time. As its format may change in time, you should always use the address from the header. Do not compose the address on your own. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-zalacznik-do-informacji-o-gwarancjach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-attachment-to-warranty-information\" target=\"_blank\">EN</a>. + * @param attachmentId The ID of the attachment. (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly. -
400 Syntactically incorrect request. -
401 Invalid or missing bearer token. -
403 Forbidden -
404 Not found. -
413 Payload too large. -
422 Invalid file content. -
+ */ + public okhttp3.Call uploadAfterSalesServiceConditionsAttachmentUsingPUTAsync(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadAfterSalesServiceConditionsAttachmentUsingPUTValidateBeforeCall(attachmentId, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/AlleDiscountApi.java b/src/main/java/pl/wtx/allegro/api/client/AlleDiscountApi.java new file mode 100644 index 0000000..7389277 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/AlleDiscountApi.java @@ -0,0 +1,1119 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AlleDiscountGetSubmitCommandResponse; +import pl.wtx.allegro.api.client.model.AlleDiscountGetWithdrawCommandResponse; +import pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponse; +import pl.wtx.allegro.api.client.model.AlleDiscountListEligibleResponse; +import pl.wtx.allegro.api.client.model.AlleDiscountListSubmittedResponse; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandRequest; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponse; +import pl.wtx.allegro.api.client.model.AlleDiscountWithdrawCommandRequest; +import pl.wtx.allegro.api.client.model.AlleDiscountWithdrawCommandResponse; +import pl.wtx.allegro.api.client.model.ErrorsHolder; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AlleDiscountApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AlleDiscountApi() { + this(Configuration.getDefaultApiClient()); + } + + public AlleDiscountApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getAlleDiscountCampaigns + * @param campaignId Id of the searched campaign. If present, returns at most one entry. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists current AlleDiscount campaigns. -
404 Not Found. -
400 Bad Request. -
401 Unauthorized. -
+ */ + public okhttp3.Call getAlleDiscountCampaignsCall(@javax.annotation.Nullable String campaignId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/alle-discount/campaigns"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (campaignId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("campaignId", campaignId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAlleDiscountCampaignsValidateBeforeCall(@javax.annotation.Nullable String campaignId, final ApiCallback _callback) throws ApiException { + return getAlleDiscountCampaignsCall(campaignId, _callback); + + } + + /** + * List AlleDiscount campaigns + * List current AlleDiscount campaigns. Each campaign has its own list of goods (products) that indicate which offers can be submitted to it. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-dostepnych-kampanii-alleobnizka\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-available-allediscount-campaigns\" target=\"_blank\">EN</a>. + * @param campaignId Id of the searched campaign. If present, returns at most one entry. (optional) + * @return AlleDiscountListCampaignsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists current AlleDiscount campaigns. -
404 Not Found. -
400 Bad Request. -
401 Unauthorized. -
+ */ + public AlleDiscountListCampaignsResponse getAlleDiscountCampaigns(@javax.annotation.Nullable String campaignId) throws ApiException { + ApiResponse localVarResp = getAlleDiscountCampaignsWithHttpInfo(campaignId); + return localVarResp.getData(); + } + + /** + * List AlleDiscount campaigns + * List current AlleDiscount campaigns. Each campaign has its own list of goods (products) that indicate which offers can be submitted to it. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-dostepnych-kampanii-alleobnizka\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-available-allediscount-campaigns\" target=\"_blank\">EN</a>. + * @param campaignId Id of the searched campaign. If present, returns at most one entry. (optional) + * @return ApiResponse<AlleDiscountListCampaignsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists current AlleDiscount campaigns. -
404 Not Found. -
400 Bad Request. -
401 Unauthorized. -
+ */ + public ApiResponse getAlleDiscountCampaignsWithHttpInfo(@javax.annotation.Nullable String campaignId) throws ApiException { + okhttp3.Call localVarCall = getAlleDiscountCampaignsValidateBeforeCall(campaignId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List AlleDiscount campaigns (asynchronously) + * List current AlleDiscount campaigns. Each campaign has its own list of goods (products) that indicate which offers can be submitted to it. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-dostepnych-kampanii-alleobnizka\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-available-allediscount-campaigns\" target=\"_blank\">EN</a>. + * @param campaignId Id of the searched campaign. If present, returns at most one entry. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists current AlleDiscount campaigns. -
404 Not Found. -
400 Bad Request. -
401 Unauthorized. -
+ */ + public okhttp3.Call getAlleDiscountCampaignsAsync(@javax.annotation.Nullable String campaignId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAlleDiscountCampaignsValidateBeforeCall(campaignId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOffersEligibleForAlleDiscount + * @param campaignId Campaign id to list offers from. (required) + * @param limit Maximum number of offers returned in the eligibleOffers list; max value is 200. (optional) + * @param offset The number of offers to skip while listing the results. (optional) + * @param meetsConditions If true, filters offers that only meet conditions of the campaign. (optional) + * @param offerId ID of an offer; if the offer with the given ID exists, returns at most one element in the eligibleOffers list. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists offers eligible for submission. -
400 Bad Request. Example error codes: - OffsetNegative - LimitBelowMin - LimitAboveMax - OfferIdInvalidFormat -
401 Unauthorized. -
403 Forbidden. Access to the AlleDiscount campaign may have been restricted, check user message. -
404 Not Found. Check provided AlleDiscount campaign id. -
+ */ + public okhttp3.Call getOffersEligibleForAlleDiscountCall(@javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Boolean meetsConditions, @javax.annotation.Nullable String offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/alle-discount/{campaignId}/eligible-offers" + .replace("{" + "campaignId" + "}", localVarApiClient.escapeString(campaignId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (meetsConditions != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("meetsConditions", meetsConditions)); + } + + if (offerId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offerId", offerId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOffersEligibleForAlleDiscountValidateBeforeCall(@javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Boolean meetsConditions, @javax.annotation.Nullable String offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'campaignId' is set + if (campaignId == null) { + throw new ApiException("Missing the required parameter 'campaignId' when calling getOffersEligibleForAlleDiscount(Async)"); + } + + return getOffersEligibleForAlleDiscountCall(campaignId, limit, offset, meetsConditions, offerId, _callback); + + } + + /** + * List eligible offers + * Endpoint returning info about offers that can be submitted to a given AlleDiscount campaign. Only offer linked to the product in published list of goods (products) can be submitted to a given AlleDiscount campaign. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-ofert-kwalifikujacych-sie-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-offers-eligible-for-the-selected-campaign\" target=\"_blank\">EN</a>. + * @param campaignId Campaign id to list offers from. (required) + * @param limit Maximum number of offers returned in the eligibleOffers list; max value is 200. (optional) + * @param offset The number of offers to skip while listing the results. (optional) + * @param meetsConditions If true, filters offers that only meet conditions of the campaign. (optional) + * @param offerId ID of an offer; if the offer with the given ID exists, returns at most one element in the eligibleOffers list. (optional) + * @return AlleDiscountListEligibleResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists offers eligible for submission. -
400 Bad Request. Example error codes: - OffsetNegative - LimitBelowMin - LimitAboveMax - OfferIdInvalidFormat -
401 Unauthorized. -
403 Forbidden. Access to the AlleDiscount campaign may have been restricted, check user message. -
404 Not Found. Check provided AlleDiscount campaign id. -
+ */ + public AlleDiscountListEligibleResponse getOffersEligibleForAlleDiscount(@javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Boolean meetsConditions, @javax.annotation.Nullable String offerId) throws ApiException { + ApiResponse localVarResp = getOffersEligibleForAlleDiscountWithHttpInfo(campaignId, limit, offset, meetsConditions, offerId); + return localVarResp.getData(); + } + + /** + * List eligible offers + * Endpoint returning info about offers that can be submitted to a given AlleDiscount campaign. Only offer linked to the product in published list of goods (products) can be submitted to a given AlleDiscount campaign. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-ofert-kwalifikujacych-sie-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-offers-eligible-for-the-selected-campaign\" target=\"_blank\">EN</a>. + * @param campaignId Campaign id to list offers from. (required) + * @param limit Maximum number of offers returned in the eligibleOffers list; max value is 200. (optional) + * @param offset The number of offers to skip while listing the results. (optional) + * @param meetsConditions If true, filters offers that only meet conditions of the campaign. (optional) + * @param offerId ID of an offer; if the offer with the given ID exists, returns at most one element in the eligibleOffers list. (optional) + * @return ApiResponse<AlleDiscountListEligibleResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists offers eligible for submission. -
400 Bad Request. Example error codes: - OffsetNegative - LimitBelowMin - LimitAboveMax - OfferIdInvalidFormat -
401 Unauthorized. -
403 Forbidden. Access to the AlleDiscount campaign may have been restricted, check user message. -
404 Not Found. Check provided AlleDiscount campaign id. -
+ */ + public ApiResponse getOffersEligibleForAlleDiscountWithHttpInfo(@javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Boolean meetsConditions, @javax.annotation.Nullable String offerId) throws ApiException { + okhttp3.Call localVarCall = getOffersEligibleForAlleDiscountValidateBeforeCall(campaignId, limit, offset, meetsConditions, offerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List eligible offers (asynchronously) + * Endpoint returning info about offers that can be submitted to a given AlleDiscount campaign. Only offer linked to the product in published list of goods (products) can be submitted to a given AlleDiscount campaign. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-ofert-kwalifikujacych-sie-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-offers-eligible-for-the-selected-campaign\" target=\"_blank\">EN</a>. + * @param campaignId Campaign id to list offers from. (required) + * @param limit Maximum number of offers returned in the eligibleOffers list; max value is 200. (optional) + * @param offset The number of offers to skip while listing the results. (optional) + * @param meetsConditions If true, filters offers that only meet conditions of the campaign. (optional) + * @param offerId ID of an offer; if the offer with the given ID exists, returns at most one element in the eligibleOffers list. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists offers eligible for submission. -
400 Bad Request. Example error codes: - OffsetNegative - LimitBelowMin - LimitAboveMax - OfferIdInvalidFormat -
401 Unauthorized. -
403 Forbidden. Access to the AlleDiscount campaign may have been restricted, check user message. -
404 Not Found. Check provided AlleDiscount campaign id. -
+ */ + public okhttp3.Call getOffersEligibleForAlleDiscountAsync(@javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Boolean meetsConditions, @javax.annotation.Nullable String offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOffersEligibleForAlleDiscountValidateBeforeCall(campaignId, limit, offset, meetsConditions, offerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOffersSubmittedToAlleDiscount + * @param campaignId Campaign id to list offers from. (required) + * @param limit Maximum number of offers returned in the eligibleOffers list; max value is 200. (optional) + * @param offset The number of offers to skip while listing the results. (optional) + * @param offerId ID of an offer; if the offer with the given ID exists, returns at most one element in the submittedOffers list. (optional) + * @param participationId Id of the participation, returns at most one element in the submittedOffers list. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists offer participations. -
400 Bad Request. -
401 Unauthorized. -
403 Forbidden. Access to the AlleDiscount campaign may have been restricted, check user message. -
404 Not Found. Check provided AlleDiscount campaign id. -
+ */ + public okhttp3.Call getOffersSubmittedToAlleDiscountCall(@javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable String participationId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/alle-discount/{campaignId}/submitted-offers" + .replace("{" + "campaignId" + "}", localVarApiClient.escapeString(campaignId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (offerId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offerId", offerId)); + } + + if (participationId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("participationId", participationId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOffersSubmittedToAlleDiscountValidateBeforeCall(@javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable String participationId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'campaignId' is set + if (campaignId == null) { + throw new ApiException("Missing the required parameter 'campaignId' when calling getOffersSubmittedToAlleDiscount(Async)"); + } + + return getOffersSubmittedToAlleDiscountCall(campaignId, limit, offset, offerId, participationId, _callback); + + } + + /** + * List offer participations + * Endpoint returning info about offer participations for a given AlleDiscount campaign. With this endpoint you are able to validate if the offer participates in AlleDiscount and if it has lowered price on the platform. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-ofert-zgloszonych-do-wybranej-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-offers-submitted-for-the-selected-campaign\" target=\"_blank\">EN</a>. + * @param campaignId Campaign id to list offers from. (required) + * @param limit Maximum number of offers returned in the eligibleOffers list; max value is 200. (optional) + * @param offset The number of offers to skip while listing the results. (optional) + * @param offerId ID of an offer; if the offer with the given ID exists, returns at most one element in the submittedOffers list. (optional) + * @param participationId Id of the participation, returns at most one element in the submittedOffers list. (optional) + * @return AlleDiscountListSubmittedResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists offer participations. -
400 Bad Request. -
401 Unauthorized. -
403 Forbidden. Access to the AlleDiscount campaign may have been restricted, check user message. -
404 Not Found. Check provided AlleDiscount campaign id. -
+ */ + public AlleDiscountListSubmittedResponse getOffersSubmittedToAlleDiscount(@javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable String participationId) throws ApiException { + ApiResponse localVarResp = getOffersSubmittedToAlleDiscountWithHttpInfo(campaignId, limit, offset, offerId, participationId); + return localVarResp.getData(); + } + + /** + * List offer participations + * Endpoint returning info about offer participations for a given AlleDiscount campaign. With this endpoint you are able to validate if the offer participates in AlleDiscount and if it has lowered price on the platform. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-ofert-zgloszonych-do-wybranej-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-offers-submitted-for-the-selected-campaign\" target=\"_blank\">EN</a>. + * @param campaignId Campaign id to list offers from. (required) + * @param limit Maximum number of offers returned in the eligibleOffers list; max value is 200. (optional) + * @param offset The number of offers to skip while listing the results. (optional) + * @param offerId ID of an offer; if the offer with the given ID exists, returns at most one element in the submittedOffers list. (optional) + * @param participationId Id of the participation, returns at most one element in the submittedOffers list. (optional) + * @return ApiResponse<AlleDiscountListSubmittedResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists offer participations. -
400 Bad Request. -
401 Unauthorized. -
403 Forbidden. Access to the AlleDiscount campaign may have been restricted, check user message. -
404 Not Found. Check provided AlleDiscount campaign id. -
+ */ + public ApiResponse getOffersSubmittedToAlleDiscountWithHttpInfo(@javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable String participationId) throws ApiException { + okhttp3.Call localVarCall = getOffersSubmittedToAlleDiscountValidateBeforeCall(campaignId, limit, offset, offerId, participationId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List offer participations (asynchronously) + * Endpoint returning info about offer participations for a given AlleDiscount campaign. With this endpoint you are able to validate if the offer participates in AlleDiscount and if it has lowered price on the platform. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-ofert-zgloszonych-do-wybranej-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-offers-submitted-for-the-selected-campaign\" target=\"_blank\">EN</a>. + * @param campaignId Campaign id to list offers from. (required) + * @param limit Maximum number of offers returned in the eligibleOffers list; max value is 200. (optional) + * @param offset The number of offers to skip while listing the results. (optional) + * @param offerId ID of an offer; if the offer with the given ID exists, returns at most one element in the submittedOffers list. (optional) + * @param participationId Id of the participation, returns at most one element in the submittedOffers list. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Lists offer participations. -
400 Bad Request. -
401 Unauthorized. -
403 Forbidden. Access to the AlleDiscount campaign may have been restricted, check user message. -
404 Not Found. Check provided AlleDiscount campaign id. -
+ */ + public okhttp3.Call getOffersSubmittedToAlleDiscountAsync(@javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable String participationId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOffersSubmittedToAlleDiscountValidateBeforeCall(campaignId, limit, offset, offerId, participationId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getSubmitOfferToAlleDiscountCommandsStatus + * @param commandId Command id in UUID format, must be unique. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized. -
404 Not Found. Check provided command id. -
+ */ + public okhttp3.Call getSubmitOfferToAlleDiscountCommandsStatusCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/alle-discount/submit-offer-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSubmitOfferToAlleDiscountCommandsStatusValidateBeforeCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getSubmitOfferToAlleDiscountCommandsStatus(Async)"); + } + + return getSubmitOfferToAlleDiscountCommandsStatusCall(commandId, _callback); + + } + + /** + * Get the offer submission command status + * Use this resource to get information about the submit offer command execution status. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-sprawdzic-status-zgloszenia-oferty-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-check-the-status-of-an-offer-submission-to-a-campaign\" target=\"_blank\">EN</a>. + * @param commandId Command id in UUID format, must be unique. (required) + * @return AlleDiscountGetSubmitCommandResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized. -
404 Not Found. Check provided command id. -
+ */ + public AlleDiscountGetSubmitCommandResponse getSubmitOfferToAlleDiscountCommandsStatus(@javax.annotation.Nonnull String commandId) throws ApiException { + ApiResponse localVarResp = getSubmitOfferToAlleDiscountCommandsStatusWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Get the offer submission command status + * Use this resource to get information about the submit offer command execution status. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-sprawdzic-status-zgloszenia-oferty-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-check-the-status-of-an-offer-submission-to-a-campaign\" target=\"_blank\">EN</a>. + * @param commandId Command id in UUID format, must be unique. (required) + * @return ApiResponse<AlleDiscountGetSubmitCommandResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized. -
404 Not Found. Check provided command id. -
+ */ + public ApiResponse getSubmitOfferToAlleDiscountCommandsStatusWithHttpInfo(@javax.annotation.Nonnull String commandId) throws ApiException { + okhttp3.Call localVarCall = getSubmitOfferToAlleDiscountCommandsStatusValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the offer submission command status (asynchronously) + * Use this resource to get information about the submit offer command execution status. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-sprawdzic-status-zgloszenia-oferty-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-check-the-status-of-an-offer-submission-to-a-campaign\" target=\"_blank\">EN</a>. + * @param commandId Command id in UUID format, must be unique. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized. -
404 Not Found. Check provided command id. -
+ */ + public okhttp3.Call getSubmitOfferToAlleDiscountCommandsStatusAsync(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSubmitOfferToAlleDiscountCommandsStatusValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getWithdrawOfferFromAlleDiscountCommandsStatus + * @param commandId Command id in UUID format, must be unique. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized. -
404 Not Found. Check provided command id. -
+ */ + public okhttp3.Call getWithdrawOfferFromAlleDiscountCommandsStatusCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/alle-discount/withdraw-offer-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getWithdrawOfferFromAlleDiscountCommandsStatusValidateBeforeCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getWithdrawOfferFromAlleDiscountCommandsStatus(Async)"); + } + + return getWithdrawOfferFromAlleDiscountCommandsStatusCall(commandId, _callback); + + } + + /** + * Get the offer withdrawal command status + * Use this resource to get information about the withdrawal command execution status. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-sprawdzic-status-wycofania-oferty-z-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-check-the-withdrawal-status-of-an-offer-from-a-campaign\" target=\"_blank\">EN</a>. + * @param commandId Command id in UUID format, must be unique. (required) + * @return AlleDiscountGetWithdrawCommandResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized. -
404 Not Found. Check provided command id. -
+ */ + public AlleDiscountGetWithdrawCommandResponse getWithdrawOfferFromAlleDiscountCommandsStatus(@javax.annotation.Nonnull String commandId) throws ApiException { + ApiResponse localVarResp = getWithdrawOfferFromAlleDiscountCommandsStatusWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Get the offer withdrawal command status + * Use this resource to get information about the withdrawal command execution status. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-sprawdzic-status-wycofania-oferty-z-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-check-the-withdrawal-status-of-an-offer-from-a-campaign\" target=\"_blank\">EN</a>. + * @param commandId Command id in UUID format, must be unique. (required) + * @return ApiResponse<AlleDiscountGetWithdrawCommandResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized. -
404 Not Found. Check provided command id. -
+ */ + public ApiResponse getWithdrawOfferFromAlleDiscountCommandsStatusWithHttpInfo(@javax.annotation.Nonnull String commandId) throws ApiException { + okhttp3.Call localVarCall = getWithdrawOfferFromAlleDiscountCommandsStatusValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the offer withdrawal command status (asynchronously) + * Use this resource to get information about the withdrawal command execution status. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-sprawdzic-status-wycofania-oferty-z-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-check-the-withdrawal-status-of-an-offer-from-a-campaign\" target=\"_blank\">EN</a>. + * @param commandId Command id in UUID format, must be unique. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns command output with status and possible errors. -
401 Unauthorized. -
404 Not Found. Check provided command id. -
+ */ + public okhttp3.Call getWithdrawOfferFromAlleDiscountCommandsStatusAsync(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getWithdrawOfferFromAlleDiscountCommandsStatusValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for submitOfferToAlleDiscountCommands + * @param alleDiscountSubmitCommandRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command has been created. * location - A location to created command (URI).
400 Bad request. Example error codes: - CommandIdNotValidUuid - ProposedPriceAmountInvalidNumberFormat - ProposedPriceAmountNotPositive - ProposedPriceAmountInvalidDecimalPlaces - ProposedPriceAmountCannotBeNull -
401 Unauthorized. -
409 Provided UUID is already being used. -
+ */ + public okhttp3.Call submitOfferToAlleDiscountCommandsCall(@javax.annotation.Nonnull AlleDiscountSubmitCommandRequest alleDiscountSubmitCommandRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = alleDiscountSubmitCommandRequest; + + // create path and map variables + String localVarPath = "/sale/alle-discount/submit-offer-commands"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call submitOfferToAlleDiscountCommandsValidateBeforeCall(@javax.annotation.Nonnull AlleDiscountSubmitCommandRequest alleDiscountSubmitCommandRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'alleDiscountSubmitCommandRequest' is set + if (alleDiscountSubmitCommandRequest == null) { + throw new ApiException("Missing the required parameter 'alleDiscountSubmitCommandRequest' when calling submitOfferToAlleDiscountCommands(Async)"); + } + + return submitOfferToAlleDiscountCommandsCall(alleDiscountSubmitCommandRequest, _callback); + + } + + /** + * Create submit offer command + * Use this resource to create a command for submitting an offer. Offer will be submitted to the AlleDiscount campaign only if command is processed successfully. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-zglosic-oferte-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-submit-an-offer-to-a-campaign\" target=\"_blank\">EN</a>. + * @param alleDiscountSubmitCommandRequest (required) + * @return AlleDiscountSubmitCommandResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command has been created. * location - A location to created command (URI).
400 Bad request. Example error codes: - CommandIdNotValidUuid - ProposedPriceAmountInvalidNumberFormat - ProposedPriceAmountNotPositive - ProposedPriceAmountInvalidDecimalPlaces - ProposedPriceAmountCannotBeNull -
401 Unauthorized. -
409 Provided UUID is already being used. -
+ */ + public AlleDiscountSubmitCommandResponse submitOfferToAlleDiscountCommands(@javax.annotation.Nonnull AlleDiscountSubmitCommandRequest alleDiscountSubmitCommandRequest) throws ApiException { + ApiResponse localVarResp = submitOfferToAlleDiscountCommandsWithHttpInfo(alleDiscountSubmitCommandRequest); + return localVarResp.getData(); + } + + /** + * Create submit offer command + * Use this resource to create a command for submitting an offer. Offer will be submitted to the AlleDiscount campaign only if command is processed successfully. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-zglosic-oferte-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-submit-an-offer-to-a-campaign\" target=\"_blank\">EN</a>. + * @param alleDiscountSubmitCommandRequest (required) + * @return ApiResponse<AlleDiscountSubmitCommandResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command has been created. * location - A location to created command (URI).
400 Bad request. Example error codes: - CommandIdNotValidUuid - ProposedPriceAmountInvalidNumberFormat - ProposedPriceAmountNotPositive - ProposedPriceAmountInvalidDecimalPlaces - ProposedPriceAmountCannotBeNull -
401 Unauthorized. -
409 Provided UUID is already being used. -
+ */ + public ApiResponse submitOfferToAlleDiscountCommandsWithHttpInfo(@javax.annotation.Nonnull AlleDiscountSubmitCommandRequest alleDiscountSubmitCommandRequest) throws ApiException { + okhttp3.Call localVarCall = submitOfferToAlleDiscountCommandsValidateBeforeCall(alleDiscountSubmitCommandRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create submit offer command (asynchronously) + * Use this resource to create a command for submitting an offer. Offer will be submitted to the AlleDiscount campaign only if command is processed successfully. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-zglosic-oferte-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-submit-an-offer-to-a-campaign\" target=\"_blank\">EN</a>. + * @param alleDiscountSubmitCommandRequest (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command has been created. * location - A location to created command (URI).
400 Bad request. Example error codes: - CommandIdNotValidUuid - ProposedPriceAmountInvalidNumberFormat - ProposedPriceAmountNotPositive - ProposedPriceAmountInvalidDecimalPlaces - ProposedPriceAmountCannotBeNull -
401 Unauthorized. -
409 Provided UUID is already being used. -
+ */ + public okhttp3.Call submitOfferToAlleDiscountCommandsAsync(@javax.annotation.Nonnull AlleDiscountSubmitCommandRequest alleDiscountSubmitCommandRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = submitOfferToAlleDiscountCommandsValidateBeforeCall(alleDiscountSubmitCommandRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for withdrawOfferFromAlleDiscountCommands + * @param alleDiscountWithdrawCommandRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command has been created. * location - A location to created command (URI).
400 Bad request. Example error codes: - CommandIdNotValidUuid - ParticipationIdMustBeUuid - InputParticipationIdFieldMissing - InputParticipationIdDoesNotExist -
401 Unauthorized. -
409 Provided UUID is already being used. -
+ */ + public okhttp3.Call withdrawOfferFromAlleDiscountCommandsCall(@javax.annotation.Nonnull AlleDiscountWithdrawCommandRequest alleDiscountWithdrawCommandRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = alleDiscountWithdrawCommandRequest; + + // create path and map variables + String localVarPath = "/sale/alle-discount/withdraw-offer-commands"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call withdrawOfferFromAlleDiscountCommandsValidateBeforeCall(@javax.annotation.Nonnull AlleDiscountWithdrawCommandRequest alleDiscountWithdrawCommandRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'alleDiscountWithdrawCommandRequest' is set + if (alleDiscountWithdrawCommandRequest == null) { + throw new ApiException("Missing the required parameter 'alleDiscountWithdrawCommandRequest' when calling withdrawOfferFromAlleDiscountCommands(Async)"); + } + + return withdrawOfferFromAlleDiscountCommandsCall(alleDiscountWithdrawCommandRequest, _callback); + + } + + /** + * Create withdraw offer command + * Use this resource to create a command for withdrawing an offer from specific campaign. Offer will be withdrawn from the AlleDiscount campaign only if command is processed successfully. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-wycofac-oferte-z-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-withdraw-an-offer-from-a-campaign\" target=\"_blank\">EN</a>. + * @param alleDiscountWithdrawCommandRequest (required) + * @return AlleDiscountWithdrawCommandResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command has been created. * location - A location to created command (URI).
400 Bad request. Example error codes: - CommandIdNotValidUuid - ParticipationIdMustBeUuid - InputParticipationIdFieldMissing - InputParticipationIdDoesNotExist -
401 Unauthorized. -
409 Provided UUID is already being used. -
+ */ + public AlleDiscountWithdrawCommandResponse withdrawOfferFromAlleDiscountCommands(@javax.annotation.Nonnull AlleDiscountWithdrawCommandRequest alleDiscountWithdrawCommandRequest) throws ApiException { + ApiResponse localVarResp = withdrawOfferFromAlleDiscountCommandsWithHttpInfo(alleDiscountWithdrawCommandRequest); + return localVarResp.getData(); + } + + /** + * Create withdraw offer command + * Use this resource to create a command for withdrawing an offer from specific campaign. Offer will be withdrawn from the AlleDiscount campaign only if command is processed successfully. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-wycofac-oferte-z-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-withdraw-an-offer-from-a-campaign\" target=\"_blank\">EN</a>. + * @param alleDiscountWithdrawCommandRequest (required) + * @return ApiResponse<AlleDiscountWithdrawCommandResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command has been created. * location - A location to created command (URI).
400 Bad request. Example error codes: - CommandIdNotValidUuid - ParticipationIdMustBeUuid - InputParticipationIdFieldMissing - InputParticipationIdDoesNotExist -
401 Unauthorized. -
409 Provided UUID is already being used. -
+ */ + public ApiResponse withdrawOfferFromAlleDiscountCommandsWithHttpInfo(@javax.annotation.Nonnull AlleDiscountWithdrawCommandRequest alleDiscountWithdrawCommandRequest) throws ApiException { + okhttp3.Call localVarCall = withdrawOfferFromAlleDiscountCommandsValidateBeforeCall(alleDiscountWithdrawCommandRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create withdraw offer command (asynchronously) + * Use this resource to create a command for withdrawing an offer from specific campaign. Offer will be withdrawn from the AlleDiscount campaign only if command is processed successfully. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#jak-wycofac-oferte-z-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#how-to-withdraw-an-offer-from-a-campaign\" target=\"_blank\">EN</a>. + * @param alleDiscountWithdrawCommandRequest (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command has been created. * location - A location to created command (URI).
400 Bad request. Example error codes: - CommandIdNotValidUuid - ParticipationIdMustBeUuid - InputParticipationIdFieldMissing - InputParticipationIdDoesNotExist -
401 Unauthorized. -
409 Provided UUID is already being used. -
+ */ + public okhttp3.Call withdrawOfferFromAlleDiscountCommandsAsync(@javax.annotation.Nonnull AlleDiscountWithdrawCommandRequest alleDiscountWithdrawCommandRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = withdrawOfferFromAlleDiscountCommandsValidateBeforeCall(alleDiscountWithdrawCommandRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/AllegroPricesApi.java b/src/main/java/pl/wtx/allegro/api/client/AllegroPricesApi.java new file mode 100644 index 0000000..f49ab2b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/AllegroPricesApi.java @@ -0,0 +1,636 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AllegroPricesAccountChangeRequest; +import pl.wtx.allegro.api.client.model.AllegroPricesAccountConsentChangeResponse; +import pl.wtx.allegro.api.client.model.AllegroPricesEligibilityResponse; +import pl.wtx.allegro.api.client.model.AllegroPricesOfferChangeRequest; +import pl.wtx.allegro.api.client.model.AllegroPricesOfferConsentChangeResponse; +import pl.wtx.allegro.api.client.model.ErrorsHolder; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AllegroPricesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AllegroPricesApi() { + this(Configuration.getDefaultApiClient()); + } + + public AllegroPricesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getAllegroPricesConsentForOffer + * @param offerId The offer ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Consent value returned successfully. -
401 Unauthorized. -
403 Offer does not belong to seller. -
404 Offer not found. -
+ */ + public okhttp3.Call getAllegroPricesConsentForOfferCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/allegro-prices-offer-consents/{offerId}" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAllegroPricesConsentForOfferValidateBeforeCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling getAllegroPricesConsentForOffer(Async)"); + } + + return getAllegroPricesConsentForOfferCall(offerId, _callback); + + } + + /** + * Get the current consents' state for an offer + * Use this resource to get the current Allegro Prices consent value for the offer on each of the available marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @return AllegroPricesOfferConsentChangeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Consent value returned successfully. -
401 Unauthorized. -
403 Offer does not belong to seller. -
404 Offer not found. -
+ */ + public AllegroPricesOfferConsentChangeResponse getAllegroPricesConsentForOffer(@javax.annotation.Nonnull String offerId) throws ApiException { + ApiResponse localVarResp = getAllegroPricesConsentForOfferWithHttpInfo(offerId); + return localVarResp.getData(); + } + + /** + * Get the current consents' state for an offer + * Use this resource to get the current Allegro Prices consent value for the offer on each of the available marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @return ApiResponse<AllegroPricesOfferConsentChangeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Consent value returned successfully. -
401 Unauthorized. -
403 Offer does not belong to seller. -
404 Offer not found. -
+ */ + public ApiResponse getAllegroPricesConsentForOfferWithHttpInfo(@javax.annotation.Nonnull String offerId) throws ApiException { + okhttp3.Call localVarCall = getAllegroPricesConsentForOfferValidateBeforeCall(offerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the current consents' state for an offer (asynchronously) + * Use this resource to get the current Allegro Prices consent value for the offer on each of the available marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @param offerId The offer 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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Consent value returned successfully. -
401 Unauthorized. -
403 Offer does not belong to seller. -
404 Offer not found. -
+ */ + public okhttp3.Call getAllegroPricesConsentForOfferAsync(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAllegroPricesConsentForOfferValidateBeforeCall(offerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAllegroPricesEligibilityForAccount + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices eligibility information for the account returned successfully. -
401 Unauthorized. -
+ */ + public okhttp3.Call getAllegroPricesEligibilityForAccountCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/allegro-prices-account-eligibility"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAllegroPricesEligibilityForAccountValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getAllegroPricesEligibilityForAccountCall(_callback); + + } + + /** + * Get the current eligibility information for the account + * Use this resource to get the current Allegro Prices eligibility information for the account on each of the available marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @return AllegroPricesEligibilityResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices eligibility information for the account returned successfully. -
401 Unauthorized. -
+ */ + public AllegroPricesEligibilityResponse getAllegroPricesEligibilityForAccount() throws ApiException { + ApiResponse localVarResp = getAllegroPricesEligibilityForAccountWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get the current eligibility information for the account + * Use this resource to get the current Allegro Prices eligibility information for the account on each of the available marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @return ApiResponse<AllegroPricesEligibilityResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices eligibility information for the account returned successfully. -
401 Unauthorized. -
+ */ + public ApiResponse getAllegroPricesEligibilityForAccountWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getAllegroPricesEligibilityForAccountValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the current eligibility information for the account (asynchronously) + * Use this resource to get the current Allegro Prices eligibility information for the account on each of the available marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices eligibility information for the account returned successfully. -
401 Unauthorized. -
+ */ + public okhttp3.Call getAllegroPricesEligibilityForAccountAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAllegroPricesEligibilityForAccountValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateAllegroPricesConsentForAccount + * @param allegroPricesAccountChangeRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices consents' state for the account was updated successfully. -
400 Bad request -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateAllegroPricesConsentForAccountCall(@javax.annotation.Nonnull AllegroPricesAccountChangeRequest allegroPricesAccountChangeRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = allegroPricesAccountChangeRequest; + + // create path and map variables + String localVarPath = "/sale/allegro-prices-account-consent"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateAllegroPricesConsentForAccountValidateBeforeCall(@javax.annotation.Nonnull AllegroPricesAccountChangeRequest allegroPricesAccountChangeRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'allegroPricesAccountChangeRequest' is set + if (allegroPricesAccountChangeRequest == null) { + throw new ApiException("Missing the required parameter 'allegroPricesAccountChangeRequest' when calling updateAllegroPricesConsentForAccount(Async)"); + } + + return updateAllegroPricesConsentForAccountCall(allegroPricesAccountChangeRequest, _callback); + + } + + /** + * Update consents for the account + * Use this resource to update the Allegro Prices consent value for the account on chosen marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @param allegroPricesAccountChangeRequest (required) + * @return AllegroPricesAccountConsentChangeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices consents' state for the account was updated successfully. -
400 Bad request -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public AllegroPricesAccountConsentChangeResponse updateAllegroPricesConsentForAccount(@javax.annotation.Nonnull AllegroPricesAccountChangeRequest allegroPricesAccountChangeRequest) throws ApiException { + ApiResponse localVarResp = updateAllegroPricesConsentForAccountWithHttpInfo(allegroPricesAccountChangeRequest); + return localVarResp.getData(); + } + + /** + * Update consents for the account + * Use this resource to update the Allegro Prices consent value for the account on chosen marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @param allegroPricesAccountChangeRequest (required) + * @return ApiResponse<AllegroPricesAccountConsentChangeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices consents' state for the account was updated successfully. -
400 Bad request -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public ApiResponse updateAllegroPricesConsentForAccountWithHttpInfo(@javax.annotation.Nonnull AllegroPricesAccountChangeRequest allegroPricesAccountChangeRequest) throws ApiException { + okhttp3.Call localVarCall = updateAllegroPricesConsentForAccountValidateBeforeCall(allegroPricesAccountChangeRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update consents for the account (asynchronously) + * Use this resource to update the Allegro Prices consent value for the account on chosen marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @param allegroPricesAccountChangeRequest (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices consents' state for the account was updated successfully. -
400 Bad request -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateAllegroPricesConsentForAccountAsync(@javax.annotation.Nonnull AllegroPricesAccountChangeRequest allegroPricesAccountChangeRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateAllegroPricesConsentForAccountValidateBeforeCall(allegroPricesAccountChangeRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateAllegroPricesConsentForOffer + * @param offerId The offer ID. (required) + * @param allegroPricesOfferChangeRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices consents' state for the offer updated successfully. -
400 Bad request. -
401 Unauthorized. -
403 Offer does not belong to seller. -
404 Offer not found. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call updateAllegroPricesConsentForOfferCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull AllegroPricesOfferChangeRequest allegroPricesOfferChangeRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = allegroPricesOfferChangeRequest; + + // create path and map variables + String localVarPath = "/sale/allegro-prices-offer-consents/{offerId}" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateAllegroPricesConsentForOfferValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull AllegroPricesOfferChangeRequest allegroPricesOfferChangeRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling updateAllegroPricesConsentForOffer(Async)"); + } + + // verify the required parameter 'allegroPricesOfferChangeRequest' is set + if (allegroPricesOfferChangeRequest == null) { + throw new ApiException("Missing the required parameter 'allegroPricesOfferChangeRequest' when calling updateAllegroPricesConsentForOffer(Async)"); + } + + return updateAllegroPricesConsentForOfferCall(offerId, allegroPricesOfferChangeRequest, _callback); + + } + + /** + * Update consents for an offer + * Use this resource to update the Allegro Prices consent value for the offer on chosen marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @param allegroPricesOfferChangeRequest (required) + * @return AllegroPricesOfferConsentChangeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices consents' state for the offer updated successfully. -
400 Bad request. -
401 Unauthorized. -
403 Offer does not belong to seller. -
404 Offer not found. -
422 Unprocessable Entity. -
+ */ + public AllegroPricesOfferConsentChangeResponse updateAllegroPricesConsentForOffer(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull AllegroPricesOfferChangeRequest allegroPricesOfferChangeRequest) throws ApiException { + ApiResponse localVarResp = updateAllegroPricesConsentForOfferWithHttpInfo(offerId, allegroPricesOfferChangeRequest); + return localVarResp.getData(); + } + + /** + * Update consents for an offer + * Use this resource to update the Allegro Prices consent value for the offer on chosen marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @param allegroPricesOfferChangeRequest (required) + * @return ApiResponse<AllegroPricesOfferConsentChangeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices consents' state for the offer updated successfully. -
400 Bad request. -
401 Unauthorized. -
403 Offer does not belong to seller. -
404 Offer not found. -
422 Unprocessable Entity. -
+ */ + public ApiResponse updateAllegroPricesConsentForOfferWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull AllegroPricesOfferChangeRequest allegroPricesOfferChangeRequest) throws ApiException { + okhttp3.Call localVarCall = updateAllegroPricesConsentForOfferValidateBeforeCall(offerId, allegroPricesOfferChangeRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update consents for an offer (asynchronously) + * Use this resource to update the Allegro Prices consent value for the offer on chosen marketplaces. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#allegro-ceny-jak-zarzadzac-zgodami-na-uczestnictwo-w-programie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#allegro-prices-how-to-manage-program-participation-consents\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @param allegroPricesOfferChangeRequest (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Allegro Prices consents' state for the offer updated successfully. -
400 Bad request. -
401 Unauthorized. -
403 Offer does not belong to seller. -
404 Offer not found. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call updateAllegroPricesConsentForOfferAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull AllegroPricesOfferChangeRequest allegroPricesOfferChangeRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateAllegroPricesConsentForOfferValidateBeforeCall(offerId, allegroPricesOfferChangeRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/AuctionsAndBiddingApi.java b/src/main/java/pl/wtx/allegro/api/client/AuctionsAndBiddingApi.java new file mode 100644 index 0000000..5bba56f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/AuctionsAndBiddingApi.java @@ -0,0 +1,357 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.BidRequest; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.MyBidResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AuctionsAndBiddingApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AuctionsAndBiddingApi() { + this(Configuration.getDefaultApiClient()); + } + + public AuctionsAndBiddingApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getBid + * @param offerId The offer ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Bid information succesfully found. -
404 Auction not found or user did not bid in the auction. -
+ */ + public okhttp3.Call getBidCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/bidding/offers/{offerId}/bid" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getBidValidateBeforeCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling getBid(Async)"); + } + + return getBidCall(offerId, _callback); + + } + + /** + * Get current user's bid information + * Get current user's bid information. Read more: <a href=\"../../news/nowe-zasoby-zloz-oferte-kupna-w-licytacji-q018m02vDT1\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-place-a-bid-in-an-auction-rjWwEj1e7sG\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @return MyBidResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Bid information succesfully found. -
404 Auction not found or user did not bid in the auction. -
+ */ + public MyBidResponse getBid(@javax.annotation.Nonnull String offerId) throws ApiException { + ApiResponse localVarResp = getBidWithHttpInfo(offerId); + return localVarResp.getData(); + } + + /** + * Get current user's bid information + * Get current user's bid information. Read more: <a href=\"../../news/nowe-zasoby-zloz-oferte-kupna-w-licytacji-q018m02vDT1\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-place-a-bid-in-an-auction-rjWwEj1e7sG\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @return ApiResponse<MyBidResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Bid information succesfully found. -
404 Auction not found or user did not bid in the auction. -
+ */ + public ApiResponse getBidWithHttpInfo(@javax.annotation.Nonnull String offerId) throws ApiException { + okhttp3.Call localVarCall = getBidValidateBeforeCall(offerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get current user's bid information (asynchronously) + * Get current user's bid information. Read more: <a href=\"../../news/nowe-zasoby-zloz-oferte-kupna-w-licytacji-q018m02vDT1\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-place-a-bid-in-an-auction-rjWwEj1e7sG\" target=\"_blank\">EN</a>. + * @param offerId The offer 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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Bid information succesfully found. -
404 Auction not found or user did not bid in the auction. -
+ */ + public okhttp3.Call getBidAsync(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getBidValidateBeforeCall(offerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for placeBid + * @param offerId The offer ID. (required) + * @param bidRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Bid succesfully placed -
400 Bad request. -
401 Unauthorized -
404 Auction not found. -
422 If bidding was not allowed (see message for explanation). -
+ */ + public okhttp3.Call placeBidCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable BidRequest bidRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = bidRequest; + + // create path and map variables + String localVarPath = "/bidding/offers/{offerId}/bid" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call placeBidValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable BidRequest bidRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling placeBid(Async)"); + } + + return placeBidCall(offerId, bidRequest, _callback); + + } + + /** + * Place a bid in an auction + * Place a bid in an auction. Read more: <a href=\"../../news/nowe-zasoby-zloz-oferte-kupna-w-licytacji-q018m02vDT1\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-place-a-bid-in-an-auction-rjWwEj1e7sG\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @param bidRequest (optional) + * @return MyBidResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Bid succesfully placed -
400 Bad request. -
401 Unauthorized -
404 Auction not found. -
422 If bidding was not allowed (see message for explanation). -
+ */ + public MyBidResponse placeBid(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable BidRequest bidRequest) throws ApiException { + ApiResponse localVarResp = placeBidWithHttpInfo(offerId, bidRequest); + return localVarResp.getData(); + } + + /** + * Place a bid in an auction + * Place a bid in an auction. Read more: <a href=\"../../news/nowe-zasoby-zloz-oferte-kupna-w-licytacji-q018m02vDT1\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-place-a-bid-in-an-auction-rjWwEj1e7sG\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @param bidRequest (optional) + * @return ApiResponse<MyBidResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Bid succesfully placed -
400 Bad request. -
401 Unauthorized -
404 Auction not found. -
422 If bidding was not allowed (see message for explanation). -
+ */ + public ApiResponse placeBidWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable BidRequest bidRequest) throws ApiException { + okhttp3.Call localVarCall = placeBidValidateBeforeCall(offerId, bidRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Place a bid in an auction (asynchronously) + * Place a bid in an auction. Read more: <a href=\"../../news/nowe-zasoby-zloz-oferte-kupna-w-licytacji-q018m02vDT1\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-place-a-bid-in-an-auction-rjWwEj1e7sG\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @param bidRequest (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Bid succesfully placed -
400 Bad request. -
401 Unauthorized -
404 Auction not found. -
422 If bidding was not allowed (see message for explanation). -
+ */ + public okhttp3.Call placeBidAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable BidRequest bidRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = placeBidValidateBeforeCall(offerId, bidRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/AutomaticPricingApi.java b/src/main/java/pl/wtx/allegro/api/client/AutomaticPricingApi.java new file mode 100644 index 0000000..f3cac64 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/AutomaticPricingApi.java @@ -0,0 +1,916 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AutomaticPricingRulePostRequest; +import pl.wtx.allegro.api.client.model.AutomaticPricingRulePutRequest; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleResponse; +import pl.wtx.allegro.api.client.model.AutomaticPricingRulesResponse; +import pl.wtx.allegro.api.client.model.OfferRules; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AutomaticPricingApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AutomaticPricingApi() { + this(Configuration.getDefaultApiClient()); + } + + public AutomaticPricingApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createAutomaticPricingRulesUsingPost + * @param automaticPricingRulePostRequest The automatic pricing rule. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The automatic pricing rules created. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - rule with that name already exists for this seller -
+ */ + public okhttp3.Call createAutomaticPricingRulesUsingPostCall(@javax.annotation.Nonnull AutomaticPricingRulePostRequest automaticPricingRulePostRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = automaticPricingRulePostRequest; + + // create path and map variables + String localVarPath = "/sale/price-automation/rules"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createAutomaticPricingRulesUsingPostValidateBeforeCall(@javax.annotation.Nonnull AutomaticPricingRulePostRequest automaticPricingRulePostRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'automaticPricingRulePostRequest' is set + if (automaticPricingRulePostRequest == null) { + throw new ApiException("Missing the required parameter 'automaticPricingRulePostRequest' when calling createAutomaticPricingRulesUsingPost(Async)"); + } + + return createAutomaticPricingRulesUsingPostCall(automaticPricingRulePostRequest, _callback); + + } + + /** + * Post automatic pricing rule + * Use this resource to create automatic pricing rule. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-utworzyc-wlasne-reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-create-own-pricing-rules\" target=\"_blank\">EN</a>. + * @param automaticPricingRulePostRequest The automatic pricing rule. (required) + * @return AutomaticPricingRuleResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The automatic pricing rules created. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - rule with that name already exists for this seller -
+ */ + public AutomaticPricingRuleResponse createAutomaticPricingRulesUsingPost(@javax.annotation.Nonnull AutomaticPricingRulePostRequest automaticPricingRulePostRequest) throws ApiException { + ApiResponse localVarResp = createAutomaticPricingRulesUsingPostWithHttpInfo(automaticPricingRulePostRequest); + return localVarResp.getData(); + } + + /** + * Post automatic pricing rule + * Use this resource to create automatic pricing rule. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-utworzyc-wlasne-reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-create-own-pricing-rules\" target=\"_blank\">EN</a>. + * @param automaticPricingRulePostRequest The automatic pricing rule. (required) + * @return ApiResponse<AutomaticPricingRuleResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The automatic pricing rules created. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - rule with that name already exists for this seller -
+ */ + public ApiResponse createAutomaticPricingRulesUsingPostWithHttpInfo(@javax.annotation.Nonnull AutomaticPricingRulePostRequest automaticPricingRulePostRequest) throws ApiException { + okhttp3.Call localVarCall = createAutomaticPricingRulesUsingPostValidateBeforeCall(automaticPricingRulePostRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Post automatic pricing rule (asynchronously) + * Use this resource to create automatic pricing rule. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-utworzyc-wlasne-reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-create-own-pricing-rules\" target=\"_blank\">EN</a>. + * @param automaticPricingRulePostRequest The automatic pricing rule. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The automatic pricing rules created. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - rule with that name already exists for this seller -
+ */ + public okhttp3.Call createAutomaticPricingRulesUsingPostAsync(@javax.annotation.Nonnull AutomaticPricingRulePostRequest automaticPricingRulePostRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createAutomaticPricingRulesUsingPostValidateBeforeCall(automaticPricingRulePostRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteAutomaticPricingRuleUsingDelete + * @param ruleId The rule identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 The automatic pricing rules deleted. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call deleteAutomaticPricingRuleUsingDeleteCall(@javax.annotation.Nonnull String ruleId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/price-automation/rules/{ruleId}" + .replace("{" + "ruleId" + "}", localVarApiClient.escapeString(ruleId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteAutomaticPricingRuleUsingDeleteValidateBeforeCall(@javax.annotation.Nonnull String ruleId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + throw new ApiException("Missing the required parameter 'ruleId' when calling deleteAutomaticPricingRuleUsingDelete(Async)"); + } + + return deleteAutomaticPricingRuleUsingDeleteCall(ruleId, _callback); + + } + + /** + * Delete automatic pricing rule + * Use this resource to delete automatic pricing rule. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-usunac-regule-cenowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-delete-a-pricing-rule\" target=\"_blank\">EN</a>. + * @param ruleId The rule identifier. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 The automatic pricing rules deleted. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public void deleteAutomaticPricingRuleUsingDelete(@javax.annotation.Nonnull String ruleId) throws ApiException { + deleteAutomaticPricingRuleUsingDeleteWithHttpInfo(ruleId); + } + + /** + * Delete automatic pricing rule + * Use this resource to delete automatic pricing rule. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-usunac-regule-cenowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-delete-a-pricing-rule\" target=\"_blank\">EN</a>. + * @param ruleId The rule identifier. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 The automatic pricing rules deleted. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse deleteAutomaticPricingRuleUsingDeleteWithHttpInfo(@javax.annotation.Nonnull String ruleId) throws ApiException { + okhttp3.Call localVarCall = deleteAutomaticPricingRuleUsingDeleteValidateBeforeCall(ruleId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete automatic pricing rule (asynchronously) + * Use this resource to delete automatic pricing rule. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-usunac-regule-cenowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-delete-a-pricing-rule\" target=\"_blank\">EN</a>. + * @param ruleId The rule identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 The automatic pricing rules deleted. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call deleteAutomaticPricingRuleUsingDeleteAsync(@javax.annotation.Nonnull String ruleId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteAutomaticPricingRuleUsingDeleteValidateBeforeCall(ruleId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getAutomaticPricingRuleByIdUsingGET + * @param ruleId The rule identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The automatic pricing rule returned successfully. -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call getAutomaticPricingRuleByIdUsingGETCall(@javax.annotation.Nonnull String ruleId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/price-automation/rules/{ruleId}" + .replace("{" + "ruleId" + "}", localVarApiClient.escapeString(ruleId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAutomaticPricingRuleByIdUsingGETValidateBeforeCall(@javax.annotation.Nonnull String ruleId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + throw new ApiException("Missing the required parameter 'ruleId' when calling getAutomaticPricingRuleByIdUsingGET(Async)"); + } + + return getAutomaticPricingRuleByIdUsingGETCall(ruleId, _callback); + + } + + /** + * Get automatic pricing rule by id + * Use this resource to get automatic pricing rule by id. Rules with property **default** set to **true** are default rules created by Allegro for each merchant and cannot be modified. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-dostepne-reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-pricing-rules\" target=\"_blank\">EN</a>. + * @param ruleId The rule identifier. (required) + * @return AutomaticPricingRuleResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The automatic pricing rule returned successfully. -
401 Unauthorized -
404 Not Found -
+ */ + public AutomaticPricingRuleResponse getAutomaticPricingRuleByIdUsingGET(@javax.annotation.Nonnull String ruleId) throws ApiException { + ApiResponse localVarResp = getAutomaticPricingRuleByIdUsingGETWithHttpInfo(ruleId); + return localVarResp.getData(); + } + + /** + * Get automatic pricing rule by id + * Use this resource to get automatic pricing rule by id. Rules with property **default** set to **true** are default rules created by Allegro for each merchant and cannot be modified. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-dostepne-reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-pricing-rules\" target=\"_blank\">EN</a>. + * @param ruleId The rule identifier. (required) + * @return ApiResponse<AutomaticPricingRuleResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The automatic pricing rule returned successfully. -
401 Unauthorized -
404 Not Found -
+ */ + public ApiResponse getAutomaticPricingRuleByIdUsingGETWithHttpInfo(@javax.annotation.Nonnull String ruleId) throws ApiException { + okhttp3.Call localVarCall = getAutomaticPricingRuleByIdUsingGETValidateBeforeCall(ruleId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get automatic pricing rule by id (asynchronously) + * Use this resource to get automatic pricing rule by id. Rules with property **default** set to **true** are default rules created by Allegro for each merchant and cannot be modified. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-dostepne-reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-pricing-rules\" target=\"_blank\">EN</a>. + * @param ruleId The rule identifier. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The automatic pricing rule returned successfully. -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call getAutomaticPricingRuleByIdUsingGETAsync(@javax.annotation.Nonnull String ruleId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAutomaticPricingRuleByIdUsingGETValidateBeforeCall(ruleId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAutomaticPricingRulesForOfferUsingGET + * @param offerId The offer identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of automatic pricing rules assigned to offer returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAutomaticPricingRulesForOfferUsingGETCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/price-automation/offers/{offerId}/rules" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAutomaticPricingRulesForOfferUsingGETValidateBeforeCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling getAutomaticPricingRulesForOfferUsingGET(Async)"); + } + + return getAutomaticPricingRulesForOfferUsingGETCall(offerId, _callback); + + } + + /** + * Get automatic pricing rules assigned to the offer + * Use this resource to get automatic pricing rules for offer. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-aktualnie-przypisane-reguly-przelicznika-cen-w-ofercie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-price-automation-rules-currently-assigned-to-offer\" target=\"_blank\">EN</a>. + * @param offerId The offer identifier. (required) + * @return OfferRules + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of automatic pricing rules assigned to offer returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public OfferRules getAutomaticPricingRulesForOfferUsingGET(@javax.annotation.Nonnull String offerId) throws ApiException { + ApiResponse localVarResp = getAutomaticPricingRulesForOfferUsingGETWithHttpInfo(offerId); + return localVarResp.getData(); + } + + /** + * Get automatic pricing rules assigned to the offer + * Use this resource to get automatic pricing rules for offer. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-aktualnie-przypisane-reguly-przelicznika-cen-w-ofercie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-price-automation-rules-currently-assigned-to-offer\" target=\"_blank\">EN</a>. + * @param offerId The offer identifier. (required) + * @return ApiResponse<OfferRules> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of automatic pricing rules assigned to offer returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getAutomaticPricingRulesForOfferUsingGETWithHttpInfo(@javax.annotation.Nonnull String offerId) throws ApiException { + okhttp3.Call localVarCall = getAutomaticPricingRulesForOfferUsingGETValidateBeforeCall(offerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get automatic pricing rules assigned to the offer (asynchronously) + * Use this resource to get automatic pricing rules for offer. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-aktualnie-przypisane-reguly-przelicznika-cen-w-ofercie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-price-automation-rules-currently-assigned-to-offer\" target=\"_blank\">EN</a>. + * @param offerId The offer identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of automatic pricing rules assigned to offer returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAutomaticPricingRulesForOfferUsingGETAsync(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAutomaticPricingRulesForOfferUsingGETValidateBeforeCall(offerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAutomaticPricingRulesUsingGET + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of automatic pricing rules returned successfully. -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getAutomaticPricingRulesUsingGETCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/price-automation/rules"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAutomaticPricingRulesUsingGETValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getAutomaticPricingRulesUsingGETCall(_callback); + + } + + /** + * Get automatic pricing rules + * Use this resource to get automatic pricing rules. Rules with property **default** set to **true** are default rules created by Allegro for each merchant. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-dostepne-reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-pricing-rules\" target=\"_blank\">EN</a>. + * @return AutomaticPricingRulesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of automatic pricing rules returned successfully. -
401 Unauthorized -
403 Forbidden -
+ */ + public AutomaticPricingRulesResponse getAutomaticPricingRulesUsingGET() throws ApiException { + ApiResponse localVarResp = getAutomaticPricingRulesUsingGETWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get automatic pricing rules + * Use this resource to get automatic pricing rules. Rules with property **default** set to **true** are default rules created by Allegro for each merchant. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-dostepne-reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-pricing-rules\" target=\"_blank\">EN</a>. + * @return ApiResponse<AutomaticPricingRulesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of automatic pricing rules returned successfully. -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse getAutomaticPricingRulesUsingGETWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getAutomaticPricingRulesUsingGETValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get automatic pricing rules (asynchronously) + * Use this resource to get automatic pricing rules. Rules with property **default** set to **true** are default rules created by Allegro for each merchant. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-dostepne-reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-pricing-rules\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of automatic pricing rules returned successfully. -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getAutomaticPricingRulesUsingGETAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAutomaticPricingRulesUsingGETValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateAutomaticPricingRuleUsingPut + * @param ruleId The rule identifier. (required) + * @param automaticPricingRulePutRequest The automatic pricing rule. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 The automatic pricing rule updated. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - rule with that name already exists for this seller -
+ */ + public okhttp3.Call updateAutomaticPricingRuleUsingPutCall(@javax.annotation.Nonnull String ruleId, @javax.annotation.Nonnull AutomaticPricingRulePutRequest automaticPricingRulePutRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = automaticPricingRulePutRequest; + + // create path and map variables + String localVarPath = "/sale/price-automation/rules/{ruleId}" + .replace("{" + "ruleId" + "}", localVarApiClient.escapeString(ruleId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateAutomaticPricingRuleUsingPutValidateBeforeCall(@javax.annotation.Nonnull String ruleId, @javax.annotation.Nonnull AutomaticPricingRulePutRequest automaticPricingRulePutRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + throw new ApiException("Missing the required parameter 'ruleId' when calling updateAutomaticPricingRuleUsingPut(Async)"); + } + + // verify the required parameter 'automaticPricingRulePutRequest' is set + if (automaticPricingRulePutRequest == null) { + throw new ApiException("Missing the required parameter 'automaticPricingRulePutRequest' when calling updateAutomaticPricingRuleUsingPut(Async)"); + } + + return updateAutomaticPricingRuleUsingPutCall(ruleId, automaticPricingRulePutRequest, _callback); + + } + + /** + * Edit automatic pricing rule + * Use this resource to update automatic pricing rule. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-regule-cenowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-modify-a-pricing-rule\" target=\"_blank\">EN</a>. + * @param ruleId The rule identifier. (required) + * @param automaticPricingRulePutRequest The automatic pricing rule. (required) + * @return AutomaticPricingRuleResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 The automatic pricing rule updated. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - rule with that name already exists for this seller -
+ */ + public AutomaticPricingRuleResponse updateAutomaticPricingRuleUsingPut(@javax.annotation.Nonnull String ruleId, @javax.annotation.Nonnull AutomaticPricingRulePutRequest automaticPricingRulePutRequest) throws ApiException { + ApiResponse localVarResp = updateAutomaticPricingRuleUsingPutWithHttpInfo(ruleId, automaticPricingRulePutRequest); + return localVarResp.getData(); + } + + /** + * Edit automatic pricing rule + * Use this resource to update automatic pricing rule. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-regule-cenowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-modify-a-pricing-rule\" target=\"_blank\">EN</a>. + * @param ruleId The rule identifier. (required) + * @param automaticPricingRulePutRequest The automatic pricing rule. (required) + * @return ApiResponse<AutomaticPricingRuleResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 The automatic pricing rule updated. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - rule with that name already exists for this seller -
+ */ + public ApiResponse updateAutomaticPricingRuleUsingPutWithHttpInfo(@javax.annotation.Nonnull String ruleId, @javax.annotation.Nonnull AutomaticPricingRulePutRequest automaticPricingRulePutRequest) throws ApiException { + okhttp3.Call localVarCall = updateAutomaticPricingRuleUsingPutValidateBeforeCall(ruleId, automaticPricingRulePutRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Edit automatic pricing rule (asynchronously) + * Use this resource to update automatic pricing rule. This resource is rate limited to 5 requests per second. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-edytowac-regule-cenowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-modify-a-pricing-rule\" target=\"_blank\">EN</a>. + * @param ruleId The rule identifier. (required) + * @param automaticPricingRulePutRequest The automatic pricing rule. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 The automatic pricing rule updated. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - rule with that name already exists for this seller -
+ */ + public okhttp3.Call updateAutomaticPricingRuleUsingPutAsync(@javax.annotation.Nonnull String ruleId, @javax.annotation.Nonnull AutomaticPricingRulePutRequest automaticPricingRulePutRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateAutomaticPricingRuleUsingPutValidateBeforeCall(ruleId, automaticPricingRulePutRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/BadgeCampaignsApi.java b/src/main/java/pl/wtx/allegro/api/client/BadgeCampaignsApi.java new file mode 100644 index 0000000..44e142a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/BadgeCampaignsApi.java @@ -0,0 +1,1125 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.BadgeApplication; +import pl.wtx.allegro.api.client.model.BadgeApplicationRequest; +import pl.wtx.allegro.api.client.model.BadgeApplications; +import pl.wtx.allegro.api.client.model.BadgeOperation; +import pl.wtx.allegro.api.client.model.BadgePatchRequest; +import pl.wtx.allegro.api.client.model.BadgesList; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.GetBadgeCampaignsList; +import pl.wtx.allegro.api.client.model.PatchBadge202Response; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BadgeCampaignsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public BadgeCampaignsApi() { + this(Configuration.getDefaultApiClient()); + } + + public BadgeCampaignsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for badgeApplicationsGetAll + * @param campaignId Campaign ID. (optional) + * @param offerId Offer ID. (optional) + * @param offset Offset. (optional) + * @param limit The maximum number of applications returned in the response. (optional, default to 50) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge applications list. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public okhttp3.Call badgeApplicationsGetAllCall(@javax.annotation.Nullable String campaignId, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/badge-applications"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (campaignId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("campaign.id", campaignId)); + } + + if (offerId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offer.id", offerId)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call badgeApplicationsGetAllValidateBeforeCall(@javax.annotation.Nullable String campaignId, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + return badgeApplicationsGetAllCall(campaignId, offerId, offset, limit, _callback); + + } + + /** + * Get a list of badge applications + * Use this resource to get a list of badge applications. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#pobierz-swoje-zgloszenia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#retrieve-all-campaign-applications\" target=\"_blank\">EN</a>. + * @param campaignId Campaign ID. (optional) + * @param offerId Offer ID. (optional) + * @param offset Offset. (optional) + * @param limit The maximum number of applications returned in the response. (optional, default to 50) + * @return BadgeApplications + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge applications list. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public BadgeApplications badgeApplicationsGetAll(@javax.annotation.Nullable String campaignId, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + ApiResponse localVarResp = badgeApplicationsGetAllWithHttpInfo(campaignId, offerId, offset, limit); + return localVarResp.getData(); + } + + /** + * Get a list of badge applications + * Use this resource to get a list of badge applications. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#pobierz-swoje-zgloszenia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#retrieve-all-campaign-applications\" target=\"_blank\">EN</a>. + * @param campaignId Campaign ID. (optional) + * @param offerId Offer ID. (optional) + * @param offset Offset. (optional) + * @param limit The maximum number of applications returned in the response. (optional, default to 50) + * @return ApiResponse<BadgeApplications> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge applications list. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public ApiResponse badgeApplicationsGetAllWithHttpInfo(@javax.annotation.Nullable String campaignId, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + okhttp3.Call localVarCall = badgeApplicationsGetAllValidateBeforeCall(campaignId, offerId, offset, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of badge applications (asynchronously) + * Use this resource to get a list of badge applications. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#pobierz-swoje-zgloszenia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#retrieve-all-campaign-applications\" target=\"_blank\">EN</a>. + * @param campaignId Campaign ID. (optional) + * @param offerId Offer ID. (optional) + * @param offset Offset. (optional) + * @param limit The maximum number of applications returned in the response. (optional, default to 50) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge applications list. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public okhttp3.Call badgeApplicationsGetAllAsync(@javax.annotation.Nullable String campaignId, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = badgeApplicationsGetAllValidateBeforeCall(campaignId, offerId, offset, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for badgeApplicationsGetOne + * @param applicationId Badge application ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge application. -
401 Unauthorized. -
403 The account is not a Business Account. -
404 Badge application not found. -
+ */ + public okhttp3.Call badgeApplicationsGetOneCall(@javax.annotation.Nonnull String applicationId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/badge-applications/{applicationId}" + .replace("{" + "applicationId" + "}", localVarApiClient.escapeString(applicationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call badgeApplicationsGetOneValidateBeforeCall(@javax.annotation.Nonnull String applicationId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'applicationId' is set + if (applicationId == null) { + throw new ApiException("Missing the required parameter 'applicationId' when calling badgeApplicationsGetOne(Async)"); + } + + return badgeApplicationsGetOneCall(applicationId, _callback); + + } + + /** + * Get a badge application details + * Use this resource to get a badge application details. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#pobierz-dane-zgloszenie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#retrieve-campaign-application\" target=\"_blank\">EN</a>. + * @param applicationId Badge application ID. (required) + * @return BadgeApplication + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge application. -
401 Unauthorized. -
403 The account is not a Business Account. -
404 Badge application not found. -
+ */ + public BadgeApplication badgeApplicationsGetOne(@javax.annotation.Nonnull String applicationId) throws ApiException { + ApiResponse localVarResp = badgeApplicationsGetOneWithHttpInfo(applicationId); + return localVarResp.getData(); + } + + /** + * Get a badge application details + * Use this resource to get a badge application details. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#pobierz-dane-zgloszenie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#retrieve-campaign-application\" target=\"_blank\">EN</a>. + * @param applicationId Badge application ID. (required) + * @return ApiResponse<BadgeApplication> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge application. -
401 Unauthorized. -
403 The account is not a Business Account. -
404 Badge application not found. -
+ */ + public ApiResponse badgeApplicationsGetOneWithHttpInfo(@javax.annotation.Nonnull String applicationId) throws ApiException { + okhttp3.Call localVarCall = badgeApplicationsGetOneValidateBeforeCall(applicationId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a badge application details (asynchronously) + * Use this resource to get a badge application details. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#pobierz-dane-zgloszenie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#retrieve-campaign-application\" target=\"_blank\">EN</a>. + * @param applicationId Badge application 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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge application. -
401 Unauthorized. -
403 The account is not a Business Account. -
404 Badge application not found. -
+ */ + public okhttp3.Call badgeApplicationsGetOneAsync(@javax.annotation.Nonnull String applicationId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = badgeApplicationsGetOneValidateBeforeCall(applicationId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for badgeCampaignsGetAll + * @param marketplaceId The marketplace of campaigns. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of available badge campaigns. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public okhttp3.Call badgeCampaignsGetAllCall(@javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/badge-campaigns"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marketplaceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplace.id", marketplaceId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call badgeCampaignsGetAllValidateBeforeCall(@javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + return badgeCampaignsGetAllCall(marketplaceId, _callback); + + } + + /** + * Get a list of available badge campaigns + * Badge campaigns are another way to promote your offers. You can apply for a badge, which - depending on a type - will be displayed on your offer page of on the list of offers. First - use this resource to get a list of all available badge campaigns at the moment, then use *POST /sale/badges* to apply for badge. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-dostepnych-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-available-campaigns\" target=\"_blank\">EN</a>. + * @param marketplaceId The marketplace of campaigns. (optional) + * @return GetBadgeCampaignsList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of available badge campaigns. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public GetBadgeCampaignsList badgeCampaignsGetAll(@javax.annotation.Nullable String marketplaceId) throws ApiException { + ApiResponse localVarResp = badgeCampaignsGetAllWithHttpInfo(marketplaceId); + return localVarResp.getData(); + } + + /** + * Get a list of available badge campaigns + * Badge campaigns are another way to promote your offers. You can apply for a badge, which - depending on a type - will be displayed on your offer page of on the list of offers. First - use this resource to get a list of all available badge campaigns at the moment, then use *POST /sale/badges* to apply for badge. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-dostepnych-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-available-campaigns\" target=\"_blank\">EN</a>. + * @param marketplaceId The marketplace of campaigns. (optional) + * @return ApiResponse<GetBadgeCampaignsList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of available badge campaigns. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public ApiResponse badgeCampaignsGetAllWithHttpInfo(@javax.annotation.Nullable String marketplaceId) throws ApiException { + okhttp3.Call localVarCall = badgeCampaignsGetAllValidateBeforeCall(marketplaceId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of available badge campaigns (asynchronously) + * Badge campaigns are another way to promote your offers. You can apply for a badge, which - depending on a type - will be displayed on your offer page of on the list of offers. First - use this resource to get a list of all available badge campaigns at the moment, then use *POST /sale/badges* to apply for badge. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#lista-dostepnych-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#list-of-available-campaigns\" target=\"_blank\">EN</a>. + * @param marketplaceId The marketplace of campaigns. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of available badge campaigns. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public okhttp3.Call badgeCampaignsGetAllAsync(@javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = badgeCampaignsGetAllValidateBeforeCall(marketplaceId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for badgeOperationsGetOne + * @param operationId Badge operation ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge operation details. -
401 Unauthorized. -
403 You don't have permission to access this resource. -
404 Badge operation not found. -
+ */ + public okhttp3.Call badgeOperationsGetOneCall(@javax.annotation.Nonnull String operationId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/badge-operations/{operationId}" + .replace("{" + "operationId" + "}", localVarApiClient.escapeString(operationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call badgeOperationsGetOneValidateBeforeCall(@javax.annotation.Nonnull String operationId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'operationId' is set + if (operationId == null) { + throw new ApiException("Missing the required parameter 'operationId' when calling badgeOperationsGetOne(Async)"); + } + + return badgeOperationsGetOneCall(operationId, _callback); + + } + + /** + * Get badge operation details + * Use this resource to get badge operation details. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#zmiana-ceny-i-zakonczenie-oznaczenia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#change-price-and-finish-badge\" target=\"_blank\">EN</a>. + * @param operationId Badge operation ID. (required) + * @return BadgeOperation + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge operation details. -
401 Unauthorized. -
403 You don't have permission to access this resource. -
404 Badge operation not found. -
+ */ + public BadgeOperation badgeOperationsGetOne(@javax.annotation.Nonnull String operationId) throws ApiException { + ApiResponse localVarResp = badgeOperationsGetOneWithHttpInfo(operationId); + return localVarResp.getData(); + } + + /** + * Get badge operation details + * Use this resource to get badge operation details. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#zmiana-ceny-i-zakonczenie-oznaczenia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#change-price-and-finish-badge\" target=\"_blank\">EN</a>. + * @param operationId Badge operation ID. (required) + * @return ApiResponse<BadgeOperation> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge operation details. -
401 Unauthorized. -
403 You don't have permission to access this resource. -
404 Badge operation not found. -
+ */ + public ApiResponse badgeOperationsGetOneWithHttpInfo(@javax.annotation.Nonnull String operationId) throws ApiException { + okhttp3.Call localVarCall = badgeOperationsGetOneValidateBeforeCall(operationId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get badge operation details (asynchronously) + * Use this resource to get badge operation details. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#zmiana-ceny-i-zakonczenie-oznaczenia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#change-price-and-finish-badge\" target=\"_blank\">EN</a>. + * @param operationId Badge operation 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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned badge operation details. -
401 Unauthorized. -
403 You don't have permission to access this resource. -
404 Badge operation not found. -
+ */ + public okhttp3.Call badgeOperationsGetOneAsync(@javax.annotation.Nonnull String operationId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = badgeOperationsGetOneValidateBeforeCall(operationId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getBadges + * @param offerId Offer ID. (optional) + * @param marketplaceId The marketplace of badges. (optional) + * @param offset Offset. (optional) + * @param limit The maximum number of badges returned in the response. (optional, default to 50) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of badges. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public okhttp3.Call getBadgesCall(@javax.annotation.Nullable String offerId, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/badges"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offerId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offer.id", offerId)); + } + + if (marketplaceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplace.id", marketplaceId)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getBadgesValidateBeforeCall(@javax.annotation.Nullable String offerId, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + return getBadgesCall(offerId, marketplaceId, offset, limit, _callback); + + } + + /** + * Get a list of badges + * Use this resource to get a list of badges in authorized seller's offers. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#kampanie-przypisane-do-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#check-badges-assigned-to-offers\" target=\"_blank\">EN</a>. + * @param offerId Offer ID. (optional) + * @param marketplaceId The marketplace of badges. (optional) + * @param offset Offset. (optional) + * @param limit The maximum number of badges returned in the response. (optional, default to 50) + * @return BadgesList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of badges. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public BadgesList getBadges(@javax.annotation.Nullable String offerId, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + ApiResponse localVarResp = getBadgesWithHttpInfo(offerId, marketplaceId, offset, limit); + return localVarResp.getData(); + } + + /** + * Get a list of badges + * Use this resource to get a list of badges in authorized seller's offers. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#kampanie-przypisane-do-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#check-badges-assigned-to-offers\" target=\"_blank\">EN</a>. + * @param offerId Offer ID. (optional) + * @param marketplaceId The marketplace of badges. (optional) + * @param offset Offset. (optional) + * @param limit The maximum number of badges returned in the response. (optional, default to 50) + * @return ApiResponse<BadgesList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of badges. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public ApiResponse getBadgesWithHttpInfo(@javax.annotation.Nullable String offerId, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + okhttp3.Call localVarCall = getBadgesValidateBeforeCall(offerId, marketplaceId, offset, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of badges (asynchronously) + * Use this resource to get a list of badges in authorized seller's offers. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#kampanie-przypisane-do-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#check-badges-assigned-to-offers\" target=\"_blank\">EN</a>. + * @param offerId Offer ID. (optional) + * @param marketplaceId The marketplace of badges. (optional) + * @param offset Offset. (optional) + * @param limit The maximum number of badges returned in the response. (optional, default to 50) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of badges. -
400 Invalid values supplied in the query parameters. -
401 Unauthorized. -
403 The account is not a Business Account. -
+ */ + public okhttp3.Call getBadgesAsync(@javax.annotation.Nullable String offerId, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getBadgesValidateBeforeCall(offerId, marketplaceId, offset, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for patchBadge + * @param offerId Offer ID. (required) + * @param campaignId Campaign ID. (required) + * @param badgePatchRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Successfully requested badge update. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
400 Syntactically incorrect request. -
401 Unauthorized. -
403 You don't have permission to access this resource. -
404 Resource not found. -
409 Asynchronous badge operation for this offer already exists in status REQUESTED. -
422 Validation error. Invalid parameters provided in the request. -
+ */ + public okhttp3.Call patchBadgeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable BadgePatchRequest badgePatchRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = badgePatchRequest; + + // create path and map variables + String localVarPath = "/sale/badges/offers/{offerId}/campaigns/{campaignId}" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())) + .replace("{" + "campaignId" + "}", localVarApiClient.escapeString(campaignId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call patchBadgeValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable BadgePatchRequest badgePatchRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling patchBadge(Async)"); + } + + // verify the required parameter 'campaignId' is set + if (campaignId == null) { + throw new ApiException("Missing the required parameter 'campaignId' when calling patchBadge(Async)"); + } + + return patchBadgeCall(offerId, campaignId, badgePatchRequest, _callback); + + } + + /** + * Update campaign badge for the given offer + * This resource allows you to update a campaign badge for the given offer. You can use *Location* provided in header of the response to track your update status. Update offer price in a campaign or finish marking an offer in a campaign. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#zmiana-ceny-i-zakonczenie-oznaczenia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#change-price-and-finish-badge\" target=\"_blank\">EN</a>. + * @param offerId Offer ID. (required) + * @param campaignId Campaign ID. (required) + * @param badgePatchRequest (optional) + * @return PatchBadge202Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Successfully requested badge update. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
400 Syntactically incorrect request. -
401 Unauthorized. -
403 You don't have permission to access this resource. -
404 Resource not found. -
409 Asynchronous badge operation for this offer already exists in status REQUESTED. -
422 Validation error. Invalid parameters provided in the request. -
+ */ + public PatchBadge202Response patchBadge(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable BadgePatchRequest badgePatchRequest) throws ApiException { + ApiResponse localVarResp = patchBadgeWithHttpInfo(offerId, campaignId, badgePatchRequest); + return localVarResp.getData(); + } + + /** + * Update campaign badge for the given offer + * This resource allows you to update a campaign badge for the given offer. You can use *Location* provided in header of the response to track your update status. Update offer price in a campaign or finish marking an offer in a campaign. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#zmiana-ceny-i-zakonczenie-oznaczenia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#change-price-and-finish-badge\" target=\"_blank\">EN</a>. + * @param offerId Offer ID. (required) + * @param campaignId Campaign ID. (required) + * @param badgePatchRequest (optional) + * @return ApiResponse<PatchBadge202Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Successfully requested badge update. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
400 Syntactically incorrect request. -
401 Unauthorized. -
403 You don't have permission to access this resource. -
404 Resource not found. -
409 Asynchronous badge operation for this offer already exists in status REQUESTED. -
422 Validation error. Invalid parameters provided in the request. -
+ */ + public ApiResponse patchBadgeWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable BadgePatchRequest badgePatchRequest) throws ApiException { + okhttp3.Call localVarCall = patchBadgeValidateBeforeCall(offerId, campaignId, badgePatchRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update campaign badge for the given offer (asynchronously) + * This resource allows you to update a campaign badge for the given offer. You can use *Location* provided in header of the response to track your update status. Update offer price in a campaign or finish marking an offer in a campaign. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#zmiana-ceny-i-zakonczenie-oznaczenia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#change-price-and-finish-badge\" target=\"_blank\">EN</a>. + * @param offerId Offer ID. (required) + * @param campaignId Campaign ID. (required) + * @param badgePatchRequest (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Successfully requested badge update. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
400 Syntactically incorrect request. -
401 Unauthorized. -
403 You don't have permission to access this resource. -
404 Resource not found. -
409 Asynchronous badge operation for this offer already exists in status REQUESTED. -
422 Validation error. Invalid parameters provided in the request. -
+ */ + public okhttp3.Call patchBadgeAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull String campaignId, @javax.annotation.Nullable BadgePatchRequest badgePatchRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = patchBadgeValidateBeforeCall(offerId, campaignId, badgePatchRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for postBadges + * @param badgeApplicationRequest (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Successfully applied for a badge. -
400 Syntactically incorrect request. -
401 Unauthorized -
403 The account is not a Business Account. -
422 Validation error. Invalid parameters provided in the request. -
+ */ + public okhttp3.Call postBadgesCall(@javax.annotation.Nullable BadgeApplicationRequest badgeApplicationRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = badgeApplicationRequest; + + // create path and map variables + String localVarPath = "/sale/badges"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postBadgesValidateBeforeCall(@javax.annotation.Nullable BadgeApplicationRequest badgeApplicationRequest, final ApiCallback _callback) throws ApiException { + return postBadgesCall(badgeApplicationRequest, _callback); + + } + + /** + * Apply for badge in selected offer + * This resource allows you to apply for a badge. Most badges involve additional fee charged. Your badge application will be verified and you will be notified about the verification status via e-mail. You can use *Location* provided in header of the response to track your application status. Application will be removed after 30 days when status of the application was changed form PROCESSED or DECLINED. Fees will be charged in accordance with Annex No. 1 to the <a href=\"https://allegro.pl/regulaminy/regulamin-strefy-okazji-9dGVAPB69In\" target=\"_blank\">Daily deals zone terms and conditions</a>. By using this resource you agree to the <a href=\"https://allegro.pl/regulaminy/regulamin-strefy-okazji-9dGVAPB69In\" target=\"_blank\">Daily deals zone terms and conditions</a> or <a href=\"https://allegro.pl/regulaminy/regulamin-programu-bonusowego-prowizja-nawet-0-5-0KPkAE7wkcv\" target=\"_blank\">Commission discount terms and conditions</a>. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#zglos-oferte-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#submit-offer-to-a-campaign\" target=\"_blank\">EN</a>. + * @param badgeApplicationRequest (optional) + * @return BadgeApplication + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Successfully applied for a badge. -
400 Syntactically incorrect request. -
401 Unauthorized -
403 The account is not a Business Account. -
422 Validation error. Invalid parameters provided in the request. -
+ */ + public BadgeApplication postBadges(@javax.annotation.Nullable BadgeApplicationRequest badgeApplicationRequest) throws ApiException { + ApiResponse localVarResp = postBadgesWithHttpInfo(badgeApplicationRequest); + return localVarResp.getData(); + } + + /** + * Apply for badge in selected offer + * This resource allows you to apply for a badge. Most badges involve additional fee charged. Your badge application will be verified and you will be notified about the verification status via e-mail. You can use *Location* provided in header of the response to track your application status. Application will be removed after 30 days when status of the application was changed form PROCESSED or DECLINED. Fees will be charged in accordance with Annex No. 1 to the <a href=\"https://allegro.pl/regulaminy/regulamin-strefy-okazji-9dGVAPB69In\" target=\"_blank\">Daily deals zone terms and conditions</a>. By using this resource you agree to the <a href=\"https://allegro.pl/regulaminy/regulamin-strefy-okazji-9dGVAPB69In\" target=\"_blank\">Daily deals zone terms and conditions</a> or <a href=\"https://allegro.pl/regulaminy/regulamin-programu-bonusowego-prowizja-nawet-0-5-0KPkAE7wkcv\" target=\"_blank\">Commission discount terms and conditions</a>. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#zglos-oferte-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#submit-offer-to-a-campaign\" target=\"_blank\">EN</a>. + * @param badgeApplicationRequest (optional) + * @return ApiResponse<BadgeApplication> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Successfully applied for a badge. -
400 Syntactically incorrect request. -
401 Unauthorized -
403 The account is not a Business Account. -
422 Validation error. Invalid parameters provided in the request. -
+ */ + public ApiResponse postBadgesWithHttpInfo(@javax.annotation.Nullable BadgeApplicationRequest badgeApplicationRequest) throws ApiException { + okhttp3.Call localVarCall = postBadgesValidateBeforeCall(badgeApplicationRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Apply for badge in selected offer (asynchronously) + * This resource allows you to apply for a badge. Most badges involve additional fee charged. Your badge application will be verified and you will be notified about the verification status via e-mail. You can use *Location* provided in header of the response to track your application status. Application will be removed after 30 days when status of the application was changed form PROCESSED or DECLINED. Fees will be charged in accordance with Annex No. 1 to the <a href=\"https://allegro.pl/regulaminy/regulamin-strefy-okazji-9dGVAPB69In\" target=\"_blank\">Daily deals zone terms and conditions</a>. By using this resource you agree to the <a href=\"https://allegro.pl/regulaminy/regulamin-strefy-okazji-9dGVAPB69In\" target=\"_blank\">Daily deals zone terms and conditions</a> or <a href=\"https://allegro.pl/regulaminy/regulamin-programu-bonusowego-prowizja-nawet-0-5-0KPkAE7wkcv\" target=\"_blank\">Commission discount terms and conditions</a>. Read more: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#zglos-oferte-do-kampanii\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#submit-offer-to-a-campaign\" target=\"_blank\">EN</a>. + * @param badgeApplicationRequest (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Successfully applied for a badge. -
400 Syntactically incorrect request. -
401 Unauthorized -
403 The account is not a Business Account. -
422 Validation error. Invalid parameters provided in the request. -
+ */ + public okhttp3.Call postBadgesAsync(@javax.annotation.Nullable BadgeApplicationRequest badgeApplicationRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postBadgesValidateBeforeCall(badgeApplicationRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/BatchOfferModificationApi.java b/src/main/java/pl/wtx/allegro/api/client/BatchOfferModificationApi.java new file mode 100644 index 0000000..e45d7c8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/BatchOfferModificationApi.java @@ -0,0 +1,1870 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.GeneralReport; +import pl.wtx.allegro.api.client.model.OfferAutomaticPricingCommand; +import pl.wtx.allegro.api.client.model.OfferChangeCommand; +import pl.wtx.allegro.api.client.model.OfferPriceChangeCommand; +import pl.wtx.allegro.api.client.model.OfferQuantityChangeCommand; +import pl.wtx.allegro.api.client.model.TaskReport; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BatchOfferModificationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public BatchOfferModificationApi() { + this(Configuration.getDefaultApiClient()); + } + + public BatchOfferModificationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getGeneralReportUsingGET + * @param commandId Command identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public okhttp3.Call getGeneralReportUsingGETCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-modification-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGeneralReportUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getGeneralReportUsingGET(Async)"); + } + + return getGeneralReportUsingGETCall(commandId, _callback); + + } + + /** + * Modification command summary + * Use this resource to find out how many offers were edited within one {commandId}. You will receive a summary with a number of successfully edited offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-wielu-ofert-jednoczesnie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-many-offers\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @return GeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public GeneralReport getGeneralReportUsingGET(@javax.annotation.Nonnull String commandId) throws ApiException { + ApiResponse localVarResp = getGeneralReportUsingGETWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Modification command summary + * Use this resource to find out how many offers were edited within one {commandId}. You will receive a summary with a number of successfully edited offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-wielu-ofert-jednoczesnie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-many-offers\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @return ApiResponse<GeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public ApiResponse getGeneralReportUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId) throws ApiException { + okhttp3.Call localVarCall = getGeneralReportUsingGETValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Modification command summary (asynchronously) + * Use this resource to find out how many offers were edited within one {commandId}. You will receive a summary with a number of successfully edited offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-wielu-ofert-jednoczesnie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-many-offers\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public okhttp3.Call getGeneralReportUsingGETAsync(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGeneralReportUsingGETValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPriceModificationCommandStatusUsingGET + * @param commandId Command identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
404 Command not found -
+ */ + public okhttp3.Call getPriceModificationCommandStatusUsingGETCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-price-change-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPriceModificationCommandStatusUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getPriceModificationCommandStatusUsingGET(Async)"); + } + + return getPriceModificationCommandStatusUsingGETCall(commandId, _callback); + + } + + /** + * Change price command summary + * Returns status and summary of particular command execution. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#cena\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#price\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @return GeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
404 Command not found -
+ */ + public GeneralReport getPriceModificationCommandStatusUsingGET(@javax.annotation.Nonnull String commandId) throws ApiException { + ApiResponse localVarResp = getPriceModificationCommandStatusUsingGETWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Change price command summary + * Returns status and summary of particular command execution. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#cena\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#price\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @return ApiResponse<GeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
404 Command not found -
+ */ + public ApiResponse getPriceModificationCommandStatusUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId) throws ApiException { + okhttp3.Call localVarCall = getPriceModificationCommandStatusUsingGETValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Change price command summary (asynchronously) + * Returns status and summary of particular command execution. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#cena\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#price\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
404 Command not found -
+ */ + public okhttp3.Call getPriceModificationCommandStatusUsingGETAsync(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPriceModificationCommandStatusUsingGETValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPriceModificationCommandTasksStatusesUsingGET + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
404 Command not found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getPriceModificationCommandTasksStatusesUsingGETCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-price-change-commands/{commandId}/tasks" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPriceModificationCommandTasksStatusesUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getPriceModificationCommandTasksStatusesUsingGET(Async)"); + } + + return getPriceModificationCommandTasksStatusesUsingGETCall(commandId, limit, offset, _callback); + + } + + /** + * Change price command detailed report + * Defaults: limit = 100, offset = 0. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#cena\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#price\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return TaskReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
404 Command not found -
422 Unprocessable Entity -
+ */ + public TaskReport getPriceModificationCommandTasksStatusesUsingGET(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getPriceModificationCommandTasksStatusesUsingGETWithHttpInfo(commandId, limit, offset); + return localVarResp.getData(); + } + + /** + * Change price command detailed report + * Defaults: limit = 100, offset = 0. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#cena\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#price\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ApiResponse<TaskReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
404 Command not found -
422 Unprocessable Entity -
+ */ + public ApiResponse getPriceModificationCommandTasksStatusesUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getPriceModificationCommandTasksStatusesUsingGETValidateBeforeCall(commandId, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Change price command detailed report (asynchronously) + * Defaults: limit = 100, offset = 0. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#cena\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#price\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
404 Command not found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getPriceModificationCommandTasksStatusesUsingGETAsync(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPriceModificationCommandTasksStatusesUsingGETValidateBeforeCall(commandId, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getQuantityModificationCommandStatusUsingGET + * @param commandId Command identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Report was generated and successfully returned -
401 Unauthorized -
404 Command not found -
+ */ + public okhttp3.Call getQuantityModificationCommandStatusUsingGETCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-quantity-change-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getQuantityModificationCommandStatusUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getQuantityModificationCommandStatusUsingGET(Async)"); + } + + return getQuantityModificationCommandStatusUsingGETCall(commandId, _callback); + + } + + /** + * Change quantity command summary + * Returns status and summary of the command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#liczba-przedmiotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#quantity\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @return GeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Report was generated and successfully returned -
401 Unauthorized -
404 Command not found -
+ */ + public GeneralReport getQuantityModificationCommandStatusUsingGET(@javax.annotation.Nonnull String commandId) throws ApiException { + ApiResponse localVarResp = getQuantityModificationCommandStatusUsingGETWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Change quantity command summary + * Returns status and summary of the command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#liczba-przedmiotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#quantity\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @return ApiResponse<GeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Report was generated and successfully returned -
401 Unauthorized -
404 Command not found -
+ */ + public ApiResponse getQuantityModificationCommandStatusUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId) throws ApiException { + okhttp3.Call localVarCall = getQuantityModificationCommandStatusUsingGETValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Change quantity command summary (asynchronously) + * Returns status and summary of the command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#liczba-przedmiotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#quantity\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Report was generated and successfully returned -
401 Unauthorized -
404 Command not found -
+ */ + public okhttp3.Call getQuantityModificationCommandStatusUsingGETAsync(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getQuantityModificationCommandStatusUsingGETValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getQuantityModificationCommandTasksStatusesUsingGET + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
404 Command not found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getQuantityModificationCommandTasksStatusesUsingGETCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-quantity-change-commands/{commandId}/tasks" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getQuantityModificationCommandTasksStatusesUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getQuantityModificationCommandTasksStatusesUsingGET(Async)"); + } + + return getQuantityModificationCommandTasksStatusesUsingGETCall(commandId, limit, offset, _callback); + + } + + /** + * Change quantity command detailed report + * Defaults: limit = 100, offset = 0. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#liczba-przedmiotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#quantity\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return TaskReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
404 Command not found -
422 Unprocessable Entity -
+ */ + public TaskReport getQuantityModificationCommandTasksStatusesUsingGET(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getQuantityModificationCommandTasksStatusesUsingGETWithHttpInfo(commandId, limit, offset); + return localVarResp.getData(); + } + + /** + * Change quantity command detailed report + * Defaults: limit = 100, offset = 0. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#liczba-przedmiotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#quantity\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ApiResponse<TaskReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
404 Command not found -
422 Unprocessable Entity -
+ */ + public ApiResponse getQuantityModificationCommandTasksStatusesUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getQuantityModificationCommandTasksStatusesUsingGETValidateBeforeCall(commandId, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Change quantity command detailed report (asynchronously) + * Defaults: limit = 100, offset = 0. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#liczba-przedmiotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#quantity\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
404 Command not found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getQuantityModificationCommandTasksStatusesUsingGETAsync(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getQuantityModificationCommandTasksStatusesUsingGETValidateBeforeCall(commandId, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getTasksUsingGET + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getTasksUsingGETCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-modification-commands/{commandId}/tasks" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTasksUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getTasksUsingGET(Async)"); + } + + return getTasksUsingGETCall(commandId, limit, offset, _callback); + + } + + /** + * Modification command detailed report + * Use this resource to retrieve a detailed summary of changes introduced within one {commandId} (defaults: limit = 100, offset = 0). Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-wielu-ofert-jednoczesnie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-many-offers\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return TaskReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public TaskReport getTasksUsingGET(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getTasksUsingGETWithHttpInfo(commandId, limit, offset); + return localVarResp.getData(); + } + + /** + * Modification command detailed report + * Use this resource to retrieve a detailed summary of changes introduced within one {commandId} (defaults: limit = 100, offset = 0). Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-wielu-ofert-jednoczesnie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-many-offers\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ApiResponse<TaskReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public ApiResponse getTasksUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getTasksUsingGETValidateBeforeCall(commandId, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Modification command detailed report (asynchronously) + * Use this resource to retrieve a detailed summary of changes introduced within one {commandId} (defaults: limit = 100, offset = 0). Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-wielu-ofert-jednoczesnie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-many-offers\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getTasksUsingGETAsync(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTasksUsingGETValidateBeforeCall(commandId, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getofferAutomaticPricingModificationCommandStatusUsingGET + * @param commandId Command identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public okhttp3.Call getofferAutomaticPricingModificationCommandStatusUsingGETCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-price-automation-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getofferAutomaticPricingModificationCommandStatusUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getofferAutomaticPricingModificationCommandStatusUsingGET(Async)"); + } + + return getofferAutomaticPricingModificationCommandStatusUsingGETCall(commandId, _callback); + + } + + /** + * Automatic pricing command summary + * Returns status and summary of the offer-price-automation-command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#pricing-rules\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @return GeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public GeneralReport getofferAutomaticPricingModificationCommandStatusUsingGET(@javax.annotation.Nonnull String commandId) throws ApiException { + ApiResponse localVarResp = getofferAutomaticPricingModificationCommandStatusUsingGETWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Automatic pricing command summary + * Returns status and summary of the offer-price-automation-command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#pricing-rules\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @return ApiResponse<GeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public ApiResponse getofferAutomaticPricingModificationCommandStatusUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId) throws ApiException { + okhttp3.Call localVarCall = getofferAutomaticPricingModificationCommandStatusUsingGETValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Automatic pricing command summary (asynchronously) + * Returns status and summary of the offer-price-automation-command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#pricing-rules\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public okhttp3.Call getofferAutomaticPricingModificationCommandStatusUsingGETAsync(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getofferAutomaticPricingModificationCommandStatusUsingGETValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getofferAutomaticPricingModificationCommandTasksStatusesUsingGET + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getofferAutomaticPricingModificationCommandTasksStatusesUsingGETCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-price-automation-commands/{commandId}/tasks" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getofferAutomaticPricingModificationCommandTasksStatusesUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getofferAutomaticPricingModificationCommandTasksStatusesUsingGET(Async)"); + } + + return getofferAutomaticPricingModificationCommandTasksStatusesUsingGETCall(commandId, limit, offset, _callback); + + } + + /** + * Automatic pricing command detailed report + * Defaults: limit = 100, offset = 0. Returns status and report of the offer-price-automation-command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#pricing-rules\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return TaskReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public TaskReport getofferAutomaticPricingModificationCommandTasksStatusesUsingGET(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getofferAutomaticPricingModificationCommandTasksStatusesUsingGETWithHttpInfo(commandId, limit, offset); + return localVarResp.getData(); + } + + /** + * Automatic pricing command detailed report + * Defaults: limit = 100, offset = 0. Returns status and report of the offer-price-automation-command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#pricing-rules\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ApiResponse<TaskReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public ApiResponse getofferAutomaticPricingModificationCommandTasksStatusesUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getofferAutomaticPricingModificationCommandTasksStatusesUsingGETValidateBeforeCall(commandId, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Automatic pricing command detailed report (asynchronously) + * Defaults: limit = 100, offset = 0. Returns status and report of the offer-price-automation-command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#pricing-rules\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getofferAutomaticPricingModificationCommandTasksStatusesUsingGETAsync(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getofferAutomaticPricingModificationCommandTasksStatusesUsingGETValidateBeforeCall(commandId, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for modificationCommandUsingPUT + * @param commandId Command identifier. (required) + * @param offerChangeCommand offerChangeCommandDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public okhttp3.Call modificationCommandUsingPUTCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferChangeCommand offerChangeCommand, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = offerChangeCommand; + + // create path and map variables + String localVarPath = "/sale/offer-modification-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call modificationCommandUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferChangeCommand offerChangeCommand, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling modificationCommandUsingPUT(Async)"); + } + + // verify the required parameter 'offerChangeCommand' is set + if (offerChangeCommand == null) { + throw new ApiException("Missing the required parameter 'offerChangeCommand' when calling modificationCommandUsingPUT(Async)"); + } + + return modificationCommandUsingPUTCall(commandId, offerChangeCommand, _callback); + + } + + /** + * Batch offer modification + * Use this resource to modify multiple offers at once. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-wielu-ofert-jednoczesnie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-many-offers\" target=\"_blank\">EN</a>. This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param offerChangeCommand offerChangeCommandDto (required) + * @return GeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public GeneralReport modificationCommandUsingPUT(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferChangeCommand offerChangeCommand) throws ApiException { + ApiResponse localVarResp = modificationCommandUsingPUTWithHttpInfo(commandId, offerChangeCommand); + return localVarResp.getData(); + } + + /** + * Batch offer modification + * Use this resource to modify multiple offers at once. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-wielu-ofert-jednoczesnie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-many-offers\" target=\"_blank\">EN</a>. This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param offerChangeCommand offerChangeCommandDto (required) + * @return ApiResponse<GeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public ApiResponse modificationCommandUsingPUTWithHttpInfo(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferChangeCommand offerChangeCommand) throws ApiException { + okhttp3.Call localVarCall = modificationCommandUsingPUTValidateBeforeCall(commandId, offerChangeCommand, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Batch offer modification (asynchronously) + * Use this resource to modify multiple offers at once. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-wielu-ofert-jednoczesnie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-many-offers\" target=\"_blank\">EN</a>. This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param offerChangeCommand offerChangeCommandDto (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public okhttp3.Call modificationCommandUsingPUTAsync(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferChangeCommand offerChangeCommand, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = modificationCommandUsingPUTValidateBeforeCall(commandId, offerChangeCommand, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for offerAutomaticPricingModificationCommandUsingPOST + * @param offerAutomaticPricingCommand OfferAutomaticPricingCommand (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public okhttp3.Call offerAutomaticPricingModificationCommandUsingPOSTCall(@javax.annotation.Nonnull OfferAutomaticPricingCommand offerAutomaticPricingCommand, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = offerAutomaticPricingCommand; + + // create path and map variables + String localVarPath = "/sale/offer-price-automation-commands"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call offerAutomaticPricingModificationCommandUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull OfferAutomaticPricingCommand offerAutomaticPricingCommand, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerAutomaticPricingCommand' is set + if (offerAutomaticPricingCommand == null) { + throw new ApiException("Missing the required parameter 'offerAutomaticPricingCommand' when calling offerAutomaticPricingModificationCommandUsingPOST(Async)"); + } + + return offerAutomaticPricingModificationCommandUsingPOSTCall(offerAutomaticPricingCommand, _callback); + + } + + /** + * Batch offer automatic pricing rules modification + * Use this resource to modify the automatic pricing rules of multiple offers at the same time. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#pricing-rules\" target=\"_blank\">EN</a>. This resource is rate limited to 150 000 offer changes per hour or 9000 offer changes per minute. + * @param offerAutomaticPricingCommand OfferAutomaticPricingCommand (required) + * @return GeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public GeneralReport offerAutomaticPricingModificationCommandUsingPOST(@javax.annotation.Nonnull OfferAutomaticPricingCommand offerAutomaticPricingCommand) throws ApiException { + ApiResponse localVarResp = offerAutomaticPricingModificationCommandUsingPOSTWithHttpInfo(offerAutomaticPricingCommand); + return localVarResp.getData(); + } + + /** + * Batch offer automatic pricing rules modification + * Use this resource to modify the automatic pricing rules of multiple offers at the same time. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#pricing-rules\" target=\"_blank\">EN</a>. This resource is rate limited to 150 000 offer changes per hour or 9000 offer changes per minute. + * @param offerAutomaticPricingCommand OfferAutomaticPricingCommand (required) + * @return ApiResponse<GeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public ApiResponse offerAutomaticPricingModificationCommandUsingPOSTWithHttpInfo(@javax.annotation.Nonnull OfferAutomaticPricingCommand offerAutomaticPricingCommand) throws ApiException { + okhttp3.Call localVarCall = offerAutomaticPricingModificationCommandUsingPOSTValidateBeforeCall(offerAutomaticPricingCommand, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Batch offer automatic pricing rules modification (asynchronously) + * Use this resource to modify the automatic pricing rules of multiple offers at the same time. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#reguly-cenowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#pricing-rules\" target=\"_blank\">EN</a>. This resource is rate limited to 150 000 offer changes per hour or 9000 offer changes per minute. + * @param offerAutomaticPricingCommand OfferAutomaticPricingCommand (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public okhttp3.Call offerAutomaticPricingModificationCommandUsingPOSTAsync(@javax.annotation.Nonnull OfferAutomaticPricingCommand offerAutomaticPricingCommand, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = offerAutomaticPricingModificationCommandUsingPOSTValidateBeforeCall(offerAutomaticPricingCommand, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for priceModificationCommandUsingPUT + * @param commandId Command identifier. (required) + * @param offerPriceChangeCommand offerPriceChangeCommandDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public okhttp3.Call priceModificationCommandUsingPUTCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferPriceChangeCommand offerPriceChangeCommand, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = offerPriceChangeCommand; + + // create path and map variables + String localVarPath = "/sale/offer-price-change-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call priceModificationCommandUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferPriceChangeCommand offerPriceChangeCommand, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling priceModificationCommandUsingPUT(Async)"); + } + + // verify the required parameter 'offerPriceChangeCommand' is set + if (offerPriceChangeCommand == null) { + throw new ApiException("Missing the required parameter 'offerPriceChangeCommand' when calling priceModificationCommandUsingPUT(Async)"); + } + + return priceModificationCommandUsingPUTCall(commandId, offerPriceChangeCommand, _callback); + + } + + /** + * Batch offer price modification + * Change price of offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#cena\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#price\" target=\"_blank\">EN</a>. This resource is rate limited to 150 000 offer changes per hour or 9000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param offerPriceChangeCommand offerPriceChangeCommandDto (required) + * @return GeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public GeneralReport priceModificationCommandUsingPUT(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferPriceChangeCommand offerPriceChangeCommand) throws ApiException { + ApiResponse localVarResp = priceModificationCommandUsingPUTWithHttpInfo(commandId, offerPriceChangeCommand); + return localVarResp.getData(); + } + + /** + * Batch offer price modification + * Change price of offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#cena\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#price\" target=\"_blank\">EN</a>. This resource is rate limited to 150 000 offer changes per hour or 9000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param offerPriceChangeCommand offerPriceChangeCommandDto (required) + * @return ApiResponse<GeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public ApiResponse priceModificationCommandUsingPUTWithHttpInfo(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferPriceChangeCommand offerPriceChangeCommand) throws ApiException { + okhttp3.Call localVarCall = priceModificationCommandUsingPUTValidateBeforeCall(commandId, offerPriceChangeCommand, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Batch offer price modification (asynchronously) + * Change price of offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#cena\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#price\" target=\"_blank\">EN</a>. This resource is rate limited to 150 000 offer changes per hour or 9000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param offerPriceChangeCommand offerPriceChangeCommandDto (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public okhttp3.Call priceModificationCommandUsingPUTAsync(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferPriceChangeCommand offerPriceChangeCommand, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = priceModificationCommandUsingPUTValidateBeforeCall(commandId, offerPriceChangeCommand, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for quantityModificationCommandUsingPUT + * @param commandId Command identifier. (required) + * @param offerQuantityChangeCommand offerQuantityChangeCommandDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public okhttp3.Call quantityModificationCommandUsingPUTCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferQuantityChangeCommand offerQuantityChangeCommand, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = offerQuantityChangeCommand; + + // create path and map variables + String localVarPath = "/sale/offer-quantity-change-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call quantityModificationCommandUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferQuantityChangeCommand offerQuantityChangeCommand, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling quantityModificationCommandUsingPUT(Async)"); + } + + // verify the required parameter 'offerQuantityChangeCommand' is set + if (offerQuantityChangeCommand == null) { + throw new ApiException("Missing the required parameter 'offerQuantityChangeCommand' when calling quantityModificationCommandUsingPUT(Async)"); + } + + return quantityModificationCommandUsingPUTCall(commandId, offerQuantityChangeCommand, _callback); + + } + + /** + * Batch offer quantity modification + * Change quantity of multiple offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#liczba-przedmiotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#quantity\" target=\"_blank\">EN</a>. This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute - limit applies to a single user of the application. + * @param commandId Command identifier. (required) + * @param offerQuantityChangeCommand offerQuantityChangeCommandDto (required) + * @return GeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public GeneralReport quantityModificationCommandUsingPUT(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferQuantityChangeCommand offerQuantityChangeCommand) throws ApiException { + ApiResponse localVarResp = quantityModificationCommandUsingPUTWithHttpInfo(commandId, offerQuantityChangeCommand); + return localVarResp.getData(); + } + + /** + * Batch offer quantity modification + * Change quantity of multiple offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#liczba-przedmiotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#quantity\" target=\"_blank\">EN</a>. This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute - limit applies to a single user of the application. + * @param commandId Command identifier. (required) + * @param offerQuantityChangeCommand offerQuantityChangeCommandDto (required) + * @return ApiResponse<GeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public ApiResponse quantityModificationCommandUsingPUTWithHttpInfo(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferQuantityChangeCommand offerQuantityChangeCommand) throws ApiException { + okhttp3.Call localVarCall = quantityModificationCommandUsingPUTValidateBeforeCall(commandId, offerQuantityChangeCommand, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Batch offer quantity modification (asynchronously) + * Change quantity of multiple offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#liczba-przedmiotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#quantity\" target=\"_blank\">EN</a>. This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute - limit applies to a single user of the application. + * @param commandId Command identifier. (required) + * @param offerQuantityChangeCommand offerQuantityChangeCommandDto (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public okhttp3.Call quantityModificationCommandUsingPUTAsync(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull OfferQuantityChangeCommand offerQuantityChangeCommand, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = quantityModificationCommandUsingPUTValidateBeforeCall(commandId, offerQuantityChangeCommand, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/BillingApi.java b/src/main/java/pl/wtx/allegro/api/client/BillingApi.java new file mode 100644 index 0000000..404a57a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/BillingApi.java @@ -0,0 +1,403 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.BillingEntries; +import pl.wtx.allegro.api.client.model.BillingType; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import java.time.OffsetDateTime; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BillingApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public BillingApi() { + this(Configuration.getDefaultApiClient()); + } + + public BillingApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getBillingEntries + * @param marketplaceId The marketplace ID where operation was made. By default the marketplace ID where the user is registered. **Note:** Business marketplace is not a separate user's billing and defaults back to the main marketplace for given country. (optional) + * @param occurredAtGte Date from which billing entries are filtered. If occurredAt.lte is also set, occurredAt.gte cannot be later. (optional) + * @param occurredAtLte Date to which billing entries are filtered. If occurredAt.gte is also set, occurredAt.lte cannot be earlier. (optional) + * @param typeId List of billing types by which billing entries are filtered. (optional) + * @param offerId Offer ID by which billing entries are filtered. (optional) + * @param orderId Order UUID by which billing entries are filtered. (optional) + * @param limit Number of returned operations. (optional, default to 100) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of billing entries returned successfully. -
401 Unauthorized -
406 Not Acceptable -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getBillingEntriesCall(@javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List typeId, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable UUID orderId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/billing/billing-entries"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marketplaceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplaceId", marketplaceId)); + } + + if (occurredAtGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("occurredAt.gte", occurredAtGte)); + } + + if (occurredAtLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("occurredAt.lte", occurredAtLte)); + } + + if (typeId != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "type.id", typeId)); + } + + if (offerId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offer.id", offerId)); + } + + if (orderId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("order.id", orderId)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getBillingEntriesValidateBeforeCall(@javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List typeId, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable UUID orderId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + return getBillingEntriesCall(marketplaceId, occurredAtGte, occurredAtLte, typeId, offerId, orderId, limit, offset, _callback); + + } + + /** + * Get a list of billing entries + * The billing entries are sorted in a descending order (newest first) by date on which they occurred. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#historia-operacji-billingowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#billing-operations\" target=\"_blank\">EN</a>. + * @param marketplaceId The marketplace ID where operation was made. By default the marketplace ID where the user is registered. **Note:** Business marketplace is not a separate user's billing and defaults back to the main marketplace for given country. (optional) + * @param occurredAtGte Date from which billing entries are filtered. If occurredAt.lte is also set, occurredAt.gte cannot be later. (optional) + * @param occurredAtLte Date to which billing entries are filtered. If occurredAt.gte is also set, occurredAt.lte cannot be earlier. (optional) + * @param typeId List of billing types by which billing entries are filtered. (optional) + * @param offerId Offer ID by which billing entries are filtered. (optional) + * @param orderId Order UUID by which billing entries are filtered. (optional) + * @param limit Number of returned operations. (optional, default to 100) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @return BillingEntries + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of billing entries returned successfully. -
401 Unauthorized -
406 Not Acceptable -
422 Unprocessable Entity -
+ */ + public BillingEntries getBillingEntries(@javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List typeId, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable UUID orderId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getBillingEntriesWithHttpInfo(marketplaceId, occurredAtGte, occurredAtLte, typeId, offerId, orderId, limit, offset); + return localVarResp.getData(); + } + + /** + * Get a list of billing entries + * The billing entries are sorted in a descending order (newest first) by date on which they occurred. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#historia-operacji-billingowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#billing-operations\" target=\"_blank\">EN</a>. + * @param marketplaceId The marketplace ID where operation was made. By default the marketplace ID where the user is registered. **Note:** Business marketplace is not a separate user's billing and defaults back to the main marketplace for given country. (optional) + * @param occurredAtGte Date from which billing entries are filtered. If occurredAt.lte is also set, occurredAt.gte cannot be later. (optional) + * @param occurredAtLte Date to which billing entries are filtered. If occurredAt.gte is also set, occurredAt.lte cannot be earlier. (optional) + * @param typeId List of billing types by which billing entries are filtered. (optional) + * @param offerId Offer ID by which billing entries are filtered. (optional) + * @param orderId Order UUID by which billing entries are filtered. (optional) + * @param limit Number of returned operations. (optional, default to 100) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @return ApiResponse<BillingEntries> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of billing entries returned successfully. -
401 Unauthorized -
406 Not Acceptable -
422 Unprocessable Entity -
+ */ + public ApiResponse getBillingEntriesWithHttpInfo(@javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List typeId, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable UUID orderId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getBillingEntriesValidateBeforeCall(marketplaceId, occurredAtGte, occurredAtLte, typeId, offerId, orderId, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of billing entries (asynchronously) + * The billing entries are sorted in a descending order (newest first) by date on which they occurred. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#historia-operacji-billingowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#billing-operations\" target=\"_blank\">EN</a>. + * @param marketplaceId The marketplace ID where operation was made. By default the marketplace ID where the user is registered. **Note:** Business marketplace is not a separate user's billing and defaults back to the main marketplace for given country. (optional) + * @param occurredAtGte Date from which billing entries are filtered. If occurredAt.lte is also set, occurredAt.gte cannot be later. (optional) + * @param occurredAtLte Date to which billing entries are filtered. If occurredAt.gte is also set, occurredAt.lte cannot be earlier. (optional) + * @param typeId List of billing types by which billing entries are filtered. (optional) + * @param offerId Offer ID by which billing entries are filtered. (optional) + * @param orderId Order UUID by which billing entries are filtered. (optional) + * @param limit Number of returned operations. (optional, default to 100) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of billing entries returned successfully. -
401 Unauthorized -
406 Not Acceptable -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getBillingEntriesAsync(@javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List typeId, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable UUID orderId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getBillingEntriesValidateBeforeCall(marketplaceId, occurredAtGte, occurredAtLte, typeId, offerId, orderId, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getBillingTypes + * @param acceptLanguage Expected language of name translations. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of billing types returned successfully. -
401 Unauthorized -
+ */ + public okhttp3.Call getBillingTypesCall(@javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/billing/billing-types"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getBillingTypesValidateBeforeCall(@javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + return getBillingTypesCall(acceptLanguage, _callback); + + } + + /** + * Get a list of billing types + * List of all billing types. Type names are localized according to \"Accept-Language\" header. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#historia-operacji-billingowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#billing-operations\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of name translations. (optional) + * @return List<BillingType> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of billing types returned successfully. -
401 Unauthorized -
+ */ + public List getBillingTypes(@javax.annotation.Nullable String acceptLanguage) throws ApiException { + ApiResponse> localVarResp = getBillingTypesWithHttpInfo(acceptLanguage); + return localVarResp.getData(); + } + + /** + * Get a list of billing types + * List of all billing types. Type names are localized according to \"Accept-Language\" header. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#historia-operacji-billingowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#billing-operations\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of name translations. (optional) + * @return ApiResponse<List<BillingType>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of billing types returned successfully. -
401 Unauthorized -
+ */ + public ApiResponse> getBillingTypesWithHttpInfo(@javax.annotation.Nullable String acceptLanguage) throws ApiException { + okhttp3.Call localVarCall = getBillingTypesValidateBeforeCall(acceptLanguage, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of billing types (asynchronously) + * List of all billing types. Type names are localized according to \"Accept-Language\" header. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#historia-operacji-billingowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#billing-operations\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of name translations. (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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of billing types returned successfully. -
401 Unauthorized -
+ */ + public okhttp3.Call getBillingTypesAsync(@javax.annotation.Nullable String acceptLanguage, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getBillingTypesValidateBeforeCall(acceptLanguage, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/CategoriesAndParametersApi.java b/src/main/java/pl/wtx/allegro/api/client/CategoriesAndParametersApi.java new file mode 100644 index 0000000..b36e913 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/CategoriesAndParametersApi.java @@ -0,0 +1,952 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.CategoriesDto; +import pl.wtx.allegro.api.client.model.CategoryDto; +import pl.wtx.allegro.api.client.model.CategoryEventsResponse; +import pl.wtx.allegro.api.client.model.CategoryParameterList; +import pl.wtx.allegro.api.client.model.CategoryParametersScheduledChangesResponse; +import pl.wtx.allegro.api.client.model.CategorySuggestionResponse; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import java.time.OffsetDateTime; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CategoriesAndParametersApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CategoriesAndParametersApi() { + this(Configuration.getDefaultApiClient()); + } + + public CategoriesAndParametersApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for categorySuggestionUsingGET + * @param name Product name for which you want to get suggested categories. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Category suggestion returned successfully. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
422 Unprocessable Entity -
+ */ + public okhttp3.Call categorySuggestionUsingGETCall(@javax.annotation.Nonnull String name, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/matching-categories"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (name != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("name", name)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call categorySuggestionUsingGETValidateBeforeCall(@javax.annotation.Nonnull String name, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling categorySuggestionUsingGET(Async)"); + } + + return categorySuggestionUsingGETCall(name, _callback); + + } + + /** + * Get categories suggestions + * Use this resource to receive suggested categories for given phrase. Read more: <a href=\"../../news/udostepnilismy-nowy-zasob-dzieki-ktoremu-sprawdzisz-sugerowane-kategorie-dla-podanej-frazy-4RAl9jwX1FW\" target=\"_blank\">PL</a> / <a href=\"../../news/we-have-introduced-a-new-resource-that-allows-you-to-retrieve-the-suggested-categories-for-the-given-phrase-v8Wdy1EOyF0\" target=\"_blank\">EN</a>. + * @param name Product name for which you want to get suggested categories. (required) + * @return CategorySuggestionResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Category suggestion returned successfully. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
422 Unprocessable Entity -
+ */ + public CategorySuggestionResponse categorySuggestionUsingGET(@javax.annotation.Nonnull String name) throws ApiException { + ApiResponse localVarResp = categorySuggestionUsingGETWithHttpInfo(name); + return localVarResp.getData(); + } + + /** + * Get categories suggestions + * Use this resource to receive suggested categories for given phrase. Read more: <a href=\"../../news/udostepnilismy-nowy-zasob-dzieki-ktoremu-sprawdzisz-sugerowane-kategorie-dla-podanej-frazy-4RAl9jwX1FW\" target=\"_blank\">PL</a> / <a href=\"../../news/we-have-introduced-a-new-resource-that-allows-you-to-retrieve-the-suggested-categories-for-the-given-phrase-v8Wdy1EOyF0\" target=\"_blank\">EN</a>. + * @param name Product name for which you want to get suggested categories. (required) + * @return ApiResponse<CategorySuggestionResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Category suggestion returned successfully. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
422 Unprocessable Entity -
+ */ + public ApiResponse categorySuggestionUsingGETWithHttpInfo(@javax.annotation.Nonnull String name) throws ApiException { + okhttp3.Call localVarCall = categorySuggestionUsingGETValidateBeforeCall(name, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get categories suggestions (asynchronously) + * Use this resource to receive suggested categories for given phrase. Read more: <a href=\"../../news/udostepnilismy-nowy-zasob-dzieki-ktoremu-sprawdzisz-sugerowane-kategorie-dla-podanej-frazy-4RAl9jwX1FW\" target=\"_blank\">PL</a> / <a href=\"../../news/we-have-introduced-a-new-resource-that-allows-you-to-retrieve-the-suggested-categories-for-the-given-phrase-v8Wdy1EOyF0\" target=\"_blank\">EN</a>. + * @param name Product name for which you want to get suggested categories. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Category suggestion returned successfully. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
422 Unprocessable Entity -
+ */ + public okhttp3.Call categorySuggestionUsingGETAsync(@javax.annotation.Nonnull String name, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = categorySuggestionUsingGETValidateBeforeCall(name, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCategoriesUsingGET + * @param parentId The ID of the category which children should be returned. If omitted, the list of main Allegro categories will be returned. (optional, default to 954b95b6-43cf-4104-8354-dea4d9b10ddf) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of categories returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public okhttp3.Call getCategoriesUsingGETCall(@javax.annotation.Nullable String parentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/categories"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (parentId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("parent.id", parentId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCategoriesUsingGETValidateBeforeCall(@javax.annotation.Nullable String parentId, final ApiCallback _callback) throws ApiException { + return getCategoriesUsingGETCall(parentId, _callback); + + } + + /** + * Get IDs of Allegro categories + * Use this resource to traverse the Allegro categories tree. It returns the list of the given category's children or a list of the main Allegro categories. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#uzupelnij-kategorie-i-parametry\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#provide-category-and-parameters\" target=\"_blank\">EN</a>. + * @param parentId The ID of the category which children should be returned. If omitted, the list of main Allegro categories will be returned. (optional, default to 954b95b6-43cf-4104-8354-dea4d9b10ddf) + * @return CategoriesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of categories returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public CategoriesDto getCategoriesUsingGET(@javax.annotation.Nullable String parentId) throws ApiException { + ApiResponse localVarResp = getCategoriesUsingGETWithHttpInfo(parentId); + return localVarResp.getData(); + } + + /** + * Get IDs of Allegro categories + * Use this resource to traverse the Allegro categories tree. It returns the list of the given category's children or a list of the main Allegro categories. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#uzupelnij-kategorie-i-parametry\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#provide-category-and-parameters\" target=\"_blank\">EN</a>. + * @param parentId The ID of the category which children should be returned. If omitted, the list of main Allegro categories will be returned. (optional, default to 954b95b6-43cf-4104-8354-dea4d9b10ddf) + * @return ApiResponse<CategoriesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of categories returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public ApiResponse getCategoriesUsingGETWithHttpInfo(@javax.annotation.Nullable String parentId) throws ApiException { + okhttp3.Call localVarCall = getCategoriesUsingGETValidateBeforeCall(parentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get IDs of Allegro categories (asynchronously) + * Use this resource to traverse the Allegro categories tree. It returns the list of the given category's children or a list of the main Allegro categories. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#uzupelnij-kategorie-i-parametry\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#provide-category-and-parameters\" target=\"_blank\">EN</a>. + * @param parentId The ID of the category which children should be returned. If omitted, the list of main Allegro categories will be returned. (optional, default to 954b95b6-43cf-4104-8354-dea4d9b10ddf) + * @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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of categories returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public okhttp3.Call getCategoriesUsingGETAsync(@javax.annotation.Nullable String parentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCategoriesUsingGETValidateBeforeCall(parentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCategoryEventsUsingGET1 + * @param from The ID of the last seen event. Changes that occurred after the given event will be returned. (optional) + * @param limit The number of events that will be returned in the response. (optional, default to 100) + * @param type The types of events that will be returned in the response. All types of events are returned by default. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of category changes returned successfully -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public okhttp3.Call getCategoryEventsUsingGET1Call(@javax.annotation.Nullable String from, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List type, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/category-events"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (from != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("from", from)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (type != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "type", type)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCategoryEventsUsingGET1ValidateBeforeCall(@javax.annotation.Nullable String from, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List type, final ApiCallback _callback) throws ApiException { + return getCategoryEventsUsingGET1Call(from, limit, type, _callback); + + } + + /** + * Get changes in categories + * Use this resource to get information about changes in categories. It returns changes that occurred in the last 3 months. At present we support the following changes: - CATEGORY_CREATED - new category was created. - CATEGORY_RENAMED - category name has been changed. - CATEGORY_MOVED - category has been moved to a different place in category tree, category parent id field is changed. - CATEGORY_DELETED - category is no longer available, category from redirectCategory field should be used instead. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#dziennik-zmian-w-kategoriach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#event-journal-in-categories\" target=\"_blank\">EN</a>. + * @param from The ID of the last seen event. Changes that occurred after the given event will be returned. (optional) + * @param limit The number of events that will be returned in the response. (optional, default to 100) + * @param type The types of events that will be returned in the response. All types of events are returned by default. (optional) + * @return CategoryEventsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of category changes returned successfully -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public CategoryEventsResponse getCategoryEventsUsingGET1(@javax.annotation.Nullable String from, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List type) throws ApiException { + ApiResponse localVarResp = getCategoryEventsUsingGET1WithHttpInfo(from, limit, type); + return localVarResp.getData(); + } + + /** + * Get changes in categories + * Use this resource to get information about changes in categories. It returns changes that occurred in the last 3 months. At present we support the following changes: - CATEGORY_CREATED - new category was created. - CATEGORY_RENAMED - category name has been changed. - CATEGORY_MOVED - category has been moved to a different place in category tree, category parent id field is changed. - CATEGORY_DELETED - category is no longer available, category from redirectCategory field should be used instead. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#dziennik-zmian-w-kategoriach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#event-journal-in-categories\" target=\"_blank\">EN</a>. + * @param from The ID of the last seen event. Changes that occurred after the given event will be returned. (optional) + * @param limit The number of events that will be returned in the response. (optional, default to 100) + * @param type The types of events that will be returned in the response. All types of events are returned by default. (optional) + * @return ApiResponse<CategoryEventsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of category changes returned successfully -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public ApiResponse getCategoryEventsUsingGET1WithHttpInfo(@javax.annotation.Nullable String from, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List type) throws ApiException { + okhttp3.Call localVarCall = getCategoryEventsUsingGET1ValidateBeforeCall(from, limit, type, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get changes in categories (asynchronously) + * Use this resource to get information about changes in categories. It returns changes that occurred in the last 3 months. At present we support the following changes: - CATEGORY_CREATED - new category was created. - CATEGORY_RENAMED - category name has been changed. - CATEGORY_MOVED - category has been moved to a different place in category tree, category parent id field is changed. - CATEGORY_DELETED - category is no longer available, category from redirectCategory field should be used instead. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#dziennik-zmian-w-kategoriach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#event-journal-in-categories\" target=\"_blank\">EN</a>. + * @param from The ID of the last seen event. Changes that occurred after the given event will be returned. (optional) + * @param limit The number of events that will be returned in the response. (optional, default to 100) + * @param type The types of events that will be returned in the response. All types of events are returned by default. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of category changes returned successfully -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public okhttp3.Call getCategoryEventsUsingGET1Async(@javax.annotation.Nullable String from, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List type, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCategoryEventsUsingGET1ValidateBeforeCall(from, limit, type, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCategoryParametersScheduledChangesUsingGET1 + * @param scheduledForGte The minimum date and time from which the change will be effective from in ISO 8601 format. Should be greater than the current date time and less than 3 months from the current date. (optional) + * @param scheduledForLte The maximum date and time from which the change will be effective from in ISO 8601 format. Should be greater than the current date time and less than 3 months from the current date. (optional) + * @param scheduledAtGte The minimum date and time at which the change was scheduled in ISO 8601 format. (optional) + * @param scheduledAtLte The maximum date and time at which the change was scheduled in ISO 8601 format. (optional) + * @param type The types of changes that will be returned in the response. All types of changes are returned by default. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Category parameters changes returned successfully. -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public okhttp3.Call getCategoryParametersScheduledChangesUsingGET1Call(@javax.annotation.Nullable OffsetDateTime scheduledForGte, @javax.annotation.Nullable OffsetDateTime scheduledForLte, @javax.annotation.Nullable OffsetDateTime scheduledAtGte, @javax.annotation.Nullable OffsetDateTime scheduledAtLte, @javax.annotation.Nullable List type, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/category-parameters-scheduled-changes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (scheduledForGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("scheduledFor.gte", scheduledForGte)); + } + + if (scheduledForLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("scheduledFor.lte", scheduledForLte)); + } + + if (scheduledAtGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("scheduledAt.gte", scheduledAtGte)); + } + + if (scheduledAtLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("scheduledAt.lte", scheduledAtLte)); + } + + if (type != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "type", type)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCategoryParametersScheduledChangesUsingGET1ValidateBeforeCall(@javax.annotation.Nullable OffsetDateTime scheduledForGte, @javax.annotation.Nullable OffsetDateTime scheduledForLte, @javax.annotation.Nullable OffsetDateTime scheduledAtGte, @javax.annotation.Nullable OffsetDateTime scheduledAtLte, @javax.annotation.Nullable List type, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + return getCategoryParametersScheduledChangesUsingGET1Call(scheduledForGte, scheduledForLte, scheduledAtGte, scheduledAtLte, type, offset, limit, _callback); + + } + + /** + * Get planned changes in category parameters + * Use this resource to get information about planned changes in category parameters. Please note that in some cases, the returned events may finally not happen in the future. At present we support the following changes: - REQUIREMENT_CHANGE - the parameter will be required in the category. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-przyszle-zmiany-w-parametrach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-future-changes-in-parameters\" target=\"_blank\">EN</a>. + * @param scheduledForGte The minimum date and time from which the change will be effective from in ISO 8601 format. Should be greater than the current date time and less than 3 months from the current date. (optional) + * @param scheduledForLte The maximum date and time from which the change will be effective from in ISO 8601 format. Should be greater than the current date time and less than 3 months from the current date. (optional) + * @param scheduledAtGte The minimum date and time at which the change was scheduled in ISO 8601 format. (optional) + * @param scheduledAtLte The maximum date and time at which the change was scheduled in ISO 8601 format. (optional) + * @param type The types of changes that will be returned in the response. All types of changes are returned by default. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 100) + * @return CategoryParametersScheduledChangesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Category parameters changes returned successfully. -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public CategoryParametersScheduledChangesResponse getCategoryParametersScheduledChangesUsingGET1(@javax.annotation.Nullable OffsetDateTime scheduledForGte, @javax.annotation.Nullable OffsetDateTime scheduledForLte, @javax.annotation.Nullable OffsetDateTime scheduledAtGte, @javax.annotation.Nullable OffsetDateTime scheduledAtLte, @javax.annotation.Nullable List type, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + ApiResponse localVarResp = getCategoryParametersScheduledChangesUsingGET1WithHttpInfo(scheduledForGte, scheduledForLte, scheduledAtGte, scheduledAtLte, type, offset, limit); + return localVarResp.getData(); + } + + /** + * Get planned changes in category parameters + * Use this resource to get information about planned changes in category parameters. Please note that in some cases, the returned events may finally not happen in the future. At present we support the following changes: - REQUIREMENT_CHANGE - the parameter will be required in the category. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-przyszle-zmiany-w-parametrach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-future-changes-in-parameters\" target=\"_blank\">EN</a>. + * @param scheduledForGte The minimum date and time from which the change will be effective from in ISO 8601 format. Should be greater than the current date time and less than 3 months from the current date. (optional) + * @param scheduledForLte The maximum date and time from which the change will be effective from in ISO 8601 format. Should be greater than the current date time and less than 3 months from the current date. (optional) + * @param scheduledAtGte The minimum date and time at which the change was scheduled in ISO 8601 format. (optional) + * @param scheduledAtLte The maximum date and time at which the change was scheduled in ISO 8601 format. (optional) + * @param type The types of changes that will be returned in the response. All types of changes are returned by default. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 100) + * @return ApiResponse<CategoryParametersScheduledChangesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Category parameters changes returned successfully. -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public ApiResponse getCategoryParametersScheduledChangesUsingGET1WithHttpInfo(@javax.annotation.Nullable OffsetDateTime scheduledForGte, @javax.annotation.Nullable OffsetDateTime scheduledForLte, @javax.annotation.Nullable OffsetDateTime scheduledAtGte, @javax.annotation.Nullable OffsetDateTime scheduledAtLte, @javax.annotation.Nullable List type, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + okhttp3.Call localVarCall = getCategoryParametersScheduledChangesUsingGET1ValidateBeforeCall(scheduledForGte, scheduledForLte, scheduledAtGte, scheduledAtLte, type, offset, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get planned changes in category parameters (asynchronously) + * Use this resource to get information about planned changes in category parameters. Please note that in some cases, the returned events may finally not happen in the future. At present we support the following changes: - REQUIREMENT_CHANGE - the parameter will be required in the category. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-przyszle-zmiany-w-parametrach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-future-changes-in-parameters\" target=\"_blank\">EN</a>. + * @param scheduledForGte The minimum date and time from which the change will be effective from in ISO 8601 format. Should be greater than the current date time and less than 3 months from the current date. (optional) + * @param scheduledForLte The maximum date and time from which the change will be effective from in ISO 8601 format. Should be greater than the current date time and less than 3 months from the current date. (optional) + * @param scheduledAtGte The minimum date and time at which the change was scheduled in ISO 8601 format. (optional) + * @param scheduledAtLte The maximum date and time at which the change was scheduled in ISO 8601 format. (optional) + * @param type The types of changes that will be returned in the response. All types of changes are returned by default. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Category parameters changes returned successfully. -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public okhttp3.Call getCategoryParametersScheduledChangesUsingGET1Async(@javax.annotation.Nullable OffsetDateTime scheduledForGte, @javax.annotation.Nullable OffsetDateTime scheduledForLte, @javax.annotation.Nullable OffsetDateTime scheduledAtGte, @javax.annotation.Nullable OffsetDateTime scheduledAtLte, @javax.annotation.Nullable List type, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCategoryParametersScheduledChangesUsingGET1ValidateBeforeCall(scheduledForGte, scheduledForLte, scheduledAtGte, scheduledAtLte, type, offset, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCategoryUsingGET1 + * @param categoryId The category ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The details of a category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public okhttp3.Call getCategoryUsingGET1Call(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/categories/{categoryId}" + .replace("{" + "categoryId" + "}", localVarApiClient.escapeString(categoryId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCategoryUsingGET1ValidateBeforeCall(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'categoryId' is set + if (categoryId == null) { + throw new ApiException("Missing the required parameter 'categoryId' when calling getCategoryUsingGET1(Async)"); + } + + return getCategoryUsingGET1Call(categoryId, _callback); + + } + + /** + * Get a category by ID + * Use this resource to get the details of a specific category. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-utworzyc-nowy-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-create-a-product\" target=\"_blank\">EN</a>. + * @param categoryId The category ID. (required) + * @return CategoryDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The details of a category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public CategoryDto getCategoryUsingGET1(@javax.annotation.Nonnull String categoryId) throws ApiException { + ApiResponse localVarResp = getCategoryUsingGET1WithHttpInfo(categoryId); + return localVarResp.getData(); + } + + /** + * Get a category by ID + * Use this resource to get the details of a specific category. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-utworzyc-nowy-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-create-a-product\" target=\"_blank\">EN</a>. + * @param categoryId The category ID. (required) + * @return ApiResponse<CategoryDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The details of a category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public ApiResponse getCategoryUsingGET1WithHttpInfo(@javax.annotation.Nonnull String categoryId) throws ApiException { + okhttp3.Call localVarCall = getCategoryUsingGET1ValidateBeforeCall(categoryId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a category by ID (asynchronously) + * Use this resource to get the details of a specific category. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-utworzyc-nowy-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-create-a-product\" target=\"_blank\">EN</a>. + * @param categoryId The category 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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The details of a category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public okhttp3.Call getCategoryUsingGET1Async(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCategoryUsingGET1ValidateBeforeCall(categoryId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getFlatParametersUsingGET2 + * @param categoryId The category ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of parameters for the category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public okhttp3.Call getFlatParametersUsingGET2Call(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/categories/{categoryId}/parameters" + .replace("{" + "categoryId" + "}", localVarApiClient.escapeString(categoryId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFlatParametersUsingGET2ValidateBeforeCall(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'categoryId' is set + if (categoryId == null) { + throw new ApiException("Missing the required parameter 'categoryId' when calling getFlatParametersUsingGET2(Async)"); + } + + return getFlatParametersUsingGET2Call(categoryId, _callback); + + } + + /** + * Get parameters supported by a category + * Use this resource to get the list of parameters that are supported by the given category. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#parametry-ofertowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-parameters\" target=\"_blank\">EN</a>. + * @param categoryId The category ID. (required) + * @return CategoryParameterList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of parameters for the category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public CategoryParameterList getFlatParametersUsingGET2(@javax.annotation.Nonnull String categoryId) throws ApiException { + ApiResponse localVarResp = getFlatParametersUsingGET2WithHttpInfo(categoryId); + return localVarResp.getData(); + } + + /** + * Get parameters supported by a category + * Use this resource to get the list of parameters that are supported by the given category. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#parametry-ofertowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-parameters\" target=\"_blank\">EN</a>. + * @param categoryId The category ID. (required) + * @return ApiResponse<CategoryParameterList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of parameters for the category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public ApiResponse getFlatParametersUsingGET2WithHttpInfo(@javax.annotation.Nonnull String categoryId) throws ApiException { + okhttp3.Call localVarCall = getFlatParametersUsingGET2ValidateBeforeCall(categoryId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get parameters supported by a category (asynchronously) + * Use this resource to get the list of parameters that are supported by the given category. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#parametry-ofertowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-parameters\" target=\"_blank\">EN</a>. + * @param categoryId The category 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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of parameters for the category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public okhttp3.Call getFlatParametersUsingGET2Async(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getFlatParametersUsingGET2ValidateBeforeCall(categoryId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/CharityApi.java b/src/main/java/pl/wtx/allegro/api/client/CharityApi.java new file mode 100644 index 0000000..30d871c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/CharityApi.java @@ -0,0 +1,230 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.FundraisingCampaigns; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CharityApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CharityApi() { + this(Configuration.getDefaultApiClient()); + } + + public CharityApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for searchFundraisingCampaigns + * @param limit Maximum number of returned results. (required) + * @param phrase Fundraising campaign name or it's Organization name prefix to search for. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The request successfully returns the search result. -
400 Invalid or missing query parameters. -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call searchFundraisingCampaignsCall(@javax.annotation.Nonnull Integer limit, @javax.annotation.Nonnull String phrase, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/charity/fundraising-campaigns"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (phrase != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("phrase", phrase)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.beta.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call searchFundraisingCampaignsValidateBeforeCall(@javax.annotation.Nonnull Integer limit, @javax.annotation.Nonnull String phrase, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'limit' is set + if (limit == null) { + throw new ApiException("Missing the required parameter 'limit' when calling searchFundraisingCampaigns(Async)"); + } + + // verify the required parameter 'phrase' is set + if (phrase == null) { + throw new ApiException("Missing the required parameter 'phrase' when calling searchFundraisingCampaigns(Async)"); + } + + return searchFundraisingCampaignsCall(limit, phrase, _callback); + + } + + /** + * Search fundraising campaigns + * Use this resource to search fundraising campaigns. Read more: <a href=\"../../news/wystaw-oferte-charytatywna-na-allegro-MR87PBxZySY\" target=\"_blank\">PL</a> / <a href=\"../../news/list-a-charity-offer-on-allegro-LRV0572GOhr\" target=\"_blank\">EN</a>. + * @param limit Maximum number of returned results. (required) + * @param phrase Fundraising campaign name or it's Organization name prefix to search for. (required) + * @return FundraisingCampaigns + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The request successfully returns the search result. -
400 Invalid or missing query parameters. -
401 Unauthorized -
403 Forbidden -
+ */ + public FundraisingCampaigns searchFundraisingCampaigns(@javax.annotation.Nonnull Integer limit, @javax.annotation.Nonnull String phrase) throws ApiException { + ApiResponse localVarResp = searchFundraisingCampaignsWithHttpInfo(limit, phrase); + return localVarResp.getData(); + } + + /** + * Search fundraising campaigns + * Use this resource to search fundraising campaigns. Read more: <a href=\"../../news/wystaw-oferte-charytatywna-na-allegro-MR87PBxZySY\" target=\"_blank\">PL</a> / <a href=\"../../news/list-a-charity-offer-on-allegro-LRV0572GOhr\" target=\"_blank\">EN</a>. + * @param limit Maximum number of returned results. (required) + * @param phrase Fundraising campaign name or it's Organization name prefix to search for. (required) + * @return ApiResponse<FundraisingCampaigns> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The request successfully returns the search result. -
400 Invalid or missing query parameters. -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse searchFundraisingCampaignsWithHttpInfo(@javax.annotation.Nonnull Integer limit, @javax.annotation.Nonnull String phrase) throws ApiException { + okhttp3.Call localVarCall = searchFundraisingCampaignsValidateBeforeCall(limit, phrase, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Search fundraising campaigns (asynchronously) + * Use this resource to search fundraising campaigns. Read more: <a href=\"../../news/wystaw-oferte-charytatywna-na-allegro-MR87PBxZySY\" target=\"_blank\">PL</a> / <a href=\"../../news/list-a-charity-offer-on-allegro-LRV0572GOhr\" target=\"_blank\">EN</a>. + * @param limit Maximum number of returned results. (required) + * @param phrase Fundraising campaign name or it's Organization name prefix to search for. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The request successfully returns the search result. -
400 Invalid or missing query parameters. -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call searchFundraisingCampaignsAsync(@javax.annotation.Nonnull Integer limit, @javax.annotation.Nonnull String phrase, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = searchFundraisingCampaignsValidateBeforeCall(limit, phrase, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/ClassifiedsApi.java b/src/main/java/pl/wtx/allegro/api/client/ClassifiedsApi.java new file mode 100644 index 0000000..c6eacca --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/ClassifiedsApi.java @@ -0,0 +1,975 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.ClassifiedPackageConfig; +import pl.wtx.allegro.api.client.model.ClassifiedPackageConfigs; +import pl.wtx.allegro.api.client.model.ClassifiedPackages; +import pl.wtx.allegro.api.client.model.ClassifiedResponse; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.OfferStatsResponseDto; +import java.time.OffsetDateTime; +import pl.wtx.allegro.api.client.model.SellerOfferStatsResponseDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ClassifiedsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ClassifiedsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ClassifiedsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for assignClassifiedPackagesUsingPUT + * @param offerId The offer ID. (required) + * @param classifiedPackages Packages that should be assigned to the classified. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Packages have been successfully assigned to the classified. -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Classified not found -
422 Validation error -
+ */ + public okhttp3.Call assignClassifiedPackagesUsingPUTCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull ClassifiedPackages classifiedPackages, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = classifiedPackages; + + // create path and map variables + String localVarPath = "/sale/offer-classifieds-packages/{offerId}" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call assignClassifiedPackagesUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull ClassifiedPackages classifiedPackages, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling assignClassifiedPackagesUsingPUT(Async)"); + } + + // verify the required parameter 'classifiedPackages' is set + if (classifiedPackages == null) { + throw new ApiException("Missing the required parameter 'classifiedPackages' when calling assignClassifiedPackagesUsingPUT(Async)"); + } + + return assignClassifiedPackagesUsingPUTCall(offerId, classifiedPackages, _callback); + + } + + /** + * Assign packages to a classified + * Use this resource to assign classified packages to an offer. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#dodatkowe-opcje-promowania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#additional-promo-options\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @param classifiedPackages Packages that should be assigned to the classified. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Packages have been successfully assigned to the classified. -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Classified not found -
422 Validation error -
+ */ + public void assignClassifiedPackagesUsingPUT(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull ClassifiedPackages classifiedPackages) throws ApiException { + assignClassifiedPackagesUsingPUTWithHttpInfo(offerId, classifiedPackages); + } + + /** + * Assign packages to a classified + * Use this resource to assign classified packages to an offer. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#dodatkowe-opcje-promowania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#additional-promo-options\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @param classifiedPackages Packages that should be assigned to the classified. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Packages have been successfully assigned to the classified. -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Classified not found -
422 Validation error -
+ */ + public ApiResponse assignClassifiedPackagesUsingPUTWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull ClassifiedPackages classifiedPackages) throws ApiException { + okhttp3.Call localVarCall = assignClassifiedPackagesUsingPUTValidateBeforeCall(offerId, classifiedPackages, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Assign packages to a classified (asynchronously) + * Use this resource to assign classified packages to an offer. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#dodatkowe-opcje-promowania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#additional-promo-options\" target=\"_blank\">EN</a>. + * @param offerId The offer ID. (required) + * @param classifiedPackages Packages that should be assigned to the classified. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Packages have been successfully assigned to the classified. -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Classified not found -
422 Validation error -
+ */ + public okhttp3.Call assignClassifiedPackagesUsingPUTAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull ClassifiedPackages classifiedPackages, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = assignClassifiedPackagesUsingPUTValidateBeforeCall(offerId, classifiedPackages, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for classifiedOffersStatsGET + * @param offerId List of offer Ids, maximum 50 values. (required) + * @param dateGte The maximum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @param dateLte The minimum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time and greater than date.lte. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns offer's statistics list -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call classifiedOffersStatsGETCall(@javax.annotation.Nonnull List offerId, @javax.annotation.Nullable OffsetDateTime dateGte, @javax.annotation.Nullable OffsetDateTime dateLte, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/classified-offers-stats"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offerId != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "offer.id", offerId)); + } + + if (dateGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("date.gte", dateGte)); + } + + if (dateLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("date.lte", dateLte)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call classifiedOffersStatsGETValidateBeforeCall(@javax.annotation.Nonnull List offerId, @javax.annotation.Nullable OffsetDateTime dateGte, @javax.annotation.Nullable OffsetDateTime dateLte, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling classifiedOffersStatsGET(Async)"); + } + + return classifiedOffersStatsGETCall(offerId, dateGte, dateLte, _callback); + + } + + /** + * Get the advertisements daily statistics + * This endpoint returns daily statistics collected for a list of advertisements in a given date range. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#statystyki-wybranych-ogloszen\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#statistics-of-selected-classified-ads\" target=\"_blank\">EN</a>. + * @param offerId List of offer Ids, maximum 50 values. (required) + * @param dateGte The maximum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @param dateLte The minimum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time and greater than date.lte. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @return OfferStatsResponseDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns offer's statistics list -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public OfferStatsResponseDto classifiedOffersStatsGET(@javax.annotation.Nonnull List offerId, @javax.annotation.Nullable OffsetDateTime dateGte, @javax.annotation.Nullable OffsetDateTime dateLte) throws ApiException { + ApiResponse localVarResp = classifiedOffersStatsGETWithHttpInfo(offerId, dateGte, dateLte); + return localVarResp.getData(); + } + + /** + * Get the advertisements daily statistics + * This endpoint returns daily statistics collected for a list of advertisements in a given date range. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#statystyki-wybranych-ogloszen\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#statistics-of-selected-classified-ads\" target=\"_blank\">EN</a>. + * @param offerId List of offer Ids, maximum 50 values. (required) + * @param dateGte The maximum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @param dateLte The minimum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time and greater than date.lte. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @return ApiResponse<OfferStatsResponseDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns offer's statistics list -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ApiResponse classifiedOffersStatsGETWithHttpInfo(@javax.annotation.Nonnull List offerId, @javax.annotation.Nullable OffsetDateTime dateGte, @javax.annotation.Nullable OffsetDateTime dateLte) throws ApiException { + okhttp3.Call localVarCall = classifiedOffersStatsGETValidateBeforeCall(offerId, dateGte, dateLte, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the advertisements daily statistics (asynchronously) + * This endpoint returns daily statistics collected for a list of advertisements in a given date range. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#statystyki-wybranych-ogloszen\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#statistics-of-selected-classified-ads\" target=\"_blank\">EN</a>. + * @param offerId List of offer Ids, maximum 50 values. (required) + * @param dateGte The maximum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @param dateLte The minimum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time and greater than date.lte. The difference between date.gte and date.lte should be less than 3 months. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns offer's statistics list -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call classifiedOffersStatsGETAsync(@javax.annotation.Nonnull List offerId, @javax.annotation.Nullable OffsetDateTime dateGte, @javax.annotation.Nullable OffsetDateTime dateLte, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = classifiedOffersStatsGETValidateBeforeCall(offerId, dateGte, dateLte, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for classifiedSellerOfferStatsGET + * @param dateGte The maximum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @param dateLte The minimum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time and greater than date.lte. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns offer's statistics list -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call classifiedSellerOfferStatsGETCall(@javax.annotation.Nullable OffsetDateTime dateGte, @javax.annotation.Nullable OffsetDateTime dateLte, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/classified-seller-stats"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (dateGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("date.gte", dateGte)); + } + + if (dateLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("date.lte", dateLte)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call classifiedSellerOfferStatsGETValidateBeforeCall(@javax.annotation.Nullable OffsetDateTime dateGte, @javax.annotation.Nullable OffsetDateTime dateLte, final ApiCallback _callback) throws ApiException { + return classifiedSellerOfferStatsGETCall(dateGte, dateLte, _callback); + + } + + /** + * Get the seller's advertisements daily statistics + * This endpoint returns daily statistics collected for a list of advertisements in a given date range for logged user. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#statystyki-wszystkich-ogloszen-sprzedawcy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#statistics-of-seller-s-classified-ads\" target=\"_blank\">EN</a>. + * @param dateGte The maximum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @param dateLte The minimum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time and greater than date.lte. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @return SellerOfferStatsResponseDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns offer's statistics list -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public SellerOfferStatsResponseDto classifiedSellerOfferStatsGET(@javax.annotation.Nullable OffsetDateTime dateGte, @javax.annotation.Nullable OffsetDateTime dateLte) throws ApiException { + ApiResponse localVarResp = classifiedSellerOfferStatsGETWithHttpInfo(dateGte, dateLte); + return localVarResp.getData(); + } + + /** + * Get the seller's advertisements daily statistics + * This endpoint returns daily statistics collected for a list of advertisements in a given date range for logged user. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#statystyki-wszystkich-ogloszen-sprzedawcy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#statistics-of-seller-s-classified-ads\" target=\"_blank\">EN</a>. + * @param dateGte The maximum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @param dateLte The minimum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time and greater than date.lte. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @return ApiResponse<SellerOfferStatsResponseDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns offer's statistics list -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ApiResponse classifiedSellerOfferStatsGETWithHttpInfo(@javax.annotation.Nullable OffsetDateTime dateGte, @javax.annotation.Nullable OffsetDateTime dateLte) throws ApiException { + okhttp3.Call localVarCall = classifiedSellerOfferStatsGETValidateBeforeCall(dateGte, dateLte, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the seller's advertisements daily statistics (asynchronously) + * This endpoint returns daily statistics collected for a list of advertisements in a given date range for logged user. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#statystyki-wszystkich-ogloszen-sprzedawcy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#statistics-of-seller-s-classified-ads\" target=\"_blank\">EN</a>. + * @param dateGte The maximum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time. The difference between date.gte and date.lte should be less than 3 months. (optional) + * @param dateLte The minimum date and time from which the events will be fetched in ISO 8601 format. The value should be less than the current date time and greater than date.lte. The difference between date.gte and date.lte should be less than 3 months. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns offer's statistics list -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call classifiedSellerOfferStatsGETAsync(@javax.annotation.Nullable OffsetDateTime dateGte, @javax.annotation.Nullable OffsetDateTime dateLte, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = classifiedSellerOfferStatsGETValidateBeforeCall(dateGte, dateLte, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getClassifiedPackageConfigurationUsingGET + * @param packageId The classifieds package ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The package's configuration returned successfully. -
400 Bad request -
401 Unauthorized -
404 The classifieds package not found. -
+ */ + public okhttp3.Call getClassifiedPackageConfigurationUsingGETCall(@javax.annotation.Nonnull String packageId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/classifieds-packages/{packageId}" + .replace("{" + "packageId" + "}", localVarApiClient.escapeString(packageId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getClassifiedPackageConfigurationUsingGETValidateBeforeCall(@javax.annotation.Nonnull String packageId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'packageId' is set + if (packageId == null) { + throw new ApiException("Missing the required parameter 'packageId' when calling getClassifiedPackageConfigurationUsingGET(Async)"); + } + + return getClassifiedPackageConfigurationUsingGETCall(packageId, _callback); + + } + + /** + * Get the configuration of a package + * Use this resource to retrieve the configuration of a classifieds package. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#lista-pakietow-i-opcji-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#list-of-promo-options\" target=\"_blank\">EN</a>. + * @param packageId The classifieds package ID. (required) + * @return ClassifiedPackageConfig + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The package's configuration returned successfully. -
400 Bad request -
401 Unauthorized -
404 The classifieds package not found. -
+ */ + public ClassifiedPackageConfig getClassifiedPackageConfigurationUsingGET(@javax.annotation.Nonnull String packageId) throws ApiException { + ApiResponse localVarResp = getClassifiedPackageConfigurationUsingGETWithHttpInfo(packageId); + return localVarResp.getData(); + } + + /** + * Get the configuration of a package + * Use this resource to retrieve the configuration of a classifieds package. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#lista-pakietow-i-opcji-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#list-of-promo-options\" target=\"_blank\">EN</a>. + * @param packageId The classifieds package ID. (required) + * @return ApiResponse<ClassifiedPackageConfig> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The package's configuration returned successfully. -
400 Bad request -
401 Unauthorized -
404 The classifieds package not found. -
+ */ + public ApiResponse getClassifiedPackageConfigurationUsingGETWithHttpInfo(@javax.annotation.Nonnull String packageId) throws ApiException { + okhttp3.Call localVarCall = getClassifiedPackageConfigurationUsingGETValidateBeforeCall(packageId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the configuration of a package (asynchronously) + * Use this resource to retrieve the configuration of a classifieds package. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#lista-pakietow-i-opcji-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#list-of-promo-options\" target=\"_blank\">EN</a>. + * @param packageId The classifieds package 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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The package's configuration returned successfully. -
400 Bad request -
401 Unauthorized -
404 The classifieds package not found. -
+ */ + public okhttp3.Call getClassifiedPackageConfigurationUsingGETAsync(@javax.annotation.Nonnull String packageId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getClassifiedPackageConfigurationUsingGETValidateBeforeCall(packageId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getClassifiedPackageConfigurationsForCategoryUsingGET + * @param categoryId The category ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Package configurations for the category returned successfully. -
400 Bad request -
401 Unauthorized -
+ */ + public okhttp3.Call getClassifiedPackageConfigurationsForCategoryUsingGETCall(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/classifieds-packages"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (categoryId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("category.id", categoryId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getClassifiedPackageConfigurationsForCategoryUsingGETValidateBeforeCall(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'categoryId' is set + if (categoryId == null) { + throw new ApiException("Missing the required parameter 'categoryId' when calling getClassifiedPackageConfigurationsForCategoryUsingGET(Async)"); + } + + return getClassifiedPackageConfigurationsForCategoryUsingGETCall(categoryId, _callback); + + } + + /** + * Get configurations of packages + * Use this resource to retrieve configurations of classifieds packages for a category. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#lista-pakietow-i-opcji-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#list-of-promo-options\" target=\"_blank\">EN</a>. + * @param categoryId The category ID. (required) + * @return ClassifiedPackageConfigs + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Package configurations for the category returned successfully. -
400 Bad request -
401 Unauthorized -
+ */ + public ClassifiedPackageConfigs getClassifiedPackageConfigurationsForCategoryUsingGET(@javax.annotation.Nonnull String categoryId) throws ApiException { + ApiResponse localVarResp = getClassifiedPackageConfigurationsForCategoryUsingGETWithHttpInfo(categoryId); + return localVarResp.getData(); + } + + /** + * Get configurations of packages + * Use this resource to retrieve configurations of classifieds packages for a category. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#lista-pakietow-i-opcji-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#list-of-promo-options\" target=\"_blank\">EN</a>. + * @param categoryId The category ID. (required) + * @return ApiResponse<ClassifiedPackageConfigs> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Package configurations for the category returned successfully. -
400 Bad request -
401 Unauthorized -
+ */ + public ApiResponse getClassifiedPackageConfigurationsForCategoryUsingGETWithHttpInfo(@javax.annotation.Nonnull String categoryId) throws ApiException { + okhttp3.Call localVarCall = getClassifiedPackageConfigurationsForCategoryUsingGETValidateBeforeCall(categoryId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get configurations of packages (asynchronously) + * Use this resource to retrieve configurations of classifieds packages for a category. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#lista-pakietow-i-opcji-dodatkowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#list-of-promo-options\" target=\"_blank\">EN</a>. + * @param categoryId The category 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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Package configurations for the category returned successfully. -
400 Bad request -
401 Unauthorized -
+ */ + public okhttp3.Call getClassifiedPackageConfigurationsForCategoryUsingGETAsync(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getClassifiedPackageConfigurationsForCategoryUsingGETValidateBeforeCall(categoryId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getClassifiedPackagesUsingGET + * @param offerId Offer ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Packages returned successfully -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Classified not found -
+ */ + public okhttp3.Call getClassifiedPackagesUsingGETCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-classifieds-packages/{offerId}" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getClassifiedPackagesUsingGETValidateBeforeCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling getClassifiedPackagesUsingGET(Async)"); + } + + return getClassifiedPackagesUsingGETCall(offerId, _callback); + + } + + /** + * Get classified packages assigned to an offer + * Use this resource to retrieve classified packages currently assigned to an offer. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#dodatkowe-opcje-promowania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#additional-promo-options\" target=\"_blank\">EN</a>. + * @param offerId Offer ID. (required) + * @return ClassifiedResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Packages returned successfully -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Classified not found -
+ */ + public ClassifiedResponse getClassifiedPackagesUsingGET(@javax.annotation.Nonnull String offerId) throws ApiException { + ApiResponse localVarResp = getClassifiedPackagesUsingGETWithHttpInfo(offerId); + return localVarResp.getData(); + } + + /** + * Get classified packages assigned to an offer + * Use this resource to retrieve classified packages currently assigned to an offer. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#dodatkowe-opcje-promowania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#additional-promo-options\" target=\"_blank\">EN</a>. + * @param offerId Offer ID. (required) + * @return ApiResponse<ClassifiedResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Packages returned successfully -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Classified not found -
+ */ + public ApiResponse getClassifiedPackagesUsingGETWithHttpInfo(@javax.annotation.Nonnull String offerId) throws ApiException { + okhttp3.Call localVarCall = getClassifiedPackagesUsingGETValidateBeforeCall(offerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get classified packages assigned to an offer (asynchronously) + * Use this resource to retrieve classified packages currently assigned to an offer. Read more: <a href=\"../../tutorials/jak-wystawic-i-zarzadzac-ogloszeniem-K6r3Z47dKcy#dodatkowe-opcje-promowania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-classified-ads-5Ln0r6wkWs7#additional-promo-options\" target=\"_blank\">EN</a>. + * @param offerId Offer 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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Packages returned successfully -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Classified not found -
+ */ + public okhttp3.Call getClassifiedPackagesUsingGETAsync(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getClassifiedPackagesUsingGETValidateBeforeCall(offerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/CommissionRefundsApi.java b/src/main/java/pl/wtx/allegro/api/client/CommissionRefundsApi.java new file mode 100644 index 0000000..e05c3ed --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/CommissionRefundsApi.java @@ -0,0 +1,699 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.GetRefundApplications200Response; +import pl.wtx.allegro.api.client.model.RefundClaim; +import pl.wtx.allegro.api.client.model.RefundClaimRequest; +import pl.wtx.allegro.api.client.model.RefundClaimResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CommissionRefundsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CommissionRefundsApi() { + this(Configuration.getDefaultApiClient()); + } + + public CommissionRefundsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for cancelRefundApplication + * @param claimId Refund application ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Refund application was cancelled successfully. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
404 Refund application not found. -
406 Not Acceptable. -
422 Refund application has already been processed. -
+ */ + public okhttp3.Call cancelRefundApplicationCall(@javax.annotation.Nonnull String claimId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/refund-claims/{claimId}" + .replace("{" + "claimId" + "}", localVarApiClient.escapeString(claimId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call cancelRefundApplicationValidateBeforeCall(@javax.annotation.Nonnull String claimId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'claimId' is set + if (claimId == null) { + throw new ApiException("Missing the required parameter 'claimId' when calling cancelRefundApplication(Async)"); + } + + return cancelRefundApplicationCall(claimId, _callback); + + } + + /** + * Cancel a refund application + * Use this resource to cancel a refund application. This cannot be undone. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-anulowac-wniosek-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-cancel-sale-commission-refund\" target=\"_blank\">EN</a>. + * @param claimId Refund application ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Refund application was cancelled successfully. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
404 Refund application not found. -
406 Not Acceptable. -
422 Refund application has already been processed. -
+ */ + public void cancelRefundApplication(@javax.annotation.Nonnull String claimId) throws ApiException { + cancelRefundApplicationWithHttpInfo(claimId); + } + + /** + * Cancel a refund application + * Use this resource to cancel a refund application. This cannot be undone. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-anulowac-wniosek-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-cancel-sale-commission-refund\" target=\"_blank\">EN</a>. + * @param claimId Refund application ID. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Refund application was cancelled successfully. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
404 Refund application not found. -
406 Not Acceptable. -
422 Refund application has already been processed. -
+ */ + public ApiResponse cancelRefundApplicationWithHttpInfo(@javax.annotation.Nonnull String claimId) throws ApiException { + okhttp3.Call localVarCall = cancelRefundApplicationValidateBeforeCall(claimId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Cancel a refund application (asynchronously) + * Use this resource to cancel a refund application. This cannot be undone. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-anulowac-wniosek-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-cancel-sale-commission-refund\" target=\"_blank\">EN</a>. + * @param claimId Refund application 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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Refund application was cancelled successfully. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
404 Refund application not found. -
406 Not Acceptable. -
422 Refund application has already been processed. -
+ */ + public okhttp3.Call cancelRefundApplicationAsync(@javax.annotation.Nonnull String claimId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = cancelRefundApplicationValidateBeforeCall(claimId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createRefundApplication + * @param refundClaimRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The refund application was created successfully. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Forbidden. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call createRefundApplicationCall(@javax.annotation.Nonnull RefundClaimRequest refundClaimRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = refundClaimRequest; + + // create path and map variables + String localVarPath = "/order/refund-claims"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createRefundApplicationValidateBeforeCall(@javax.annotation.Nonnull RefundClaimRequest refundClaimRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'refundClaimRequest' is set + if (refundClaimRequest == null) { + throw new ApiException("Missing the required parameter 'refundClaimRequest' when calling createRefundApplication(Async)"); + } + + return createRefundApplicationCall(refundClaimRequest, _callback); + + } + + /** + * Create a refund application + * Use this resource to create a refund application. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-utworzyc-wniosek-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-create-a-sale-commission-refund-application\" target=\"_blank\">EN</a>. + * @param refundClaimRequest (required) + * @return RefundClaimResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The refund application was created successfully. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Forbidden. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public RefundClaimResponse createRefundApplication(@javax.annotation.Nonnull RefundClaimRequest refundClaimRequest) throws ApiException { + ApiResponse localVarResp = createRefundApplicationWithHttpInfo(refundClaimRequest); + return localVarResp.getData(); + } + + /** + * Create a refund application + * Use this resource to create a refund application. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-utworzyc-wniosek-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-create-a-sale-commission-refund-application\" target=\"_blank\">EN</a>. + * @param refundClaimRequest (required) + * @return ApiResponse<RefundClaimResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The refund application was created successfully. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Forbidden. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public ApiResponse createRefundApplicationWithHttpInfo(@javax.annotation.Nonnull RefundClaimRequest refundClaimRequest) throws ApiException { + okhttp3.Call localVarCall = createRefundApplicationValidateBeforeCall(refundClaimRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a refund application (asynchronously) + * Use this resource to create a refund application. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-utworzyc-wniosek-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-create-a-sale-commission-refund-application\" target=\"_blank\">EN</a>. + * @param refundClaimRequest (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The refund application was created successfully. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Forbidden. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call createRefundApplicationAsync(@javax.annotation.Nonnull RefundClaimRequest refundClaimRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createRefundApplicationValidateBeforeCall(refundClaimRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getRefundApplication + * @param claimId Refund application ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned refund application. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
404 Refund application not found. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call getRefundApplicationCall(@javax.annotation.Nonnull String claimId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/refund-claims/{claimId}" + .replace("{" + "claimId" + "}", localVarApiClient.escapeString(claimId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getRefundApplicationValidateBeforeCall(@javax.annotation.Nonnull String claimId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'claimId' is set + if (claimId == null) { + throw new ApiException("Missing the required parameter 'claimId' when calling getRefundApplication(Async)"); + } + + return getRefundApplicationCall(claimId, _callback); + + } + + /** + * Get a refund application details + * Use this resource to get refund application details. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-pojedynczy-wniosek-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-single-sale-commission-refund\" target=\"_blank\">EN</a>. + * @param claimId Refund application ID. (required) + * @return RefundClaim + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned refund application. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
404 Refund application not found. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public RefundClaim getRefundApplication(@javax.annotation.Nonnull String claimId) throws ApiException { + ApiResponse localVarResp = getRefundApplicationWithHttpInfo(claimId); + return localVarResp.getData(); + } + + /** + * Get a refund application details + * Use this resource to get refund application details. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-pojedynczy-wniosek-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-single-sale-commission-refund\" target=\"_blank\">EN</a>. + * @param claimId Refund application ID. (required) + * @return ApiResponse<RefundClaim> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned refund application. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
404 Refund application not found. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public ApiResponse getRefundApplicationWithHttpInfo(@javax.annotation.Nonnull String claimId) throws ApiException { + okhttp3.Call localVarCall = getRefundApplicationValidateBeforeCall(claimId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a refund application details (asynchronously) + * Use this resource to get refund application details. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-pojedynczy-wniosek-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-single-sale-commission-refund\" target=\"_blank\">EN</a>. + * @param claimId Refund application 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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned refund application. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
404 Refund application not found. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call getRefundApplicationAsync(@javax.annotation.Nonnull String claimId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getRefundApplicationValidateBeforeCall(claimId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getRefundApplications + * @param lineItemOfferId ID of the offer associated with the refund application. (optional) + * @param buyerLogin Login of the buyer that made the purchase associated with the refund application. (optional) + * @param status Status of the refund application. (optional) + * @param limit Maximum number of returned refund applications in response. (optional, default to 25) + * @param offset Index of the first returned refund application from all search results. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of refund applications. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call getRefundApplicationsCall(@javax.annotation.Nullable String lineItemOfferId, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String status, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/refund-claims"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (lineItemOfferId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("lineItem.offer.id", lineItemOfferId)); + } + + if (buyerLogin != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("buyer.login", buyerLogin)); + } + + if (status != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("status", status)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getRefundApplicationsValidateBeforeCall(@javax.annotation.Nullable String lineItemOfferId, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String status, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + return getRefundApplicationsCall(lineItemOfferId, buyerLogin, status, limit, offset, _callback); + + } + + /** + * Get a list of refund applications + * Use this resource to get a list of refund applications based on the provided query parameters. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-liste-utworzonych-wnioskow-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-list-of-sale-commission-refunds\" target=\"_blank\">EN</a>. + * @param lineItemOfferId ID of the offer associated with the refund application. (optional) + * @param buyerLogin Login of the buyer that made the purchase associated with the refund application. (optional) + * @param status Status of the refund application. (optional) + * @param limit Maximum number of returned refund applications in response. (optional, default to 25) + * @param offset Index of the first returned refund application from all search results. (optional, default to 0) + * @return GetRefundApplications200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of refund applications. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public GetRefundApplications200Response getRefundApplications(@javax.annotation.Nullable String lineItemOfferId, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String status, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getRefundApplicationsWithHttpInfo(lineItemOfferId, buyerLogin, status, limit, offset); + return localVarResp.getData(); + } + + /** + * Get a list of refund applications + * Use this resource to get a list of refund applications based on the provided query parameters. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-liste-utworzonych-wnioskow-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-list-of-sale-commission-refunds\" target=\"_blank\">EN</a>. + * @param lineItemOfferId ID of the offer associated with the refund application. (optional) + * @param buyerLogin Login of the buyer that made the purchase associated with the refund application. (optional) + * @param status Status of the refund application. (optional) + * @param limit Maximum number of returned refund applications in response. (optional, default to 25) + * @param offset Index of the first returned refund application from all search results. (optional, default to 0) + * @return ApiResponse<GetRefundApplications200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of refund applications. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public ApiResponse getRefundApplicationsWithHttpInfo(@javax.annotation.Nullable String lineItemOfferId, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String status, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getRefundApplicationsValidateBeforeCall(lineItemOfferId, buyerLogin, status, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of refund applications (asynchronously) + * Use this resource to get a list of refund applications based on the provided query parameters. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-liste-utworzonych-wnioskow-o-rabat-transakcyjny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-list-of-sale-commission-refunds\" target=\"_blank\">EN</a>. + * @param lineItemOfferId ID of the offer associated with the refund application. (optional) + * @param buyerLogin Login of the buyer that made the purchase associated with the refund application. (optional) + * @param status Status of the refund application. (optional) + * @param limit Maximum number of returned refund applications in response. (optional, default to 25) + * @param offset Index of the first returned refund application from all search results. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of refund applications. -
400 Semantically incorrect request or provided conditions not correct. -
401 Unauthorized. -
403 Refund application does not belong to you. -
406 Not Acceptable. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call getRefundApplicationsAsync(@javax.annotation.Nullable String lineItemOfferId, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String status, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getRefundApplicationsValidateBeforeCall(lineItemOfferId, buyerLogin, status, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/CompatibilityListApi.java b/src/main/java/pl/wtx/allegro/api/client/CompatibilityListApi.java new file mode 100644 index 0000000..4797f26 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/CompatibilityListApi.java @@ -0,0 +1,731 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.CompatibilityList; +import pl.wtx.allegro.api.client.model.CompatibilityListSupportedCategoriesDto; +import pl.wtx.allegro.api.client.model.CompatibleProductsGroupsDto; +import pl.wtx.allegro.api.client.model.CompatibleProductsListDto; +import pl.wtx.allegro.api.client.model.ErrorsHolder; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CompatibilityListApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CompatibilityListApi() { + this(Configuration.getDefaultApiClient()); + } + + public CompatibilityListApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getCategoriesThatSupportCompatibilityList + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Configuration of supported categories. -
401 Unauthorized -
+ */ + public okhttp3.Call getCategoriesThatSupportCompatibilityListCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/compatibility-list/supported-categories"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCategoriesThatSupportCompatibilityListValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getCategoriesThatSupportCompatibilityListCall(_callback); + + } + + /** + * Get list of categories where compatibility list is supported + * Compatibility list is available in particular categories, this resource allows to get the list of these categories with additional details. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-sprawdzic-czy-w-danej-kategorii-moge-dodac-sekcje-pasuje-do-do-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#which-categories-support-compatibility-section\" target=\"_blank\">EN</a>. + * @return CompatibilityListSupportedCategoriesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Configuration of supported categories. -
401 Unauthorized -
+ */ + public CompatibilityListSupportedCategoriesDto getCategoriesThatSupportCompatibilityList() throws ApiException { + ApiResponse localVarResp = getCategoriesThatSupportCompatibilityListWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get list of categories where compatibility list is supported + * Compatibility list is available in particular categories, this resource allows to get the list of these categories with additional details. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-sprawdzic-czy-w-danej-kategorii-moge-dodac-sekcje-pasuje-do-do-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#which-categories-support-compatibility-section\" target=\"_blank\">EN</a>. + * @return ApiResponse<CompatibilityListSupportedCategoriesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Configuration of supported categories. -
401 Unauthorized -
+ */ + public ApiResponse getCategoriesThatSupportCompatibilityListWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getCategoriesThatSupportCompatibilityListValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get list of categories where compatibility list is supported (asynchronously) + * Compatibility list is available in particular categories, this resource allows to get the list of these categories with additional details. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-sprawdzic-czy-w-danej-kategorii-moge-dodac-sekcje-pasuje-do-do-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#which-categories-support-compatibility-section\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Configuration of supported categories. -
401 Unauthorized -
+ */ + public okhttp3.Call getCategoriesThatSupportCompatibilityListAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCategoriesThatSupportCompatibilityListValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCompatibilityListSuggestion + * @param offerId Offer id on the basis of which we will return the suggested compatibility list. (optional) + * @param productId Product id on the basis of which we will return the suggested compatibility list. (optional) + * @param language Locale on the basis of which we will return the suggested compatibility list. For product-based suggestions if missing pl-PL will be used. For offer-based suggestions if missing offer language will be used. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Compatibility list suggestion returned successfully. -
400 Bad request. -
401 Unauthorized. -
404 Suggestion was not found. -
+ */ + public okhttp3.Call getCompatibilityListSuggestionCall(@javax.annotation.Nullable String offerId, @javax.annotation.Nullable String productId, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/compatibility-list-suggestions"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offerId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offer.id", offerId)); + } + + if (productId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("product.id", productId)); + } + + if (language != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("language", language)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCompatibilityListSuggestionValidateBeforeCall(@javax.annotation.Nullable String offerId, @javax.annotation.Nullable String productId, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + return getCompatibilityListSuggestionCall(offerId, productId, language, _callback); + + } + + /** + * Get suggested compatibility list. + * Resource allows to fetch compatibility list suggestion for given offer or product. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-wyszukac-sugerowana-sekcje-compatibilitylist\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#how-to-search-for-the-suggested-compatibility-section\" target=\"_blank\">EN</a>. + * @param offerId Offer id on the basis of which we will return the suggested compatibility list. (optional) + * @param productId Product id on the basis of which we will return the suggested compatibility list. (optional) + * @param language Locale on the basis of which we will return the suggested compatibility list. For product-based suggestions if missing pl-PL will be used. For offer-based suggestions if missing offer language will be used. (optional) + * @return CompatibilityList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Compatibility list suggestion returned successfully. -
400 Bad request. -
401 Unauthorized. -
404 Suggestion was not found. -
+ */ + public CompatibilityList getCompatibilityListSuggestion(@javax.annotation.Nullable String offerId, @javax.annotation.Nullable String productId, @javax.annotation.Nullable String language) throws ApiException { + ApiResponse localVarResp = getCompatibilityListSuggestionWithHttpInfo(offerId, productId, language); + return localVarResp.getData(); + } + + /** + * Get suggested compatibility list. + * Resource allows to fetch compatibility list suggestion for given offer or product. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-wyszukac-sugerowana-sekcje-compatibilitylist\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#how-to-search-for-the-suggested-compatibility-section\" target=\"_blank\">EN</a>. + * @param offerId Offer id on the basis of which we will return the suggested compatibility list. (optional) + * @param productId Product id on the basis of which we will return the suggested compatibility list. (optional) + * @param language Locale on the basis of which we will return the suggested compatibility list. For product-based suggestions if missing pl-PL will be used. For offer-based suggestions if missing offer language will be used. (optional) + * @return ApiResponse<CompatibilityList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Compatibility list suggestion returned successfully. -
400 Bad request. -
401 Unauthorized. -
404 Suggestion was not found. -
+ */ + public ApiResponse getCompatibilityListSuggestionWithHttpInfo(@javax.annotation.Nullable String offerId, @javax.annotation.Nullable String productId, @javax.annotation.Nullable String language) throws ApiException { + okhttp3.Call localVarCall = getCompatibilityListSuggestionValidateBeforeCall(offerId, productId, language, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get suggested compatibility list. (asynchronously) + * Resource allows to fetch compatibility list suggestion for given offer or product. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-wyszukac-sugerowana-sekcje-compatibilitylist\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#how-to-search-for-the-suggested-compatibility-section\" target=\"_blank\">EN</a>. + * @param offerId Offer id on the basis of which we will return the suggested compatibility list. (optional) + * @param productId Product id on the basis of which we will return the suggested compatibility list. (optional) + * @param language Locale on the basis of which we will return the suggested compatibility list. For product-based suggestions if missing pl-PL will be used. For offer-based suggestions if missing offer language will be used. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Compatibility list suggestion returned successfully. -
400 Bad request. -
401 Unauthorized. -
404 Suggestion was not found. -
+ */ + public okhttp3.Call getCompatibilityListSuggestionAsync(@javax.annotation.Nullable String offerId, @javax.annotation.Nullable String productId, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCompatibilityListSuggestionValidateBeforeCall(offerId, productId, language, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCompatibleProducts + * @param type Type of compatible products. You can find available types in the response for the GET <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\">supported-categories</a> resource. You can use value provided in `itemsType`, for categories where `inputType=ID`. (required) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. Header is ignored if `phrase` parameter is used. (optional) + * @param groupId Group identifier from `/sale/compatible-products/groups` resource. Parameter is required when parameter `tecdoc.kTypNr` or `tecdoc.nTypNr` or `phrase` is not specified. (optional) + * @param tecdocKTypNr Identifier of passenger vehicle (kTypNr) from TecDoc database. When used, `group.id` parameter is ignored. (optional) + * @param tecdocNTypNr Identifier of commercial vehicle (nTypNr) from TecDoc database. When used, `group.id` parameter is ignored. (optional) + * @param phrase Query for compatible products. When used, parameters: `group.id`, `limit`, `offset` and header `If-Modified-Since` are ignored. (optional) + * @param limit The limit of returned items. If `phrase` parameter is present, parameter is ignored and maximum value is set to `200`. (optional, default to 200) + * @param offset The offset of returned items. If `phrase` parameter is present, parameter is ignored. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Compatible products returned successfully. -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request -
401 Unauthorized -
422 Validation failed - for example invalid format of If-Modified-Since header was passed -
+ */ + public okhttp3.Call getCompatibleProductsCall(@javax.annotation.Nonnull String type, @javax.annotation.Nullable String ifModifiedSince, @javax.annotation.Nullable String groupId, @javax.annotation.Nullable String tecdocKTypNr, @javax.annotation.Nullable String tecdocNTypNr, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/compatible-products"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (type != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("type", type)); + } + + if (groupId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("group.id", groupId)); + } + + if (tecdocKTypNr != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("tecdoc.kTypNr", tecdocKTypNr)); + } + + if (tecdocNTypNr != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("tecdoc.nTypNr", tecdocNTypNr)); + } + + if (phrase != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("phrase", phrase)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (ifModifiedSince != null) { + localVarHeaderParams.put("If-Modified-Since", localVarApiClient.parameterToString(ifModifiedSince)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCompatibleProductsValidateBeforeCall(@javax.annotation.Nonnull String type, @javax.annotation.Nullable String ifModifiedSince, @javax.annotation.Nullable String groupId, @javax.annotation.Nullable String tecdocKTypNr, @javax.annotation.Nullable String tecdocNTypNr, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'type' is set + if (type == null) { + throw new ApiException("Missing the required parameter 'type' when calling getCompatibleProducts(Async)"); + } + + return getCompatibleProductsCall(type, ifModifiedSince, groupId, tecdocKTypNr, tecdocNTypNr, phrase, limit, offset, _callback); + + } + + /** + * Get list of compatible products + * Resource allows to fetch compatible products of given type. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-zarzadzac-sekcja-pasuje-do-zintegrowana-z-baza-pojazdow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#managing-the-compatibility-section-compatibilitylist-integrated-vehicle-database\" target=\"_blank\">EN</a>. + * @param type Type of compatible products. You can find available types in the response for the GET <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\">supported-categories</a> resource. You can use value provided in `itemsType`, for categories where `inputType=ID`. (required) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. Header is ignored if `phrase` parameter is used. (optional) + * @param groupId Group identifier from `/sale/compatible-products/groups` resource. Parameter is required when parameter `tecdoc.kTypNr` or `tecdoc.nTypNr` or `phrase` is not specified. (optional) + * @param tecdocKTypNr Identifier of passenger vehicle (kTypNr) from TecDoc database. When used, `group.id` parameter is ignored. (optional) + * @param tecdocNTypNr Identifier of commercial vehicle (nTypNr) from TecDoc database. When used, `group.id` parameter is ignored. (optional) + * @param phrase Query for compatible products. When used, parameters: `group.id`, `limit`, `offset` and header `If-Modified-Since` are ignored. (optional) + * @param limit The limit of returned items. If `phrase` parameter is present, parameter is ignored and maximum value is set to `200`. (optional, default to 200) + * @param offset The offset of returned items. If `phrase` parameter is present, parameter is ignored. (optional, default to 0) + * @return CompatibleProductsListDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Compatible products returned successfully. -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request -
401 Unauthorized -
422 Validation failed - for example invalid format of If-Modified-Since header was passed -
+ */ + public CompatibleProductsListDto getCompatibleProducts(@javax.annotation.Nonnull String type, @javax.annotation.Nullable String ifModifiedSince, @javax.annotation.Nullable String groupId, @javax.annotation.Nullable String tecdocKTypNr, @javax.annotation.Nullable String tecdocNTypNr, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getCompatibleProductsWithHttpInfo(type, ifModifiedSince, groupId, tecdocKTypNr, tecdocNTypNr, phrase, limit, offset); + return localVarResp.getData(); + } + + /** + * Get list of compatible products + * Resource allows to fetch compatible products of given type. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-zarzadzac-sekcja-pasuje-do-zintegrowana-z-baza-pojazdow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#managing-the-compatibility-section-compatibilitylist-integrated-vehicle-database\" target=\"_blank\">EN</a>. + * @param type Type of compatible products. You can find available types in the response for the GET <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\">supported-categories</a> resource. You can use value provided in `itemsType`, for categories where `inputType=ID`. (required) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. Header is ignored if `phrase` parameter is used. (optional) + * @param groupId Group identifier from `/sale/compatible-products/groups` resource. Parameter is required when parameter `tecdoc.kTypNr` or `tecdoc.nTypNr` or `phrase` is not specified. (optional) + * @param tecdocKTypNr Identifier of passenger vehicle (kTypNr) from TecDoc database. When used, `group.id` parameter is ignored. (optional) + * @param tecdocNTypNr Identifier of commercial vehicle (nTypNr) from TecDoc database. When used, `group.id` parameter is ignored. (optional) + * @param phrase Query for compatible products. When used, parameters: `group.id`, `limit`, `offset` and header `If-Modified-Since` are ignored. (optional) + * @param limit The limit of returned items. If `phrase` parameter is present, parameter is ignored and maximum value is set to `200`. (optional, default to 200) + * @param offset The offset of returned items. If `phrase` parameter is present, parameter is ignored. (optional, default to 0) + * @return ApiResponse<CompatibleProductsListDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Compatible products returned successfully. -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request -
401 Unauthorized -
422 Validation failed - for example invalid format of If-Modified-Since header was passed -
+ */ + public ApiResponse getCompatibleProductsWithHttpInfo(@javax.annotation.Nonnull String type, @javax.annotation.Nullable String ifModifiedSince, @javax.annotation.Nullable String groupId, @javax.annotation.Nullable String tecdocKTypNr, @javax.annotation.Nullable String tecdocNTypNr, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getCompatibleProductsValidateBeforeCall(type, ifModifiedSince, groupId, tecdocKTypNr, tecdocNTypNr, phrase, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get list of compatible products (asynchronously) + * Resource allows to fetch compatible products of given type. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-zarzadzac-sekcja-pasuje-do-zintegrowana-z-baza-pojazdow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#managing-the-compatibility-section-compatibilitylist-integrated-vehicle-database\" target=\"_blank\">EN</a>. + * @param type Type of compatible products. You can find available types in the response for the GET <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\">supported-categories</a> resource. You can use value provided in `itemsType`, for categories where `inputType=ID`. (required) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. Header is ignored if `phrase` parameter is used. (optional) + * @param groupId Group identifier from `/sale/compatible-products/groups` resource. Parameter is required when parameter `tecdoc.kTypNr` or `tecdoc.nTypNr` or `phrase` is not specified. (optional) + * @param tecdocKTypNr Identifier of passenger vehicle (kTypNr) from TecDoc database. When used, `group.id` parameter is ignored. (optional) + * @param tecdocNTypNr Identifier of commercial vehicle (nTypNr) from TecDoc database. When used, `group.id` parameter is ignored. (optional) + * @param phrase Query for compatible products. When used, parameters: `group.id`, `limit`, `offset` and header `If-Modified-Since` are ignored. (optional) + * @param limit The limit of returned items. If `phrase` parameter is present, parameter is ignored and maximum value is set to `200`. (optional, default to 200) + * @param offset The offset of returned items. If `phrase` parameter is present, parameter is ignored. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Compatible products returned successfully. -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request -
401 Unauthorized -
422 Validation failed - for example invalid format of If-Modified-Since header was passed -
+ */ + public okhttp3.Call getCompatibleProductsAsync(@javax.annotation.Nonnull String type, @javax.annotation.Nullable String ifModifiedSince, @javax.annotation.Nullable String groupId, @javax.annotation.Nullable String tecdocKTypNr, @javax.annotation.Nullable String tecdocNTypNr, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCompatibleProductsValidateBeforeCall(type, ifModifiedSince, groupId, tecdocKTypNr, tecdocNTypNr, phrase, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCompatibleProductsGroups + * @param type Type of compatible products. You can find available types in the response for the GET <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\">supported-categories</a> resource. You can use value provided in `itemsType`, for categories where `inputType=ID`. (required) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. (optional) + * @param limit The limit of returned items. (optional, default to 200) + * @param offset The offset of returned items. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Groups of compatible products returned successfully. -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request -
401 Unauthorized -
422 Validation failed - for example type that was used is not supported -
+ */ + public okhttp3.Call getCompatibleProductsGroupsCall(@javax.annotation.Nonnull String type, @javax.annotation.Nullable String ifModifiedSince, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/compatible-products/groups"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (type != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("type", type)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (ifModifiedSince != null) { + localVarHeaderParams.put("If-Modified-Since", localVarApiClient.parameterToString(ifModifiedSince)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCompatibleProductsGroupsValidateBeforeCall(@javax.annotation.Nonnull String type, @javax.annotation.Nullable String ifModifiedSince, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'type' is set + if (type == null) { + throw new ApiException("Missing the required parameter 'type' when calling getCompatibleProductsGroups(Async)"); + } + + return getCompatibleProductsGroupsCall(type, ifModifiedSince, limit, offset, _callback); + + } + + /** + * Get list of compatible product groups + * Compatible products are organized in groups, this resource allows to browse these groups. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-zarzadzac-sekcja-pasuje-do-zintegrowana-z-baza-pojazdow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#managing-the-compatibility-section-compatibilitylist-integrated-vehicle-database\" target=\"_blank\">EN</a>. + * @param type Type of compatible products. You can find available types in the response for the GET <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\">supported-categories</a> resource. You can use value provided in `itemsType`, for categories where `inputType=ID`. (required) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. (optional) + * @param limit The limit of returned items. (optional, default to 200) + * @param offset The offset of returned items. (optional, default to 0) + * @return CompatibleProductsGroupsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Groups of compatible products returned successfully. -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request -
401 Unauthorized -
422 Validation failed - for example type that was used is not supported -
+ */ + public CompatibleProductsGroupsDto getCompatibleProductsGroups(@javax.annotation.Nonnull String type, @javax.annotation.Nullable String ifModifiedSince, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getCompatibleProductsGroupsWithHttpInfo(type, ifModifiedSince, limit, offset); + return localVarResp.getData(); + } + + /** + * Get list of compatible product groups + * Compatible products are organized in groups, this resource allows to browse these groups. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-zarzadzac-sekcja-pasuje-do-zintegrowana-z-baza-pojazdow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#managing-the-compatibility-section-compatibilitylist-integrated-vehicle-database\" target=\"_blank\">EN</a>. + * @param type Type of compatible products. You can find available types in the response for the GET <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\">supported-categories</a> resource. You can use value provided in `itemsType`, for categories where `inputType=ID`. (required) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. (optional) + * @param limit The limit of returned items. (optional, default to 200) + * @param offset The offset of returned items. (optional, default to 0) + * @return ApiResponse<CompatibleProductsGroupsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Groups of compatible products returned successfully. -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request -
401 Unauthorized -
422 Validation failed - for example type that was used is not supported -
+ */ + public ApiResponse getCompatibleProductsGroupsWithHttpInfo(@javax.annotation.Nonnull String type, @javax.annotation.Nullable String ifModifiedSince, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getCompatibleProductsGroupsValidateBeforeCall(type, ifModifiedSince, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get list of compatible product groups (asynchronously) + * Compatible products are organized in groups, this resource allows to browse these groups. Read more: <a href=\"../../tutorials/jak-zarzadzac-sekcja-pasuje-do-E7Zj6gAEGil#jak-zarzadzac-sekcja-pasuje-do-zintegrowana-z-baza-pojazdow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-compatibility-section-v8WbL1wV0Hz#managing-the-compatibility-section-compatibilitylist-integrated-vehicle-database\" target=\"_blank\">EN</a>. + * @param type Type of compatible products. You can find available types in the response for the GET <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\">supported-categories</a> resource. You can use value provided in `itemsType`, for categories where `inputType=ID`. (required) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. (optional) + * @param limit The limit of returned items. (optional, default to 200) + * @param offset The offset of returned items. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Groups of compatible products returned successfully. -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request -
401 Unauthorized -
422 Validation failed - for example type that was used is not supported -
+ */ + public okhttp3.Call getCompatibleProductsGroupsAsync(@javax.annotation.Nonnull String type, @javax.annotation.Nullable String ifModifiedSince, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCompatibleProductsGroupsValidateBeforeCall(type, ifModifiedSince, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/ContactsApi.java b/src/main/java/pl/wtx/allegro/api/client/ContactsApi.java new file mode 100644 index 0000000..111991c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/ContactsApi.java @@ -0,0 +1,649 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.ContactRequest; +import pl.wtx.allegro.api.client.model.ContactResponse; +import pl.wtx.allegro.api.client.model.ContactResponseList; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ContactsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ContactsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ContactsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createContactUsingPOST + * @param contactRequest New contact (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createContactUsingPOSTCall(@javax.annotation.Nonnull ContactRequest contactRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = contactRequest; + + // create path and map variables + String localVarPath = "/sale/offer-contacts"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createContactUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull ContactRequest contactRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'contactRequest' is set + if (contactRequest == null) { + throw new ApiException("Missing the required parameter 'contactRequest' when calling createContactUsingPOST(Async)"); + } + + return createContactUsingPOSTCall(contactRequest, _callback); + + } + + /** + * Create a new contact + * Use this resource to create a new contact. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-utworzyc-nowy-kontakt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-create-new-contact\" target=\"_blank\">EN</a>. + * @param contactRequest New contact (required) + * @return ContactResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ContactResponse createContactUsingPOST(@javax.annotation.Nonnull ContactRequest contactRequest) throws ApiException { + ApiResponse localVarResp = createContactUsingPOSTWithHttpInfo(contactRequest); + return localVarResp.getData(); + } + + /** + * Create a new contact + * Use this resource to create a new contact. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-utworzyc-nowy-kontakt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-create-new-contact\" target=\"_blank\">EN</a>. + * @param contactRequest New contact (required) + * @return ApiResponse<ContactResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse createContactUsingPOSTWithHttpInfo(@javax.annotation.Nonnull ContactRequest contactRequest) throws ApiException { + okhttp3.Call localVarCall = createContactUsingPOSTValidateBeforeCall(contactRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a new contact (asynchronously) + * Use this resource to create a new contact. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-utworzyc-nowy-kontakt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-create-new-contact\" target=\"_blank\">EN</a>. + * @param contactRequest New contact (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createContactUsingPOSTAsync(@javax.annotation.Nonnull ContactRequest contactRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createContactUsingPOSTValidateBeforeCall(contactRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getContactUsingGET + * @param id Contact identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getContactUsingGETCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-contacts/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getContactUsingGETValidateBeforeCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getContactUsingGET(Async)"); + } + + return getContactUsingGETCall(id, _callback); + + } + + /** + * Get contact details + * Use this resource to get contact details. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-szczegoly-danego-kontaktu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-contact-details\" target=\"_blank\">EN</a>. + * @param id Contact identifier. (required) + * @return ContactResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ContactResponse getContactUsingGET(@javax.annotation.Nonnull String id) throws ApiException { + ApiResponse localVarResp = getContactUsingGETWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get contact details + * Use this resource to get contact details. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-szczegoly-danego-kontaktu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-contact-details\" target=\"_blank\">EN</a>. + * @param id Contact identifier. (required) + * @return ApiResponse<ContactResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getContactUsingGETWithHttpInfo(@javax.annotation.Nonnull String id) throws ApiException { + okhttp3.Call localVarCall = getContactUsingGETValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get contact details (asynchronously) + * Use this resource to get contact details. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-szczegoly-danego-kontaktu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-contact-details\" target=\"_blank\">EN</a>. + * @param id Contact identifier. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getContactUsingGETAsync(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getContactUsingGETValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getListOfContactsUsingGET + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getListOfContactsUsingGETCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-contacts"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getListOfContactsUsingGETValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getListOfContactsUsingGETCall(_callback); + + } + + /** + * Get the user's contacts + * Use this resource to get details of many contacts. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-liste-kontaktow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-a-list-of-contacts\" target=\"_blank\">EN</a>. + * @return ContactResponseList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
+ */ + public ContactResponseList getListOfContactsUsingGET() throws ApiException { + ApiResponse localVarResp = getListOfContactsUsingGETWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get the user's contacts + * Use this resource to get details of many contacts. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-liste-kontaktow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-a-list-of-contacts\" target=\"_blank\">EN</a>. + * @return ApiResponse<ContactResponseList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse getListOfContactsUsingGETWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getListOfContactsUsingGETValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's contacts (asynchronously) + * Use this resource to get details of many contacts. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-liste-kontaktow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-a-list-of-contacts\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getListOfContactsUsingGETAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getListOfContactsUsingGETValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for modifyContactUsingPUT + * @param id Contact identifier. (required) + * @param contactRequest Contact (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call modifyContactUsingPUTCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull ContactRequest contactRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = contactRequest; + + // create path and map variables + String localVarPath = "/sale/offer-contacts/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call modifyContactUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull ContactRequest contactRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling modifyContactUsingPUT(Async)"); + } + + // verify the required parameter 'contactRequest' is set + if (contactRequest == null) { + throw new ApiException("Missing the required parameter 'contactRequest' when calling modifyContactUsingPUT(Async)"); + } + + return modifyContactUsingPUTCall(id, contactRequest, _callback); + + } + + /** + * Modify contact details + * Use this resource to modify contact details. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-zmienic-dane-kontaktu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-change-contact-data\" target=\"_blank\">EN</a>. + * @param id Contact identifier. (required) + * @param contactRequest Contact (required) + * @return ContactResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ContactResponse modifyContactUsingPUT(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull ContactRequest contactRequest) throws ApiException { + ApiResponse localVarResp = modifyContactUsingPUTWithHttpInfo(id, contactRequest); + return localVarResp.getData(); + } + + /** + * Modify contact details + * Use this resource to modify contact details. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-zmienic-dane-kontaktu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-change-contact-data\" target=\"_blank\">EN</a>. + * @param id Contact identifier. (required) + * @param contactRequest Contact (required) + * @return ApiResponse<ContactResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ApiResponse modifyContactUsingPUTWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull ContactRequest contactRequest) throws ApiException { + okhttp3.Call localVarCall = modifyContactUsingPUTValidateBeforeCall(id, contactRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Modify contact details (asynchronously) + * Use this resource to modify contact details. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-zmienic-dane-kontaktu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-change-contact-data\" target=\"_blank\">EN</a>. + * @param id Contact identifier. (required) + * @param contactRequest Contact (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call modifyContactUsingPUTAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull ContactRequest contactRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = modifyContactUsingPUTValidateBeforeCall(id, contactRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/CustomerReturnsApi.java b/src/main/java/pl/wtx/allegro/api/client/CustomerReturnsApi.java new file mode 100644 index 0000000..7f9a402 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/CustomerReturnsApi.java @@ -0,0 +1,668 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.CustomerReturn; +import pl.wtx.allegro.api.client.model.CustomerReturnRefundRejectionRequest; +import pl.wtx.allegro.api.client.model.CustomerReturnResponse; +import pl.wtx.allegro.api.client.model.ErrorsHolder; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CustomerReturnsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CustomerReturnsApi() { + this(Configuration.getDefaultApiClient()); + } + + public CustomerReturnsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getCustomerReturnById + * @param customerReturnId Id of the customer return. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully retrieved customer return. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
404 Not found -
406 Not Acceptable -
+ */ + public okhttp3.Call getCustomerReturnByIdCall(@javax.annotation.Nonnull String customerReturnId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/customer-returns/{customerReturnId}" + .replace("{" + "customerReturnId" + "}", localVarApiClient.escapeString(customerReturnId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.beta.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCustomerReturnByIdValidateBeforeCall(@javax.annotation.Nonnull String customerReturnId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'customerReturnId' is set + if (customerReturnId == null) { + throw new ApiException("Missing the required parameter 'customerReturnId' when calling getCustomerReturnById(Async)"); + } + + return getCustomerReturnByIdCall(customerReturnId, _callback); + + } + + /** + * [BETA] Get customer return by id + * Use this resource to get customer returns by its identifier. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-szczegolowe-informacje-o-zwrocie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-detailed-information-about-customer-return\" target=\"_blank\">EN</a>. + * @param customerReturnId Id of the customer return. (required) + * @return CustomerReturn + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully retrieved customer return. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
404 Not found -
406 Not Acceptable -
+ */ + public CustomerReturn getCustomerReturnById(@javax.annotation.Nonnull String customerReturnId) throws ApiException { + ApiResponse localVarResp = getCustomerReturnByIdWithHttpInfo(customerReturnId); + return localVarResp.getData(); + } + + /** + * [BETA] Get customer return by id + * Use this resource to get customer returns by its identifier. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-szczegolowe-informacje-o-zwrocie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-detailed-information-about-customer-return\" target=\"_blank\">EN</a>. + * @param customerReturnId Id of the customer return. (required) + * @return ApiResponse<CustomerReturn> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully retrieved customer return. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
404 Not found -
406 Not Acceptable -
+ */ + public ApiResponse getCustomerReturnByIdWithHttpInfo(@javax.annotation.Nonnull String customerReturnId) throws ApiException { + okhttp3.Call localVarCall = getCustomerReturnByIdValidateBeforeCall(customerReturnId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * [BETA] Get customer return by id (asynchronously) + * Use this resource to get customer returns by its identifier. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-szczegolowe-informacje-o-zwrocie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-detailed-information-about-customer-return\" target=\"_blank\">EN</a>. + * @param customerReturnId Id of the customer return. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully retrieved customer return. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
404 Not found -
406 Not Acceptable -
+ */ + public okhttp3.Call getCustomerReturnByIdAsync(@javax.annotation.Nonnull String customerReturnId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCustomerReturnByIdValidateBeforeCall(customerReturnId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCustomerReturns + * @param customerReturnId One or more customer return id's. (optional) + * @param orderId One or more order id's. (optional) + * @param buyerEmail One or more buyer emails. (optional) + * @param buyerLogin One or more buyer logins. (optional) + * @param itemsOfferId One or more returned item offer id's. (optional) + * @param itemsName One or more item names. (optional) + * @param parcelsWaybill One or more waybill id's. (optional) + * @param parcelsTransportingWaybill Waybill ids as generated by carriers physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. (optional) + * @param parcelsCarrierId One or more carrier id's. (optional) + * @param parcelsTransportingCarrierId Carrier id of a carrier physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. (optional) + * @param parcelsSenderPhoneNumber One or more phone numbers. (optional) + * @param referenceNumber One or more reference numbers. (optional) + * @param from The ID of the last seen customer return. Customer returns created after the given customer return will be returned. (optional) + * @param createdAtGte Date of the return in ISO 8601 format to search by greater or equal. (optional) + * @param createdAtLte Date of the return in ISO 8601 format to search by lower or equal. (optional) + * @param marketplaceId The marketplace ID where operation was made. When the parameter is omitted, searches for operations with all marketplaces. (optional) + * @param status Current return timeline statuses. The allowed values are: * CREATED * DISPATCHED * IN_TRANSIT * DELIVERED * FINISHED * FINISHED_APT * REJECTED * COMMISSION_REFUND_CLAIMED * COMMISSION_REFUNDED * WAREHOUSE_DELIVERED * WAREHOUSE_VERIFICATION. (optional) + * @param limit Limit of customer returns per page. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully retrieved customer returns. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
+ */ + public okhttp3.Call getCustomerReturnsCall(@javax.annotation.Nullable String customerReturnId, @javax.annotation.Nullable String orderId, @javax.annotation.Nullable String buyerEmail, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String itemsOfferId, @javax.annotation.Nullable String itemsName, @javax.annotation.Nullable String parcelsWaybill, @javax.annotation.Nullable String parcelsTransportingWaybill, @javax.annotation.Nullable String parcelsCarrierId, @javax.annotation.Nullable String parcelsTransportingCarrierId, @javax.annotation.Nullable String parcelsSenderPhoneNumber, @javax.annotation.Nullable String referenceNumber, @javax.annotation.Nullable String from, @javax.annotation.Nullable String createdAtGte, @javax.annotation.Nullable String createdAtLte, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String status, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/customer-returns"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (customerReturnId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("customerReturnId", customerReturnId)); + } + + if (orderId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("orderId", orderId)); + } + + if (buyerEmail != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("buyer.email", buyerEmail)); + } + + if (buyerLogin != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("buyer.login", buyerLogin)); + } + + if (itemsOfferId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("items.offerId", itemsOfferId)); + } + + if (itemsName != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("items.name", itemsName)); + } + + if (parcelsWaybill != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("parcels.waybill", parcelsWaybill)); + } + + if (parcelsTransportingWaybill != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("parcels.transportingWaybill", parcelsTransportingWaybill)); + } + + if (parcelsCarrierId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("parcels.carrierId", parcelsCarrierId)); + } + + if (parcelsTransportingCarrierId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("parcels.transportingCarrierId", parcelsTransportingCarrierId)); + } + + if (parcelsSenderPhoneNumber != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("parcels.sender.phoneNumber", parcelsSenderPhoneNumber)); + } + + if (referenceNumber != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("referenceNumber", referenceNumber)); + } + + if (from != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("from", from)); + } + + if (createdAtGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("createdAt.gte", createdAtGte)); + } + + if (createdAtLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("createdAt.lte", createdAtLte)); + } + + if (marketplaceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplaceId", marketplaceId)); + } + + if (status != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("status", status)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.beta.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCustomerReturnsValidateBeforeCall(@javax.annotation.Nullable String customerReturnId, @javax.annotation.Nullable String orderId, @javax.annotation.Nullable String buyerEmail, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String itemsOfferId, @javax.annotation.Nullable String itemsName, @javax.annotation.Nullable String parcelsWaybill, @javax.annotation.Nullable String parcelsTransportingWaybill, @javax.annotation.Nullable String parcelsCarrierId, @javax.annotation.Nullable String parcelsTransportingCarrierId, @javax.annotation.Nullable String parcelsSenderPhoneNumber, @javax.annotation.Nullable String referenceNumber, @javax.annotation.Nullable String from, @javax.annotation.Nullable String createdAtGte, @javax.annotation.Nullable String createdAtLte, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String status, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + return getCustomerReturnsCall(customerReturnId, orderId, buyerEmail, buyerLogin, itemsOfferId, itemsName, parcelsWaybill, parcelsTransportingWaybill, parcelsCarrierId, parcelsTransportingCarrierId, parcelsSenderPhoneNumber, referenceNumber, from, createdAtGte, createdAtLte, marketplaceId, status, limit, offset, _callback); + + } + + /** + * [BETA] Get customer returns by provided query parameters + * Use this resource to get all customer returns filtered by query parameters. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-liste-zwrotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-customer-returns-list\" target=\"_blank\">EN</a>. This resource is limited to 25 requests per second for a single user and 50 requests per second for clientId. + * @param customerReturnId One or more customer return id's. (optional) + * @param orderId One or more order id's. (optional) + * @param buyerEmail One or more buyer emails. (optional) + * @param buyerLogin One or more buyer logins. (optional) + * @param itemsOfferId One or more returned item offer id's. (optional) + * @param itemsName One or more item names. (optional) + * @param parcelsWaybill One or more waybill id's. (optional) + * @param parcelsTransportingWaybill Waybill ids as generated by carriers physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. (optional) + * @param parcelsCarrierId One or more carrier id's. (optional) + * @param parcelsTransportingCarrierId Carrier id of a carrier physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. (optional) + * @param parcelsSenderPhoneNumber One or more phone numbers. (optional) + * @param referenceNumber One or more reference numbers. (optional) + * @param from The ID of the last seen customer return. Customer returns created after the given customer return will be returned. (optional) + * @param createdAtGte Date of the return in ISO 8601 format to search by greater or equal. (optional) + * @param createdAtLte Date of the return in ISO 8601 format to search by lower or equal. (optional) + * @param marketplaceId The marketplace ID where operation was made. When the parameter is omitted, searches for operations with all marketplaces. (optional) + * @param status Current return timeline statuses. The allowed values are: * CREATED * DISPATCHED * IN_TRANSIT * DELIVERED * FINISHED * FINISHED_APT * REJECTED * COMMISSION_REFUND_CLAIMED * COMMISSION_REFUNDED * WAREHOUSE_DELIVERED * WAREHOUSE_VERIFICATION. (optional) + * @param limit Limit of customer returns per page. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return CustomerReturnResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully retrieved customer returns. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
+ */ + public CustomerReturnResponse getCustomerReturns(@javax.annotation.Nullable String customerReturnId, @javax.annotation.Nullable String orderId, @javax.annotation.Nullable String buyerEmail, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String itemsOfferId, @javax.annotation.Nullable String itemsName, @javax.annotation.Nullable String parcelsWaybill, @javax.annotation.Nullable String parcelsTransportingWaybill, @javax.annotation.Nullable String parcelsCarrierId, @javax.annotation.Nullable String parcelsTransportingCarrierId, @javax.annotation.Nullable String parcelsSenderPhoneNumber, @javax.annotation.Nullable String referenceNumber, @javax.annotation.Nullable String from, @javax.annotation.Nullable String createdAtGte, @javax.annotation.Nullable String createdAtLte, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String status, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getCustomerReturnsWithHttpInfo(customerReturnId, orderId, buyerEmail, buyerLogin, itemsOfferId, itemsName, parcelsWaybill, parcelsTransportingWaybill, parcelsCarrierId, parcelsTransportingCarrierId, parcelsSenderPhoneNumber, referenceNumber, from, createdAtGte, createdAtLte, marketplaceId, status, limit, offset); + return localVarResp.getData(); + } + + /** + * [BETA] Get customer returns by provided query parameters + * Use this resource to get all customer returns filtered by query parameters. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-liste-zwrotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-customer-returns-list\" target=\"_blank\">EN</a>. This resource is limited to 25 requests per second for a single user and 50 requests per second for clientId. + * @param customerReturnId One or more customer return id's. (optional) + * @param orderId One or more order id's. (optional) + * @param buyerEmail One or more buyer emails. (optional) + * @param buyerLogin One or more buyer logins. (optional) + * @param itemsOfferId One or more returned item offer id's. (optional) + * @param itemsName One or more item names. (optional) + * @param parcelsWaybill One or more waybill id's. (optional) + * @param parcelsTransportingWaybill Waybill ids as generated by carriers physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. (optional) + * @param parcelsCarrierId One or more carrier id's. (optional) + * @param parcelsTransportingCarrierId Carrier id of a carrier physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. (optional) + * @param parcelsSenderPhoneNumber One or more phone numbers. (optional) + * @param referenceNumber One or more reference numbers. (optional) + * @param from The ID of the last seen customer return. Customer returns created after the given customer return will be returned. (optional) + * @param createdAtGte Date of the return in ISO 8601 format to search by greater or equal. (optional) + * @param createdAtLte Date of the return in ISO 8601 format to search by lower or equal. (optional) + * @param marketplaceId The marketplace ID where operation was made. When the parameter is omitted, searches for operations with all marketplaces. (optional) + * @param status Current return timeline statuses. The allowed values are: * CREATED * DISPATCHED * IN_TRANSIT * DELIVERED * FINISHED * FINISHED_APT * REJECTED * COMMISSION_REFUND_CLAIMED * COMMISSION_REFUNDED * WAREHOUSE_DELIVERED * WAREHOUSE_VERIFICATION. (optional) + * @param limit Limit of customer returns per page. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ApiResponse<CustomerReturnResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully retrieved customer returns. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
+ */ + public ApiResponse getCustomerReturnsWithHttpInfo(@javax.annotation.Nullable String customerReturnId, @javax.annotation.Nullable String orderId, @javax.annotation.Nullable String buyerEmail, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String itemsOfferId, @javax.annotation.Nullable String itemsName, @javax.annotation.Nullable String parcelsWaybill, @javax.annotation.Nullable String parcelsTransportingWaybill, @javax.annotation.Nullable String parcelsCarrierId, @javax.annotation.Nullable String parcelsTransportingCarrierId, @javax.annotation.Nullable String parcelsSenderPhoneNumber, @javax.annotation.Nullable String referenceNumber, @javax.annotation.Nullable String from, @javax.annotation.Nullable String createdAtGte, @javax.annotation.Nullable String createdAtLte, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String status, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getCustomerReturnsValidateBeforeCall(customerReturnId, orderId, buyerEmail, buyerLogin, itemsOfferId, itemsName, parcelsWaybill, parcelsTransportingWaybill, parcelsCarrierId, parcelsTransportingCarrierId, parcelsSenderPhoneNumber, referenceNumber, from, createdAtGte, createdAtLte, marketplaceId, status, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * [BETA] Get customer returns by provided query parameters (asynchronously) + * Use this resource to get all customer returns filtered by query parameters. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-liste-zwrotow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-customer-returns-list\" target=\"_blank\">EN</a>. This resource is limited to 25 requests per second for a single user and 50 requests per second for clientId. + * @param customerReturnId One or more customer return id's. (optional) + * @param orderId One or more order id's. (optional) + * @param buyerEmail One or more buyer emails. (optional) + * @param buyerLogin One or more buyer logins. (optional) + * @param itemsOfferId One or more returned item offer id's. (optional) + * @param itemsName One or more item names. (optional) + * @param parcelsWaybill One or more waybill id's. (optional) + * @param parcelsTransportingWaybill Waybill ids as generated by carriers physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. (optional) + * @param parcelsCarrierId One or more carrier id's. (optional) + * @param parcelsTransportingCarrierId Carrier id of a carrier physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. (optional) + * @param parcelsSenderPhoneNumber One or more phone numbers. (optional) + * @param referenceNumber One or more reference numbers. (optional) + * @param from The ID of the last seen customer return. Customer returns created after the given customer return will be returned. (optional) + * @param createdAtGte Date of the return in ISO 8601 format to search by greater or equal. (optional) + * @param createdAtLte Date of the return in ISO 8601 format to search by lower or equal. (optional) + * @param marketplaceId The marketplace ID where operation was made. When the parameter is omitted, searches for operations with all marketplaces. (optional) + * @param status Current return timeline statuses. The allowed values are: * CREATED * DISPATCHED * IN_TRANSIT * DELIVERED * FINISHED * FINISHED_APT * REJECTED * COMMISSION_REFUND_CLAIMED * COMMISSION_REFUNDED * WAREHOUSE_DELIVERED * WAREHOUSE_VERIFICATION. (optional) + * @param limit Limit of customer returns per page. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully retrieved customer returns. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
+ */ + public okhttp3.Call getCustomerReturnsAsync(@javax.annotation.Nullable String customerReturnId, @javax.annotation.Nullable String orderId, @javax.annotation.Nullable String buyerEmail, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String itemsOfferId, @javax.annotation.Nullable String itemsName, @javax.annotation.Nullable String parcelsWaybill, @javax.annotation.Nullable String parcelsTransportingWaybill, @javax.annotation.Nullable String parcelsCarrierId, @javax.annotation.Nullable String parcelsTransportingCarrierId, @javax.annotation.Nullable String parcelsSenderPhoneNumber, @javax.annotation.Nullable String referenceNumber, @javax.annotation.Nullable String from, @javax.annotation.Nullable String createdAtGte, @javax.annotation.Nullable String createdAtLte, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String status, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCustomerReturnsValidateBeforeCall(customerReturnId, orderId, buyerEmail, buyerLogin, itemsOfferId, itemsName, parcelsWaybill, parcelsTransportingWaybill, parcelsCarrierId, parcelsTransportingCarrierId, parcelsSenderPhoneNumber, referenceNumber, from, createdAtGte, createdAtLte, marketplaceId, status, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for rejectCustomerReturnRefund + * @param customerReturnId Id of the customer return. (required) + * @param customerReturnRefundRejectionRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully rejected customer return. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
422 Unprocessable Entity. Might occur when customer return has already been rejected -
+ */ + public okhttp3.Call rejectCustomerReturnRefundCall(@javax.annotation.Nonnull String customerReturnId, @javax.annotation.Nonnull CustomerReturnRefundRejectionRequest customerReturnRefundRejectionRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = customerReturnRefundRejectionRequest; + + // create path and map variables + String localVarPath = "/order/customer-returns/{customerReturnId}/rejection" + .replace("{" + "customerReturnId" + "}", localVarApiClient.escapeString(customerReturnId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.beta.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.beta.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call rejectCustomerReturnRefundValidateBeforeCall(@javax.annotation.Nonnull String customerReturnId, @javax.annotation.Nonnull CustomerReturnRefundRejectionRequest customerReturnRefundRejectionRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'customerReturnId' is set + if (customerReturnId == null) { + throw new ApiException("Missing the required parameter 'customerReturnId' when calling rejectCustomerReturnRefund(Async)"); + } + + // verify the required parameter 'customerReturnRefundRejectionRequest' is set + if (customerReturnRefundRejectionRequest == null) { + throw new ApiException("Missing the required parameter 'customerReturnRefundRejectionRequest' when calling rejectCustomerReturnRefund(Async)"); + } + + return rejectCustomerReturnRefundCall(customerReturnId, customerReturnRefundRejectionRequest, _callback); + + } + + /** + * [BETA] Reject customer return refund + * Use this resource to reject customer return refund with provided reason. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-odmowic-zwrotu-wplaty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-reject-customer-return-refund\" target=\"_blank\">EN</a>. + * @param customerReturnId Id of the customer return. (required) + * @param customerReturnRefundRejectionRequest (required) + * @return CustomerReturn + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully rejected customer return. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
422 Unprocessable Entity. Might occur when customer return has already been rejected -
+ */ + public CustomerReturn rejectCustomerReturnRefund(@javax.annotation.Nonnull String customerReturnId, @javax.annotation.Nonnull CustomerReturnRefundRejectionRequest customerReturnRefundRejectionRequest) throws ApiException { + ApiResponse localVarResp = rejectCustomerReturnRefundWithHttpInfo(customerReturnId, customerReturnRefundRejectionRequest); + return localVarResp.getData(); + } + + /** + * [BETA] Reject customer return refund + * Use this resource to reject customer return refund with provided reason. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-odmowic-zwrotu-wplaty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-reject-customer-return-refund\" target=\"_blank\">EN</a>. + * @param customerReturnId Id of the customer return. (required) + * @param customerReturnRefundRejectionRequest (required) + * @return ApiResponse<CustomerReturn> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully rejected customer return. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
422 Unprocessable Entity. Might occur when customer return has already been rejected -
+ */ + public ApiResponse rejectCustomerReturnRefundWithHttpInfo(@javax.annotation.Nonnull String customerReturnId, @javax.annotation.Nonnull CustomerReturnRefundRejectionRequest customerReturnRefundRejectionRequest) throws ApiException { + okhttp3.Call localVarCall = rejectCustomerReturnRefundValidateBeforeCall(customerReturnId, customerReturnRefundRejectionRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * [BETA] Reject customer return refund (asynchronously) + * Use this resource to reject customer return refund with provided reason. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-odmowic-zwrotu-wplaty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-reject-customer-return-refund\" target=\"_blank\">EN</a>. + * @param customerReturnId Id of the customer return. (required) + * @param customerReturnRefundRejectionRequest (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully rejected customer return. -
400 Bad request. -
401 Unauthorized -
403 Forbidden -
406 Not Acceptable -
422 Unprocessable Entity. Might occur when customer return has already been rejected -
+ */ + public okhttp3.Call rejectCustomerReturnRefundAsync(@javax.annotation.Nonnull String customerReturnId, @javax.annotation.Nonnull CustomerReturnRefundRejectionRequest customerReturnRefundRejectionRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = rejectCustomerReturnRefundValidateBeforeCall(customerReturnId, customerReturnRefundRejectionRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/DeliveryApi.java b/src/main/java/pl/wtx/allegro/api/client/DeliveryApi.java new file mode 100644 index 0000000..27fab47 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/DeliveryApi.java @@ -0,0 +1,1054 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.DeliverySettingsRequest; +import pl.wtx.allegro.api.client.model.DeliverySettingsResponse; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200Response; +import pl.wtx.allegro.api.client.model.GetListOfShippingRatestUsingGET200Response; +import pl.wtx.allegro.api.client.model.ShippingRatesSet; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DeliveryApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DeliveryApi() { + this(Configuration.getDefaultApiClient()); + } + + public DeliveryApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createShippingRatesSetUsingPOST + * @param shippingRatesSet Shipping rates set (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Authentication required -
422 The user has reached the limit of shipping rates sets. Information on the limit will be returned in the error message. -
+ */ + public okhttp3.Call createShippingRatesSetUsingPOSTCall(@javax.annotation.Nonnull ShippingRatesSet shippingRatesSet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = shippingRatesSet; + + // create path and map variables + String localVarPath = "/sale/shipping-rates"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createShippingRatesSetUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull ShippingRatesSet shippingRatesSet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'shippingRatesSet' is set + if (shippingRatesSet == null) { + throw new ApiException("Missing the required parameter 'shippingRatesSet' when calling createShippingRatesSetUsingPOST(Async)"); + } + + return createShippingRatesSetUsingPOSTCall(shippingRatesSet, _callback); + + } + + /** + * Create a new shipping rates set + * Use this resource to create a new seller's shipping rates set. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-add-shipping-rates\" target=\"_blank\">EN</a>. + * @param shippingRatesSet Shipping rates set (required) + * @return ShippingRatesSet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Authentication required -
422 The user has reached the limit of shipping rates sets. Information on the limit will be returned in the error message. -
+ */ + public ShippingRatesSet createShippingRatesSetUsingPOST(@javax.annotation.Nonnull ShippingRatesSet shippingRatesSet) throws ApiException { + ApiResponse localVarResp = createShippingRatesSetUsingPOSTWithHttpInfo(shippingRatesSet); + return localVarResp.getData(); + } + + /** + * Create a new shipping rates set + * Use this resource to create a new seller's shipping rates set. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-add-shipping-rates\" target=\"_blank\">EN</a>. + * @param shippingRatesSet Shipping rates set (required) + * @return ApiResponse<ShippingRatesSet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Authentication required -
422 The user has reached the limit of shipping rates sets. Information on the limit will be returned in the error message. -
+ */ + public ApiResponse createShippingRatesSetUsingPOSTWithHttpInfo(@javax.annotation.Nonnull ShippingRatesSet shippingRatesSet) throws ApiException { + okhttp3.Call localVarCall = createShippingRatesSetUsingPOSTValidateBeforeCall(shippingRatesSet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a new shipping rates set (asynchronously) + * Use this resource to create a new seller's shipping rates set. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-add-shipping-rates\" target=\"_blank\">EN</a>. + * @param shippingRatesSet Shipping rates set (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Authentication required -
422 The user has reached the limit of shipping rates sets. Information on the limit will be returned in the error message. -
+ */ + public okhttp3.Call createShippingRatesSetUsingPOSTAsync(@javax.annotation.Nonnull ShippingRatesSet shippingRatesSet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createShippingRatesSetUsingPOSTValidateBeforeCall(shippingRatesSet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getListOfDeliveryMethodsUsingGET + * @param marketplace Allows to filter delivery methods by marketplace id. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
+ */ + public okhttp3.Call getListOfDeliveryMethodsUsingGETCall(@javax.annotation.Nullable String marketplace, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/delivery-methods"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marketplace != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplace", marketplace)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getListOfDeliveryMethodsUsingGETValidateBeforeCall(@javax.annotation.Nullable String marketplace, final ApiCallback _callback) throws ApiException { + return getListOfDeliveryMethodsUsingGETCall(marketplace, _callback); + + } + + /** + * Get the list of delivery methods + * Use this resource to get a list of all delivery methods currently available on the platform, as well as those that have already been discontinued. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-add-shipping-rates\" target=\"_blank\">EN</a>. + * @param marketplace Allows to filter delivery methods by marketplace id. (optional) + * @return GetListOfDeliveryMethodsUsingGET200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
+ */ + public GetListOfDeliveryMethodsUsingGET200Response getListOfDeliveryMethodsUsingGET(@javax.annotation.Nullable String marketplace) throws ApiException { + ApiResponse localVarResp = getListOfDeliveryMethodsUsingGETWithHttpInfo(marketplace); + return localVarResp.getData(); + } + + /** + * Get the list of delivery methods + * Use this resource to get a list of all delivery methods currently available on the platform, as well as those that have already been discontinued. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-add-shipping-rates\" target=\"_blank\">EN</a>. + * @param marketplace Allows to filter delivery methods by marketplace id. (optional) + * @return ApiResponse<GetListOfDeliveryMethodsUsingGET200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
+ */ + public ApiResponse getListOfDeliveryMethodsUsingGETWithHttpInfo(@javax.annotation.Nullable String marketplace) throws ApiException { + okhttp3.Call localVarCall = getListOfDeliveryMethodsUsingGETValidateBeforeCall(marketplace, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the list of delivery methods (asynchronously) + * Use this resource to get a list of all delivery methods currently available on the platform, as well as those that have already been discontinued. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-add-shipping-rates\" target=\"_blank\">EN</a>. + * @param marketplace Allows to filter delivery methods by marketplace id. (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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
+ */ + public okhttp3.Call getListOfDeliveryMethodsUsingGETAsync(@javax.annotation.Nullable String marketplace, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getListOfDeliveryMethodsUsingGETValidateBeforeCall(marketplace, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getListOfShippingRatestUsingGET + * @param marketplace Allows to filter shipping rates by marketplace that they are qualified for. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required -
403 Unauthorized -
+ */ + public okhttp3.Call getListOfShippingRatestUsingGETCall(@javax.annotation.Nullable String marketplace, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/shipping-rates"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marketplace != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplace", marketplace)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getListOfShippingRatestUsingGETValidateBeforeCall(@javax.annotation.Nullable String marketplace, final ApiCallback _callback) throws ApiException { + return getListOfShippingRatestUsingGETCall(marketplace, _callback); + + } + + /** + * Get the user's shipping rates + * Use this resource to get a list of seller's shipping rates. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-shipping-rates\" target=\"_blank\">EN</a>. + * @param marketplace Allows to filter shipping rates by marketplace that they are qualified for. (optional) + * @return GetListOfShippingRatestUsingGET200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required -
403 Unauthorized -
+ */ + public GetListOfShippingRatestUsingGET200Response getListOfShippingRatestUsingGET(@javax.annotation.Nullable String marketplace) throws ApiException { + ApiResponse localVarResp = getListOfShippingRatestUsingGETWithHttpInfo(marketplace); + return localVarResp.getData(); + } + + /** + * Get the user's shipping rates + * Use this resource to get a list of seller's shipping rates. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-shipping-rates\" target=\"_blank\">EN</a>. + * @param marketplace Allows to filter shipping rates by marketplace that they are qualified for. (optional) + * @return ApiResponse<GetListOfShippingRatestUsingGET200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required -
403 Unauthorized -
+ */ + public ApiResponse getListOfShippingRatestUsingGETWithHttpInfo(@javax.annotation.Nullable String marketplace) throws ApiException { + okhttp3.Call localVarCall = getListOfShippingRatestUsingGETValidateBeforeCall(marketplace, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's shipping rates (asynchronously) + * Use this resource to get a list of seller's shipping rates. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-shipping-rates\" target=\"_blank\">EN</a>. + * @param marketplace Allows to filter shipping rates by marketplace that they are qualified for. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required -
403 Unauthorized -
+ */ + public okhttp3.Call getListOfShippingRatestUsingGETAsync(@javax.annotation.Nullable String marketplace, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getListOfShippingRatestUsingGETValidateBeforeCall(marketplace, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getSaleDeliverySettings + * @param marketplaceId Marketplace for which delivery settings will be returned. By default (if the marketplace parameter is not set) the marketplace on which the seller has registered is used. However, we recommend that the marketplace.id query parameter should always be explicitly set. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
403 Forbidden - not allowed to access user data. -
422 Unprocessable Entity - not supported marketplace. -
+ */ + public okhttp3.Call getSaleDeliverySettingsCall(@javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/delivery-settings"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marketplaceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplace.id", marketplaceId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSaleDeliverySettingsValidateBeforeCall(@javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + return getSaleDeliverySettingsCall(marketplaceId, _callback); + + } + + /** + * Get the user's delivery settings + * Use this resource to get the delivery settings declared by the seller. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-ustawienia-dostawy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-get-delivery-settings\" target=\"_blank\">EN</a>. + * @param marketplaceId Marketplace for which delivery settings will be returned. By default (if the marketplace parameter is not set) the marketplace on which the seller has registered is used. However, we recommend that the marketplace.id query parameter should always be explicitly set. (optional) + * @return DeliverySettingsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
403 Forbidden - not allowed to access user data. -
422 Unprocessable Entity - not supported marketplace. -
+ */ + public DeliverySettingsResponse getSaleDeliverySettings(@javax.annotation.Nullable String marketplaceId) throws ApiException { + ApiResponse localVarResp = getSaleDeliverySettingsWithHttpInfo(marketplaceId); + return localVarResp.getData(); + } + + /** + * Get the user's delivery settings + * Use this resource to get the delivery settings declared by the seller. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-ustawienia-dostawy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-get-delivery-settings\" target=\"_blank\">EN</a>. + * @param marketplaceId Marketplace for which delivery settings will be returned. By default (if the marketplace parameter is not set) the marketplace on which the seller has registered is used. However, we recommend that the marketplace.id query parameter should always be explicitly set. (optional) + * @return ApiResponse<DeliverySettingsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
403 Forbidden - not allowed to access user data. -
422 Unprocessable Entity - not supported marketplace. -
+ */ + public ApiResponse getSaleDeliverySettingsWithHttpInfo(@javax.annotation.Nullable String marketplaceId) throws ApiException { + okhttp3.Call localVarCall = getSaleDeliverySettingsValidateBeforeCall(marketplaceId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's delivery settings (asynchronously) + * Use this resource to get the delivery settings declared by the seller. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-ustawienia-dostawy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-get-delivery-settings\" target=\"_blank\">EN</a>. + * @param marketplaceId Marketplace for which delivery settings will be returned. By default (if the marketplace parameter is not set) the marketplace on which the seller has registered is used. However, we recommend that the marketplace.id query parameter should always be explicitly set. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
403 Forbidden - not allowed to access user data. -
422 Unprocessable Entity - not supported marketplace. -
+ */ + public okhttp3.Call getSaleDeliverySettingsAsync(@javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSaleDeliverySettingsValidateBeforeCall(marketplaceId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getShippingRatesSetUsingGET + * @param id Shipping rates set identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required -
403 Unauthorized -
404 Shipping rates set with given ID not found -
+ */ + public okhttp3.Call getShippingRatesSetUsingGETCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/shipping-rates/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getShippingRatesSetUsingGETValidateBeforeCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getShippingRatesSetUsingGET(Async)"); + } + + return getShippingRatesSetUsingGETCall(id, _callback); + + } + + /** + * Get the details of a shipping rates set + * Use this resource to get details of the given shipping rates set. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-shipping-rates\" target=\"_blank\">EN</a>. + * @param id Shipping rates set identifier. (required) + * @return ShippingRatesSet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required -
403 Unauthorized -
404 Shipping rates set with given ID not found -
+ */ + public ShippingRatesSet getShippingRatesSetUsingGET(@javax.annotation.Nonnull String id) throws ApiException { + ApiResponse localVarResp = getShippingRatesSetUsingGETWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get the details of a shipping rates set + * Use this resource to get details of the given shipping rates set. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-shipping-rates\" target=\"_blank\">EN</a>. + * @param id Shipping rates set identifier. (required) + * @return ApiResponse<ShippingRatesSet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required -
403 Unauthorized -
404 Shipping rates set with given ID not found -
+ */ + public ApiResponse getShippingRatesSetUsingGETWithHttpInfo(@javax.annotation.Nonnull String id) throws ApiException { + okhttp3.Call localVarCall = getShippingRatesSetUsingGETValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the details of a shipping rates set (asynchronously) + * Use this resource to get details of the given shipping rates set. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-shipping-rates\" target=\"_blank\">EN</a>. + * @param id Shipping rates set identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required -
403 Unauthorized -
404 Shipping rates set with given ID not found -
+ */ + public okhttp3.Call getShippingRatesSetUsingGETAsync(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getShippingRatesSetUsingGETValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for modifyShippingRatesSetUsingPUT + * @param id Shipping rates set identifier. (required) + * @param shippingRatesSet Shipping rates set (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad request -
401 Authentication required -
403 Unauthorized -
404 Set with given id does not exist -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call modifyShippingRatesSetUsingPUTCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull ShippingRatesSet shippingRatesSet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = shippingRatesSet; + + // create path and map variables + String localVarPath = "/sale/shipping-rates/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call modifyShippingRatesSetUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull ShippingRatesSet shippingRatesSet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling modifyShippingRatesSetUsingPUT(Async)"); + } + + // verify the required parameter 'shippingRatesSet' is set + if (shippingRatesSet == null) { + throw new ApiException("Missing the required parameter 'shippingRatesSet' when calling modifyShippingRatesSetUsingPUT(Async)"); + } + + return modifyShippingRatesSetUsingPUTCall(id, shippingRatesSet, _callback); + + } + + /** + * Edit a user's shipping rates set + * Use this resource to edit a new seller's shipping rates set. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-edytowac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-modify-shipping-rates\" target=\"_blank\">EN</a>. + * @param id Shipping rates set identifier. (required) + * @param shippingRatesSet Shipping rates set (required) + * @return ShippingRatesSet + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad request -
401 Authentication required -
403 Unauthorized -
404 Set with given id does not exist -
422 Unprocessable Entity. -
+ */ + public ShippingRatesSet modifyShippingRatesSetUsingPUT(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull ShippingRatesSet shippingRatesSet) throws ApiException { + ApiResponse localVarResp = modifyShippingRatesSetUsingPUTWithHttpInfo(id, shippingRatesSet); + return localVarResp.getData(); + } + + /** + * Edit a user's shipping rates set + * Use this resource to edit a new seller's shipping rates set. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-edytowac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-modify-shipping-rates\" target=\"_blank\">EN</a>. + * @param id Shipping rates set identifier. (required) + * @param shippingRatesSet Shipping rates set (required) + * @return ApiResponse<ShippingRatesSet> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad request -
401 Authentication required -
403 Unauthorized -
404 Set with given id does not exist -
422 Unprocessable Entity. -
+ */ + public ApiResponse modifyShippingRatesSetUsingPUTWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull ShippingRatesSet shippingRatesSet) throws ApiException { + okhttp3.Call localVarCall = modifyShippingRatesSetUsingPUTValidateBeforeCall(id, shippingRatesSet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Edit a user's shipping rates set (asynchronously) + * Use this resource to edit a new seller's shipping rates set. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-edytowac-cennik-dostaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-modify-shipping-rates\" target=\"_blank\">EN</a>. + * @param id Shipping rates set identifier. (required) + * @param shippingRatesSet Shipping rates set (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad request -
401 Authentication required -
403 Unauthorized -
404 Set with given id does not exist -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call modifyShippingRatesSetUsingPUTAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull ShippingRatesSet shippingRatesSet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = modifyShippingRatesSetUsingPUTValidateBeforeCall(id, shippingRatesSet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for putSaleDeliverySettings + * @param deliverySettingsRequest Delivery settings set (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
403 Forbidden - not allowed to access user data. -
422 Unprocessable Entity - wrong amount, wrong currency, wrong join policy strategy, unsupported marketplace, attempt to modify marketplace allegro-business-* - modifying the settings for such a marketplace should be done by modifying the allegro-* marketplace. -
+ */ + public okhttp3.Call putSaleDeliverySettingsCall(@javax.annotation.Nonnull DeliverySettingsRequest deliverySettingsRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = deliverySettingsRequest; + + // create path and map variables + String localVarPath = "/sale/delivery-settings"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putSaleDeliverySettingsValidateBeforeCall(@javax.annotation.Nonnull DeliverySettingsRequest deliverySettingsRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'deliverySettingsRequest' is set + if (deliverySettingsRequest == null) { + throw new ApiException("Missing the required parameter 'deliverySettingsRequest' when calling putSaleDeliverySettings(Async)"); + } + + return putSaleDeliverySettingsCall(deliverySettingsRequest, _callback); + + } + + /** + * Modify the user's delivery settings + * Use this resource to modify the delivery settings declared by the seller. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-edytowac-ustawienia-dostawy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-edit-delivery-settings\" target=\"_blank\">EN</a>. + * @param deliverySettingsRequest Delivery settings set (required) + * @return DeliverySettingsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
403 Forbidden - not allowed to access user data. -
422 Unprocessable Entity - wrong amount, wrong currency, wrong join policy strategy, unsupported marketplace, attempt to modify marketplace allegro-business-* - modifying the settings for such a marketplace should be done by modifying the allegro-* marketplace. -
+ */ + public DeliverySettingsResponse putSaleDeliverySettings(@javax.annotation.Nonnull DeliverySettingsRequest deliverySettingsRequest) throws ApiException { + ApiResponse localVarResp = putSaleDeliverySettingsWithHttpInfo(deliverySettingsRequest); + return localVarResp.getData(); + } + + /** + * Modify the user's delivery settings + * Use this resource to modify the delivery settings declared by the seller. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-edytowac-ustawienia-dostawy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-edit-delivery-settings\" target=\"_blank\">EN</a>. + * @param deliverySettingsRequest Delivery settings set (required) + * @return ApiResponse<DeliverySettingsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
403 Forbidden - not allowed to access user data. -
422 Unprocessable Entity - wrong amount, wrong currency, wrong join policy strategy, unsupported marketplace, attempt to modify marketplace allegro-business-* - modifying the settings for such a marketplace should be done by modifying the allegro-* marketplace. -
+ */ + public ApiResponse putSaleDeliverySettingsWithHttpInfo(@javax.annotation.Nonnull DeliverySettingsRequest deliverySettingsRequest) throws ApiException { + okhttp3.Call localVarCall = putSaleDeliverySettingsValidateBeforeCall(deliverySettingsRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Modify the user's delivery settings (asynchronously) + * Use this resource to modify the delivery settings declared by the seller. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-edytowac-ustawienia-dostawy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-edit-delivery-settings\" target=\"_blank\">EN</a>. + * @param deliverySettingsRequest Delivery settings set (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Authentication required. -
403 Forbidden - not allowed to access user data. -
422 Unprocessable Entity - wrong amount, wrong currency, wrong join policy strategy, unsupported marketplace, attempt to modify marketplace allegro-business-* - modifying the settings for such a marketplace should be done by modifying the allegro-* marketplace. -
+ */ + public okhttp3.Call putSaleDeliverySettingsAsync(@javax.annotation.Nonnull DeliverySettingsRequest deliverySettingsRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putSaleDeliverySettingsValidateBeforeCall(deliverySettingsRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/DisputesApi.java b/src/main/java/pl/wtx/allegro/api/client/DisputesApi.java new file mode 100644 index 0000000..451debd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/DisputesApi.java @@ -0,0 +1,1134 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AttachmentDeclaration; +import pl.wtx.allegro.api.client.model.Dispute; +import pl.wtx.allegro.api.client.model.DisputeAttachmentId; +import pl.wtx.allegro.api.client.model.DisputeListResponse; +import pl.wtx.allegro.api.client.model.DisputeMessage; +import pl.wtx.allegro.api.client.model.DisputeMessageList; +import java.io.File; +import pl.wtx.allegro.api.client.model.MessageRequest; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DisputesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DisputesApi() { + this(Configuration.getDefaultApiClient()); + } + + public DisputesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addMessageToDisputeUsingPOST + * @param disputeId Dispute identifier. (required) + * @param messageRequest Message request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 CREATED -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Dispute is in a state that forbids adding new messages -
422 Unprocessable Entity -
+ */ + public okhttp3.Call addMessageToDisputeUsingPOSTCall(@javax.annotation.Nonnull UUID disputeId, @javax.annotation.Nonnull MessageRequest messageRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = messageRequest; + + // create path and map variables + String localVarPath = "/sale/disputes/{disputeId}/messages" + .replace("{" + "disputeId" + "}", localVarApiClient.escapeString(disputeId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addMessageToDisputeUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull UUID disputeId, @javax.annotation.Nonnull MessageRequest messageRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'disputeId' is set + if (disputeId == null) { + throw new ApiException("Missing the required parameter 'disputeId' when calling addMessageToDisputeUsingPOST(Async)"); + } + + // verify the required parameter 'messageRequest' is set + if (messageRequest == null) { + throw new ApiException("Missing the required parameter 'messageRequest' when calling addMessageToDisputeUsingPOST(Async)"); + } + + return addMessageToDisputeUsingPOSTCall(disputeId, messageRequest, _callback); + + } + + /** + * Add a message to a dispute + * Use this resource to post a message in certain dispute. At least one of fields: 'text', 'attachment' has to be present. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#nowa-wiadomosc-w-dyskusji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#add-a-new-message-in-the-discussion\" target=\"_blank\">EN</a>. + * @param disputeId Dispute identifier. (required) + * @param messageRequest Message request (required) + * @return DisputeMessage + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 CREATED -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Dispute is in a state that forbids adding new messages -
422 Unprocessable Entity -
+ */ + public DisputeMessage addMessageToDisputeUsingPOST(@javax.annotation.Nonnull UUID disputeId, @javax.annotation.Nonnull MessageRequest messageRequest) throws ApiException { + ApiResponse localVarResp = addMessageToDisputeUsingPOSTWithHttpInfo(disputeId, messageRequest); + return localVarResp.getData(); + } + + /** + * Add a message to a dispute + * Use this resource to post a message in certain dispute. At least one of fields: 'text', 'attachment' has to be present. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#nowa-wiadomosc-w-dyskusji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#add-a-new-message-in-the-discussion\" target=\"_blank\">EN</a>. + * @param disputeId Dispute identifier. (required) + * @param messageRequest Message request (required) + * @return ApiResponse<DisputeMessage> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 CREATED -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Dispute is in a state that forbids adding new messages -
422 Unprocessable Entity -
+ */ + public ApiResponse addMessageToDisputeUsingPOSTWithHttpInfo(@javax.annotation.Nonnull UUID disputeId, @javax.annotation.Nonnull MessageRequest messageRequest) throws ApiException { + okhttp3.Call localVarCall = addMessageToDisputeUsingPOSTValidateBeforeCall(disputeId, messageRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add a message to a dispute (asynchronously) + * Use this resource to post a message in certain dispute. At least one of fields: 'text', 'attachment' has to be present. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#nowa-wiadomosc-w-dyskusji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#add-a-new-message-in-the-discussion\" target=\"_blank\">EN</a>. + * @param disputeId Dispute identifier. (required) + * @param messageRequest Message request (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 CREATED -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Dispute is in a state that forbids adding new messages -
422 Unprocessable Entity -
+ */ + public okhttp3.Call addMessageToDisputeUsingPOSTAsync(@javax.annotation.Nonnull UUID disputeId, @javax.annotation.Nonnull MessageRequest messageRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addMessageToDisputeUsingPOSTValidateBeforeCall(disputeId, messageRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createAnAttachmentUsingPOST + * @param attachmentDeclaration A detailed declaration of a file to be uploaded (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 CREATED * Location - The location URI points to a resource that will display the status of the asynchronous processing.
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createAnAttachmentUsingPOSTCall(@javax.annotation.Nonnull AttachmentDeclaration attachmentDeclaration, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = attachmentDeclaration; + + // create path and map variables + String localVarPath = "/sale/dispute-attachments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createAnAttachmentUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull AttachmentDeclaration attachmentDeclaration, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'attachmentDeclaration' is set + if (attachmentDeclaration == null) { + throw new ApiException("Missing the required parameter 'attachmentDeclaration' when calling createAnAttachmentUsingPOST(Async)"); + } + + return createAnAttachmentUsingPOSTCall(attachmentDeclaration, _callback); + + } + + /** + * Create an attachment declaration + * Use this resource to post an attachment declaration. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#deklaracja-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#attachment-declaration\" target=\"_blank\">EN</a>. + * @param attachmentDeclaration A detailed declaration of a file to be uploaded (required) + * @return DisputeAttachmentId + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 CREATED * Location - The location URI points to a resource that will display the status of the asynchronous processing.
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public DisputeAttachmentId createAnAttachmentUsingPOST(@javax.annotation.Nonnull AttachmentDeclaration attachmentDeclaration) throws ApiException { + ApiResponse localVarResp = createAnAttachmentUsingPOSTWithHttpInfo(attachmentDeclaration); + return localVarResp.getData(); + } + + /** + * Create an attachment declaration + * Use this resource to post an attachment declaration. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#deklaracja-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#attachment-declaration\" target=\"_blank\">EN</a>. + * @param attachmentDeclaration A detailed declaration of a file to be uploaded (required) + * @return ApiResponse<DisputeAttachmentId> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 CREATED * Location - The location URI points to a resource that will display the status of the asynchronous processing.
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse createAnAttachmentUsingPOSTWithHttpInfo(@javax.annotation.Nonnull AttachmentDeclaration attachmentDeclaration) throws ApiException { + okhttp3.Call localVarCall = createAnAttachmentUsingPOSTValidateBeforeCall(attachmentDeclaration, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create an attachment declaration (asynchronously) + * Use this resource to post an attachment declaration. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#deklaracja-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#attachment-declaration\" target=\"_blank\">EN</a>. + * @param attachmentDeclaration A detailed declaration of a file to be uploaded (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 CREATED * Location - The location URI points to a resource that will display the status of the asynchronous processing.
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createAnAttachmentUsingPOSTAsync(@javax.annotation.Nonnull AttachmentDeclaration attachmentDeclaration, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createAnAttachmentUsingPOSTValidateBeforeCall(attachmentDeclaration, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAttachmentUsingGET + * @param attachmentId Attachment identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAttachmentUsingGETCall(@javax.annotation.Nonnull UUID attachmentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/dispute-attachments/{attachmentId}" + .replace("{" + "attachmentId" + "}", localVarApiClient.escapeString(attachmentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAttachmentUsingGETValidateBeforeCall(@javax.annotation.Nonnull UUID attachmentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'attachmentId' is set + if (attachmentId == null) { + throw new ApiException("Missing the required parameter 'attachmentId' when calling getAttachmentUsingGET(Async)"); + } + + return getAttachmentUsingGETCall(attachmentId, _callback); + + } + + /** + * Get an attachment + * Use this resource to get an attachment. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#pobranie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#attachment-related-to-the-discussion\" target=\"_blank\">EN</a>. + * @param attachmentId Attachment identifier. (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public File getAttachmentUsingGET(@javax.annotation.Nonnull UUID attachmentId) throws ApiException { + ApiResponse localVarResp = getAttachmentUsingGETWithHttpInfo(attachmentId); + return localVarResp.getData(); + } + + /** + * Get an attachment + * Use this resource to get an attachment. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#pobranie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#attachment-related-to-the-discussion\" target=\"_blank\">EN</a>. + * @param attachmentId Attachment identifier. (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getAttachmentUsingGETWithHttpInfo(@javax.annotation.Nonnull UUID attachmentId) throws ApiException { + okhttp3.Call localVarCall = getAttachmentUsingGETValidateBeforeCall(attachmentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get an attachment (asynchronously) + * Use this resource to get an attachment. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#pobranie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#attachment-related-to-the-discussion\" target=\"_blank\">EN</a>. + * @param attachmentId Attachment identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getAttachmentUsingGETAsync(@javax.annotation.Nonnull UUID attachmentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAttachmentUsingGETValidateBeforeCall(attachmentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getDisputeUsingGET + * @param disputeId Dispute identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getDisputeUsingGETCall(@javax.annotation.Nonnull UUID disputeId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/disputes/{disputeId}" + .replace("{" + "disputeId" + "}", localVarApiClient.escapeString(disputeId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getDisputeUsingGETValidateBeforeCall(@javax.annotation.Nonnull UUID disputeId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'disputeId' is set + if (disputeId == null) { + throw new ApiException("Missing the required parameter 'disputeId' when calling getDisputeUsingGET(Async)"); + } + + return getDisputeUsingGETCall(disputeId, _callback); + + } + + /** + * Get a single dispute + * Use this resource to get a single dispute. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#szczegolowe-informacje-o-dyskusji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#information-about-a-particular-discussion\" target=\"_blank\">EN</a>. + * @param disputeId Dispute identifier. (required) + * @return Dispute + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public Dispute getDisputeUsingGET(@javax.annotation.Nonnull UUID disputeId) throws ApiException { + ApiResponse localVarResp = getDisputeUsingGETWithHttpInfo(disputeId); + return localVarResp.getData(); + } + + /** + * Get a single dispute + * Use this resource to get a single dispute. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#szczegolowe-informacje-o-dyskusji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#information-about-a-particular-discussion\" target=\"_blank\">EN</a>. + * @param disputeId Dispute identifier. (required) + * @return ApiResponse<Dispute> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getDisputeUsingGETWithHttpInfo(@javax.annotation.Nonnull UUID disputeId) throws ApiException { + okhttp3.Call localVarCall = getDisputeUsingGETValidateBeforeCall(disputeId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a single dispute (asynchronously) + * Use this resource to get a single dispute. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#szczegolowe-informacje-o-dyskusji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#information-about-a-particular-discussion\" target=\"_blank\">EN</a>. + * @param disputeId Dispute identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getDisputeUsingGETAsync(@javax.annotation.Nonnull UUID disputeId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getDisputeUsingGETValidateBeforeCall(disputeId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getListOfDisputesUsingGET + * @param checkoutFormId Checkout form identifier. (optional) + * @param limit The maximum number of disputes in a response. (optional, default to 10) + * @param offset Index of first returned dispute. (optional, default to 0) + * @param status Filter disputes with given set of statuses. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getListOfDisputesUsingGETCall(@javax.annotation.Nullable UUID checkoutFormId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/disputes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (checkoutFormId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("checkoutForm.id", checkoutFormId)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "status", status)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getListOfDisputesUsingGETValidateBeforeCall(@javax.annotation.Nullable UUID checkoutFormId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable List status, final ApiCallback _callback) throws ApiException { + return getListOfDisputesUsingGETCall(checkoutFormId, limit, offset, status, _callback); + + } + + /** + * Get the user's disputes + * Use this resource to get the list of your disputes ordered by descending opened date. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#dyskusje-na-koncie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#all-discussions\" target=\"_blank\">EN</a>. + * @param checkoutFormId Checkout form identifier. (optional) + * @param limit The maximum number of disputes in a response. (optional, default to 10) + * @param offset Index of first returned dispute. (optional, default to 0) + * @param status Filter disputes with given set of statuses. (optional) + * @return DisputeListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
422 Unprocessable Entity -
+ */ + public DisputeListResponse getListOfDisputesUsingGET(@javax.annotation.Nullable UUID checkoutFormId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable List status) throws ApiException { + ApiResponse localVarResp = getListOfDisputesUsingGETWithHttpInfo(checkoutFormId, limit, offset, status); + return localVarResp.getData(); + } + + /** + * Get the user's disputes + * Use this resource to get the list of your disputes ordered by descending opened date. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#dyskusje-na-koncie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#all-discussions\" target=\"_blank\">EN</a>. + * @param checkoutFormId Checkout form identifier. (optional) + * @param limit The maximum number of disputes in a response. (optional, default to 10) + * @param offset Index of first returned dispute. (optional, default to 0) + * @param status Filter disputes with given set of statuses. (optional) + * @return ApiResponse<DisputeListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ApiResponse getListOfDisputesUsingGETWithHttpInfo(@javax.annotation.Nullable UUID checkoutFormId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable List status) throws ApiException { + okhttp3.Call localVarCall = getListOfDisputesUsingGETValidateBeforeCall(checkoutFormId, limit, offset, status, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's disputes (asynchronously) + * Use this resource to get the list of your disputes ordered by descending opened date. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#dyskusje-na-koncie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#all-discussions\" target=\"_blank\">EN</a>. + * @param checkoutFormId Checkout form identifier. (optional) + * @param limit The maximum number of disputes in a response. (optional, default to 10) + * @param offset Index of first returned dispute. (optional, default to 0) + * @param status Filter disputes with given set of statuses. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getListOfDisputesUsingGETAsync(@javax.annotation.Nullable UUID checkoutFormId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable List status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getListOfDisputesUsingGETValidateBeforeCall(checkoutFormId, limit, offset, status, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getMessagesFromDisputeUsingGET + * @param disputeId Dispute identifier. (required) + * @param limit The maximum number of messages within dispute returned in a response. (optional, default to 10) + * @param offset Index of first returned message within dispute. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getMessagesFromDisputeUsingGETCall(@javax.annotation.Nonnull UUID disputeId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/disputes/{disputeId}/messages" + .replace("{" + "disputeId" + "}", localVarApiClient.escapeString(disputeId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getMessagesFromDisputeUsingGETValidateBeforeCall(@javax.annotation.Nonnull UUID disputeId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'disputeId' is set + if (disputeId == null) { + throw new ApiException("Missing the required parameter 'disputeId' when calling getMessagesFromDisputeUsingGET(Async)"); + } + + return getMessagesFromDisputeUsingGETCall(disputeId, limit, offset, _callback); + + } + + /** + * Get the messages within a dispute + * Use this resource to get the list of messages within dispute. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#wiadomosci-z-dyskusji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#all-messages-within-a-discussion\" target=\"_blank\">EN</a>. + * @param disputeId Dispute identifier. (required) + * @param limit The maximum number of messages within dispute returned in a response. (optional, default to 10) + * @param offset Index of first returned message within dispute. (optional, default to 0) + * @return DisputeMessageList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public DisputeMessageList getMessagesFromDisputeUsingGET(@javax.annotation.Nonnull UUID disputeId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getMessagesFromDisputeUsingGETWithHttpInfo(disputeId, limit, offset); + return localVarResp.getData(); + } + + /** + * Get the messages within a dispute + * Use this resource to get the list of messages within dispute. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#wiadomosci-z-dyskusji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#all-messages-within-a-discussion\" target=\"_blank\">EN</a>. + * @param disputeId Dispute identifier. (required) + * @param limit The maximum number of messages within dispute returned in a response. (optional, default to 10) + * @param offset Index of first returned message within dispute. (optional, default to 0) + * @return ApiResponse<DisputeMessageList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getMessagesFromDisputeUsingGETWithHttpInfo(@javax.annotation.Nonnull UUID disputeId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getMessagesFromDisputeUsingGETValidateBeforeCall(disputeId, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the messages within a dispute (asynchronously) + * Use this resource to get the list of messages within dispute. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#wiadomosci-z-dyskusji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#all-messages-within-a-discussion\" target=\"_blank\">EN</a>. + * @param disputeId Dispute identifier. (required) + * @param limit The maximum number of messages within dispute returned in a response. (optional, default to 10) + * @param offset Index of first returned message within dispute. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getMessagesFromDisputeUsingGETAsync(@javax.annotation.Nonnull UUID disputeId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getMessagesFromDisputeUsingGETValidateBeforeCall(disputeId, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadDisputeAttachmentUsingPUT + * @param attachmentId Attachment identifier. (required) + * @param body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
413 File is too big -
415 Unsupported media type -
422 Unprocessable Entity -
+ */ + public okhttp3.Call uploadDisputeAttachmentUsingPUTCall(@javax.annotation.Nonnull UUID attachmentId, @javax.annotation.Nonnull File body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://upload.{environment}" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/sale/dispute-attachments/{attachmentId}" + .replace("{" + "attachmentId" + "}", localVarApiClient.escapeString(attachmentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "image/png", + "image/gif", + "image/bmp", + "image/tiff", + "image/jpeg", + "application/pdf" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadDisputeAttachmentUsingPUTValidateBeforeCall(@javax.annotation.Nonnull UUID attachmentId, @javax.annotation.Nonnull File body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'attachmentId' is set + if (attachmentId == null) { + throw new ApiException("Missing the required parameter 'attachmentId' when calling uploadDisputeAttachmentUsingPUT(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling uploadDisputeAttachmentUsingPUT(Async)"); + } + + return uploadDisputeAttachmentUsingPUTCall(attachmentId, body, _callback); + + } + + /** + * Upload a dispute message attachment + * Upload a dispute message attachment. This operation should be used after creating an attachment declaration with *POST /sale/dispute-attachments* **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /sale/dispute-attachments*. The URL is unique and one-time. As its format may change in time, you should always use the address from the header. Do not compose the address on your own. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#dodanie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#adding-an-attachment\" target=\"_blank\">EN</a>. + * @param attachmentId Attachment identifier. (required) + * @param body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
413 File is too big -
415 Unsupported media type -
422 Unprocessable Entity -
+ */ + public void uploadDisputeAttachmentUsingPUT(@javax.annotation.Nonnull UUID attachmentId, @javax.annotation.Nonnull File body) throws ApiException { + uploadDisputeAttachmentUsingPUTWithHttpInfo(attachmentId, body); + } + + /** + * Upload a dispute message attachment + * Upload a dispute message attachment. This operation should be used after creating an attachment declaration with *POST /sale/dispute-attachments* **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /sale/dispute-attachments*. The URL is unique and one-time. As its format may change in time, you should always use the address from the header. Do not compose the address on your own. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#dodanie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#adding-an-attachment\" target=\"_blank\">EN</a>. + * @param attachmentId Attachment identifier. (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
413 File is too big -
415 Unsupported media type -
422 Unprocessable Entity -
+ */ + public ApiResponse uploadDisputeAttachmentUsingPUTWithHttpInfo(@javax.annotation.Nonnull UUID attachmentId, @javax.annotation.Nonnull File body) throws ApiException { + okhttp3.Call localVarCall = uploadDisputeAttachmentUsingPUTValidateBeforeCall(attachmentId, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Upload a dispute message attachment (asynchronously) + * Upload a dispute message attachment. This operation should be used after creating an attachment declaration with *POST /sale/dispute-attachments* **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /sale/dispute-attachments*. The URL is unique and one-time. As its format may change in time, you should always use the address from the header. Do not compose the address on your own. Read more: <a href=\"../../tutorials/jak-zarzadzac-dyskusjami-E7Zj6gK7ysE#dodanie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-discussions-VL6Yr40e5t5#adding-an-attachment\" target=\"_blank\">EN</a>. + * @param attachmentId Attachment identifier. (required) + * @param body (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
413 File is too big -
415 Unsupported media type -
422 Unprocessable Entity -
+ */ + public okhttp3.Call uploadDisputeAttachmentUsingPUTAsync(@javax.annotation.Nonnull UUID attachmentId, @javax.annotation.Nonnull File body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadDisputeAttachmentUsingPUTValidateBeforeCall(attachmentId, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/FulfillmentParcelsApi.java b/src/main/java/pl/wtx/allegro/api/client/FulfillmentParcelsApi.java new file mode 100644 index 0000000..be7ce59 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/FulfillmentParcelsApi.java @@ -0,0 +1,211 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.FulfillmentOrder; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FulfillmentParcelsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FulfillmentParcelsApi() { + this(Configuration.getDefaultApiClient()); + } + + public FulfillmentParcelsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getFulfillmentOrderParcels + * @param orderId The Allegro's platform order identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of parcels shipped by warehouse in a given order. -
404 Not Found -
401 User not authenticated or token is expired -
+ */ + public okhttp3.Call getFulfillmentOrderParcelsCall(@javax.annotation.Nonnull UUID orderId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/orders/{orderId}/parcels" + .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFulfillmentOrderParcelsValidateBeforeCall(@javax.annotation.Nonnull UUID orderId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException("Missing the required parameter 'orderId' when calling getFulfillmentOrderParcels(Async)"); + } + + return getFulfillmentOrderParcelsCall(orderId, _callback); + + } + + /** + * Get list of shipped parcels + * Use this resource to get list of parcels and included items for a given order. Items include detailed information such as expiration dates and serial numbers. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-obslugiwac-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-handle-orders\" target=\"_blank\">EN</a>. + * @param orderId The Allegro's platform order identifier. (required) + * @return FulfillmentOrder + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of parcels shipped by warehouse in a given order. -
404 Not Found -
401 User not authenticated or token is expired -
+ */ + public FulfillmentOrder getFulfillmentOrderParcels(@javax.annotation.Nonnull UUID orderId) throws ApiException { + ApiResponse localVarResp = getFulfillmentOrderParcelsWithHttpInfo(orderId); + return localVarResp.getData(); + } + + /** + * Get list of shipped parcels + * Use this resource to get list of parcels and included items for a given order. Items include detailed information such as expiration dates and serial numbers. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-obslugiwac-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-handle-orders\" target=\"_blank\">EN</a>. + * @param orderId The Allegro's platform order identifier. (required) + * @return ApiResponse<FulfillmentOrder> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of parcels shipped by warehouse in a given order. -
404 Not Found -
401 User not authenticated or token is expired -
+ */ + public ApiResponse getFulfillmentOrderParcelsWithHttpInfo(@javax.annotation.Nonnull UUID orderId) throws ApiException { + okhttp3.Call localVarCall = getFulfillmentOrderParcelsValidateBeforeCall(orderId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get list of shipped parcels (asynchronously) + * Use this resource to get list of parcels and included items for a given order. Items include detailed information such as expiration dates and serial numbers. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-obslugiwac-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#how-to-handle-orders\" target=\"_blank\">EN</a>. + * @param orderId The Allegro's platform order identifier. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of parcels shipped by warehouse in a given order. -
404 Not Found -
401 User not authenticated or token is expired -
+ */ + public okhttp3.Call getFulfillmentOrderParcelsAsync(@javax.annotation.Nonnull UUID orderId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getFulfillmentOrderParcelsValidateBeforeCall(orderId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/FulfillmentProductsApi.java b/src/main/java/pl/wtx/allegro/api/client/FulfillmentProductsApi.java new file mode 100644 index 0000000..5f98861 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/FulfillmentProductsApi.java @@ -0,0 +1,231 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AvailableProductsList; +import pl.wtx.allegro.api.client.model.ErrorsHolder; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FulfillmentProductsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FulfillmentProductsApi() { + this(Configuration.getDefaultApiClient()); + } + + public FulfillmentProductsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getAvailableProducts + * @param acceptLanguage Expected language of product name translation. (optional, default to en-US) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit Maximum number of elements in response. (optional, default to 50) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of products that can be added to Advance Ship Notice. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public okhttp3.Call getAvailableProductsCall(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/available-products"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAvailableProductsValidateBeforeCall(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + return getAvailableProductsCall(acceptLanguage, offset, limit, _callback); + + } + + /** + * Get list of available products + * Use this resource to get a list of products that can be added to Advance Ship Notice. The list contains products for which the seller has created offers and is ordered by product's name. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#sprawdz-dostepne-produkty-do-awizacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#check-available-products-for-asn\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of product name translation. (optional, default to en-US) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit Maximum number of elements in response. (optional, default to 50) + * @return AvailableProductsList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of products that can be added to Advance Ship Notice. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public AvailableProductsList getAvailableProducts(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + ApiResponse localVarResp = getAvailableProductsWithHttpInfo(acceptLanguage, offset, limit); + return localVarResp.getData(); + } + + /** + * Get list of available products + * Use this resource to get a list of products that can be added to Advance Ship Notice. The list contains products for which the seller has created offers and is ordered by product's name. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#sprawdz-dostepne-produkty-do-awizacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#check-available-products-for-asn\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of product name translation. (optional, default to en-US) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit Maximum number of elements in response. (optional, default to 50) + * @return ApiResponse<AvailableProductsList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of products that can be added to Advance Ship Notice. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public ApiResponse getAvailableProductsWithHttpInfo(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + okhttp3.Call localVarCall = getAvailableProductsValidateBeforeCall(acceptLanguage, offset, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get list of available products (asynchronously) + * Use this resource to get a list of products that can be added to Advance Ship Notice. The list contains products for which the seller has created offers and is ordered by product's name. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#sprawdz-dostepne-produkty-do-awizacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#check-available-products-for-asn\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of product name translation. (optional, default to en-US) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit Maximum number of elements in response. (optional, default to 50) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns list of products that can be added to Advance Ship Notice. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public okhttp3.Call getAvailableProductsAsync(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAvailableProductsValidateBeforeCall(acceptLanguage, offset, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/FulfillmentRemovalApi.java b/src/main/java/pl/wtx/allegro/api/client/FulfillmentRemovalApi.java new file mode 100644 index 0000000..0a774d4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/FulfillmentRemovalApi.java @@ -0,0 +1,346 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.FulfillmentRemovalPreference; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FulfillmentRemovalApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FulfillmentRemovalApi() { + this(Configuration.getDefaultApiClient()); + } + + public FulfillmentRemovalApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createFulfillmentRemovalPreferences + * @param fulfillmentRemovalPreference (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Active Fulfillment Removal Preference created. -
401 Unauthorized -
403 Forbidden -
422 Fulfillment Removal Preferences cannot be created due to invalid request body. -
+ */ + public okhttp3.Call createFulfillmentRemovalPreferencesCall(@javax.annotation.Nonnull FulfillmentRemovalPreference fulfillmentRemovalPreference, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = fulfillmentRemovalPreference; + + // create path and map variables + String localVarPath = "/fulfillment/removal/preferences"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createFulfillmentRemovalPreferencesValidateBeforeCall(@javax.annotation.Nonnull FulfillmentRemovalPreference fulfillmentRemovalPreference, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'fulfillmentRemovalPreference' is set + if (fulfillmentRemovalPreference == null) { + throw new ApiException("Missing the required parameter 'fulfillmentRemovalPreference' when calling createFulfillmentRemovalPreferences(Async)"); + } + + return createFulfillmentRemovalPreferencesCall(fulfillmentRemovalPreference, _callback); + + } + + /** + * Create new active Fulfillment Removal Preference + * Use this resource to create new active removal preference. From the moment the preference is set, it becomes the active one, and all new system removal orders will be associated with this preference. Removal preference is associated with system removal order at the moment of removal order is created. It means there can be not yet fulfilled removal orders associated with previously set removal preference. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#utworz-lub-edytuj-ustawienia-sposobu-usuniecia-towaru-z-magazynu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#create-or-edit-settings-for-how-to-remove-goods-from-the-warehouse\" target=\"_blank\">EN</a>. + * @param fulfillmentRemovalPreference (required) + * @return FulfillmentRemovalPreference + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Active Fulfillment Removal Preference created. -
401 Unauthorized -
403 Forbidden -
422 Fulfillment Removal Preferences cannot be created due to invalid request body. -
+ */ + public FulfillmentRemovalPreference createFulfillmentRemovalPreferences(@javax.annotation.Nonnull FulfillmentRemovalPreference fulfillmentRemovalPreference) throws ApiException { + ApiResponse localVarResp = createFulfillmentRemovalPreferencesWithHttpInfo(fulfillmentRemovalPreference); + return localVarResp.getData(); + } + + /** + * Create new active Fulfillment Removal Preference + * Use this resource to create new active removal preference. From the moment the preference is set, it becomes the active one, and all new system removal orders will be associated with this preference. Removal preference is associated with system removal order at the moment of removal order is created. It means there can be not yet fulfilled removal orders associated with previously set removal preference. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#utworz-lub-edytuj-ustawienia-sposobu-usuniecia-towaru-z-magazynu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#create-or-edit-settings-for-how-to-remove-goods-from-the-warehouse\" target=\"_blank\">EN</a>. + * @param fulfillmentRemovalPreference (required) + * @return ApiResponse<FulfillmentRemovalPreference> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Active Fulfillment Removal Preference created. -
401 Unauthorized -
403 Forbidden -
422 Fulfillment Removal Preferences cannot be created due to invalid request body. -
+ */ + public ApiResponse createFulfillmentRemovalPreferencesWithHttpInfo(@javax.annotation.Nonnull FulfillmentRemovalPreference fulfillmentRemovalPreference) throws ApiException { + okhttp3.Call localVarCall = createFulfillmentRemovalPreferencesValidateBeforeCall(fulfillmentRemovalPreference, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new active Fulfillment Removal Preference (asynchronously) + * Use this resource to create new active removal preference. From the moment the preference is set, it becomes the active one, and all new system removal orders will be associated with this preference. Removal preference is associated with system removal order at the moment of removal order is created. It means there can be not yet fulfilled removal orders associated with previously set removal preference. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#utworz-lub-edytuj-ustawienia-sposobu-usuniecia-towaru-z-magazynu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#create-or-edit-settings-for-how-to-remove-goods-from-the-warehouse\" target=\"_blank\">EN</a>. + * @param fulfillmentRemovalPreference (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Active Fulfillment Removal Preference created. -
401 Unauthorized -
403 Forbidden -
422 Fulfillment Removal Preferences cannot be created due to invalid request body. -
+ */ + public okhttp3.Call createFulfillmentRemovalPreferencesAsync(@javax.annotation.Nonnull FulfillmentRemovalPreference fulfillmentRemovalPreference, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createFulfillmentRemovalPreferencesValidateBeforeCall(fulfillmentRemovalPreference, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getFulfillmentRemovalPreferences + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns the current active Fulfillment Removal Preference -
401 Unauthorized -
403 Forbidden -
404 Not Found (Fulfillment Removal Preferences was never set) -
+ */ + public okhttp3.Call getFulfillmentRemovalPreferencesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/removal/preferences"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFulfillmentRemovalPreferencesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getFulfillmentRemovalPreferencesCall(_callback); + + } + + /** + * Get current active removal preference + * Use this resource to read your current removal preference. Removal preference is associated with system removal order at the moment of removal order is created. It means there can be not yet fulfilled removal orders associated with previously set removal preference. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#pobierz-aktualne-ustawienia-sposobu-usuniecia-towaru-z-magazynu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#retrieve-current-settings-for-how-to-remove-goods-from-the-warehouse\" target=\"_blank\">EN</a>. + * @return FulfillmentRemovalPreference + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns the current active Fulfillment Removal Preference -
401 Unauthorized -
403 Forbidden -
404 Not Found (Fulfillment Removal Preferences was never set) -
+ */ + public FulfillmentRemovalPreference getFulfillmentRemovalPreferences() throws ApiException { + ApiResponse localVarResp = getFulfillmentRemovalPreferencesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get current active removal preference + * Use this resource to read your current removal preference. Removal preference is associated with system removal order at the moment of removal order is created. It means there can be not yet fulfilled removal orders associated with previously set removal preference. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#pobierz-aktualne-ustawienia-sposobu-usuniecia-towaru-z-magazynu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#retrieve-current-settings-for-how-to-remove-goods-from-the-warehouse\" target=\"_blank\">EN</a>. + * @return ApiResponse<FulfillmentRemovalPreference> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns the current active Fulfillment Removal Preference -
401 Unauthorized -
403 Forbidden -
404 Not Found (Fulfillment Removal Preferences was never set) -
+ */ + public ApiResponse getFulfillmentRemovalPreferencesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getFulfillmentRemovalPreferencesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get current active removal preference (asynchronously) + * Use this resource to read your current removal preference. Removal preference is associated with system removal order at the moment of removal order is created. It means there can be not yet fulfilled removal orders associated with previously set removal preference. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#pobierz-aktualne-ustawienia-sposobu-usuniecia-towaru-z-magazynu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#retrieve-current-settings-for-how-to-remove-goods-from-the-warehouse\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns the current active Fulfillment Removal Preference -
401 Unauthorized -
403 Forbidden -
404 Not Found (Fulfillment Removal Preferences was never set) -
+ */ + public okhttp3.Call getFulfillmentRemovalPreferencesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getFulfillmentRemovalPreferencesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/FulfillmentStockApi.java b/src/main/java/pl/wtx/allegro/api/client/FulfillmentStockApi.java new file mode 100644 index 0000000..26c76d1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/FulfillmentStockApi.java @@ -0,0 +1,297 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.StockProductList; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FulfillmentStockApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public FulfillmentStockApi() { + this(Configuration.getDefaultApiClient()); + } + + public FulfillmentStockApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getFulfillmentStock + * @param acceptLanguage Expected language of product name translation. (optional, default to en-US) + * @param offset The offset of elements in the response. Ignored for text/csv content type. (optional, default to 0) + * @param limit Maximum number of elements in response. Ignored for text/csv content type. (optional, default to 50) + * @param phrase Filtering search results by product name. (optional) + * @param sort Defines how elements are sorted in response. Minus sign can be added to imply descending sort order. Ignored for text/csv content type. Possible values for the \"sort\" parameter: * -available - sorting by quantity of available products (descending) * available - sorting by quantity of available products (ascending) * -unfulfillable - sorting by quantity of unfulfillable products (descending) * unfulfillable - sorting by quantity of unfulfillable products (ascending) * -name - sorting by product’s name (descending) * name - sorting by product’s name (ascending) * lastWeekSalesAverage - sorting by product last week average sales (ascending) * -lastWeekSalesAverage - sorting by product last week average sales (descending) * reserve - sorting by reserve.outOfStockIn field (ascending) * -reserve - sorting by reserve.outOfStockIn field (descending) * lastThirtyDaysSalesSum - sorting by product last month sum sales (ascending) * -lastThirtyDaysSalesSum - sorting by product last month sum sales (descending) * storageFee - sorting by storage fee (ascending). The order by fee status is: NOT_APPLICABLE, then INCLUDED_IN_STORAGE_FEE, then PREDICTION, then CHARGED ordered by amountGross ascending. * -storageFee - sorting by storage fee (descending). The order by fee status is: CHARGED ordered by amountGross descending, then PREDICTION, then INCLUDED_IN_STORAGE_FEE, then NOT_APPLICABLE. (optional, default to name) + * @param productId Filtering search results by fulfillment product identifier. Ignored for text/csv content type. (optional) + * @param productAvailability Filtering search results by availability. (optional) + * @param productStatus Filtering search results by status. (optional) + * @param asnStatus Filtering search results by ASN status. Following values are allowed: SUBMITTED - Advanced Ship Notice document has been submitted and it contains a particular product. Only the products that have ASN with products on it are returned. NOT_FOUND - Advanced Ship Notice that contains a particular product was not found. It has not been submitted, may be expired, or products have already been delivered to the warehouse. Only the products that don't have related ASN with products on it are returned. (optional) + * @param outOfStockInFrom Filter by products with outOfStockIn greater than or equal. (optional) + * @param outOfStockInTo Filter by products with outOfStockIn less than or equal. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns available stock for the seller. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public okhttp3.Call getFulfillmentStockCall(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String sort, @javax.annotation.Nullable UUID productId, @javax.annotation.Nullable List productAvailability, @javax.annotation.Nullable String productStatus, @javax.annotation.Nullable String asnStatus, @javax.annotation.Nullable Integer outOfStockInFrom, @javax.annotation.Nullable Integer outOfStockInTo, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/stock"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (phrase != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("phrase", phrase)); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + if (productId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("productId", productId)); + } + + if (productAvailability != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "productAvailability", productAvailability)); + } + + if (productStatus != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("productStatus", productStatus)); + } + + if (asnStatus != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("asnStatus", asnStatus)); + } + + if (outOfStockInFrom != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("outOfStockInFrom", outOfStockInFrom)); + } + + if (outOfStockInTo != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("outOfStockInTo", outOfStockInTo)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "text/csv", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFulfillmentStockValidateBeforeCall(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String sort, @javax.annotation.Nullable UUID productId, @javax.annotation.Nullable List productAvailability, @javax.annotation.Nullable String productStatus, @javax.annotation.Nullable String asnStatus, @javax.annotation.Nullable Integer outOfStockInFrom, @javax.annotation.Nullable Integer outOfStockInTo, final ApiCallback _callback) throws ApiException { + return getFulfillmentStockCall(acceptLanguage, offset, limit, phrase, sort, productId, productAvailability, productStatus, asnStatus, outOfStockInFrom, outOfStockInTo, _callback); + + } + + /** + * Get available stock + * Use this resource to get a list of the products belonging to the seller, which are in Allegro Warehouse. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-pobrac-aktualne-stany-magazynowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#get-available-stock\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of product name translation. (optional, default to en-US) + * @param offset The offset of elements in the response. Ignored for text/csv content type. (optional, default to 0) + * @param limit Maximum number of elements in response. Ignored for text/csv content type. (optional, default to 50) + * @param phrase Filtering search results by product name. (optional) + * @param sort Defines how elements are sorted in response. Minus sign can be added to imply descending sort order. Ignored for text/csv content type. Possible values for the \"sort\" parameter: * -available - sorting by quantity of available products (descending) * available - sorting by quantity of available products (ascending) * -unfulfillable - sorting by quantity of unfulfillable products (descending) * unfulfillable - sorting by quantity of unfulfillable products (ascending) * -name - sorting by product’s name (descending) * name - sorting by product’s name (ascending) * lastWeekSalesAverage - sorting by product last week average sales (ascending) * -lastWeekSalesAverage - sorting by product last week average sales (descending) * reserve - sorting by reserve.outOfStockIn field (ascending) * -reserve - sorting by reserve.outOfStockIn field (descending) * lastThirtyDaysSalesSum - sorting by product last month sum sales (ascending) * -lastThirtyDaysSalesSum - sorting by product last month sum sales (descending) * storageFee - sorting by storage fee (ascending). The order by fee status is: NOT_APPLICABLE, then INCLUDED_IN_STORAGE_FEE, then PREDICTION, then CHARGED ordered by amountGross ascending. * -storageFee - sorting by storage fee (descending). The order by fee status is: CHARGED ordered by amountGross descending, then PREDICTION, then INCLUDED_IN_STORAGE_FEE, then NOT_APPLICABLE. (optional, default to name) + * @param productId Filtering search results by fulfillment product identifier. Ignored for text/csv content type. (optional) + * @param productAvailability Filtering search results by availability. (optional) + * @param productStatus Filtering search results by status. (optional) + * @param asnStatus Filtering search results by ASN status. Following values are allowed: SUBMITTED - Advanced Ship Notice document has been submitted and it contains a particular product. Only the products that have ASN with products on it are returned. NOT_FOUND - Advanced Ship Notice that contains a particular product was not found. It has not been submitted, may be expired, or products have already been delivered to the warehouse. Only the products that don't have related ASN with products on it are returned. (optional) + * @param outOfStockInFrom Filter by products with outOfStockIn greater than or equal. (optional) + * @param outOfStockInTo Filter by products with outOfStockIn less than or equal. (optional) + * @return StockProductList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns available stock for the seller. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public StockProductList getFulfillmentStock(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String sort, @javax.annotation.Nullable UUID productId, @javax.annotation.Nullable List productAvailability, @javax.annotation.Nullable String productStatus, @javax.annotation.Nullable String asnStatus, @javax.annotation.Nullable Integer outOfStockInFrom, @javax.annotation.Nullable Integer outOfStockInTo) throws ApiException { + ApiResponse localVarResp = getFulfillmentStockWithHttpInfo(acceptLanguage, offset, limit, phrase, sort, productId, productAvailability, productStatus, asnStatus, outOfStockInFrom, outOfStockInTo); + return localVarResp.getData(); + } + + /** + * Get available stock + * Use this resource to get a list of the products belonging to the seller, which are in Allegro Warehouse. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-pobrac-aktualne-stany-magazynowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#get-available-stock\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of product name translation. (optional, default to en-US) + * @param offset The offset of elements in the response. Ignored for text/csv content type. (optional, default to 0) + * @param limit Maximum number of elements in response. Ignored for text/csv content type. (optional, default to 50) + * @param phrase Filtering search results by product name. (optional) + * @param sort Defines how elements are sorted in response. Minus sign can be added to imply descending sort order. Ignored for text/csv content type. Possible values for the \"sort\" parameter: * -available - sorting by quantity of available products (descending) * available - sorting by quantity of available products (ascending) * -unfulfillable - sorting by quantity of unfulfillable products (descending) * unfulfillable - sorting by quantity of unfulfillable products (ascending) * -name - sorting by product’s name (descending) * name - sorting by product’s name (ascending) * lastWeekSalesAverage - sorting by product last week average sales (ascending) * -lastWeekSalesAverage - sorting by product last week average sales (descending) * reserve - sorting by reserve.outOfStockIn field (ascending) * -reserve - sorting by reserve.outOfStockIn field (descending) * lastThirtyDaysSalesSum - sorting by product last month sum sales (ascending) * -lastThirtyDaysSalesSum - sorting by product last month sum sales (descending) * storageFee - sorting by storage fee (ascending). The order by fee status is: NOT_APPLICABLE, then INCLUDED_IN_STORAGE_FEE, then PREDICTION, then CHARGED ordered by amountGross ascending. * -storageFee - sorting by storage fee (descending). The order by fee status is: CHARGED ordered by amountGross descending, then PREDICTION, then INCLUDED_IN_STORAGE_FEE, then NOT_APPLICABLE. (optional, default to name) + * @param productId Filtering search results by fulfillment product identifier. Ignored for text/csv content type. (optional) + * @param productAvailability Filtering search results by availability. (optional) + * @param productStatus Filtering search results by status. (optional) + * @param asnStatus Filtering search results by ASN status. Following values are allowed: SUBMITTED - Advanced Ship Notice document has been submitted and it contains a particular product. Only the products that have ASN with products on it are returned. NOT_FOUND - Advanced Ship Notice that contains a particular product was not found. It has not been submitted, may be expired, or products have already been delivered to the warehouse. Only the products that don't have related ASN with products on it are returned. (optional) + * @param outOfStockInFrom Filter by products with outOfStockIn greater than or equal. (optional) + * @param outOfStockInTo Filter by products with outOfStockIn less than or equal. (optional) + * @return ApiResponse<StockProductList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns available stock for the seller. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public ApiResponse getFulfillmentStockWithHttpInfo(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String sort, @javax.annotation.Nullable UUID productId, @javax.annotation.Nullable List productAvailability, @javax.annotation.Nullable String productStatus, @javax.annotation.Nullable String asnStatus, @javax.annotation.Nullable Integer outOfStockInFrom, @javax.annotation.Nullable Integer outOfStockInTo) throws ApiException { + okhttp3.Call localVarCall = getFulfillmentStockValidateBeforeCall(acceptLanguage, offset, limit, phrase, sort, productId, productAvailability, productStatus, asnStatus, outOfStockInFrom, outOfStockInTo, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get available stock (asynchronously) + * Use this resource to get a list of the products belonging to the seller, which are in Allegro Warehouse. Read more: <a href=\"../../tutorials/one-fulfillment-by-allegro-0ADwgOLqWSw#jak-pobrac-aktualne-stany-magazynowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/one-fulfillment-by-allegro-4R9dXyMPlc9#get-available-stock\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of product name translation. (optional, default to en-US) + * @param offset The offset of elements in the response. Ignored for text/csv content type. (optional, default to 0) + * @param limit Maximum number of elements in response. Ignored for text/csv content type. (optional, default to 50) + * @param phrase Filtering search results by product name. (optional) + * @param sort Defines how elements are sorted in response. Minus sign can be added to imply descending sort order. Ignored for text/csv content type. Possible values for the \"sort\" parameter: * -available - sorting by quantity of available products (descending) * available - sorting by quantity of available products (ascending) * -unfulfillable - sorting by quantity of unfulfillable products (descending) * unfulfillable - sorting by quantity of unfulfillable products (ascending) * -name - sorting by product’s name (descending) * name - sorting by product’s name (ascending) * lastWeekSalesAverage - sorting by product last week average sales (ascending) * -lastWeekSalesAverage - sorting by product last week average sales (descending) * reserve - sorting by reserve.outOfStockIn field (ascending) * -reserve - sorting by reserve.outOfStockIn field (descending) * lastThirtyDaysSalesSum - sorting by product last month sum sales (ascending) * -lastThirtyDaysSalesSum - sorting by product last month sum sales (descending) * storageFee - sorting by storage fee (ascending). The order by fee status is: NOT_APPLICABLE, then INCLUDED_IN_STORAGE_FEE, then PREDICTION, then CHARGED ordered by amountGross ascending. * -storageFee - sorting by storage fee (descending). The order by fee status is: CHARGED ordered by amountGross descending, then PREDICTION, then INCLUDED_IN_STORAGE_FEE, then NOT_APPLICABLE. (optional, default to name) + * @param productId Filtering search results by fulfillment product identifier. Ignored for text/csv content type. (optional) + * @param productAvailability Filtering search results by availability. (optional) + * @param productStatus Filtering search results by status. (optional) + * @param asnStatus Filtering search results by ASN status. Following values are allowed: SUBMITTED - Advanced Ship Notice document has been submitted and it contains a particular product. Only the products that have ASN with products on it are returned. NOT_FOUND - Advanced Ship Notice that contains a particular product was not found. It has not been submitted, may be expired, or products have already been delivered to the warehouse. Only the products that don't have related ASN with products on it are returned. (optional) + * @param outOfStockInFrom Filter by products with outOfStockIn greater than or equal. (optional) + * @param outOfStockInTo Filter by products with outOfStockIn less than or equal. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns available stock for the seller. -
401 Unauthorized -
403 Forbidden -
422 Invalid request parameters. -
+ */ + public okhttp3.Call getFulfillmentStockAsync(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String sort, @javax.annotation.Nullable UUID productId, @javax.annotation.Nullable List productAvailability, @javax.annotation.Nullable String productStatus, @javax.annotation.Nullable String asnStatus, @javax.annotation.Nullable Integer outOfStockInFrom, @javax.annotation.Nullable Integer outOfStockInTo, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getFulfillmentStockValidateBeforeCall(acceptLanguage, offset, limit, phrase, sort, productId, productAvailability, productStatus, asnStatus, outOfStockInFrom, outOfStockInTo, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/ImagesAndAttachmentsApi.java b/src/main/java/pl/wtx/allegro/api/client/ImagesAndAttachmentsApi.java new file mode 100644 index 0000000..69d16a6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/ImagesAndAttachmentsApi.java @@ -0,0 +1,657 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import pl.wtx.allegro.api.client.model.OfferAttachment; +import pl.wtx.allegro.api.client.model.OfferAttachmentRequest; +import pl.wtx.allegro.api.client.model.OfferImageLinkUploadRequest; +import pl.wtx.allegro.api.client.model.OfferImageUploadResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ImagesAndAttachmentsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ImagesAndAttachmentsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ImagesAndAttachmentsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createOfferAttachmentUsingPOST + * @param offerAttachmentRequest offer attachment (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment created successfully -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
415 Unsupported media type -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createOfferAttachmentUsingPOSTCall(@javax.annotation.Nonnull OfferAttachmentRequest offerAttachmentRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = offerAttachmentRequest; + + // create path and map variables + String localVarPath = "/sale/offer-attachments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createOfferAttachmentUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull OfferAttachmentRequest offerAttachmentRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerAttachmentRequest' is set + if (offerAttachmentRequest == null) { + throw new ApiException("Missing the required parameter 'offerAttachmentRequest' when calling createOfferAttachmentUsingPOST(Async)"); + } + + return createOfferAttachmentUsingPOSTCall(offerAttachmentRequest, _callback); + + } + + /** + * Create an offer attachment + * You can attach pdf, jpeg or png files to your offers. We will present them under the offer description in the Additional information section. You can attach up to 9 files to one offer – one per each type from the list: * Guide (MANUAL). Allowed media types: PDF * Special offer terms (SPECIAL_OFFER_RULES). Allowed media types: PDF * Competition terms (COMPETITION_RULES). Allowed media types: PDF * Book excerpt (BOOK_EXCERPT). Allowed media types: PDF * Manual (USER_MANUAL). Allowed media types: PDF * Installation manual (INSTALLATION_INSTRUCTIONS). Allowed media types: PDF * Game manual (GAME_INSTRUCTIONS). Allowed media types: PDF * Energy label (ENERGY_LABEL). Allowed media types: JPEG, JPG, PNG * Product information sheet (PRODUCT_INFORMATION_SHEET). Allowed media types: PDF * Tire label (TIRE_LABEL). Allowed media types: JPEG, JPG, PNG You can attach up to 20 files to one product for: * Safety information manual (SAFETY_INFORMATION_MANUAL). Allowed media types: PDF, JPEG, JPG, PNG Uploading attachments flow: 1. Create an attachment object to receive an upload URL (*POST /sale/offer-attachments*), 2. Use the upload URL to submit the file (*PUT /sale/offer-attachments/{attachmentId}*), 3. Add attachments to the offer (*PATCH /sale/product-offers/{offerId}*). Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#zalaczniki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#attachments\" target=\"_blank\">EN</a>. + * @param offerAttachmentRequest offer attachment (required) + * @return OfferAttachment + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment created successfully -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
415 Unsupported media type -
422 Unprocessable Entity -
+ */ + public OfferAttachment createOfferAttachmentUsingPOST(@javax.annotation.Nonnull OfferAttachmentRequest offerAttachmentRequest) throws ApiException { + ApiResponse localVarResp = createOfferAttachmentUsingPOSTWithHttpInfo(offerAttachmentRequest); + return localVarResp.getData(); + } + + /** + * Create an offer attachment + * You can attach pdf, jpeg or png files to your offers. We will present them under the offer description in the Additional information section. You can attach up to 9 files to one offer – one per each type from the list: * Guide (MANUAL). Allowed media types: PDF * Special offer terms (SPECIAL_OFFER_RULES). Allowed media types: PDF * Competition terms (COMPETITION_RULES). Allowed media types: PDF * Book excerpt (BOOK_EXCERPT). Allowed media types: PDF * Manual (USER_MANUAL). Allowed media types: PDF * Installation manual (INSTALLATION_INSTRUCTIONS). Allowed media types: PDF * Game manual (GAME_INSTRUCTIONS). Allowed media types: PDF * Energy label (ENERGY_LABEL). Allowed media types: JPEG, JPG, PNG * Product information sheet (PRODUCT_INFORMATION_SHEET). Allowed media types: PDF * Tire label (TIRE_LABEL). Allowed media types: JPEG, JPG, PNG You can attach up to 20 files to one product for: * Safety information manual (SAFETY_INFORMATION_MANUAL). Allowed media types: PDF, JPEG, JPG, PNG Uploading attachments flow: 1. Create an attachment object to receive an upload URL (*POST /sale/offer-attachments*), 2. Use the upload URL to submit the file (*PUT /sale/offer-attachments/{attachmentId}*), 3. Add attachments to the offer (*PATCH /sale/product-offers/{offerId}*). Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#zalaczniki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#attachments\" target=\"_blank\">EN</a>. + * @param offerAttachmentRequest offer attachment (required) + * @return ApiResponse<OfferAttachment> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment created successfully -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
415 Unsupported media type -
422 Unprocessable Entity -
+ */ + public ApiResponse createOfferAttachmentUsingPOSTWithHttpInfo(@javax.annotation.Nonnull OfferAttachmentRequest offerAttachmentRequest) throws ApiException { + okhttp3.Call localVarCall = createOfferAttachmentUsingPOSTValidateBeforeCall(offerAttachmentRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create an offer attachment (asynchronously) + * You can attach pdf, jpeg or png files to your offers. We will present them under the offer description in the Additional information section. You can attach up to 9 files to one offer – one per each type from the list: * Guide (MANUAL). Allowed media types: PDF * Special offer terms (SPECIAL_OFFER_RULES). Allowed media types: PDF * Competition terms (COMPETITION_RULES). Allowed media types: PDF * Book excerpt (BOOK_EXCERPT). Allowed media types: PDF * Manual (USER_MANUAL). Allowed media types: PDF * Installation manual (INSTALLATION_INSTRUCTIONS). Allowed media types: PDF * Game manual (GAME_INSTRUCTIONS). Allowed media types: PDF * Energy label (ENERGY_LABEL). Allowed media types: JPEG, JPG, PNG * Product information sheet (PRODUCT_INFORMATION_SHEET). Allowed media types: PDF * Tire label (TIRE_LABEL). Allowed media types: JPEG, JPG, PNG You can attach up to 20 files to one product for: * Safety information manual (SAFETY_INFORMATION_MANUAL). Allowed media types: PDF, JPEG, JPG, PNG Uploading attachments flow: 1. Create an attachment object to receive an upload URL (*POST /sale/offer-attachments*), 2. Use the upload URL to submit the file (*PUT /sale/offer-attachments/{attachmentId}*), 3. Add attachments to the offer (*PATCH /sale/product-offers/{offerId}*). Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#zalaczniki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#attachments\" target=\"_blank\">EN</a>. + * @param offerAttachmentRequest offer attachment (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment created successfully -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
415 Unsupported media type -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createOfferAttachmentUsingPOSTAsync(@javax.annotation.Nonnull OfferAttachmentRequest offerAttachmentRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createOfferAttachmentUsingPOSTValidateBeforeCall(offerAttachmentRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOfferAttachment + * @param attachmentId The ID of the attachment. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer attachment details -
403 User has no access to an attachment -
404 Non existing attachment -
+ */ + public okhttp3.Call getOfferAttachmentCall(@javax.annotation.Nonnull String attachmentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-attachments/{attachmentId}" + .replace("{" + "attachmentId" + "}", localVarApiClient.escapeString(attachmentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOfferAttachmentValidateBeforeCall(@javax.annotation.Nonnull String attachmentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'attachmentId' is set + if (attachmentId == null) { + throw new ApiException("Missing the required parameter 'attachmentId' when calling getOfferAttachment(Async)"); + } + + return getOfferAttachmentCall(attachmentId, _callback); + + } + + /** + * Get offer attachment details + * Get details of an offer attachments, including download link, by attachment identifier (\"attachmentId\"). The attachment id can be retrieved by querying a particular offer, for example by using <a href=\"#operation/getProductOffer\">`GET /sale/product-offers/{offerId}`</a>. + * @param attachmentId The ID of the attachment. (required) + * @return OfferAttachment + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer attachment details -
403 User has no access to an attachment -
404 Non existing attachment -
+ */ + public OfferAttachment getOfferAttachment(@javax.annotation.Nonnull String attachmentId) throws ApiException { + ApiResponse localVarResp = getOfferAttachmentWithHttpInfo(attachmentId); + return localVarResp.getData(); + } + + /** + * Get offer attachment details + * Get details of an offer attachments, including download link, by attachment identifier (\"attachmentId\"). The attachment id can be retrieved by querying a particular offer, for example by using <a href=\"#operation/getProductOffer\">`GET /sale/product-offers/{offerId}`</a>. + * @param attachmentId The ID of the attachment. (required) + * @return ApiResponse<OfferAttachment> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer attachment details -
403 User has no access to an attachment -
404 Non existing attachment -
+ */ + public ApiResponse getOfferAttachmentWithHttpInfo(@javax.annotation.Nonnull String attachmentId) throws ApiException { + okhttp3.Call localVarCall = getOfferAttachmentValidateBeforeCall(attachmentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get offer attachment details (asynchronously) + * Get details of an offer attachments, including download link, by attachment identifier (\"attachmentId\"). The attachment id can be retrieved by querying a particular offer, for example by using <a href=\"#operation/getProductOffer\">`GET /sale/product-offers/{offerId}`</a>. + * @param attachmentId The ID of the attachment. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer attachment details -
403 User has no access to an attachment -
404 Non existing attachment -
+ */ + public okhttp3.Call getOfferAttachmentAsync(@javax.annotation.Nonnull String attachmentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOfferAttachmentValidateBeforeCall(attachmentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadOfferAttachmentUsingPUT + * @param attachmentId The ID of the attachment. (required) + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
415 Unsupported media type -
+ */ + public okhttp3.Call uploadOfferAttachmentUsingPUTCall(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://upload.{environment}" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/sale/offer-attachments/{attachmentId}" + .replace("{" + "attachmentId" + "}", localVarApiClient.escapeString(attachmentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/pdf", + "image/jpeg", + "image/png" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadOfferAttachmentUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'attachmentId' is set + if (attachmentId == null) { + throw new ApiException("Missing the required parameter 'attachmentId' when calling uploadOfferAttachmentUsingPUT(Async)"); + } + + return uploadOfferAttachmentUsingPUTCall(attachmentId, body, _callback); + + } + + /** + * Upload an offer attachment + * Upload an offer attachment. This operation should be used after creating an offer attachment with *POST /sale/offer-attachments* **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /sale/offer-attachments*. The URL is unique and one-time. As its format may change in time, you should always use the address from the header. Do not compose the address on your own. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#zalaczniki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#attachments\" target=\"_blank\">EN</a>. + * @param attachmentId The ID of the attachment. (required) + * @param body (optional) + * @return OfferAttachment + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
415 Unsupported media type -
+ */ + public OfferAttachment uploadOfferAttachmentUsingPUT(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nullable File body) throws ApiException { + ApiResponse localVarResp = uploadOfferAttachmentUsingPUTWithHttpInfo(attachmentId, body); + return localVarResp.getData(); + } + + /** + * Upload an offer attachment + * Upload an offer attachment. This operation should be used after creating an offer attachment with *POST /sale/offer-attachments* **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /sale/offer-attachments*. The URL is unique and one-time. As its format may change in time, you should always use the address from the header. Do not compose the address on your own. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#zalaczniki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#attachments\" target=\"_blank\">EN</a>. + * @param attachmentId The ID of the attachment. (required) + * @param body (optional) + * @return ApiResponse<OfferAttachment> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
415 Unsupported media type -
+ */ + public ApiResponse uploadOfferAttachmentUsingPUTWithHttpInfo(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nullable File body) throws ApiException { + okhttp3.Call localVarCall = uploadOfferAttachmentUsingPUTValidateBeforeCall(attachmentId, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upload an offer attachment (asynchronously) + * Upload an offer attachment. This operation should be used after creating an offer attachment with *POST /sale/offer-attachments* **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /sale/offer-attachments*. The URL is unique and one-time. As its format may change in time, you should always use the address from the header. Do not compose the address on your own. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#zalaczniki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#attachments\" target=\"_blank\">EN</a>. + * @param attachmentId The ID of the attachment. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 File uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
415 Unsupported media type -
+ */ + public okhttp3.Call uploadOfferAttachmentUsingPUTAsync(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadOfferAttachmentUsingPUTValidateBeforeCall(attachmentId, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadOfferImageUsingPOST + * @param offerImageLinkUploadRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Image uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
403 Authorization problem -
413 Image is too big -
415 Unsupported media type -
422 Unprocessable entity (problem with image server) -
+ */ + public okhttp3.Call uploadOfferImageUsingPOSTCall(@javax.annotation.Nonnull OfferImageLinkUploadRequest offerImageLinkUploadRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://upload.{environment}" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = offerImageLinkUploadRequest; + + // create path and map variables + String localVarPath = "/sale/images"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json", + "image/jpeg", + "image/png", + "image/webp" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadOfferImageUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull OfferImageLinkUploadRequest offerImageLinkUploadRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerImageLinkUploadRequest' is set + if (offerImageLinkUploadRequest == null) { + throw new ApiException("Missing the required parameter 'offerImageLinkUploadRequest' when calling uploadOfferImageUsingPOST(Async)"); + } + + return uploadOfferImageUsingPOSTCall(offerImageLinkUploadRequest, _callback); + + } + + /** + * Upload an offer image + * Upload image to our servers. You can choose from two upload options: * \\- provide a link and we will download an image for you * \\- send an image as binary data **Important!** Remember to use dedicated domain for upload, i.e. * \\- https://upload.allegro.pl for Production * \\- https://upload.allegro.pl.allegrosandbox.pl for Sandbox Read more about the rules for photos in an offer's gallery and description: <a href=\"https://help.allegro.com/pl/sell/a/zasady-dla-zdjec-w-galerii-i-w-opisie-8dvWz3eo4T5?marketplaceId=allegro-pl\" target=\"_blank\">PL</a> / <a href=\"https://help.allegro.com/en/sell/a/rules-for-images-in-the-gallery-and-in-descriptions-8dvWB8Y2PIq\" target=\"_blank\">EN</a>. + * @param offerImageLinkUploadRequest (required) + * @return OfferImageUploadResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Image uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
403 Authorization problem -
413 Image is too big -
415 Unsupported media type -
422 Unprocessable entity (problem with image server) -
+ */ + public OfferImageUploadResponse uploadOfferImageUsingPOST(@javax.annotation.Nonnull OfferImageLinkUploadRequest offerImageLinkUploadRequest) throws ApiException { + ApiResponse localVarResp = uploadOfferImageUsingPOSTWithHttpInfo(offerImageLinkUploadRequest); + return localVarResp.getData(); + } + + /** + * Upload an offer image + * Upload image to our servers. You can choose from two upload options: * \\- provide a link and we will download an image for you * \\- send an image as binary data **Important!** Remember to use dedicated domain for upload, i.e. * \\- https://upload.allegro.pl for Production * \\- https://upload.allegro.pl.allegrosandbox.pl for Sandbox Read more about the rules for photos in an offer's gallery and description: <a href=\"https://help.allegro.com/pl/sell/a/zasady-dla-zdjec-w-galerii-i-w-opisie-8dvWz3eo4T5?marketplaceId=allegro-pl\" target=\"_blank\">PL</a> / <a href=\"https://help.allegro.com/en/sell/a/rules-for-images-in-the-gallery-and-in-descriptions-8dvWB8Y2PIq\" target=\"_blank\">EN</a>. + * @param offerImageLinkUploadRequest (required) + * @return ApiResponse<OfferImageUploadResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Image uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
403 Authorization problem -
413 Image is too big -
415 Unsupported media type -
422 Unprocessable entity (problem with image server) -
+ */ + public ApiResponse uploadOfferImageUsingPOSTWithHttpInfo(@javax.annotation.Nonnull OfferImageLinkUploadRequest offerImageLinkUploadRequest) throws ApiException { + okhttp3.Call localVarCall = uploadOfferImageUsingPOSTValidateBeforeCall(offerImageLinkUploadRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upload an offer image (asynchronously) + * Upload image to our servers. You can choose from two upload options: * \\- provide a link and we will download an image for you * \\- send an image as binary data **Important!** Remember to use dedicated domain for upload, i.e. * \\- https://upload.allegro.pl for Production * \\- https://upload.allegro.pl.allegrosandbox.pl for Sandbox Read more about the rules for photos in an offer's gallery and description: <a href=\"https://help.allegro.com/pl/sell/a/zasady-dla-zdjec-w-galerii-i-w-opisie-8dvWz3eo4T5?marketplaceId=allegro-pl\" target=\"_blank\">PL</a> / <a href=\"https://help.allegro.com/en/sell/a/rules-for-images-in-the-gallery-and-in-descriptions-8dvWB8Y2PIq\" target=\"_blank\">EN</a>. + * @param offerImageLinkUploadRequest (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Image uploaded correctly -
400 Syntactically incorrect request -
401 Invalid or missing bearer token -
403 Authorization problem -
413 Image is too big -
415 Unsupported media type -
422 Unprocessable entity (problem with image server) -
+ */ + public okhttp3.Call uploadOfferImageUsingPOSTAsync(@javax.annotation.Nonnull OfferImageLinkUploadRequest offerImageLinkUploadRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadOfferImageUsingPOSTValidateBeforeCall(offerImageLinkUploadRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/InformationAboutMarketplacesApi.java b/src/main/java/pl/wtx/allegro/api/client/InformationAboutMarketplacesApi.java new file mode 100644 index 0000000..aca4774 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/InformationAboutMarketplacesApi.java @@ -0,0 +1,192 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AllegroMarketplaces; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class InformationAboutMarketplacesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public InformationAboutMarketplacesApi() { + this(Configuration.getDefaultApiClient()); + } + + public InformationAboutMarketplacesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for marketplacesGET + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned all available marketplaces in allegro -
+ */ + public okhttp3.Call marketplacesGETCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/marketplaces"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call marketplacesGETValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return marketplacesGETCall(_callback); + + } + + /** + * Get details for all marketplaces in allegro + * Use this resource to get information about all the marketplaces on the platform. Read more: <a href=\"../../tutorials/wystawianie-i-zarzadzanie-oferta-w-serwisach-zagranicznych-wwzjP4M8gTZ#serwis-bazowy-uzytkownika-oraz-lista-dostepnych-serwisow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-offers-on-foreign-marketplaces-7GndGjeAATn#user-s-base-marketplace-and-list-of-available-marketplaces\" target=\"_blank\">EN</a>. + * @return AllegroMarketplaces + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned all available marketplaces in allegro -
+ */ + public AllegroMarketplaces marketplacesGET() throws ApiException { + ApiResponse localVarResp = marketplacesGETWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get details for all marketplaces in allegro + * Use this resource to get information about all the marketplaces on the platform. Read more: <a href=\"../../tutorials/wystawianie-i-zarzadzanie-oferta-w-serwisach-zagranicznych-wwzjP4M8gTZ#serwis-bazowy-uzytkownika-oraz-lista-dostepnych-serwisow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-offers-on-foreign-marketplaces-7GndGjeAATn#user-s-base-marketplace-and-list-of-available-marketplaces\" target=\"_blank\">EN</a>. + * @return ApiResponse<AllegroMarketplaces> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned all available marketplaces in allegro -
+ */ + public ApiResponse marketplacesGETWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = marketplacesGETValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details for all marketplaces in allegro (asynchronously) + * Use this resource to get information about all the marketplaces on the platform. Read more: <a href=\"../../tutorials/wystawianie-i-zarzadzanie-oferta-w-serwisach-zagranicznych-wwzjP4M8gTZ#serwis-bazowy-uzytkownika-oraz-lista-dostepnych-serwisow\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/listing-and-managing-offers-on-foreign-marketplaces-7GndGjeAATn#user-s-base-marketplace-and-list-of-available-marketplaces\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned all available marketplaces in allegro -
+ */ + public okhttp3.Call marketplacesGETAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = marketplacesGETValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/InformationAboutUserApi.java b/src/main/java/pl/wtx/allegro/api/client/InformationAboutUserApi.java new file mode 100644 index 0000000..2ea1daf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/InformationAboutUserApi.java @@ -0,0 +1,1642 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AdditionalEmail; +import pl.wtx.allegro.api.client.model.AdditionalEmailRequest; +import pl.wtx.allegro.api.client.model.AdditionalEmailsResponse; +import pl.wtx.allegro.api.client.model.Answer; +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.MeResponse; +import java.time.OffsetDateTime; +import pl.wtx.allegro.api.client.model.Removal; +import pl.wtx.allegro.api.client.model.SalesQualityHistoryResponse; +import pl.wtx.allegro.api.client.model.SmartSellerClassificationReport; +import pl.wtx.allegro.api.client.model.UserRating; +import pl.wtx.allegro.api.client.model.UserRatingAnswerRequest; +import pl.wtx.allegro.api.client.model.UserRatingListResponse; +import pl.wtx.allegro.api.client.model.UserRatingListResponseVBeta1; +import pl.wtx.allegro.api.client.model.UserRatingRemovalRequest; +import pl.wtx.allegro.api.client.model.UserRatingVBeta1; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class InformationAboutUserApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public InformationAboutUserApi() { + this(Configuration.getDefaultApiClient()); + } + + public InformationAboutUserApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addAdditionalEmailUsingPOST + * @param additionalEmailRequest request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Additional email added successfully -
400 Bad request -
401 Unauthorized -
422 Email address provided in the request is not valid -
+ */ + public okhttp3.Call addAdditionalEmailUsingPOSTCall(@javax.annotation.Nonnull AdditionalEmailRequest additionalEmailRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = additionalEmailRequest; + + // create path and map variables + String localVarPath = "/account/additional-emails"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addAdditionalEmailUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull AdditionalEmailRequest additionalEmailRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'additionalEmailRequest' is set + if (additionalEmailRequest == null) { + throw new ApiException("Missing the required parameter 'additionalEmailRequest' when calling addAdditionalEmailUsingPOST(Async)"); + } + + return addAdditionalEmailUsingPOSTCall(additionalEmailRequest, _callback); + + } + + /** + * Add a new additional email address to user's account + * Use this resource to add a new additional email address to account. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-adres-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-add-an-additional-email\" target=\"_blank\">EN</a>. + * @param additionalEmailRequest request (required) + * @return AdditionalEmail + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Additional email added successfully -
400 Bad request -
401 Unauthorized -
422 Email address provided in the request is not valid -
+ */ + public AdditionalEmail addAdditionalEmailUsingPOST(@javax.annotation.Nonnull AdditionalEmailRequest additionalEmailRequest) throws ApiException { + ApiResponse localVarResp = addAdditionalEmailUsingPOSTWithHttpInfo(additionalEmailRequest); + return localVarResp.getData(); + } + + /** + * Add a new additional email address to user's account + * Use this resource to add a new additional email address to account. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-adres-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-add-an-additional-email\" target=\"_blank\">EN</a>. + * @param additionalEmailRequest request (required) + * @return ApiResponse<AdditionalEmail> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Additional email added successfully -
400 Bad request -
401 Unauthorized -
422 Email address provided in the request is not valid -
+ */ + public ApiResponse addAdditionalEmailUsingPOSTWithHttpInfo(@javax.annotation.Nonnull AdditionalEmailRequest additionalEmailRequest) throws ApiException { + okhttp3.Call localVarCall = addAdditionalEmailUsingPOSTValidateBeforeCall(additionalEmailRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add a new additional email address to user's account (asynchronously) + * Use this resource to add a new additional email address to account. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-adres-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-add-an-additional-email\" target=\"_blank\">EN</a>. + * @param additionalEmailRequest request (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Additional email added successfully -
400 Bad request -
401 Unauthorized -
422 Email address provided in the request is not valid -
+ */ + public okhttp3.Call addAdditionalEmailUsingPOSTAsync(@javax.annotation.Nonnull AdditionalEmailRequest additionalEmailRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addAdditionalEmailUsingPOSTValidateBeforeCall(additionalEmailRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for answerUserRatingUsingPUT + * @param ratingId ID of the rating. (required) + * @param userRatingAnswerRequest User rating answer request. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call answerUserRatingUsingPUTCall(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nonnull UserRatingAnswerRequest userRatingAnswerRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = userRatingAnswerRequest; + + // create path and map variables + String localVarPath = "/sale/user-ratings/{ratingId}/answer" + .replace("{" + "ratingId" + "}", localVarApiClient.escapeString(ratingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call answerUserRatingUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nonnull UserRatingAnswerRequest userRatingAnswerRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'ratingId' is set + if (ratingId == null) { + throw new ApiException("Missing the required parameter 'ratingId' when calling answerUserRatingUsingPUT(Async)"); + } + + // verify the required parameter 'userRatingAnswerRequest' is set + if (userRatingAnswerRequest == null) { + throw new ApiException("Missing the required parameter 'userRatingAnswerRequest' when calling answerUserRatingUsingPUT(Async)"); + } + + return answerUserRatingUsingPUTCall(ratingId, userRatingAnswerRequest, _callback); + + } + + /** + * Answer for user's rating + * Use this resource to answer for received rating. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-odpowiedz-na-ocene\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-answer-for-user-rating\" target=\"_blank\">EN</a>. + * @param ratingId ID of the rating. (required) + * @param userRatingAnswerRequest User rating answer request. (required) + * @return Answer + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public Answer answerUserRatingUsingPUT(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nonnull UserRatingAnswerRequest userRatingAnswerRequest) throws ApiException { + ApiResponse localVarResp = answerUserRatingUsingPUTWithHttpInfo(ratingId, userRatingAnswerRequest); + return localVarResp.getData(); + } + + /** + * Answer for user's rating + * Use this resource to answer for received rating. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-odpowiedz-na-ocene\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-answer-for-user-rating\" target=\"_blank\">EN</a>. + * @param ratingId ID of the rating. (required) + * @param userRatingAnswerRequest User rating answer request. (required) + * @return ApiResponse<Answer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse answerUserRatingUsingPUTWithHttpInfo(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nonnull UserRatingAnswerRequest userRatingAnswerRequest) throws ApiException { + okhttp3.Call localVarCall = answerUserRatingUsingPUTValidateBeforeCall(ratingId, userRatingAnswerRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Answer for user's rating (asynchronously) + * Use this resource to answer for received rating. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-dodac-odpowiedz-na-ocene\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-answer-for-user-rating\" target=\"_blank\">EN</a>. + * @param ratingId ID of the rating. (required) + * @param userRatingAnswerRequest User rating answer request. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call answerUserRatingUsingPUTAsync(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nonnull UserRatingAnswerRequest userRatingAnswerRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = answerUserRatingUsingPUTValidateBeforeCall(ratingId, userRatingAnswerRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteAdditionalEmailUsingDELETE + * @param emailId Id of the additional email to be deleted. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deleted additional email -
401 Unauthorized -
404 Additional email not found -
+ */ + public okhttp3.Call deleteAdditionalEmailUsingDELETECall(@javax.annotation.Nonnull String emailId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/account/additional-emails/{emailId}" + .replace("{" + "emailId" + "}", localVarApiClient.escapeString(emailId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteAdditionalEmailUsingDELETEValidateBeforeCall(@javax.annotation.Nonnull String emailId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'emailId' is set + if (emailId == null) { + throw new ApiException("Missing the required parameter 'emailId' when calling deleteAdditionalEmailUsingDELETE(Async)"); + } + + return deleteAdditionalEmailUsingDELETECall(emailId, _callback); + + } + + /** + * Delete an additional email address + * Use this resource to delete one of additional emails. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-usunac-adres-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-remove-e-mail\" target=\"_blank\">EN</a>. + * @param emailId Id of the additional email to be deleted. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deleted additional email -
401 Unauthorized -
404 Additional email not found -
+ */ + public void deleteAdditionalEmailUsingDELETE(@javax.annotation.Nonnull String emailId) throws ApiException { + deleteAdditionalEmailUsingDELETEWithHttpInfo(emailId); + } + + /** + * Delete an additional email address + * Use this resource to delete one of additional emails. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-usunac-adres-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-remove-e-mail\" target=\"_blank\">EN</a>. + * @param emailId Id of the additional email to be deleted. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deleted additional email -
401 Unauthorized -
404 Additional email not found -
+ */ + public ApiResponse deleteAdditionalEmailUsingDELETEWithHttpInfo(@javax.annotation.Nonnull String emailId) throws ApiException { + okhttp3.Call localVarCall = deleteAdditionalEmailUsingDELETEValidateBeforeCall(emailId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete an additional email address (asynchronously) + * Use this resource to delete one of additional emails. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-usunac-adres-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-remove-e-mail\" target=\"_blank\">EN</a>. + * @param emailId Id of the additional email 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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deleted additional email -
401 Unauthorized -
404 Additional email not found -
+ */ + public okhttp3.Call deleteAdditionalEmailUsingDELETEAsync(@javax.annotation.Nonnull String emailId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteAdditionalEmailUsingDELETEValidateBeforeCall(emailId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getAdditionalEmailUsingGET + * @param emailId Id of the additional email. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Additional email returned successfully -
401 Unauthorized -
404 Additional email not found -
+ */ + public okhttp3.Call getAdditionalEmailUsingGETCall(@javax.annotation.Nonnull String emailId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/account/additional-emails/{emailId}" + .replace("{" + "emailId" + "}", localVarApiClient.escapeString(emailId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAdditionalEmailUsingGETValidateBeforeCall(@javax.annotation.Nonnull String emailId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'emailId' is set + if (emailId == null) { + throw new ApiException("Missing the required parameter 'emailId' when calling getAdditionalEmailUsingGET(Async)"); + } + + return getAdditionalEmailUsingGETCall(emailId, _callback); + + } + + /** + * Get information about a particular additional email + * Use this resource to retrieve a single additional email. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-szczegolowe-informacje-o-adresie-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-e-mail-details\" target=\"_blank\">EN</a>. + * @param emailId Id of the additional email. (required) + * @return AdditionalEmail + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Additional email returned successfully -
401 Unauthorized -
404 Additional email not found -
+ */ + public AdditionalEmail getAdditionalEmailUsingGET(@javax.annotation.Nonnull String emailId) throws ApiException { + ApiResponse localVarResp = getAdditionalEmailUsingGETWithHttpInfo(emailId); + return localVarResp.getData(); + } + + /** + * Get information about a particular additional email + * Use this resource to retrieve a single additional email. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-szczegolowe-informacje-o-adresie-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-e-mail-details\" target=\"_blank\">EN</a>. + * @param emailId Id of the additional email. (required) + * @return ApiResponse<AdditionalEmail> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Additional email returned successfully -
401 Unauthorized -
404 Additional email not found -
+ */ + public ApiResponse getAdditionalEmailUsingGETWithHttpInfo(@javax.annotation.Nonnull String emailId) throws ApiException { + okhttp3.Call localVarCall = getAdditionalEmailUsingGETValidateBeforeCall(emailId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get information about a particular additional email (asynchronously) + * Use this resource to retrieve a single additional email. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-szczegolowe-informacje-o-adresie-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-e-mail-details\" target=\"_blank\">EN</a>. + * @param emailId Id of the additional email. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Additional email returned successfully -
401 Unauthorized -
404 Additional email not found -
+ */ + public okhttp3.Call getAdditionalEmailUsingGETAsync(@javax.annotation.Nonnull String emailId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAdditionalEmailUsingGETValidateBeforeCall(emailId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getListOfAdditionalEmailsUsingGET + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of user's additional emails returned successfully -
401 Unauthorized -
+ */ + public okhttp3.Call getListOfAdditionalEmailsUsingGETCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/account/additional-emails"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getListOfAdditionalEmailsUsingGETValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getListOfAdditionalEmailsUsingGETCall(_callback); + + } + + /** + * Get user's additional emails + * Use this resource to get a list of all additional email addresses assigned to account. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-adresy-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-email-addresses\" target=\"_blank\">EN</a>. + * @return AdditionalEmailsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of user's additional emails returned successfully -
401 Unauthorized -
+ */ + public AdditionalEmailsResponse getListOfAdditionalEmailsUsingGET() throws ApiException { + ApiResponse localVarResp = getListOfAdditionalEmailsUsingGETWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get user's additional emails + * Use this resource to get a list of all additional email addresses assigned to account. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-adresy-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-email-addresses\" target=\"_blank\">EN</a>. + * @return ApiResponse<AdditionalEmailsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of user's additional emails returned successfully -
401 Unauthorized -
+ */ + public ApiResponse getListOfAdditionalEmailsUsingGETWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getListOfAdditionalEmailsUsingGETValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user's additional emails (asynchronously) + * Use this resource to get a list of all additional email addresses assigned to account. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-adresy-e-mail\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-email-addresses\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 List of user's additional emails returned successfully -
401 Unauthorized -
+ */ + public okhttp3.Call getListOfAdditionalEmailsUsingGETAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getListOfAdditionalEmailsUsingGETValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getSaleQualityUsingGET + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getSaleQualityUsingGETCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/quality"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSaleQualityUsingGETValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getSaleQualityUsingGETCall(_callback); + + } + + /** + * Get sales quality + * Use this resource to get current sales quality with at most 30 days history. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jakosc-sprzedazy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#sales-quality\" target=\"_blank\">EN</a>. + * @return SalesQualityHistoryResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public SalesQualityHistoryResponse getSaleQualityUsingGET() throws ApiException { + ApiResponse localVarResp = getSaleQualityUsingGETWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get sales quality + * Use this resource to get current sales quality with at most 30 days history. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jakosc-sprzedazy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#sales-quality\" target=\"_blank\">EN</a>. + * @return ApiResponse<SalesQualityHistoryResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse getSaleQualityUsingGETWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getSaleQualityUsingGETValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get sales quality (asynchronously) + * Use this resource to get current sales quality with at most 30 days history. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jakosc-sprzedazy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#sales-quality\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getSaleQualityUsingGETAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSaleQualityUsingGETValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getSellerSmartClassificationGET + * @param marketplaceId Marketplace for which seller classification report will be returned. If not specified, the classification result for the seller's registration marketplace will be returned. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned seller Smart! classification report -
401 Unauthorized action -
404 Not Found -
422 Unprocessable entity -
+ */ + public okhttp3.Call getSellerSmartClassificationGETCall(@javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/smart"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marketplaceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplaceId", marketplaceId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSellerSmartClassificationGETValidateBeforeCall(@javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + return getSellerSmartClassificationGETCall(marketplaceId, _callback); + + } + + /** + * Get Smart! seller classification report + * Use this resource to get a full Smart! seller classification report. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#kwalifikacja-sprzedawcy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#seller-qualification\" target=\"_blank\">EN</a>. + * @param marketplaceId Marketplace for which seller classification report will be returned. If not specified, the classification result for the seller's registration marketplace will be returned. (optional) + * @return SmartSellerClassificationReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned seller Smart! classification report -
401 Unauthorized action -
404 Not Found -
422 Unprocessable entity -
+ */ + public SmartSellerClassificationReport getSellerSmartClassificationGET(@javax.annotation.Nullable String marketplaceId) throws ApiException { + ApiResponse localVarResp = getSellerSmartClassificationGETWithHttpInfo(marketplaceId); + return localVarResp.getData(); + } + + /** + * Get Smart! seller classification report + * Use this resource to get a full Smart! seller classification report. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#kwalifikacja-sprzedawcy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#seller-qualification\" target=\"_blank\">EN</a>. + * @param marketplaceId Marketplace for which seller classification report will be returned. If not specified, the classification result for the seller's registration marketplace will be returned. (optional) + * @return ApiResponse<SmartSellerClassificationReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned seller Smart! classification report -
401 Unauthorized action -
404 Not Found -
422 Unprocessable entity -
+ */ + public ApiResponse getSellerSmartClassificationGETWithHttpInfo(@javax.annotation.Nullable String marketplaceId) throws ApiException { + okhttp3.Call localVarCall = getSellerSmartClassificationGETValidateBeforeCall(marketplaceId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Smart! seller classification report (asynchronously) + * Use this resource to get a full Smart! seller classification report. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#kwalifikacja-sprzedawcy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#seller-qualification\" target=\"_blank\">EN</a>. + * @param marketplaceId Marketplace for which seller classification report will be returned. If not specified, the classification result for the seller's registration marketplace will be 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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned seller Smart! classification report -
401 Unauthorized action -
404 Not Found -
422 Unprocessable entity -
+ */ + public okhttp3.Call getSellerSmartClassificationGETAsync(@javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSellerSmartClassificationGETValidateBeforeCall(marketplaceId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserRatingUsingGET + * @param ratingId The ID of the rating. (required) + * @param acceptLanguage Expected language of messages. The header is available only for content version 'application/vnd.allegro.beta.v1+json'. (optional, default to pl-PL) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getUserRatingUsingGETCall(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/user-ratings/{ratingId}" + .replace("{" + "ratingId" + "}", localVarApiClient.escapeString(ratingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/vnd.allegro.beta.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserRatingUsingGETValidateBeforeCall(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'ratingId' is set + if (ratingId == null) { + throw new ApiException("Missing the required parameter 'ratingId' when calling getUserRatingUsingGET(Async)"); + } + + return getUserRatingUsingGETCall(ratingId, acceptLanguage, _callback); + + } + + /** + * Get the user's rating by given rating id + * Use this resource to receive your sales rating by given rating id. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-informacje-o-ocenie-sprzedazy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-user-s-ratings-data\" target=\"_blank\">EN</a>. + * @param ratingId The ID of the rating. (required) + * @param acceptLanguage Expected language of messages. The header is available only for content version 'application/vnd.allegro.beta.v1+json'. (optional, default to pl-PL) + * @return UserRating + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public UserRating getUserRatingUsingGET(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + ApiResponse localVarResp = getUserRatingUsingGETWithHttpInfo(ratingId, acceptLanguage); + return localVarResp.getData(); + } + + /** + * Get the user's rating by given rating id + * Use this resource to receive your sales rating by given rating id. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-informacje-o-ocenie-sprzedazy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-user-s-ratings-data\" target=\"_blank\">EN</a>. + * @param ratingId The ID of the rating. (required) + * @param acceptLanguage Expected language of messages. The header is available only for content version 'application/vnd.allegro.beta.v1+json'. (optional, default to pl-PL) + * @return ApiResponse<UserRating> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getUserRatingUsingGETWithHttpInfo(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + okhttp3.Call localVarCall = getUserRatingUsingGETValidateBeforeCall(ratingId, acceptLanguage, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's rating by given rating id (asynchronously) + * Use this resource to receive your sales rating by given rating id. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-informacje-o-ocenie-sprzedazy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-user-s-ratings-data\" target=\"_blank\">EN</a>. + * @param ratingId The ID of the rating. (required) + * @param acceptLanguage Expected language of messages. The header is available only for content version 'application/vnd.allegro.beta.v1+json'. (optional, default to pl-PL) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getUserRatingUsingGETAsync(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserRatingUsingGETValidateBeforeCall(ratingId, acceptLanguage, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserRatingsUsingGET + * @param acceptLanguage Expected language of messages. The header is available only for content version 'application/vnd.allegro.beta.v1+json'. (optional, default to pl-PL) + * @param recommended Filter by recommended. (optional) + * @param lastChangedAtGte Last change (creation or latest edition) date time in ISO 8601 format. The lower bound of date time range from which ratings will be fetched. (optional) + * @param lastChangedAtLte Last change (creation or latest edition) date time in ISO 8601 format. The upper bound of date time range from which ratings will be fetched. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 20) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getUserRatingsUsingGETCall(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable String recommended, @javax.annotation.Nullable OffsetDateTime lastChangedAtGte, @javax.annotation.Nullable OffsetDateTime lastChangedAtLte, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/user-ratings"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (recommended != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("recommended", recommended)); + } + + if (lastChangedAtGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("lastChangedAt.gte", lastChangedAtGte)); + } + + if (lastChangedAtLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("lastChangedAt.lte", lastChangedAtLte)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/vnd.allegro.beta.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserRatingsUsingGETValidateBeforeCall(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable String recommended, @javax.annotation.Nullable OffsetDateTime lastChangedAtGte, @javax.annotation.Nullable OffsetDateTime lastChangedAtLte, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + return getUserRatingsUsingGETCall(acceptLanguage, recommended, lastChangedAtGte, lastChangedAtLte, offset, limit, _callback); + + } + + /** + * Get the user's ratings + * Use this resource to receive your sales ratings sorted by last change date, starting from the latest. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-informacje-o-ocenie-sprzedazy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-user-s-ratings-data\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of messages. The header is available only for content version 'application/vnd.allegro.beta.v1+json'. (optional, default to pl-PL) + * @param recommended Filter by recommended. (optional) + * @param lastChangedAtGte Last change (creation or latest edition) date time in ISO 8601 format. The lower bound of date time range from which ratings will be fetched. (optional) + * @param lastChangedAtLte Last change (creation or latest edition) date time in ISO 8601 format. The upper bound of date time range from which ratings will be fetched. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 20) + * @return UserRatingListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public UserRatingListResponse getUserRatingsUsingGET(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable String recommended, @javax.annotation.Nullable OffsetDateTime lastChangedAtGte, @javax.annotation.Nullable OffsetDateTime lastChangedAtLte, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + ApiResponse localVarResp = getUserRatingsUsingGETWithHttpInfo(acceptLanguage, recommended, lastChangedAtGte, lastChangedAtLte, offset, limit); + return localVarResp.getData(); + } + + /** + * Get the user's ratings + * Use this resource to receive your sales ratings sorted by last change date, starting from the latest. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-informacje-o-ocenie-sprzedazy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-user-s-ratings-data\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of messages. The header is available only for content version 'application/vnd.allegro.beta.v1+json'. (optional, default to pl-PL) + * @param recommended Filter by recommended. (optional) + * @param lastChangedAtGte Last change (creation or latest edition) date time in ISO 8601 format. The lower bound of date time range from which ratings will be fetched. (optional) + * @param lastChangedAtLte Last change (creation or latest edition) date time in ISO 8601 format. The upper bound of date time range from which ratings will be fetched. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 20) + * @return ApiResponse<UserRatingListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getUserRatingsUsingGETWithHttpInfo(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable String recommended, @javax.annotation.Nullable OffsetDateTime lastChangedAtGte, @javax.annotation.Nullable OffsetDateTime lastChangedAtLte, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + okhttp3.Call localVarCall = getUserRatingsUsingGETValidateBeforeCall(acceptLanguage, recommended, lastChangedAtGte, lastChangedAtLte, offset, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's ratings (asynchronously) + * Use this resource to receive your sales ratings sorted by last change date, starting from the latest. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-pobrac-informacje-o-ocenie-sprzedazy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-retrieve-user-s-ratings-data\" target=\"_blank\">EN</a>. + * @param acceptLanguage Expected language of messages. The header is available only for content version 'application/vnd.allegro.beta.v1+json'. (optional, default to pl-PL) + * @param recommended Filter by recommended. (optional) + * @param lastChangedAtGte Last change (creation or latest edition) date time in ISO 8601 format. The lower bound of date time range from which ratings will be fetched. (optional) + * @param lastChangedAtLte Last change (creation or latest edition) date time in ISO 8601 format. The upper bound of date time range from which ratings will be fetched. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 20) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getUserRatingsUsingGETAsync(@javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable String recommended, @javax.annotation.Nullable OffsetDateTime lastChangedAtGte, @javax.annotation.Nullable OffsetDateTime lastChangedAtLte, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserRatingsUsingGETValidateBeforeCall(acceptLanguage, recommended, lastChangedAtGte, lastChangedAtLte, offset, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for meGET + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden - when token is without user context -
+ */ + public okhttp3.Call meGETCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/me"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call meGETValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return meGETCall(_callback); + + } + + /** + * Get basic information about user + * Use this resource when you need basic information about authenticated user. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#informacje-o-uzytkowniku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#information-about-user\" target=\"_blank\">EN</a>. + * @return MeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden - when token is without user context -
+ */ + public MeResponse meGET() throws ApiException { + ApiResponse localVarResp = meGETWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get basic information about user + * Use this resource when you need basic information about authenticated user. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#informacje-o-uzytkowniku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#information-about-user\" target=\"_blank\">EN</a>. + * @return ApiResponse<MeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden - when token is without user context -
+ */ + public ApiResponse meGETWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = meGETValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get basic information about user (asynchronously) + * Use this resource when you need basic information about authenticated user. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#informacje-o-uzytkowniku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#information-about-user\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden - when token is without user context -
+ */ + public okhttp3.Call meGETAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = meGETValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for userRatingRemovalUsingPUT + * @param ratingId ID of the rating. (required) + * @param userRatingRemovalRequest User rating removal request. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call userRatingRemovalUsingPUTCall(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nonnull UserRatingRemovalRequest userRatingRemovalRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = userRatingRemovalRequest; + + // create path and map variables + String localVarPath = "/sale/user-ratings/{ratingId}/removal" + .replace("{" + "ratingId" + "}", localVarApiClient.escapeString(ratingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call userRatingRemovalUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nonnull UserRatingRemovalRequest userRatingRemovalRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'ratingId' is set + if (ratingId == null) { + throw new ApiException("Missing the required parameter 'ratingId' when calling userRatingRemovalUsingPUT(Async)"); + } + + // verify the required parameter 'userRatingRemovalRequest' is set + if (userRatingRemovalRequest == null) { + throw new ApiException("Missing the required parameter 'userRatingRemovalRequest' when calling userRatingRemovalUsingPUT(Async)"); + } + + return userRatingRemovalUsingPUTCall(ratingId, userRatingRemovalRequest, _callback); + + } + + /** + * Request removal of user's rating + * Use this resource to request removal of received rating. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-wyslac-prosbe-o-usuniecie-oceny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-send-a-request-to-remove-user-rating\" target=\"_blank\">EN</a>. + * @param ratingId ID of the rating. (required) + * @param userRatingRemovalRequest User rating removal request. (required) + * @return Removal + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public Removal userRatingRemovalUsingPUT(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nonnull UserRatingRemovalRequest userRatingRemovalRequest) throws ApiException { + ApiResponse localVarResp = userRatingRemovalUsingPUTWithHttpInfo(ratingId, userRatingRemovalRequest); + return localVarResp.getData(); + } + + /** + * Request removal of user's rating + * Use this resource to request removal of received rating. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-wyslac-prosbe-o-usuniecie-oceny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-send-a-request-to-remove-user-rating\" target=\"_blank\">EN</a>. + * @param ratingId ID of the rating. (required) + * @param userRatingRemovalRequest User rating removal request. (required) + * @return ApiResponse<Removal> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse userRatingRemovalUsingPUTWithHttpInfo(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nonnull UserRatingRemovalRequest userRatingRemovalRequest) throws ApiException { + okhttp3.Call localVarCall = userRatingRemovalUsingPUTValidateBeforeCall(ratingId, userRatingRemovalRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Request removal of user's rating (asynchronously) + * Use this resource to request removal of received rating. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#jak-wyslac-prosbe-o-usuniecie-oceny\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#how-to-send-a-request-to-remove-user-rating\" target=\"_blank\">EN</a>. + * @param ratingId ID of the rating. (required) + * @param userRatingRemovalRequest User rating removal request. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call userRatingRemovalUsingPUTAsync(@javax.annotation.Nonnull String ratingId, @javax.annotation.Nonnull UserRatingRemovalRequest userRatingRemovalRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = userRatingRemovalUsingPUTValidateBeforeCall(ratingId, userRatingRemovalRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/MessageCenterApi.java b/src/main/java/pl/wtx/allegro/api/client/MessageCenterApi.java new file mode 100644 index 0000000..9d8ea06 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/MessageCenterApi.java @@ -0,0 +1,1682 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import pl.wtx.allegro.api.client.model.Message; +import pl.wtx.allegro.api.client.model.MessageAttachmentId; +import pl.wtx.allegro.api.client.model.MessagesList; +import pl.wtx.allegro.api.client.model.NewAttachmentDeclaration; +import pl.wtx.allegro.api.client.model.NewMessage; +import pl.wtx.allegro.api.client.model.NewMessageInThread; +import java.time.OffsetDateTime; +import pl.wtx.allegro.api.client.model.Thread; +import pl.wtx.allegro.api.client.model.ThreadReadFlag; +import pl.wtx.allegro.api.client.model.ThreadsList; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MessageCenterApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public MessageCenterApi() { + this(Configuration.getDefaultApiClient()); + } + + public MessageCenterApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for changeReadFlagOnThreadPUT + * @param threadId Identifier of thread to be marked. (required) + * @param threadReadFlag Updated read flag (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread marked as read successfully -
401 User not authorized -
403 User not allowed to update thread read flag -
404 Thread not found -
422 Validation errors - missing flag in the request body -
+ */ + public okhttp3.Call changeReadFlagOnThreadPUTCall(@javax.annotation.Nonnull String threadId, @javax.annotation.Nonnull ThreadReadFlag threadReadFlag, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = threadReadFlag; + + // create path and map variables + String localVarPath = "/messaging/threads/{threadId}/read" + .replace("{" + "threadId" + "}", localVarApiClient.escapeString(threadId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call changeReadFlagOnThreadPUTValidateBeforeCall(@javax.annotation.Nonnull String threadId, @javax.annotation.Nonnull ThreadReadFlag threadReadFlag, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'threadId' is set + if (threadId == null) { + throw new ApiException("Missing the required parameter 'threadId' when calling changeReadFlagOnThreadPUT(Async)"); + } + + // verify the required parameter 'threadReadFlag' is set + if (threadReadFlag == null) { + throw new ApiException("Missing the required parameter 'threadReadFlag' when calling changeReadFlagOnThreadPUT(Async)"); + } + + return changeReadFlagOnThreadPUTCall(threadId, threadReadFlag, _callback); + + } + + /** + * Mark a particular thread as read + * Use this resource to mark thread with provided identifier as read. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#szczegolowe-informacje-o-wiadomosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#information-about-a-particular-message\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to be marked. (required) + * @param threadReadFlag Updated read flag (required) + * @return Thread + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread marked as read successfully -
401 User not authorized -
403 User not allowed to update thread read flag -
404 Thread not found -
422 Validation errors - missing flag in the request body -
+ */ + public Thread changeReadFlagOnThreadPUT(@javax.annotation.Nonnull String threadId, @javax.annotation.Nonnull ThreadReadFlag threadReadFlag) throws ApiException { + ApiResponse localVarResp = changeReadFlagOnThreadPUTWithHttpInfo(threadId, threadReadFlag); + return localVarResp.getData(); + } + + /** + * Mark a particular thread as read + * Use this resource to mark thread with provided identifier as read. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#szczegolowe-informacje-o-wiadomosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#information-about-a-particular-message\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to be marked. (required) + * @param threadReadFlag Updated read flag (required) + * @return ApiResponse<Thread> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread marked as read successfully -
401 User not authorized -
403 User not allowed to update thread read flag -
404 Thread not found -
422 Validation errors - missing flag in the request body -
+ */ + public ApiResponse changeReadFlagOnThreadPUTWithHttpInfo(@javax.annotation.Nonnull String threadId, @javax.annotation.Nonnull ThreadReadFlag threadReadFlag) throws ApiException { + okhttp3.Call localVarCall = changeReadFlagOnThreadPUTValidateBeforeCall(threadId, threadReadFlag, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Mark a particular thread as read (asynchronously) + * Use this resource to mark thread with provided identifier as read. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#szczegolowe-informacje-o-wiadomosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#information-about-a-particular-message\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to be marked. (required) + * @param threadReadFlag Updated read flag (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread marked as read successfully -
401 User not authorized -
403 User not allowed to update thread read flag -
404 Thread not found -
422 Validation errors - missing flag in the request body -
+ */ + public okhttp3.Call changeReadFlagOnThreadPUTAsync(@javax.annotation.Nonnull String threadId, @javax.annotation.Nonnull ThreadReadFlag threadReadFlag, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = changeReadFlagOnThreadPUTValidateBeforeCall(threadId, threadReadFlag, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteMessageDELETE + * @param messageId Identifier of the message to delete. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Message successfully deleted -
401 User not authorized -
403 User not allowed to delete particular message -
404 Message not found -
+ */ + public okhttp3.Call deleteMessageDELETECall(@javax.annotation.Nonnull String messageId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/messaging/messages/{messageId}" + .replace("{" + "messageId" + "}", localVarApiClient.escapeString(messageId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteMessageDELETEValidateBeforeCall(@javax.annotation.Nonnull String messageId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'messageId' is set + if (messageId == null) { + throw new ApiException("Missing the required parameter 'messageId' when calling deleteMessageDELETE(Async)"); + } + + return deleteMessageDELETECall(messageId, _callback); + + } + + /** + * Delete single message + * Use this resource to delete message with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#usuniecie-wiadomosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#delete-a-message\" target=\"_blank\">EN</a>. + * @param messageId Identifier of the message to delete. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Message successfully deleted -
401 User not authorized -
403 User not allowed to delete particular message -
404 Message not found -
+ */ + public void deleteMessageDELETE(@javax.annotation.Nonnull String messageId) throws ApiException { + deleteMessageDELETEWithHttpInfo(messageId); + } + + /** + * Delete single message + * Use this resource to delete message with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#usuniecie-wiadomosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#delete-a-message\" target=\"_blank\">EN</a>. + * @param messageId Identifier of the message to delete. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Message successfully deleted -
401 User not authorized -
403 User not allowed to delete particular message -
404 Message not found -
+ */ + public ApiResponse deleteMessageDELETEWithHttpInfo(@javax.annotation.Nonnull String messageId) throws ApiException { + okhttp3.Call localVarCall = deleteMessageDELETEValidateBeforeCall(messageId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete single message (asynchronously) + * Use this resource to delete message with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#usuniecie-wiadomosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#delete-a-message\" target=\"_blank\">EN</a>. + * @param messageId Identifier of the message to delete. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Message successfully deleted -
401 User not authorized -
403 User not allowed to delete particular message -
404 Message not found -
+ */ + public okhttp3.Call deleteMessageDELETEAsync(@javax.annotation.Nonnull String messageId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteMessageDELETEValidateBeforeCall(messageId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for downloadAttachmentGET + * @param attachmentId Identifier of the attachment that will be downloaded. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Attachment file returned successfully * Content-Disposition -
* Content-Type -
401 User not authorized -
404 Attachment not found -
+ */ + public okhttp3.Call downloadAttachmentGETCall(@javax.annotation.Nonnull String attachmentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/messaging/message-attachments/{attachmentId}" + .replace("{" + "attachmentId" + "}", localVarApiClient.escapeString(attachmentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call downloadAttachmentGETValidateBeforeCall(@javax.annotation.Nonnull String attachmentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'attachmentId' is set + if (attachmentId == null) { + throw new ApiException("Missing the required parameter 'attachmentId' when calling downloadAttachmentGET(Async)"); + } + + return downloadAttachmentGETCall(attachmentId, _callback); + + } + + /** + * Download attachment + * Use this resource to download attachment with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#pobranie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#attachment-related-to-the-message\" target=\"_blank\">EN</a>. + * @param attachmentId Identifier of the attachment that will be downloaded. (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Attachment file returned successfully * Content-Disposition -
* Content-Type -
401 User not authorized -
404 Attachment not found -
+ */ + public File downloadAttachmentGET(@javax.annotation.Nonnull String attachmentId) throws ApiException { + ApiResponse localVarResp = downloadAttachmentGETWithHttpInfo(attachmentId); + return localVarResp.getData(); + } + + /** + * Download attachment + * Use this resource to download attachment with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#pobranie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#attachment-related-to-the-message\" target=\"_blank\">EN</a>. + * @param attachmentId Identifier of the attachment that will be downloaded. (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Attachment file returned successfully * Content-Disposition -
* Content-Type -
401 User not authorized -
404 Attachment not found -
+ */ + public ApiResponse downloadAttachmentGETWithHttpInfo(@javax.annotation.Nonnull String attachmentId) throws ApiException { + okhttp3.Call localVarCall = downloadAttachmentGETValidateBeforeCall(attachmentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Download attachment (asynchronously) + * Use this resource to download attachment with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#pobranie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#attachment-related-to-the-message\" target=\"_blank\">EN</a>. + * @param attachmentId Identifier of the attachment that will be downloaded. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Attachment file returned successfully * Content-Disposition -
* Content-Type -
401 User not authorized -
404 Attachment not found -
+ */ + public okhttp3.Call downloadAttachmentGETAsync(@javax.annotation.Nonnull String attachmentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = downloadAttachmentGETValidateBeforeCall(attachmentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getMessageGET + * @param messageId Identifier of message to be returned. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Message returned successfully -
401 User not authorized -
404 Message not found -
+ */ + public okhttp3.Call getMessageGETCall(@javax.annotation.Nonnull String messageId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/messaging/messages/{messageId}" + .replace("{" + "messageId" + "}", localVarApiClient.escapeString(messageId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getMessageGETValidateBeforeCall(@javax.annotation.Nonnull String messageId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'messageId' is set + if (messageId == null) { + throw new ApiException("Missing the required parameter 'messageId' when calling getMessageGET(Async)"); + } + + return getMessageGETCall(messageId, _callback); + + } + + /** + * Get single message + * Use this resource to get message with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#szczegolowe-informacje-o-wiadomosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#information-about-a-particular-message\" target=\"_blank\">EN</a>. + * @param messageId Identifier of message to be returned. (required) + * @return Message + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Message returned successfully -
401 User not authorized -
404 Message not found -
+ */ + public Message getMessageGET(@javax.annotation.Nonnull String messageId) throws ApiException { + ApiResponse localVarResp = getMessageGETWithHttpInfo(messageId); + return localVarResp.getData(); + } + + /** + * Get single message + * Use this resource to get message with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#szczegolowe-informacje-o-wiadomosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#information-about-a-particular-message\" target=\"_blank\">EN</a>. + * @param messageId Identifier of message to be returned. (required) + * @return ApiResponse<Message> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Message returned successfully -
401 User not authorized -
404 Message not found -
+ */ + public ApiResponse getMessageGETWithHttpInfo(@javax.annotation.Nonnull String messageId) throws ApiException { + okhttp3.Call localVarCall = getMessageGETValidateBeforeCall(messageId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get single message (asynchronously) + * Use this resource to get message with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#szczegolowe-informacje-o-wiadomosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#information-about-a-particular-message\" target=\"_blank\">EN</a>. + * @param messageId Identifier of message to be returned. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Message returned successfully -
401 User not authorized -
404 Message not found -
+ */ + public okhttp3.Call getMessageGETAsync(@javax.annotation.Nonnull String messageId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getMessageGETValidateBeforeCall(messageId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getThreadGET + * @param threadId Identifier of thread to get. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread returned successfully -
401 User not authorized -
404 Thread not found -
+ */ + public okhttp3.Call getThreadGETCall(@javax.annotation.Nonnull String threadId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/messaging/threads/{threadId}" + .replace("{" + "threadId" + "}", localVarApiClient.escapeString(threadId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getThreadGETValidateBeforeCall(@javax.annotation.Nonnull String threadId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'threadId' is set + if (threadId == null) { + throw new ApiException("Missing the required parameter 'threadId' when calling getThreadGET(Async)"); + } + + return getThreadGETCall(threadId, _callback); + + } + + /** + * Get user thread + * Use this resource to get thread with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#szczegolowe-informacje-o-danym-watku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#information-about-a-particular-thread\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to get. (required) + * @return Thread + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread returned successfully -
401 User not authorized -
404 Thread not found -
+ */ + public Thread getThreadGET(@javax.annotation.Nonnull String threadId) throws ApiException { + ApiResponse localVarResp = getThreadGETWithHttpInfo(threadId); + return localVarResp.getData(); + } + + /** + * Get user thread + * Use this resource to get thread with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#szczegolowe-informacje-o-danym-watku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#information-about-a-particular-thread\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to get. (required) + * @return ApiResponse<Thread> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread returned successfully -
401 User not authorized -
404 Thread not found -
+ */ + public ApiResponse getThreadGETWithHttpInfo(@javax.annotation.Nonnull String threadId) throws ApiException { + okhttp3.Call localVarCall = getThreadGETValidateBeforeCall(threadId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get user thread (asynchronously) + * Use this resource to get thread with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#szczegolowe-informacje-o-danym-watku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#information-about-a-particular-thread\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to get. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread returned successfully -
401 User not authorized -
404 Thread not found -
+ */ + public okhttp3.Call getThreadGETAsync(@javax.annotation.Nonnull String threadId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getThreadGETValidateBeforeCall(threadId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listMessagesGET + * @param threadId Identifier of thread to get messages from. (required) + * @param limit The maximum number of messages returned in the response. (optional, default to 20) + * @param offset Index of the first returned message from all results. (optional, default to 0) + * @param before Message creation date before filter parameter (exclusive) - cannot be used with offset. (optional) + * @param after Message creation date after filter parameter (exclusive). (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread message list returned successfully -
401 User not authorized -
403 User not allowed to list messages in selected thread -
404 Thread not found -
422 Incorrect limit, offset, after or before -
+ */ + public okhttp3.Call listMessagesGETCall(@javax.annotation.Nonnull String threadId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable OffsetDateTime before, @javax.annotation.Nullable OffsetDateTime after, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/messaging/threads/{threadId}/messages" + .replace("{" + "threadId" + "}", localVarApiClient.escapeString(threadId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (before != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("before", before)); + } + + if (after != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("after", after)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listMessagesGETValidateBeforeCall(@javax.annotation.Nonnull String threadId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable OffsetDateTime before, @javax.annotation.Nullable OffsetDateTime after, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'threadId' is set + if (threadId == null) { + throw new ApiException("Missing the required parameter 'threadId' when calling listMessagesGET(Async)"); + } + + return listMessagesGETCall(threadId, limit, offset, before, after, _callback); + + } + + /** + * List messages in thread + * Use this resource to list messages in thread with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#lista-wiadomosci-dla-wybranego-watku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#list-of-the-messages-for-the-particular-thread\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to get messages from. (required) + * @param limit The maximum number of messages returned in the response. (optional, default to 20) + * @param offset Index of the first returned message from all results. (optional, default to 0) + * @param before Message creation date before filter parameter (exclusive) - cannot be used with offset. (optional) + * @param after Message creation date after filter parameter (exclusive). (optional) + * @return MessagesList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread message list returned successfully -
401 User not authorized -
403 User not allowed to list messages in selected thread -
404 Thread not found -
422 Incorrect limit, offset, after or before -
+ */ + public MessagesList listMessagesGET(@javax.annotation.Nonnull String threadId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable OffsetDateTime before, @javax.annotation.Nullable OffsetDateTime after) throws ApiException { + ApiResponse localVarResp = listMessagesGETWithHttpInfo(threadId, limit, offset, before, after); + return localVarResp.getData(); + } + + /** + * List messages in thread + * Use this resource to list messages in thread with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#lista-wiadomosci-dla-wybranego-watku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#list-of-the-messages-for-the-particular-thread\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to get messages from. (required) + * @param limit The maximum number of messages returned in the response. (optional, default to 20) + * @param offset Index of the first returned message from all results. (optional, default to 0) + * @param before Message creation date before filter parameter (exclusive) - cannot be used with offset. (optional) + * @param after Message creation date after filter parameter (exclusive). (optional) + * @return ApiResponse<MessagesList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread message list returned successfully -
401 User not authorized -
403 User not allowed to list messages in selected thread -
404 Thread not found -
422 Incorrect limit, offset, after or before -
+ */ + public ApiResponse listMessagesGETWithHttpInfo(@javax.annotation.Nonnull String threadId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable OffsetDateTime before, @javax.annotation.Nullable OffsetDateTime after) throws ApiException { + okhttp3.Call localVarCall = listMessagesGETValidateBeforeCall(threadId, limit, offset, before, after, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List messages in thread (asynchronously) + * Use this resource to list messages in thread with provided identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#lista-wiadomosci-dla-wybranego-watku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#list-of-the-messages-for-the-particular-thread\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to get messages from. (required) + * @param limit The maximum number of messages returned in the response. (optional, default to 20) + * @param offset Index of the first returned message from all results. (optional, default to 0) + * @param before Message creation date before filter parameter (exclusive) - cannot be used with offset. (optional) + * @param after Message creation date after filter parameter (exclusive). (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Thread message list returned successfully -
401 User not authorized -
403 User not allowed to list messages in selected thread -
404 Thread not found -
422 Incorrect limit, offset, after or before -
+ */ + public okhttp3.Call listMessagesGETAsync(@javax.annotation.Nonnull String threadId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable OffsetDateTime before, @javax.annotation.Nullable OffsetDateTime after, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listMessagesGETValidateBeforeCall(threadId, limit, offset, before, after, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listThreadsGET + * @param limit The maximum number of threads returned in the response. (optional, default to 20) + * @param offset Index of the first returned thread from all results. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 User not authorized -
422 Incorrect limit or offset -
+ */ + public okhttp3.Call listThreadsGETCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/messaging/threads"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listThreadsGETValidateBeforeCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + return listThreadsGETCall(limit, offset, _callback); + + } + + /** + * List user threads + * Use this resource to get the list of user threads sorted by last message date, starting from newest. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#lista-watkow-na-koncie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#list-of-threads\" target=\"_blank\">EN</a>. + * @param limit The maximum number of threads returned in the response. (optional, default to 20) + * @param offset Index of the first returned thread from all results. (optional, default to 0) + * @return ThreadsList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 User not authorized -
422 Incorrect limit or offset -
+ */ + public ThreadsList listThreadsGET(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset) throws ApiException { + ApiResponse localVarResp = listThreadsGETWithHttpInfo(limit, offset); + return localVarResp.getData(); + } + + /** + * List user threads + * Use this resource to get the list of user threads sorted by last message date, starting from newest. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#lista-watkow-na-koncie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#list-of-threads\" target=\"_blank\">EN</a>. + * @param limit The maximum number of threads returned in the response. (optional, default to 20) + * @param offset Index of the first returned thread from all results. (optional, default to 0) + * @return ApiResponse<ThreadsList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 User not authorized -
422 Incorrect limit or offset -
+ */ + public ApiResponse listThreadsGETWithHttpInfo(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset) throws ApiException { + okhttp3.Call localVarCall = listThreadsGETValidateBeforeCall(limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List user threads (asynchronously) + * Use this resource to get the list of user threads sorted by last message date, starting from newest. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#lista-watkow-na-koncie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#list-of-threads\" target=\"_blank\">EN</a>. + * @param limit The maximum number of threads returned in the response. (optional, default to 20) + * @param offset Index of the first returned thread from all results. (optional, default to 0) + * @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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 User not authorized -
422 Incorrect limit or offset -
+ */ + public okhttp3.Call listThreadsGETAsync(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listThreadsGETValidateBeforeCall(limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for newAttachmentDeclarationPOST + * @param newAttachmentDeclaration (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment declaration successfully added -
401 User not authorized -
415 Unsupported mime type -
422 Validation errors -
+ */ + public okhttp3.Call newAttachmentDeclarationPOSTCall(@javax.annotation.Nonnull NewAttachmentDeclaration newAttachmentDeclaration, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = newAttachmentDeclaration; + + // create path and map variables + String localVarPath = "/messaging/message-attachments"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call newAttachmentDeclarationPOSTValidateBeforeCall(@javax.annotation.Nonnull NewAttachmentDeclaration newAttachmentDeclaration, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'newAttachmentDeclaration' is set + if (newAttachmentDeclaration == null) { + throw new ApiException("Missing the required parameter 'newAttachmentDeclaration' when calling newAttachmentDeclarationPOST(Async)"); + } + + return newAttachmentDeclarationPOSTCall(newAttachmentDeclaration, _callback); + + } + + /** + * Add attachment declaration + * Use this resource to add attachment declaration before uploading. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#deklaracja-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#attachment-declaration\" target=\"_blank\">EN</a>. + * @param newAttachmentDeclaration (required) + * @return MessageAttachmentId + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment declaration successfully added -
401 User not authorized -
415 Unsupported mime type -
422 Validation errors -
+ */ + public MessageAttachmentId newAttachmentDeclarationPOST(@javax.annotation.Nonnull NewAttachmentDeclaration newAttachmentDeclaration) throws ApiException { + ApiResponse localVarResp = newAttachmentDeclarationPOSTWithHttpInfo(newAttachmentDeclaration); + return localVarResp.getData(); + } + + /** + * Add attachment declaration + * Use this resource to add attachment declaration before uploading. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#deklaracja-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#attachment-declaration\" target=\"_blank\">EN</a>. + * @param newAttachmentDeclaration (required) + * @return ApiResponse<MessageAttachmentId> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment declaration successfully added -
401 User not authorized -
415 Unsupported mime type -
422 Validation errors -
+ */ + public ApiResponse newAttachmentDeclarationPOSTWithHttpInfo(@javax.annotation.Nonnull NewAttachmentDeclaration newAttachmentDeclaration) throws ApiException { + okhttp3.Call localVarCall = newAttachmentDeclarationPOSTValidateBeforeCall(newAttachmentDeclaration, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add attachment declaration (asynchronously) + * Use this resource to add attachment declaration before uploading. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#deklaracja-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#attachment-declaration\" target=\"_blank\">EN</a>. + * @param newAttachmentDeclaration (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Attachment declaration successfully added -
401 User not authorized -
415 Unsupported mime type -
422 Validation errors -
+ */ + public okhttp3.Call newAttachmentDeclarationPOSTAsync(@javax.annotation.Nonnull NewAttachmentDeclaration newAttachmentDeclaration, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = newAttachmentDeclarationPOSTValidateBeforeCall(newAttachmentDeclaration, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for newMessageInThreadPOST + * @param threadId Identifier of thread to write message to. (required) + * @param newMessageInThread (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Message in thread successfully written -
401 User not authorized -
403 User not allowed to list messages in selected thread -
404 Thread not found -
422 Validation errors -
+ */ + public okhttp3.Call newMessageInThreadPOSTCall(@javax.annotation.Nonnull String threadId, @javax.annotation.Nonnull NewMessageInThread newMessageInThread, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = newMessageInThread; + + // create path and map variables + String localVarPath = "/messaging/threads/{threadId}/messages" + .replace("{" + "threadId" + "}", localVarApiClient.escapeString(threadId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call newMessageInThreadPOSTValidateBeforeCall(@javax.annotation.Nonnull String threadId, @javax.annotation.Nonnull NewMessageInThread newMessageInThread, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'threadId' is set + if (threadId == null) { + throw new ApiException("Missing the required parameter 'threadId' when calling newMessageInThreadPOST(Async)"); + } + + // verify the required parameter 'newMessageInThread' is set + if (newMessageInThread == null) { + throw new ApiException("Missing the required parameter 'newMessageInThread' when calling newMessageInThreadPOST(Async)"); + } + + return newMessageInThreadPOSTCall(threadId, newMessageInThread, _callback); + + } + + /** + * Write a new message in thread + * Use this resource to write new message in existing thread. This resource is rate limited to 1 request per second for a user. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#nowa-wiadomosc\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#add-a-new-message\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to write message to. (required) + * @param newMessageInThread (required) + * @return Message + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Message in thread successfully written -
401 User not authorized -
403 User not allowed to list messages in selected thread -
404 Thread not found -
422 Validation errors -
+ */ + public Message newMessageInThreadPOST(@javax.annotation.Nonnull String threadId, @javax.annotation.Nonnull NewMessageInThread newMessageInThread) throws ApiException { + ApiResponse localVarResp = newMessageInThreadPOSTWithHttpInfo(threadId, newMessageInThread); + return localVarResp.getData(); + } + + /** + * Write a new message in thread + * Use this resource to write new message in existing thread. This resource is rate limited to 1 request per second for a user. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#nowa-wiadomosc\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#add-a-new-message\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to write message to. (required) + * @param newMessageInThread (required) + * @return ApiResponse<Message> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Message in thread successfully written -
401 User not authorized -
403 User not allowed to list messages in selected thread -
404 Thread not found -
422 Validation errors -
+ */ + public ApiResponse newMessageInThreadPOSTWithHttpInfo(@javax.annotation.Nonnull String threadId, @javax.annotation.Nonnull NewMessageInThread newMessageInThread) throws ApiException { + okhttp3.Call localVarCall = newMessageInThreadPOSTValidateBeforeCall(threadId, newMessageInThread, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Write a new message in thread (asynchronously) + * Use this resource to write new message in existing thread. This resource is rate limited to 1 request per second for a user. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#nowa-wiadomosc\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#add-a-new-message\" target=\"_blank\">EN</a>. + * @param threadId Identifier of thread to write message to. (required) + * @param newMessageInThread (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Message in thread successfully written -
401 User not authorized -
403 User not allowed to list messages in selected thread -
404 Thread not found -
422 Validation errors -
+ */ + public okhttp3.Call newMessageInThreadPOSTAsync(@javax.annotation.Nonnull String threadId, @javax.annotation.Nonnull NewMessageInThread newMessageInThread, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = newMessageInThreadPOSTValidateBeforeCall(threadId, newMessageInThread, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for newMessagePOST + * @param newMessage Object representing new message. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 Message successfully written -
401 Authentication required -
422 Validation errors -
+ */ + public okhttp3.Call newMessagePOSTCall(@javax.annotation.Nonnull NewMessage newMessage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = newMessage; + + // create path and map variables + String localVarPath = "/messaging/messages"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call newMessagePOSTValidateBeforeCall(@javax.annotation.Nonnull NewMessage newMessage, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'newMessage' is set + if (newMessage == null) { + throw new ApiException("Missing the required parameter 'newMessage' when calling newMessagePOST(Async)"); + } + + return newMessagePOSTCall(newMessage, _callback); + + } + + /** + * Write a new message + * Use this resource to write new message to recipient. This resource is rate limited to 1 request per second for a user. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#nowa-wiadomosc\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#add-a-new-message\" target=\"_blank\">EN</a>. + * @param newMessage Object representing new message. (required) + * @return Message + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 Message successfully written -
401 Authentication required -
422 Validation errors -
+ */ + public Message newMessagePOST(@javax.annotation.Nonnull NewMessage newMessage) throws ApiException { + ApiResponse localVarResp = newMessagePOSTWithHttpInfo(newMessage); + return localVarResp.getData(); + } + + /** + * Write a new message + * Use this resource to write new message to recipient. This resource is rate limited to 1 request per second for a user. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#nowa-wiadomosc\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#add-a-new-message\" target=\"_blank\">EN</a>. + * @param newMessage Object representing new message. (required) + * @return ApiResponse<Message> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 Message successfully written -
401 Authentication required -
422 Validation errors -
+ */ + public ApiResponse newMessagePOSTWithHttpInfo(@javax.annotation.Nonnull NewMessage newMessage) throws ApiException { + okhttp3.Call localVarCall = newMessagePOSTValidateBeforeCall(newMessage, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Write a new message (asynchronously) + * Use this resource to write new message to recipient. This resource is rate limited to 1 request per second for a user. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#nowa-wiadomosc\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#add-a-new-message\" target=\"_blank\">EN</a>. + * @param newMessage Object representing new message. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
201 Message successfully written -
401 Authentication required -
422 Validation errors -
+ */ + public okhttp3.Call newMessagePOSTAsync(@javax.annotation.Nonnull NewMessage newMessage, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = newMessagePOSTValidateBeforeCall(newMessage, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadAttachmentPUT + * @param attachmentId The identifier of attachment that will be uploaded. (required) + * @param body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Attachment succesfully uploaded. -
401 User not authorized -
403 User does not have -
404 Attachment declaration not found -
413 Exceeded size limit -
415 Unsupported mime type -
+ */ + public okhttp3.Call uploadAttachmentPUTCall(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nonnull File body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/messaging/message-attachments/{attachmentId}" + .replace("{" + "attachmentId" + "}", localVarApiClient.escapeString(attachmentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "image/png", + "image/gif", + "image/bmp", + "image/tiff", + "image/jpeg", + "application/pdf" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadAttachmentPUTValidateBeforeCall(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nonnull File body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'attachmentId' is set + if (attachmentId == null) { + throw new ApiException("Missing the required parameter 'attachmentId' when calling uploadAttachmentPUT(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling uploadAttachmentPUT(Async)"); + } + + return uploadAttachmentPUTCall(attachmentId, body, _callback); + + } + + /** + * Upload attachment binary data + * Use this resource to upload attachment using identifier that was declared. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#dodanie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#add-an-attachment\" target=\"_blank\">EN</a>. + * @param attachmentId The identifier of attachment that will be uploaded. (required) + * @param body (required) + * @return MessageAttachmentId + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Attachment succesfully uploaded. -
401 User not authorized -
403 User does not have -
404 Attachment declaration not found -
413 Exceeded size limit -
415 Unsupported mime type -
+ */ + public MessageAttachmentId uploadAttachmentPUT(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nonnull File body) throws ApiException { + ApiResponse localVarResp = uploadAttachmentPUTWithHttpInfo(attachmentId, body); + return localVarResp.getData(); + } + + /** + * Upload attachment binary data + * Use this resource to upload attachment using identifier that was declared. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#dodanie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#add-an-attachment\" target=\"_blank\">EN</a>. + * @param attachmentId The identifier of attachment that will be uploaded. (required) + * @param body (required) + * @return ApiResponse<MessageAttachmentId> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Attachment succesfully uploaded. -
401 User not authorized -
403 User does not have -
404 Attachment declaration not found -
413 Exceeded size limit -
415 Unsupported mime type -
+ */ + public ApiResponse uploadAttachmentPUTWithHttpInfo(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nonnull File body) throws ApiException { + okhttp3.Call localVarCall = uploadAttachmentPUTValidateBeforeCall(attachmentId, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upload attachment binary data (asynchronously) + * Use this resource to upload attachment using identifier that was declared. Read more: <a href=\"../../tutorials/jak-zarzadzac-centrum-wiadomosci-XxWm2K890Fk#dodanie-zalacznika\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-the-message-center-g05avyGlZUW#add-an-attachment\" target=\"_blank\">EN</a>. + * @param attachmentId The identifier of attachment that will be uploaded. (required) + * @param body (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Attachment succesfully uploaded. -
401 User not authorized -
403 User does not have -
404 Attachment declaration not found -
413 Exceeded size limit -
415 Unsupported mime type -
+ */ + public okhttp3.Call uploadAttachmentPUTAsync(@javax.annotation.Nonnull String attachmentId, @javax.annotation.Nonnull File body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadAttachmentPUTValidateBeforeCall(attachmentId, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/OfferBundlesApi.java b/src/main/java/pl/wtx/allegro/api/client/OfferBundlesApi.java new file mode 100644 index 0000000..7b0c057 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/OfferBundlesApi.java @@ -0,0 +1,799 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.CreateOfferBundleDTO; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.OfferBundleDTO; +import pl.wtx.allegro.api.client.model.OfferBundlesDTO; +import pl.wtx.allegro.api.client.model.UpdateOfferBundleDiscountDTO; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class OfferBundlesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public OfferBundlesApi() { + this(Configuration.getDefaultApiClient()); + } + + public OfferBundlesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createOfferBundleUsingPOST + * @param createOfferBundleDTO (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Successfully created the requested offer bundle. Once bundle is created it can be in one of two statuses on each marketplace separately: <ul> <li> `ACTIVE` means that bundle will be displayed on offer page; <li> `SUSPENDED` means that bundle will NOT be displayed on offer page. </ul> Bundle is SUSPENDED on all marketplaces when at least one of offers is ended or out of stock. Bundle is SUSPENDED on specific marketplace when at least one of offers: <ul> <li> is not visible on that marketplace;</li> <li> is in campaign which lowers its price on that marketplace;</li> </ul> or when discount cannot be spread across offers considering their current prices on that marketplace. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call createOfferBundleUsingPOSTCall(@javax.annotation.Nonnull CreateOfferBundleDTO createOfferBundleDTO, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createOfferBundleDTO; + + // create path and map variables + String localVarPath = "/sale/bundles"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createOfferBundleUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull CreateOfferBundleDTO createOfferBundleDTO, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createOfferBundleDTO' is set + if (createOfferBundleDTO == null) { + throw new ApiException("Missing the required parameter 'createOfferBundleDTO' when calling createOfferBundleUsingPOST(Async)"); + } + + return createOfferBundleUsingPOSTCall(createOfferBundleDTO, _callback); + + } + + /** + * Create a new offer bundle + * You can create <a href=\"https://help.allegro.com/sell/en/a/how-to-create-offer-bundles-rj9eAL2XnhK?marketplaceId=allegro-pl\" target=\"_blank\">offer bundle</a> using this endpoint. Bundle has to contain at least two offers and at least one of them has to be set as an entry point. Bundle will be shown on offers' pages which are marked as entry points. You can also specify how many units of each offer will be in bundle using `requiredQuantity` property. <br> Additionally, discount can be specified for each marketplace separately. If you do not want to set discount, set `discounts` property to `null` or empty array. Also, you do not have to specify discount on all marketplaces. Fill marketplaces in 'discounts' array accordingly to your needs. <br> Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#utworz-zestaw-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#create-an-offer-bundle\" target=\"_blank\">EN</a>. + * @param createOfferBundleDTO (required) + * @return OfferBundleDTO + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Successfully created the requested offer bundle. Once bundle is created it can be in one of two statuses on each marketplace separately: <ul> <li> `ACTIVE` means that bundle will be displayed on offer page; <li> `SUSPENDED` means that bundle will NOT be displayed on offer page. </ul> Bundle is SUSPENDED on all marketplaces when at least one of offers is ended or out of stock. Bundle is SUSPENDED on specific marketplace when at least one of offers: <ul> <li> is not visible on that marketplace;</li> <li> is in campaign which lowers its price on that marketplace;</li> </ul> or when discount cannot be spread across offers considering their current prices on that marketplace. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public OfferBundleDTO createOfferBundleUsingPOST(@javax.annotation.Nonnull CreateOfferBundleDTO createOfferBundleDTO) throws ApiException { + ApiResponse localVarResp = createOfferBundleUsingPOSTWithHttpInfo(createOfferBundleDTO); + return localVarResp.getData(); + } + + /** + * Create a new offer bundle + * You can create <a href=\"https://help.allegro.com/sell/en/a/how-to-create-offer-bundles-rj9eAL2XnhK?marketplaceId=allegro-pl\" target=\"_blank\">offer bundle</a> using this endpoint. Bundle has to contain at least two offers and at least one of them has to be set as an entry point. Bundle will be shown on offers' pages which are marked as entry points. You can also specify how many units of each offer will be in bundle using `requiredQuantity` property. <br> Additionally, discount can be specified for each marketplace separately. If you do not want to set discount, set `discounts` property to `null` or empty array. Also, you do not have to specify discount on all marketplaces. Fill marketplaces in 'discounts' array accordingly to your needs. <br> Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#utworz-zestaw-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#create-an-offer-bundle\" target=\"_blank\">EN</a>. + * @param createOfferBundleDTO (required) + * @return ApiResponse<OfferBundleDTO> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Successfully created the requested offer bundle. Once bundle is created it can be in one of two statuses on each marketplace separately: <ul> <li> `ACTIVE` means that bundle will be displayed on offer page; <li> `SUSPENDED` means that bundle will NOT be displayed on offer page. </ul> Bundle is SUSPENDED on all marketplaces when at least one of offers is ended or out of stock. Bundle is SUSPENDED on specific marketplace when at least one of offers: <ul> <li> is not visible on that marketplace;</li> <li> is in campaign which lowers its price on that marketplace;</li> </ul> or when discount cannot be spread across offers considering their current prices on that marketplace. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public ApiResponse createOfferBundleUsingPOSTWithHttpInfo(@javax.annotation.Nonnull CreateOfferBundleDTO createOfferBundleDTO) throws ApiException { + okhttp3.Call localVarCall = createOfferBundleUsingPOSTValidateBeforeCall(createOfferBundleDTO, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a new offer bundle (asynchronously) + * You can create <a href=\"https://help.allegro.com/sell/en/a/how-to-create-offer-bundles-rj9eAL2XnhK?marketplaceId=allegro-pl\" target=\"_blank\">offer bundle</a> using this endpoint. Bundle has to contain at least two offers and at least one of them has to be set as an entry point. Bundle will be shown on offers' pages which are marked as entry points. You can also specify how many units of each offer will be in bundle using `requiredQuantity` property. <br> Additionally, discount can be specified for each marketplace separately. If you do not want to set discount, set `discounts` property to `null` or empty array. Also, you do not have to specify discount on all marketplaces. Fill marketplaces in 'discounts' array accordingly to your needs. <br> Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#utworz-zestaw-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#create-an-offer-bundle\" target=\"_blank\">EN</a>. + * @param createOfferBundleDTO (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Successfully created the requested offer bundle. Once bundle is created it can be in one of two statuses on each marketplace separately: <ul> <li> `ACTIVE` means that bundle will be displayed on offer page; <li> `SUSPENDED` means that bundle will NOT be displayed on offer page. </ul> Bundle is SUSPENDED on all marketplaces when at least one of offers is ended or out of stock. Bundle is SUSPENDED on specific marketplace when at least one of offers: <ul> <li> is not visible on that marketplace;</li> <li> is in campaign which lowers its price on that marketplace;</li> </ul> or when discount cannot be spread across offers considering their current prices on that marketplace. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call createOfferBundleUsingPOSTAsync(@javax.annotation.Nonnull CreateOfferBundleDTO createOfferBundleDTO, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createOfferBundleUsingPOSTValidateBeforeCall(createOfferBundleDTO, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteOfferBundleUsingGET + * @param bundleId Bundle ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Bundle successfully deleted. -
401 Unauthenticated action -
404 Bundle not found -
+ */ + public okhttp3.Call deleteOfferBundleUsingGETCall(@javax.annotation.Nonnull String bundleId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/bundles/{bundleId}" + .replace("{" + "bundleId" + "}", localVarApiClient.escapeString(bundleId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOfferBundleUsingGETValidateBeforeCall(@javax.annotation.Nonnull String bundleId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'bundleId' is set + if (bundleId == null) { + throw new ApiException("Missing the required parameter 'bundleId' when calling deleteOfferBundleUsingGET(Async)"); + } + + return deleteOfferBundleUsingGETCall(bundleId, _callback); + + } + + /** + * Delete bundle by ID + * Use this resource to delete offer bundle by its unique identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-wybrany-zestaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-the-selected-offer-bundle\" target=\"_blank\">EN</a>. + * @param bundleId Bundle ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Bundle successfully deleted. -
401 Unauthenticated action -
404 Bundle not found -
+ */ + public void deleteOfferBundleUsingGET(@javax.annotation.Nonnull String bundleId) throws ApiException { + deleteOfferBundleUsingGETWithHttpInfo(bundleId); + } + + /** + * Delete bundle by ID + * Use this resource to delete offer bundle by its unique identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-wybrany-zestaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-the-selected-offer-bundle\" target=\"_blank\">EN</a>. + * @param bundleId Bundle ID. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Bundle successfully deleted. -
401 Unauthenticated action -
404 Bundle not found -
+ */ + public ApiResponse deleteOfferBundleUsingGETWithHttpInfo(@javax.annotation.Nonnull String bundleId) throws ApiException { + okhttp3.Call localVarCall = deleteOfferBundleUsingGETValidateBeforeCall(bundleId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete bundle by ID (asynchronously) + * Use this resource to delete offer bundle by its unique identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-wybrany-zestaw\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-the-selected-offer-bundle\" target=\"_blank\">EN</a>. + * @param bundleId Bundle 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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Bundle successfully deleted. -
401 Unauthenticated action -
404 Bundle not found -
+ */ + public okhttp3.Call deleteOfferBundleUsingGETAsync(@javax.annotation.Nonnull String bundleId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOfferBundleUsingGETValidateBeforeCall(bundleId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getOfferBundleUsingGET + * @param bundleId Bundle ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested offer bundle -
401 Unauthenticated action -
404 Bundle not found -
+ */ + public okhttp3.Call getOfferBundleUsingGETCall(@javax.annotation.Nonnull String bundleId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/bundles/{bundleId}" + .replace("{" + "bundleId" + "}", localVarApiClient.escapeString(bundleId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOfferBundleUsingGETValidateBeforeCall(@javax.annotation.Nonnull String bundleId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'bundleId' is set + if (bundleId == null) { + throw new ApiException("Missing the required parameter 'bundleId' when calling getOfferBundleUsingGET(Async)"); + } + + return getOfferBundleUsingGETCall(bundleId, _callback); + + } + + /** + * Get bundle by ID + * Use this resource to retrieve offer bundle by its unique identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-szczegoly-wybranego-zestawu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-details-of-the-selected-offer-bundle\" target=\"_blank\">EN</a>. + * @param bundleId Bundle ID. (required) + * @return OfferBundleDTO + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested offer bundle -
401 Unauthenticated action -
404 Bundle not found -
+ */ + public OfferBundleDTO getOfferBundleUsingGET(@javax.annotation.Nonnull String bundleId) throws ApiException { + ApiResponse localVarResp = getOfferBundleUsingGETWithHttpInfo(bundleId); + return localVarResp.getData(); + } + + /** + * Get bundle by ID + * Use this resource to retrieve offer bundle by its unique identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-szczegoly-wybranego-zestawu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-details-of-the-selected-offer-bundle\" target=\"_blank\">EN</a>. + * @param bundleId Bundle ID. (required) + * @return ApiResponse<OfferBundleDTO> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested offer bundle -
401 Unauthenticated action -
404 Bundle not found -
+ */ + public ApiResponse getOfferBundleUsingGETWithHttpInfo(@javax.annotation.Nonnull String bundleId) throws ApiException { + okhttp3.Call localVarCall = getOfferBundleUsingGETValidateBeforeCall(bundleId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get bundle by ID (asynchronously) + * Use this resource to retrieve offer bundle by its unique identifier. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-szczegoly-wybranego-zestawu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-details-of-the-selected-offer-bundle\" target=\"_blank\">EN</a>. + * @param bundleId Bundle 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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested offer bundle -
401 Unauthenticated action -
404 Bundle not found -
+ */ + public okhttp3.Call getOfferBundleUsingGETAsync(@javax.annotation.Nonnull String bundleId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOfferBundleUsingGETValidateBeforeCall(bundleId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listSellersOfferBundlesUsingGET + * @param limit Limit of bundles per page. (optional, default to 50) + * @param offerId Filter bundles which contains offer. (optional) + * @param pageId ID of page which will be retrieved. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Page of seller's bundles. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call listSellersOfferBundlesUsingGETCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable String pageId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/bundles"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offerId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offer.id", offerId)); + } + + if (pageId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page.id", pageId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listSellersOfferBundlesUsingGETValidateBeforeCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable String pageId, final ApiCallback _callback) throws ApiException { + return listSellersOfferBundlesUsingGETCall(limit, offerId, pageId, _callback); + + } + + /** + * List seller's bundles + * You can fetch page of seller's offer bundles using this endpoint. <br> Paging: <br> To move to next page, specify `page.id` parameter with value obtained in response from previous request. Number of offer bundles on single page can be specified using `limit` parameter. <br> Filtering: <br> Offer bundles can be filtered to bundles which contain offer specified in `offer.id` parameter. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-liste-zestawow-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-offer-bundles-list\" target=\"_blank\">EN</a>. + * @param limit Limit of bundles per page. (optional, default to 50) + * @param offerId Filter bundles which contains offer. (optional) + * @param pageId ID of page which will be retrieved. (optional) + * @return OfferBundlesDTO + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Page of seller's bundles. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public OfferBundlesDTO listSellersOfferBundlesUsingGET(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable String pageId) throws ApiException { + ApiResponse localVarResp = listSellersOfferBundlesUsingGETWithHttpInfo(limit, offerId, pageId); + return localVarResp.getData(); + } + + /** + * List seller's bundles + * You can fetch page of seller's offer bundles using this endpoint. <br> Paging: <br> To move to next page, specify `page.id` parameter with value obtained in response from previous request. Number of offer bundles on single page can be specified using `limit` parameter. <br> Filtering: <br> Offer bundles can be filtered to bundles which contain offer specified in `offer.id` parameter. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-liste-zestawow-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-offer-bundles-list\" target=\"_blank\">EN</a>. + * @param limit Limit of bundles per page. (optional, default to 50) + * @param offerId Filter bundles which contains offer. (optional) + * @param pageId ID of page which will be retrieved. (optional) + * @return ApiResponse<OfferBundlesDTO> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Page of seller's bundles. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public ApiResponse listSellersOfferBundlesUsingGETWithHttpInfo(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable String pageId) throws ApiException { + okhttp3.Call localVarCall = listSellersOfferBundlesUsingGETValidateBeforeCall(limit, offerId, pageId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List seller's bundles (asynchronously) + * You can fetch page of seller's offer bundles using this endpoint. <br> Paging: <br> To move to next page, specify `page.id` parameter with value obtained in response from previous request. Number of offer bundles on single page can be specified using `limit` parameter. <br> Filtering: <br> Offer bundles can be filtered to bundles which contain offer specified in `offer.id` parameter. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-liste-zestawow-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-offer-bundles-list\" target=\"_blank\">EN</a>. + * @param limit Limit of bundles per page. (optional, default to 50) + * @param offerId Filter bundles which contains offer. (optional) + * @param pageId ID of page which will be retrieved. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Page of seller's bundles. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call listSellersOfferBundlesUsingGETAsync(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String offerId, @javax.annotation.Nullable String pageId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listSellersOfferBundlesUsingGETValidateBeforeCall(limit, offerId, pageId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateOfferBundleDiscountUsingPUT + * @param bundleId Bundle ID. (required) + * @param updateOfferBundleDiscountDTO (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Bundle discount successfully changed. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call updateOfferBundleDiscountUsingPUTCall(@javax.annotation.Nonnull String bundleId, @javax.annotation.Nonnull UpdateOfferBundleDiscountDTO updateOfferBundleDiscountDTO, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateOfferBundleDiscountDTO; + + // create path and map variables + String localVarPath = "/sale/bundles/{bundleId}/discount" + .replace("{" + "bundleId" + "}", localVarApiClient.escapeString(bundleId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateOfferBundleDiscountUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String bundleId, @javax.annotation.Nonnull UpdateOfferBundleDiscountDTO updateOfferBundleDiscountDTO, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'bundleId' is set + if (bundleId == null) { + throw new ApiException("Missing the required parameter 'bundleId' when calling updateOfferBundleDiscountUsingPUT(Async)"); + } + + // verify the required parameter 'updateOfferBundleDiscountDTO' is set + if (updateOfferBundleDiscountDTO == null) { + throw new ApiException("Missing the required parameter 'updateOfferBundleDiscountDTO' when calling updateOfferBundleDiscountUsingPUT(Async)"); + } + + return updateOfferBundleDiscountUsingPUTCall(bundleId, updateOfferBundleDiscountDTO, _callback); + + } + + /** + * Update discount associated with bundle + * Use this resource to update discount per marketplaces associated with bundle specified by its unique identifier. This will override currently set discounts for all marketplaces, so the unchanged discounts also must be specified in request. In case discount for marketplace is not specified in request it will be deleted. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#zmien-rabat-przypisany-do-wybranego-zestawu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#change-the-discount-for-the-selected-offer-bundle\" target=\"_blank\">EN</a>. + * @param bundleId Bundle ID. (required) + * @param updateOfferBundleDiscountDTO (required) + * @return OfferBundleDTO + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Bundle discount successfully changed. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public OfferBundleDTO updateOfferBundleDiscountUsingPUT(@javax.annotation.Nonnull String bundleId, @javax.annotation.Nonnull UpdateOfferBundleDiscountDTO updateOfferBundleDiscountDTO) throws ApiException { + ApiResponse localVarResp = updateOfferBundleDiscountUsingPUTWithHttpInfo(bundleId, updateOfferBundleDiscountDTO); + return localVarResp.getData(); + } + + /** + * Update discount associated with bundle + * Use this resource to update discount per marketplaces associated with bundle specified by its unique identifier. This will override currently set discounts for all marketplaces, so the unchanged discounts also must be specified in request. In case discount for marketplace is not specified in request it will be deleted. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#zmien-rabat-przypisany-do-wybranego-zestawu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#change-the-discount-for-the-selected-offer-bundle\" target=\"_blank\">EN</a>. + * @param bundleId Bundle ID. (required) + * @param updateOfferBundleDiscountDTO (required) + * @return ApiResponse<OfferBundleDTO> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Bundle discount successfully changed. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public ApiResponse updateOfferBundleDiscountUsingPUTWithHttpInfo(@javax.annotation.Nonnull String bundleId, @javax.annotation.Nonnull UpdateOfferBundleDiscountDTO updateOfferBundleDiscountDTO) throws ApiException { + okhttp3.Call localVarCall = updateOfferBundleDiscountUsingPUTValidateBeforeCall(bundleId, updateOfferBundleDiscountDTO, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update discount associated with bundle (asynchronously) + * Use this resource to update discount per marketplaces associated with bundle specified by its unique identifier. This will override currently set discounts for all marketplaces, so the unchanged discounts also must be specified in request. In case discount for marketplace is not specified in request it will be deleted. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#zmien-rabat-przypisany-do-wybranego-zestawu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#change-the-discount-for-the-selected-offer-bundle\" target=\"_blank\">EN</a>. + * @param bundleId Bundle ID. (required) + * @param updateOfferBundleDiscountDTO (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Bundle discount successfully changed. -
400 Bad request -
401 Unauthenticated action -
403 Forbidden action -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call updateOfferBundleDiscountUsingPUTAsync(@javax.annotation.Nonnull String bundleId, @javax.annotation.Nonnull UpdateOfferBundleDiscountDTO updateOfferBundleDiscountDTO, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateOfferBundleDiscountUsingPUTValidateBeforeCall(bundleId, updateOfferBundleDiscountDTO, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/OfferManagementApi.java b/src/main/java/pl/wtx/allegro/api/client/OfferManagementApi.java new file mode 100644 index 0000000..b8e0f81 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/OfferManagementApi.java @@ -0,0 +1,2485 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.AvailablePromotionPackages; +import pl.wtx.allegro.api.client.model.ChangePrice; +import pl.wtx.allegro.api.client.model.ChangePriceWithoutOutput; +import pl.wtx.allegro.api.client.model.CreateProductOffers422Response; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.GeneralReport; +import pl.wtx.allegro.api.client.model.OfferPromoOptions; +import pl.wtx.allegro.api.client.model.OfferPromoOptionsForSeller; +import pl.wtx.allegro.api.client.model.PromoGeneralReport; +import pl.wtx.allegro.api.client.model.PromoModificationReport; +import pl.wtx.allegro.api.client.model.PromoOptionsCommand; +import pl.wtx.allegro.api.client.model.PromoOptionsModifications; +import pl.wtx.allegro.api.client.model.PublicationChangeCommandDto; +import pl.wtx.allegro.api.client.model.SaleProductOfferPatchRequestV1; +import pl.wtx.allegro.api.client.model.SaleProductOfferRequestV1; +import pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1; +import pl.wtx.allegro.api.client.model.SaleProductOfferStatusResponse; +import pl.wtx.allegro.api.client.model.TaskReport; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.UnfilledParametersResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class OfferManagementApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public OfferManagementApi() { + this(Configuration.getDefaultApiClient()); + } + + public OfferManagementApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for changePublicationStatusUsingPUT + * @param commandId Command identifier. (required) + * @param publicationChangeCommandDto publicationChangeCommandDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public okhttp3.Call changePublicationStatusUsingPUTCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull PublicationChangeCommandDto publicationChangeCommandDto, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = publicationChangeCommandDto; + + // create path and map variables + String localVarPath = "/sale/offer-publication-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call changePublicationStatusUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull PublicationChangeCommandDto publicationChangeCommandDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling changePublicationStatusUsingPUT(Async)"); + } + + // verify the required parameter 'publicationChangeCommandDto' is set + if (publicationChangeCommandDto == null) { + throw new ApiException("Missing the required parameter 'publicationChangeCommandDto' when calling changePublicationStatusUsingPUT(Async)"); + } + + return changePublicationStatusUsingPUTCall(commandId, publicationChangeCommandDto, _callback); + + } + + /** + * Batch offer publish / unpublish + * Use this resource to modify multiple offers publication at once. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#publikacja-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-publication\" target=\"_blank\">EN</a>. This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param publicationChangeCommandDto publicationChangeCommandDto (required) + * @return GeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public GeneralReport changePublicationStatusUsingPUT(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull PublicationChangeCommandDto publicationChangeCommandDto) throws ApiException { + ApiResponse localVarResp = changePublicationStatusUsingPUTWithHttpInfo(commandId, publicationChangeCommandDto); + return localVarResp.getData(); + } + + /** + * Batch offer publish / unpublish + * Use this resource to modify multiple offers publication at once. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#publikacja-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-publication\" target=\"_blank\">EN</a>. This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param publicationChangeCommandDto publicationChangeCommandDto (required) + * @return ApiResponse<GeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public ApiResponse changePublicationStatusUsingPUTWithHttpInfo(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull PublicationChangeCommandDto publicationChangeCommandDto) throws ApiException { + okhttp3.Call localVarCall = changePublicationStatusUsingPUTValidateBeforeCall(commandId, publicationChangeCommandDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Batch offer publish / unpublish (asynchronously) + * Use this resource to modify multiple offers publication at once. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#publikacja-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-publication\" target=\"_blank\">EN</a>. This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param publicationChangeCommandDto publicationChangeCommandDto (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
400 Semantically incorrect request or provided conditions not correct -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Command id was already used -
422 Unprocessable Entity -
+ */ + public okhttp3.Call changePublicationStatusUsingPUTAsync(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull PublicationChangeCommandDto publicationChangeCommandDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = changePublicationStatusUsingPUTValidateBeforeCall(commandId, publicationChangeCommandDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createChangePriceCommandUsingPUT + * @param offerId The offer identifier. (required) + * @param commandId The unique command id generated by you. (required) + * @param changePriceWithoutOutput (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The command was created successfully and is queued for processing. -
0 An immediate error response is returned whether the command input data is not valid or there is an internal problem with our systems. -
+ */ + public okhttp3.Call createChangePriceCommandUsingPUTCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull UUID commandId, @javax.annotation.Nonnull ChangePriceWithoutOutput changePriceWithoutOutput, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = changePriceWithoutOutput; + + // create path and map variables + String localVarPath = "/offers/{offerId}/change-price-commands/{commandId}" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())) + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createChangePriceCommandUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull UUID commandId, @javax.annotation.Nonnull ChangePriceWithoutOutput changePriceWithoutOutput, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling createChangePriceCommandUsingPUT(Async)"); + } + + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling createChangePriceCommandUsingPUT(Async)"); + } + + // verify the required parameter 'changePriceWithoutOutput' is set + if (changePriceWithoutOutput == null) { + throw new ApiException("Missing the required parameter 'changePriceWithoutOutput' when calling createChangePriceCommandUsingPUT(Async)"); + } + + return createChangePriceCommandUsingPUTCall(offerId, commandId, changePriceWithoutOutput, _callback); + + } + + /** + * Modify the Buy Now price in an offer + * Use this resource to change the Buy Now price in a single offer. Read more: <a href=\"../../news/mozliwosc-zmiany-ceny-kup-teraz-2YzrKRrr3Sl\" target=\"_blank\">PL</a> / <a href=\"../../news/possibility-to-change-the-buy-it-now-price-q018mq8D2hW\" target=\"_blank\">EN</a>. + * @param offerId The offer identifier. (required) + * @param commandId The unique command id generated by you. (required) + * @param changePriceWithoutOutput (required) + * @return ChangePrice + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The command was created successfully and is queued for processing. -
0 An immediate error response is returned whether the command input data is not valid or there is an internal problem with our systems. -
+ */ + public ChangePrice createChangePriceCommandUsingPUT(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull UUID commandId, @javax.annotation.Nonnull ChangePriceWithoutOutput changePriceWithoutOutput) throws ApiException { + ApiResponse localVarResp = createChangePriceCommandUsingPUTWithHttpInfo(offerId, commandId, changePriceWithoutOutput); + return localVarResp.getData(); + } + + /** + * Modify the Buy Now price in an offer + * Use this resource to change the Buy Now price in a single offer. Read more: <a href=\"../../news/mozliwosc-zmiany-ceny-kup-teraz-2YzrKRrr3Sl\" target=\"_blank\">PL</a> / <a href=\"../../news/possibility-to-change-the-buy-it-now-price-q018mq8D2hW\" target=\"_blank\">EN</a>. + * @param offerId The offer identifier. (required) + * @param commandId The unique command id generated by you. (required) + * @param changePriceWithoutOutput (required) + * @return ApiResponse<ChangePrice> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The command was created successfully and is queued for processing. -
0 An immediate error response is returned whether the command input data is not valid or there is an internal problem with our systems. -
+ */ + public ApiResponse createChangePriceCommandUsingPUTWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull UUID commandId, @javax.annotation.Nonnull ChangePriceWithoutOutput changePriceWithoutOutput) throws ApiException { + okhttp3.Call localVarCall = createChangePriceCommandUsingPUTValidateBeforeCall(offerId, commandId, changePriceWithoutOutput, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Modify the Buy Now price in an offer (asynchronously) + * Use this resource to change the Buy Now price in a single offer. Read more: <a href=\"../../news/mozliwosc-zmiany-ceny-kup-teraz-2YzrKRrr3Sl\" target=\"_blank\">PL</a> / <a href=\"../../news/possibility-to-change-the-buy-it-now-price-q018mq8D2hW\" target=\"_blank\">EN</a>. + * @param offerId The offer identifier. (required) + * @param commandId The unique command id generated by you. (required) + * @param changePriceWithoutOutput (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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The command was created successfully and is queued for processing. -
0 An immediate error response is returned whether the command input data is not valid or there is an internal problem with our systems. -
+ */ + public okhttp3.Call createChangePriceCommandUsingPUTAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull UUID commandId, @javax.annotation.Nonnull ChangePriceWithoutOutput changePriceWithoutOutput, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createChangePriceCommandUsingPUTValidateBeforeCall(offerId, commandId, changePriceWithoutOutput, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createProductOffers + * @param saleProductOfferRequestV1 (required) + * @param acceptLanguage Expected language of messages. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Offer created successfully. -
202 The product-offer creation request has been accepted for processing, but the processing has not been completed. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
* Retry-after - An estimate time in seconds of when you should poll the location uri to get the status of the asynchronous processing.
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createProductOffersCall(@javax.annotation.Nonnull SaleProductOfferRequestV1 saleProductOfferRequestV1, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = saleProductOfferRequestV1; + + // create path and map variables + String localVarPath = "/sale/product-offers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createProductOffersValidateBeforeCall(@javax.annotation.Nonnull SaleProductOfferRequestV1 saleProductOfferRequestV1, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'saleProductOfferRequestV1' is set + if (saleProductOfferRequestV1 == null) { + throw new ApiException("Missing the required parameter 'saleProductOfferRequestV1' when calling createProductOffers(Async)"); + } + + return createProductOffersCall(saleProductOfferRequestV1, acceptLanguage, _callback); + + } + + /** + * Create offer based on product + * Use this resource to create offer based on product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-wystawic-oferte-z-produktem-za-pomoca-zasobu-sale-product-offers\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-list-an-offer-with-a-product-via-sale-product-offers-resource\" target=\"_blank\">EN</a>. Note that requests may be limited. + * @param saleProductOfferRequestV1 (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return SaleProductOfferResponseV1 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Offer created successfully. -
202 The product-offer creation request has been accepted for processing, but the processing has not been completed. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
* Retry-after - An estimate time in seconds of when you should poll the location uri to get the status of the asynchronous processing.
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
422 Unprocessable Entity -
+ */ + public SaleProductOfferResponseV1 createProductOffers(@javax.annotation.Nonnull SaleProductOfferRequestV1 saleProductOfferRequestV1, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + ApiResponse localVarResp = createProductOffersWithHttpInfo(saleProductOfferRequestV1, acceptLanguage); + return localVarResp.getData(); + } + + /** + * Create offer based on product + * Use this resource to create offer based on product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-wystawic-oferte-z-produktem-za-pomoca-zasobu-sale-product-offers\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-list-an-offer-with-a-product-via-sale-product-offers-resource\" target=\"_blank\">EN</a>. Note that requests may be limited. + * @param saleProductOfferRequestV1 (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return ApiResponse<SaleProductOfferResponseV1> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Offer created successfully. -
202 The product-offer creation request has been accepted for processing, but the processing has not been completed. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
* Retry-after - An estimate time in seconds of when you should poll the location uri to get the status of the asynchronous processing.
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
422 Unprocessable Entity -
+ */ + public ApiResponse createProductOffersWithHttpInfo(@javax.annotation.Nonnull SaleProductOfferRequestV1 saleProductOfferRequestV1, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + okhttp3.Call localVarCall = createProductOffersValidateBeforeCall(saleProductOfferRequestV1, acceptLanguage, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create offer based on product (asynchronously) + * Use this resource to create offer based on product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-wystawic-oferte-z-produktem-za-pomoca-zasobu-sale-product-offers\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-list-an-offer-with-a-product-via-sale-product-offers-resource\" target=\"_blank\">EN</a>. Note that requests may be limited. + * @param saleProductOfferRequestV1 (required) + * @param acceptLanguage Expected language of messages. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Offer created successfully. -
202 The product-offer creation request has been accepted for processing, but the processing has not been completed. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
* Retry-after - An estimate time in seconds of when you should poll the location uri to get the status of the asynchronous processing.
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createProductOffersAsync(@javax.annotation.Nonnull SaleProductOfferRequestV1 saleProductOfferRequestV1, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createProductOffersValidateBeforeCall(saleProductOfferRequestV1, acceptLanguage, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteOfferUsingDELETE + * @param offerId Offer identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call deleteOfferUsingDELETECall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers/{offerId}" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOfferUsingDELETEValidateBeforeCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling deleteOfferUsingDELETE(Async)"); + } + + return deleteOfferUsingDELETECall(offerId, _callback); + + } + + /** + * Delete a draft offer + * Use this resource to delete a draft offer. Read more: <a href=\"../../news/nowy-zasob-do-usuwania-draftow-ofert-aMDnGka2RuL\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resource-draft-delete-yPy9lq6myh0\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public void deleteOfferUsingDELETE(@javax.annotation.Nonnull String offerId) throws ApiException { + deleteOfferUsingDELETEWithHttpInfo(offerId); + } + + /** + * Delete a draft offer + * Use this resource to delete a draft offer. Read more: <a href=\"../../news/nowy-zasob-do-usuwania-draftow-ofert-aMDnGka2RuL\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resource-draft-delete-yPy9lq6myh0\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse deleteOfferUsingDELETEWithHttpInfo(@javax.annotation.Nonnull String offerId) throws ApiException { + okhttp3.Call localVarCall = deleteOfferUsingDELETEValidateBeforeCall(offerId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a draft offer (asynchronously) + * Use this resource to delete a draft offer. Read more: <a href=\"../../news/nowy-zasob-do-usuwania-draftow-ofert-aMDnGka2RuL\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resource-draft-delete-yPy9lq6myh0\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call deleteOfferUsingDELETEAsync(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOfferUsingDELETEValidateBeforeCall(offerId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for editProductOffers + * @param offerId The offer identifier. (required) + * @param saleProductOfferPatchRequestV1 (required) + * @param acceptLanguage Expected language of messages. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer edited successfully. -
202 The request to edit product-offer has been accepted for processing, but the processing has not been completed. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
* Retry-after - An estimate time in seconds of when you should poll the location uri to get the status of the asynchronous processing.
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
404 Not Found. Offer not found. -
409 Conflict. The current state of the offer does not allow to perform the request (e.g. The previous edition of the offer is still being processed). -
422 Unprocessable Entity -
+ */ + public okhttp3.Call editProductOffersCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull SaleProductOfferPatchRequestV1 saleProductOfferPatchRequestV1, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = saleProductOfferPatchRequestV1; + + // create path and map variables + String localVarPath = "/sale/product-offers/{offerId}" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call editProductOffersValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull SaleProductOfferPatchRequestV1 saleProductOfferPatchRequestV1, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling editProductOffers(Async)"); + } + + // verify the required parameter 'saleProductOfferPatchRequestV1' is set + if (saleProductOfferPatchRequestV1 == null) { + throw new ApiException("Missing the required parameter 'saleProductOfferPatchRequestV1' when calling editProductOffers(Async)"); + } + + return editProductOffersCall(offerId, saleProductOfferPatchRequestV1, acceptLanguage, _callback); + + } + + /** + * Edit an offer + * Use this resource to edit offer. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-pojedynczej-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-single-offer\" target=\"_blank\">EN</a>. Note that requests may be limited. + * @param offerId The offer identifier. (required) + * @param saleProductOfferPatchRequestV1 (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return SaleProductOfferResponseV1 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer edited successfully. -
202 The request to edit product-offer has been accepted for processing, but the processing has not been completed. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
* Retry-after - An estimate time in seconds of when you should poll the location uri to get the status of the asynchronous processing.
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
404 Not Found. Offer not found. -
409 Conflict. The current state of the offer does not allow to perform the request (e.g. The previous edition of the offer is still being processed). -
422 Unprocessable Entity -
+ */ + public SaleProductOfferResponseV1 editProductOffers(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull SaleProductOfferPatchRequestV1 saleProductOfferPatchRequestV1, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + ApiResponse localVarResp = editProductOffersWithHttpInfo(offerId, saleProductOfferPatchRequestV1, acceptLanguage); + return localVarResp.getData(); + } + + /** + * Edit an offer + * Use this resource to edit offer. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-pojedynczej-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-single-offer\" target=\"_blank\">EN</a>. Note that requests may be limited. + * @param offerId The offer identifier. (required) + * @param saleProductOfferPatchRequestV1 (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return ApiResponse<SaleProductOfferResponseV1> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer edited successfully. -
202 The request to edit product-offer has been accepted for processing, but the processing has not been completed. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
* Retry-after - An estimate time in seconds of when you should poll the location uri to get the status of the asynchronous processing.
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
404 Not Found. Offer not found. -
409 Conflict. The current state of the offer does not allow to perform the request (e.g. The previous edition of the offer is still being processed). -
422 Unprocessable Entity -
+ */ + public ApiResponse editProductOffersWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull SaleProductOfferPatchRequestV1 saleProductOfferPatchRequestV1, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + okhttp3.Call localVarCall = editProductOffersValidateBeforeCall(offerId, saleProductOfferPatchRequestV1, acceptLanguage, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Edit an offer (asynchronously) + * Use this resource to edit offer. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#edycja-pojedynczej-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#editing-single-offer\" target=\"_blank\">EN</a>. Note that requests may be limited. + * @param offerId The offer identifier. (required) + * @param saleProductOfferPatchRequestV1 (required) + * @param acceptLanguage Expected language of messages. (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 + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer edited successfully. -
202 The request to edit product-offer has been accepted for processing, but the processing has not been completed. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
* Retry-after - An estimate time in seconds of when you should poll the location uri to get the status of the asynchronous processing.
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
404 Not Found. Offer not found. -
409 Conflict. The current state of the offer does not allow to perform the request (e.g. The previous edition of the offer is still being processed). -
422 Unprocessable Entity -
+ */ + public okhttp3.Call editProductOffersAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull SaleProductOfferPatchRequestV1 saleProductOfferPatchRequestV1, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = editProductOffersValidateBeforeCall(offerId, saleProductOfferPatchRequestV1, acceptLanguage, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAvailableOfferPromotionPackages + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages returned successfully. -
401 Unauthorized -
+ */ + public okhttp3.Call getAvailableOfferPromotionPackagesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-promotion-packages"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAvailableOfferPromotionPackagesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getAvailableOfferPromotionPackagesCall(_callback); + + } + + /** + * Get all available offer promotion packages + * Use this resource to retrieve all available offer promotion packages. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-dostepne-opcje-promowania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-available-promo-options\" target=\"_blank\">EN</a>. + * @return AvailablePromotionPackages + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages returned successfully. -
401 Unauthorized -
+ */ + public AvailablePromotionPackages getAvailableOfferPromotionPackages() throws ApiException { + ApiResponse localVarResp = getAvailableOfferPromotionPackagesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get all available offer promotion packages + * Use this resource to retrieve all available offer promotion packages. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-dostepne-opcje-promowania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-available-promo-options\" target=\"_blank\">EN</a>. + * @return ApiResponse<AvailablePromotionPackages> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages returned successfully. -
401 Unauthorized -
+ */ + public ApiResponse getAvailableOfferPromotionPackagesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getAvailableOfferPromotionPackagesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get all available offer promotion packages (asynchronously) + * Use this resource to retrieve all available offer promotion packages. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-dostepne-opcje-promowania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-available-promo-options\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages returned successfully. -
401 Unauthorized -
+ */ + public okhttp3.Call getAvailableOfferPromotionPackagesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAvailableOfferPromotionPackagesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOfferPromoOptionsUsingGET + * @param offerId Offer identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages returned successfully -
401 Unauthorized -
403 Offer does not belong to seller. -
+ */ + public okhttp3.Call getOfferPromoOptionsUsingGETCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers/{offerId}/promo-options" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOfferPromoOptionsUsingGETValidateBeforeCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling getOfferPromoOptionsUsingGET(Async)"); + } + + return getOfferPromoOptionsUsingGETCall(offerId, _callback); + + } + + /** + * Get offer promotion packages + * Use this resource to get promotion packages assigned to an offer. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-opcje-promowania-przypisane-do-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-promo-options-assigned-to-an-offer\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @return OfferPromoOptions + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages returned successfully -
401 Unauthorized -
403 Offer does not belong to seller. -
+ */ + public OfferPromoOptions getOfferPromoOptionsUsingGET(@javax.annotation.Nonnull String offerId) throws ApiException { + ApiResponse localVarResp = getOfferPromoOptionsUsingGETWithHttpInfo(offerId); + return localVarResp.getData(); + } + + /** + * Get offer promotion packages + * Use this resource to get promotion packages assigned to an offer. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-opcje-promowania-przypisane-do-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-promo-options-assigned-to-an-offer\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @return ApiResponse<OfferPromoOptions> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages returned successfully -
401 Unauthorized -
403 Offer does not belong to seller. -
+ */ + public ApiResponse getOfferPromoOptionsUsingGETWithHttpInfo(@javax.annotation.Nonnull String offerId) throws ApiException { + okhttp3.Call localVarCall = getOfferPromoOptionsUsingGETValidateBeforeCall(offerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get offer promotion packages (asynchronously) + * Use this resource to get promotion packages assigned to an offer. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-opcje-promowania-przypisane-do-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-promo-options-assigned-to-an-offer\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages returned successfully -
401 Unauthorized -
403 Offer does not belong to seller. -
+ */ + public okhttp3.Call getOfferPromoOptionsUsingGETAsync(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOfferPromoOptionsUsingGETValidateBeforeCall(offerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOffersUnfilledParametersUsingGET1 + * @param offerId List of offer ids. If empty all offers with unfilled parameters will be returned. (optional) + * @param parameterType Filter by parameter type. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Unfilled offer parameters were returned successfully. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getOffersUnfilledParametersUsingGET1Call(@javax.annotation.Nullable List offerId, @javax.annotation.Nullable String parameterType, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers/unfilled-parameters"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offerId != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "offer.id", offerId)); + } + + if (parameterType != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("parameterType", parameterType)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOffersUnfilledParametersUsingGET1ValidateBeforeCall(@javax.annotation.Nullable List offerId, @javax.annotation.Nullable String parameterType, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + return getOffersUnfilledParametersUsingGET1Call(offerId, parameterType, offset, limit, _callback); + + } + + /** + * Get offers with missing parameters + * Use this resource to get information about required parameters or parameters scheduled to become required that are not filled in offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-nieuzupelnione-parametry-w-ofertach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-unfilled-parameters-in-offers\" target=\"_blank\">EN</a>. + * @param offerId List of offer ids. If empty all offers with unfilled parameters will be returned. (optional) + * @param parameterType Filter by parameter type. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 100) + * @return UnfilledParametersResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Unfilled offer parameters were returned successfully. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
+ */ + public UnfilledParametersResponse getOffersUnfilledParametersUsingGET1(@javax.annotation.Nullable List offerId, @javax.annotation.Nullable String parameterType, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + ApiResponse localVarResp = getOffersUnfilledParametersUsingGET1WithHttpInfo(offerId, parameterType, offset, limit); + return localVarResp.getData(); + } + + /** + * Get offers with missing parameters + * Use this resource to get information about required parameters or parameters scheduled to become required that are not filled in offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-nieuzupelnione-parametry-w-ofertach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-unfilled-parameters-in-offers\" target=\"_blank\">EN</a>. + * @param offerId List of offer ids. If empty all offers with unfilled parameters will be returned. (optional) + * @param parameterType Filter by parameter type. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (optional, default to 100) + * @return ApiResponse<UnfilledParametersResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Unfilled offer parameters were returned successfully. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse getOffersUnfilledParametersUsingGET1WithHttpInfo(@javax.annotation.Nullable List offerId, @javax.annotation.Nullable String parameterType, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + okhttp3.Call localVarCall = getOffersUnfilledParametersUsingGET1ValidateBeforeCall(offerId, parameterType, offset, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get offers with missing parameters (asynchronously) + * Use this resource to get information about required parameters or parameters scheduled to become required that are not filled in offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-nieuzupelnione-parametry-w-ofertach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-unfilled-parameters-in-offers\" target=\"_blank\">EN</a>. + * @param offerId List of offer ids. If empty all offers with unfilled parameters will be returned. (optional) + * @param parameterType Filter by parameter type. (optional) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param limit The limit of elements in the response. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Unfilled offer parameters were returned successfully. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getOffersUnfilledParametersUsingGET1Async(@javax.annotation.Nullable List offerId, @javax.annotation.Nullable String parameterType, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOffersUnfilledParametersUsingGET1ValidateBeforeCall(offerId, parameterType, offset, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getProductOfferProcessingStatus + * @param offerId Offer identifier. (required) + * @param operationId Operation identifier provided in location header of POST or PATCH request. (required) + * @param acceptLanguage Expected language of messages. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 The request processing has not been completed. -
303 The processing of product-offer has been completed. The Location header provide information about the location of processed resource. -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getProductOfferProcessingStatusCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull String operationId, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/product-offers/{offerId}/operations/{operationId}" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())) + .replace("{" + "operationId" + "}", localVarApiClient.escapeString(operationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getProductOfferProcessingStatusValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull String operationId, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling getProductOfferProcessingStatus(Async)"); + } + + // verify the required parameter 'operationId' is set + if (operationId == null) { + throw new ApiException("Missing the required parameter 'operationId' when calling getProductOfferProcessingStatus(Async)"); + } + + return getProductOfferProcessingStatusCall(offerId, operationId, acceptLanguage, _callback); + + } + + /** + * Check the processing status of a POST or PATCH request + * The URI for the resource given by Location header of POST /sale/product-offers and PATCH /sale/product-offers/{offerId}. Use this resource to check processing status of a POST or PATCH request. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#publikacja-oferty-w-asynchronicznym-api\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-publication-in-asynchronous-api\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param operationId Operation identifier provided in location header of POST or PATCH request. (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return SaleProductOfferStatusResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 The request processing has not been completed. -
303 The processing of product-offer has been completed. The Location header provide information about the location of processed resource. -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public SaleProductOfferStatusResponse getProductOfferProcessingStatus(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull String operationId, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + ApiResponse localVarResp = getProductOfferProcessingStatusWithHttpInfo(offerId, operationId, acceptLanguage); + return localVarResp.getData(); + } + + /** + * Check the processing status of a POST or PATCH request + * The URI for the resource given by Location header of POST /sale/product-offers and PATCH /sale/product-offers/{offerId}. Use this resource to check processing status of a POST or PATCH request. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#publikacja-oferty-w-asynchronicznym-api\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-publication-in-asynchronous-api\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param operationId Operation identifier provided in location header of POST or PATCH request. (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return ApiResponse<SaleProductOfferStatusResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 The request processing has not been completed. -
303 The processing of product-offer has been completed. The Location header provide information about the location of processed resource. -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getProductOfferProcessingStatusWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull String operationId, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + okhttp3.Call localVarCall = getProductOfferProcessingStatusValidateBeforeCall(offerId, operationId, acceptLanguage, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Check the processing status of a POST or PATCH request (asynchronously) + * The URI for the resource given by Location header of POST /sale/product-offers and PATCH /sale/product-offers/{offerId}. Use this resource to check processing status of a POST or PATCH request. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#publikacja-oferty-w-asynchronicznym-api\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-publication-in-asynchronous-api\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param operationId Operation identifier provided in location header of POST or PATCH request. (required) + * @param acceptLanguage Expected language of messages. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 The request processing has not been completed. -
303 The processing of product-offer has been completed. The Location header provide information about the location of processed resource. -
400 Syntactically incorrect request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getProductOfferProcessingStatusAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull String operationId, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getProductOfferProcessingStatusValidateBeforeCall(offerId, operationId, acceptLanguage, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPromoModificationCommandDetailedResultUsingGET + * @param commandId Command identifier. (required) + * @param limit The limit of returned items. (optional, default to 100) + * @param offset The offset of returned items. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Report successfully returned. -
401 Unauthorized -
403 Batch modification command does not belong to seller. -
404 Batch modification command does not exist. -
+ */ + public okhttp3.Call getPromoModificationCommandDetailedResultUsingGETCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers/promo-options-commands/{commandId}/tasks" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPromoModificationCommandDetailedResultUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getPromoModificationCommandDetailedResultUsingGET(Async)"); + } + + return getPromoModificationCommandDetailedResultUsingGETCall(commandId, limit, offset, _callback); + + } + + /** + * Modification command detailed result + * Use this resource to retrieve the result of an offer modification command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-szczegolowy-raport-zadania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-a-detailed-report-of-your-task\" target=\"_blank\">EN</a>. + * @param commandId Command identifier. (required) + * @param limit The limit of returned items. (optional, default to 100) + * @param offset The offset of returned items. (optional, default to 0) + * @return PromoModificationReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Report successfully returned. -
401 Unauthorized -
403 Batch modification command does not belong to seller. -
404 Batch modification command does not exist. -
+ */ + public PromoModificationReport getPromoModificationCommandDetailedResultUsingGET(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getPromoModificationCommandDetailedResultUsingGETWithHttpInfo(commandId, limit, offset); + return localVarResp.getData(); + } + + /** + * Modification command detailed result + * Use this resource to retrieve the result of an offer modification command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-szczegolowy-raport-zadania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-a-detailed-report-of-your-task\" target=\"_blank\">EN</a>. + * @param commandId Command identifier. (required) + * @param limit The limit of returned items. (optional, default to 100) + * @param offset The offset of returned items. (optional, default to 0) + * @return ApiResponse<PromoModificationReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Report successfully returned. -
401 Unauthorized -
403 Batch modification command does not belong to seller. -
404 Batch modification command does not exist. -
+ */ + public ApiResponse getPromoModificationCommandDetailedResultUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getPromoModificationCommandDetailedResultUsingGETValidateBeforeCall(commandId, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Modification command detailed result (asynchronously) + * Use this resource to retrieve the result of an offer modification command. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-sprawdzic-szczegolowy-raport-zadania\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-check-a-detailed-report-of-your-task\" target=\"_blank\">EN</a>. + * @param commandId Command identifier. (required) + * @param limit The limit of returned items. (optional, default to 100) + * @param offset The offset of returned items. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Report successfully returned. -
401 Unauthorized -
403 Batch modification command does not belong to seller. -
404 Batch modification command does not exist. -
+ */ + public okhttp3.Call getPromoModificationCommandDetailedResultUsingGETAsync(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPromoModificationCommandDetailedResultUsingGETValidateBeforeCall(commandId, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPromoModificationCommandResultUsingGET + * @param commandId Command identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Summary successfully returned. -
401 Unauthorized -
403 Batch modification command does not belong to seller. -
404 Batch modification command does not exist. -
+ */ + public okhttp3.Call getPromoModificationCommandResultUsingGETCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers/promo-options-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPromoModificationCommandResultUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getPromoModificationCommandResultUsingGET(Async)"); + } + + return getPromoModificationCommandResultUsingGETCall(commandId, _callback); + + } + + /** + * Modification command summary + * Use this resource to find out how many offers were edited within one {commandId}. You will receive a summary with a number of successfully edited offers and errors. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-lub-edytowac-opcje-promowania-na-wielu-ofertach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-or-change-promo-options-in-multiple-offers\" target=\"_blank\">EN</a>. + * @param commandId Command identifier. (required) + * @return PromoGeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Summary successfully returned. -
401 Unauthorized -
403 Batch modification command does not belong to seller. -
404 Batch modification command does not exist. -
+ */ + public PromoGeneralReport getPromoModificationCommandResultUsingGET(@javax.annotation.Nonnull String commandId) throws ApiException { + ApiResponse localVarResp = getPromoModificationCommandResultUsingGETWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Modification command summary + * Use this resource to find out how many offers were edited within one {commandId}. You will receive a summary with a number of successfully edited offers and errors. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-lub-edytowac-opcje-promowania-na-wielu-ofertach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-or-change-promo-options-in-multiple-offers\" target=\"_blank\">EN</a>. + * @param commandId Command identifier. (required) + * @return ApiResponse<PromoGeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Summary successfully returned. -
401 Unauthorized -
403 Batch modification command does not belong to seller. -
404 Batch modification command does not exist. -
+ */ + public ApiResponse getPromoModificationCommandResultUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId) throws ApiException { + okhttp3.Call localVarCall = getPromoModificationCommandResultUsingGETValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Modification command summary (asynchronously) + * Use this resource to find out how many offers were edited within one {commandId}. You will receive a summary with a number of successfully edited offers and errors. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-lub-edytowac-opcje-promowania-na-wielu-ofertach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-or-change-promo-options-in-multiple-offers\" target=\"_blank\">EN</a>. + * @param commandId Command identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Summary successfully returned. -
401 Unauthorized -
403 Batch modification command does not belong to seller. -
404 Batch modification command does not exist. -
+ */ + public okhttp3.Call getPromoModificationCommandResultUsingGETAsync(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPromoModificationCommandResultUsingGETValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPromoOptionsForSellerOffersUsingGET + * @param limit Limit of promo options per page. (optional, default to 5000) + * @param offset Distance between the beginning of the document and the point from which promo options are returned. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Promo options for seller offers successfully returned. -
400 Bad request -
401 Unauthorized -
+ */ + public okhttp3.Call getPromoOptionsForSellerOffersUsingGETCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers/promo-options"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPromoOptionsForSellerOffersUsingGETValidateBeforeCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + return getPromoOptionsForSellerOffersUsingGETCall(limit, offset, _callback); + + } + + /** + * Get promo options for seller's offers + * Use this resource to retrieve promo options for seller offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-opcje-promowania-dla-wielu-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-available-promo-options-for-multiple-offers\" target=\"_blank\">EN</a>. + * @param limit Limit of promo options per page. (optional, default to 5000) + * @param offset Distance between the beginning of the document and the point from which promo options are returned. (optional, default to 0) + * @return OfferPromoOptionsForSeller + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Promo options for seller offers successfully returned. -
400 Bad request -
401 Unauthorized -
+ */ + public OfferPromoOptionsForSeller getPromoOptionsForSellerOffersUsingGET(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset) throws ApiException { + ApiResponse localVarResp = getPromoOptionsForSellerOffersUsingGETWithHttpInfo(limit, offset); + return localVarResp.getData(); + } + + /** + * Get promo options for seller's offers + * Use this resource to retrieve promo options for seller offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-opcje-promowania-dla-wielu-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-available-promo-options-for-multiple-offers\" target=\"_blank\">EN</a>. + * @param limit Limit of promo options per page. (optional, default to 5000) + * @param offset Distance between the beginning of the document and the point from which promo options are returned. (optional, default to 0) + * @return ApiResponse<OfferPromoOptionsForSeller> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Promo options for seller offers successfully returned. -
400 Bad request -
401 Unauthorized -
+ */ + public ApiResponse getPromoOptionsForSellerOffersUsingGETWithHttpInfo(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset) throws ApiException { + okhttp3.Call localVarCall = getPromoOptionsForSellerOffersUsingGETValidateBeforeCall(limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get promo options for seller's offers (asynchronously) + * Use this resource to retrieve promo options for seller offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-opcje-promowania-dla-wielu-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-retrieve-available-promo-options-for-multiple-offers\" target=\"_blank\">EN</a>. + * @param limit Limit of promo options per page. (optional, default to 5000) + * @param offset Distance between the beginning of the document and the point from which promo options are returned. (optional, default to 0) + * @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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Promo options for seller offers successfully returned. -
400 Bad request -
401 Unauthorized -
+ */ + public okhttp3.Call getPromoOptionsForSellerOffersUsingGETAsync(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPromoOptionsForSellerOffersUsingGETValidateBeforeCall(limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPublicationReportUsingGET + * @param commandId Command identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public okhttp3.Call getPublicationReportUsingGETCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-publication-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPublicationReportUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getPublicationReportUsingGET(Async)"); + } + + return getPublicationReportUsingGETCall(commandId, _callback); + + } + + /** + * Publish command summary + * Use this resource to retrieve information about the offer listing statuses. You will receive a summary with a number of correctly listed offers and errors. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#zestawienie-zadan\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#task-list\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @return GeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public GeneralReport getPublicationReportUsingGET(@javax.annotation.Nonnull String commandId) throws ApiException { + ApiResponse localVarResp = getPublicationReportUsingGETWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Publish command summary + * Use this resource to retrieve information about the offer listing statuses. You will receive a summary with a number of correctly listed offers and errors. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#zestawienie-zadan\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#task-list\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @return ApiResponse<GeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public ApiResponse getPublicationReportUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId) throws ApiException { + okhttp3.Call localVarCall = getPublicationReportUsingGETValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Publish command summary (asynchronously) + * Use this resource to retrieve information about the offer listing statuses. You will receive a summary with a number of correctly listed offers and errors. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#zestawienie-zadan\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#task-list\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Report was generated and successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
+ */ + public okhttp3.Call getPublicationReportUsingGETAsync(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPublicationReportUsingGETValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPublicationTasksUsingGET + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getPublicationTasksUsingGETCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-publication-commands/{commandId}/tasks" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPublicationTasksUsingGETValidateBeforeCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getPublicationTasksUsingGET(Async)"); + } + + return getPublicationTasksUsingGETCall(commandId, limit, offset, _callback); + + } + + /** + * Publish command detailed report + * Use this resource to retrieve information about the offer statuses on the site (Defaults: limit = 100, offset = 0). Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#informacje-o-publikacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#information-about-publication\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return TaskReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public TaskReport getPublicationTasksUsingGET(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getPublicationTasksUsingGETWithHttpInfo(commandId, limit, offset); + return localVarResp.getData(); + } + + /** + * Publish command detailed report + * Use this resource to retrieve information about the offer statuses on the site (Defaults: limit = 100, offset = 0). Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#informacje-o-publikacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#information-about-publication\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ApiResponse<TaskReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public ApiResponse getPublicationTasksUsingGETWithHttpInfo(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getPublicationTasksUsingGETValidateBeforeCall(commandId, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Publish command detailed report (asynchronously) + * Use this resource to retrieve information about the offer statuses on the site (Defaults: limit = 100, offset = 0). Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#informacje-o-publikacji\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#information-about-publication\" target=\"_blank\">EN</a>. This resource is rate limited to retrieving information about 270 000 offer changes per minute. + * @param commandId Command identifier. (required) + * @param limit The limit of elements in the response. (optional, default to 100) + * @param offset The offset of elements in the response. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Task status successfully returned -
401 Unauthorized -
403 Forbidden -
404 Command not found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call getPublicationTasksUsingGETAsync(@javax.annotation.Nonnull String commandId, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPublicationTasksUsingGETValidateBeforeCall(commandId, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for modifyOfferPromoOptionsUsingPOST + * @param offerId Offer identifier. (required) + * @param promoOptionsModifications request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages modified successfully. -
401 Unauthorized -
403 Offer does not belong to seller. -
422 Offer does not exist or unsupported package name or unsupported change type. -
+ */ + public okhttp3.Call modifyOfferPromoOptionsUsingPOSTCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull PromoOptionsModifications promoOptionsModifications, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = promoOptionsModifications; + + // create path and map variables + String localVarPath = "/sale/offers/{offerId}/promo-options-modification" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call modifyOfferPromoOptionsUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull PromoOptionsModifications promoOptionsModifications, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling modifyOfferPromoOptionsUsingPOST(Async)"); + } + + // verify the required parameter 'promoOptionsModifications' is set + if (promoOptionsModifications == null) { + throw new ApiException("Missing the required parameter 'promoOptionsModifications' when calling modifyOfferPromoOptionsUsingPOST(Async)"); + } + + return modifyOfferPromoOptionsUsingPOSTCall(offerId, promoOptionsModifications, _callback); + + } + + /** + * Modify offer promotion packages + * Use this resource to modify offer promotion packages. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-lub-zmienic-opcje-promowania-w-pojedynczej-ofercie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-or-change-promo-options-in-a-single-offer\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param promoOptionsModifications request (required) + * @return OfferPromoOptions + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages modified successfully. -
401 Unauthorized -
403 Offer does not belong to seller. -
422 Offer does not exist or unsupported package name or unsupported change type. -
+ */ + public OfferPromoOptions modifyOfferPromoOptionsUsingPOST(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull PromoOptionsModifications promoOptionsModifications) throws ApiException { + ApiResponse localVarResp = modifyOfferPromoOptionsUsingPOSTWithHttpInfo(offerId, promoOptionsModifications); + return localVarResp.getData(); + } + + /** + * Modify offer promotion packages + * Use this resource to modify offer promotion packages. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-lub-zmienic-opcje-promowania-w-pojedynczej-ofercie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-or-change-promo-options-in-a-single-offer\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param promoOptionsModifications request (required) + * @return ApiResponse<OfferPromoOptions> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages modified successfully. -
401 Unauthorized -
403 Offer does not belong to seller. -
422 Offer does not exist or unsupported package name or unsupported change type. -
+ */ + public ApiResponse modifyOfferPromoOptionsUsingPOSTWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull PromoOptionsModifications promoOptionsModifications) throws ApiException { + okhttp3.Call localVarCall = modifyOfferPromoOptionsUsingPOSTValidateBeforeCall(offerId, promoOptionsModifications, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Modify offer promotion packages (asynchronously) + * Use this resource to modify offer promotion packages. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-lub-zmienic-opcje-promowania-w-pojedynczej-ofercie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-or-change-promo-options-in-a-single-offer\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param promoOptionsModifications request (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer promotion packages modified successfully. -
401 Unauthorized -
403 Offer does not belong to seller. -
422 Offer does not exist or unsupported package name or unsupported change type. -
+ */ + public okhttp3.Call modifyOfferPromoOptionsUsingPOSTAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull PromoOptionsModifications promoOptionsModifications, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = modifyOfferPromoOptionsUsingPOSTValidateBeforeCall(offerId, promoOptionsModifications, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for promoModificationCommandUsingPUT + * @param commandId Command identifier. Must be a UUID. (required) + * @param promoOptionsCommand Promo packages modification command request. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
401 Unauthorized -
409 Command id already in use. -
422 Size of batch should be between 1 and 1000 offers or unsupported modification time. -
+ */ + public okhttp3.Call promoModificationCommandUsingPUTCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull PromoOptionsCommand promoOptionsCommand, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = promoOptionsCommand; + + // create path and map variables + String localVarPath = "/sale/offers/promo-options-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call promoModificationCommandUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull PromoOptionsCommand promoOptionsCommand, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling promoModificationCommandUsingPUT(Async)"); + } + + // verify the required parameter 'promoOptionsCommand' is set + if (promoOptionsCommand == null) { + throw new ApiException("Missing the required parameter 'promoOptionsCommand' when calling promoModificationCommandUsingPUT(Async)"); + } + + return promoModificationCommandUsingPUTCall(commandId, promoOptionsCommand, _callback); + + } + + /** + * Batch offer promotion package modification + * Use this resource to modify promotion packages on multiple offers at once. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-lub-edytowac-opcje-promowania-na-wielu-ofertach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-or-change-promo-options-in-multiple-offers\" target=\"_blank\">EN</a>. + * @param commandId Command identifier. Must be a UUID. (required) + * @param promoOptionsCommand Promo packages modification command request. (required) + * @return PromoGeneralReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
401 Unauthorized -
409 Command id already in use. -
422 Size of batch should be between 1 and 1000 offers or unsupported modification time. -
+ */ + public PromoGeneralReport promoModificationCommandUsingPUT(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull PromoOptionsCommand promoOptionsCommand) throws ApiException { + ApiResponse localVarResp = promoModificationCommandUsingPUTWithHttpInfo(commandId, promoOptionsCommand); + return localVarResp.getData(); + } + + /** + * Batch offer promotion package modification + * Use this resource to modify promotion packages on multiple offers at once. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-lub-edytowac-opcje-promowania-na-wielu-ofertach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-or-change-promo-options-in-multiple-offers\" target=\"_blank\">EN</a>. + * @param commandId Command identifier. Must be a UUID. (required) + * @param promoOptionsCommand Promo packages modification command request. (required) + * @return ApiResponse<PromoGeneralReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
401 Unauthorized -
409 Command id already in use. -
422 Size of batch should be between 1 and 1000 offers or unsupported modification time. -
+ */ + public ApiResponse promoModificationCommandUsingPUTWithHttpInfo(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull PromoOptionsCommand promoOptionsCommand) throws ApiException { + okhttp3.Call localVarCall = promoModificationCommandUsingPUTValidateBeforeCall(commandId, promoOptionsCommand, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Batch offer promotion package modification (asynchronously) + * Use this resource to modify promotion packages on multiple offers at once. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-dodac-lub-edytowac-opcje-promowania-na-wielu-ofertach\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-add-or-change-promo-options-in-multiple-offers\" target=\"_blank\">EN</a>. + * @param commandId Command identifier. Must be a UUID. (required) + * @param promoOptionsCommand Promo packages modification command request. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Command was registered -
401 Unauthorized -
409 Command id already in use. -
422 Size of batch should be between 1 and 1000 offers or unsupported modification time. -
+ */ + public okhttp3.Call promoModificationCommandUsingPUTAsync(@javax.annotation.Nonnull String commandId, @javax.annotation.Nonnull PromoOptionsCommand promoOptionsCommand, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = promoModificationCommandUsingPUTValidateBeforeCall(commandId, promoOptionsCommand, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/OfferRatingApi.java b/src/main/java/pl/wtx/allegro/api/client/OfferRatingApi.java new file mode 100644 index 0000000..e3acb26 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/OfferRatingApi.java @@ -0,0 +1,215 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.OfferRating; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class OfferRatingApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public OfferRatingApi() { + this(Configuration.getDefaultApiClient()); + } + + public OfferRatingApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for offerRatingGET + * @param offerId Offer identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK. -
403 Offer access denied. -
404 Offer not found. -
401 Unauthorized action. -
+ */ + public okhttp3.Call offerRatingGETCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers/{offerId}/rating" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call offerRatingGETValidateBeforeCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling offerRatingGET(Async)"); + } + + return offerRatingGETCall(offerId, _callback); + + } + + /** + * Get offer rating + * Use this resource to get offer rating. Read more: <a href=\"../../news/nowy-zasob-do-pobrania-oceny-produktu-q018mmPe0H7\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resource-to-retrieve-product-rating-q018mmPrWUX\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @return OfferRating + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK. -
403 Offer access denied. -
404 Offer not found. -
401 Unauthorized action. -
+ */ + public OfferRating offerRatingGET(@javax.annotation.Nonnull String offerId) throws ApiException { + ApiResponse localVarResp = offerRatingGETWithHttpInfo(offerId); + return localVarResp.getData(); + } + + /** + * Get offer rating + * Use this resource to get offer rating. Read more: <a href=\"../../news/nowy-zasob-do-pobrania-oceny-produktu-q018mmPe0H7\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resource-to-retrieve-product-rating-q018mmPrWUX\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @return ApiResponse<OfferRating> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK. -
403 Offer access denied. -
404 Offer not found. -
401 Unauthorized action. -
+ */ + public ApiResponse offerRatingGETWithHttpInfo(@javax.annotation.Nonnull String offerId) throws ApiException { + okhttp3.Call localVarCall = offerRatingGETValidateBeforeCall(offerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get offer rating (asynchronously) + * Use this resource to get offer rating. Read more: <a href=\"../../news/nowy-zasob-do-pobrania-oceny-produktu-q018mmPe0H7\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resource-to-retrieve-product-rating-q018mmPrWUX\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK. -
403 Offer access denied. -
404 Offer not found. -
401 Unauthorized action. -
+ */ + public okhttp3.Call offerRatingGETAsync(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = offerRatingGETValidateBeforeCall(offerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/OfferTagsApi.java b/src/main/java/pl/wtx/allegro/api/client/OfferTagsApi.java new file mode 100644 index 0000000..608947b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/OfferTagsApi.java @@ -0,0 +1,941 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.TagId; +import pl.wtx.allegro.api.client.model.TagIdsRequest; +import pl.wtx.allegro.api.client.model.TagListResponse; +import pl.wtx.allegro.api.client.model.TagRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class OfferTagsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public OfferTagsApi() { + this(Configuration.getDefaultApiClient()); + } + + public OfferTagsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for assignTagToOfferPOST + * @param offerId Offer identifier. (required) + * @param tagIdsRequest request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully assigned tag to offer -
400 Bad request -
403 Forbidden - offer is created by someone else or user is not brandzone user or doesn't have tags subscription -
422 Validation failed - your request was correct, but the tag could not be assigned. -
401 Unauthorized action -
404 Offer not found -
+ */ + public okhttp3.Call assignTagToOfferPOSTCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull TagIdsRequest tagIdsRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = tagIdsRequest; + + // create path and map variables + String localVarPath = "/sale/offers/{offerId}/tags" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call assignTagToOfferPOSTValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull TagIdsRequest tagIdsRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling assignTagToOfferPOST(Async)"); + } + + // verify the required parameter 'tagIdsRequest' is set + if (tagIdsRequest == null) { + throw new ApiException("Missing the required parameter 'tagIdsRequest' when calling assignTagToOfferPOST(Async)"); + } + + return assignTagToOfferPOSTCall(offerId, tagIdsRequest, _callback); + + } + + /** + * Assign tags to an offer + * Use this resource to assign a tag to offer. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param tagIdsRequest request (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully assigned tag to offer -
400 Bad request -
403 Forbidden - offer is created by someone else or user is not brandzone user or doesn't have tags subscription -
422 Validation failed - your request was correct, but the tag could not be assigned. -
401 Unauthorized action -
404 Offer not found -
+ */ + public void assignTagToOfferPOST(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull TagIdsRequest tagIdsRequest) throws ApiException { + assignTagToOfferPOSTWithHttpInfo(offerId, tagIdsRequest); + } + + /** + * Assign tags to an offer + * Use this resource to assign a tag to offer. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param tagIdsRequest request (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully assigned tag to offer -
400 Bad request -
403 Forbidden - offer is created by someone else or user is not brandzone user or doesn't have tags subscription -
422 Validation failed - your request was correct, but the tag could not be assigned. -
401 Unauthorized action -
404 Offer not found -
+ */ + public ApiResponse assignTagToOfferPOSTWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull TagIdsRequest tagIdsRequest) throws ApiException { + okhttp3.Call localVarCall = assignTagToOfferPOSTValidateBeforeCall(offerId, tagIdsRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Assign tags to an offer (asynchronously) + * Use this resource to assign a tag to offer. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param tagIdsRequest request (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully assigned tag to offer -
400 Bad request -
403 Forbidden - offer is created by someone else or user is not brandzone user or doesn't have tags subscription -
422 Validation failed - your request was correct, but the tag could not be assigned. -
401 Unauthorized action -
404 Offer not found -
+ */ + public okhttp3.Call assignTagToOfferPOSTAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull TagIdsRequest tagIdsRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = assignTagToOfferPOSTValidateBeforeCall(offerId, tagIdsRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for createTagPOST1 + * @param tagRequest request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully created the requested tag -
400 Bad request -
422 Validation failed - your request was correct, but the tag could not be created. -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public okhttp3.Call createTagPOST1Call(@javax.annotation.Nonnull TagRequest tagRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = tagRequest; + + // create path and map variables + String localVarPath = "/sale/offer-tags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createTagPOST1ValidateBeforeCall(@javax.annotation.Nonnull TagRequest tagRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tagRequest' is set + if (tagRequest == null) { + throw new ApiException("Missing the required parameter 'tagRequest' when calling createTagPOST1(Async)"); + } + + return createTagPOST1Call(tagRequest, _callback); + + } + + /** + * Create a tag + * Use this resource to create a new tag. You can create up to 100 tags. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param tagRequest request (required) + * @return TagId + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully created the requested tag -
400 Bad request -
422 Validation failed - your request was correct, but the tag could not be created. -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public TagId createTagPOST1(@javax.annotation.Nonnull TagRequest tagRequest) throws ApiException { + ApiResponse localVarResp = createTagPOST1WithHttpInfo(tagRequest); + return localVarResp.getData(); + } + + /** + * Create a tag + * Use this resource to create a new tag. You can create up to 100 tags. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param tagRequest request (required) + * @return ApiResponse<TagId> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully created the requested tag -
400 Bad request -
422 Validation failed - your request was correct, but the tag could not be created. -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public ApiResponse createTagPOST1WithHttpInfo(@javax.annotation.Nonnull TagRequest tagRequest) throws ApiException { + okhttp3.Call localVarCall = createTagPOST1ValidateBeforeCall(tagRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a tag (asynchronously) + * Use this resource to create a new tag. You can create up to 100 tags. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param tagRequest request (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully created the requested tag -
400 Bad request -
422 Validation failed - your request was correct, but the tag could not be created. -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public okhttp3.Call createTagPOST1Async(@javax.annotation.Nonnull TagRequest tagRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createTagPOST1ValidateBeforeCall(tagRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteTagUsingDELETE + * @param tagId Tag identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deleted tag -
404 Tag not found -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public okhttp3.Call deleteTagUsingDELETECall(@javax.annotation.Nonnull String tagId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-tags/{tagId}" + .replace("{" + "tagId" + "}", localVarApiClient.escapeString(tagId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "*/*", + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteTagUsingDELETEValidateBeforeCall(@javax.annotation.Nonnull String tagId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tagId' is set + if (tagId == null) { + throw new ApiException("Missing the required parameter 'tagId' when calling deleteTagUsingDELETE(Async)"); + } + + return deleteTagUsingDELETECall(tagId, _callback); + + } + + /** + * Delete a tag + * Use this resource to delete the tag. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param tagId Tag identifier. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deleted tag -
404 Tag not found -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public void deleteTagUsingDELETE(@javax.annotation.Nonnull String tagId) throws ApiException { + deleteTagUsingDELETEWithHttpInfo(tagId); + } + + /** + * Delete a tag + * Use this resource to delete the tag. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param tagId Tag identifier. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deleted tag -
404 Tag not found -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public ApiResponse deleteTagUsingDELETEWithHttpInfo(@javax.annotation.Nonnull String tagId) throws ApiException { + okhttp3.Call localVarCall = deleteTagUsingDELETEValidateBeforeCall(tagId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a tag (asynchronously) + * Use this resource to delete the tag. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param tagId Tag identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deleted tag -
404 Tag not found -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public okhttp3.Call deleteTagUsingDELETEAsync(@javax.annotation.Nonnull String tagId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteTagUsingDELETEValidateBeforeCall(tagId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for listAssignedOfferTagsGET + * @param offerId Offer identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of assigned tags -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
404 Not found -
+ */ + public okhttp3.Call listAssignedOfferTagsGETCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers/{offerId}/tags" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listAssignedOfferTagsGETValidateBeforeCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling listAssignedOfferTagsGET(Async)"); + } + + return listAssignedOfferTagsGETCall(offerId, _callback); + + } + + /** + * Get tags assigned to an offer + * Use this resource to get a list of tags assigned to offer. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @return TagListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of assigned tags -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
404 Not found -
+ */ + public TagListResponse listAssignedOfferTagsGET(@javax.annotation.Nonnull String offerId) throws ApiException { + ApiResponse localVarResp = listAssignedOfferTagsGETWithHttpInfo(offerId); + return localVarResp.getData(); + } + + /** + * Get tags assigned to an offer + * Use this resource to get a list of tags assigned to offer. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @return ApiResponse<TagListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of assigned tags -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
404 Not found -
+ */ + public ApiResponse listAssignedOfferTagsGETWithHttpInfo(@javax.annotation.Nonnull String offerId) throws ApiException { + okhttp3.Call localVarCall = listAssignedOfferTagsGETValidateBeforeCall(offerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get tags assigned to an offer (asynchronously) + * Use this resource to get a list of tags assigned to offer. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned list of assigned tags -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
404 Not found -
+ */ + public okhttp3.Call listAssignedOfferTagsGETAsync(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listAssignedOfferTagsGETValidateBeforeCall(offerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listSellerTagsGET1 + * @param limit The limit of elements in the response. (optional, default to 1000) + * @param offset The offset of elements in the response. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested list of tags -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public okhttp3.Call listSellerTagsGET1Call(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-tags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listSellerTagsGET1ValidateBeforeCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + return listSellerTagsGET1Call(limit, offset, _callback); + + } + + /** + * Get the user's tags + * Use this resource to get a list of tags defined by the specified user (Defaults: limit = 1000, offset = 0). Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 1000) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return TagListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested list of tags -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public TagListResponse listSellerTagsGET1(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = listSellerTagsGET1WithHttpInfo(limit, offset); + return localVarResp.getData(); + } + + /** + * Get the user's tags + * Use this resource to get a list of tags defined by the specified user (Defaults: limit = 1000, offset = 0). Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 1000) + * @param offset The offset of elements in the response. (optional, default to 0) + * @return ApiResponse<TagListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested list of tags -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public ApiResponse listSellerTagsGET1WithHttpInfo(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = listSellerTagsGET1ValidateBeforeCall(limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's tags (asynchronously) + * Use this resource to get a list of tags defined by the specified user (Defaults: limit = 1000, offset = 0). Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. + * @param limit The limit of elements in the response. (optional, default to 1000) + * @param offset The offset of elements in the response. (optional, default to 0) + * @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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested list of tags -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
+ */ + public okhttp3.Call listSellerTagsGET1Async(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listSellerTagsGET1ValidateBeforeCall(limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateTagPUT + * @param tagId Tag identifier. (required) + * @param tagRequest request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully updated the requested tag -
422 Validation failed - your request was correct, but the tag could not be updated. -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
404 Tag not found -
+ */ + public okhttp3.Call updateTagPUTCall(@javax.annotation.Nonnull String tagId, @javax.annotation.Nonnull TagRequest tagRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = tagRequest; + + // create path and map variables + String localVarPath = "/sale/offer-tags/{tagId}" + .replace("{" + "tagId" + "}", localVarApiClient.escapeString(tagId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateTagPUTValidateBeforeCall(@javax.annotation.Nonnull String tagId, @javax.annotation.Nonnull TagRequest tagRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tagId' is set + if (tagId == null) { + throw new ApiException("Missing the required parameter 'tagId' when calling updateTagPUT(Async)"); + } + + // verify the required parameter 'tagRequest' is set + if (tagRequest == null) { + throw new ApiException("Missing the required parameter 'tagRequest' when calling updateTagPUT(Async)"); + } + + return updateTagPUTCall(tagId, tagRequest, _callback); + + } + + /** + * Modify a tag + * Use this resource to update a tag. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. This resource is rate limited to 1 million changes per hour. + * @param tagId Tag identifier. (required) + * @param tagRequest request (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully updated the requested tag -
422 Validation failed - your request was correct, but the tag could not be updated. -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
404 Tag not found -
+ */ + public void updateTagPUT(@javax.annotation.Nonnull String tagId, @javax.annotation.Nonnull TagRequest tagRequest) throws ApiException { + updateTagPUTWithHttpInfo(tagId, tagRequest); + } + + /** + * Modify a tag + * Use this resource to update a tag. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. This resource is rate limited to 1 million changes per hour. + * @param tagId Tag identifier. (required) + * @param tagRequest request (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully updated the requested tag -
422 Validation failed - your request was correct, but the tag could not be updated. -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
404 Tag not found -
+ */ + public ApiResponse updateTagPUTWithHttpInfo(@javax.annotation.Nonnull String tagId, @javax.annotation.Nonnull TagRequest tagRequest) throws ApiException { + okhttp3.Call localVarCall = updateTagPUTValidateBeforeCall(tagId, tagRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Modify a tag (asynchronously) + * Use this resource to update a tag. Read more: <a href=\"../../news/nowe-zasoby-zarzadzaj-tagami-i-zalacznikami-w-ofertach-1nzlmKLPyHl\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-manage-tags-and-attachments-in-offers-WvGz12BXrHL\" target=\"_blank\">EN</a>. This resource is rate limited to 1 million changes per hour. + * @param tagId Tag identifier. (required) + * @param tagRequest request (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully updated the requested tag -
422 Validation failed - your request was correct, but the tag could not be updated. -
401 Unauthorized action -
403 User is not brandzone user and doesn't have tags subscription -
404 Tag not found -
+ */ + public okhttp3.Call updateTagPUTAsync(@javax.annotation.Nonnull String tagId, @javax.annotation.Nonnull TagRequest tagRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateTagPUTValidateBeforeCall(tagId, tagRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/OfferTranslationsApi.java b/src/main/java/pl/wtx/allegro/api/client/OfferTranslationsApi.java new file mode 100644 index 0000000..0ec80ad --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/OfferTranslationsApi.java @@ -0,0 +1,542 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.ManualTranslationUpdateRequest; +import pl.wtx.allegro.api.client.model.OfferTranslations; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class OfferTranslationsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public OfferTranslationsApi() { + this(Configuration.getDefaultApiClient()); + } + + public OfferTranslationsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteManualTranslationUsingDELETE + * @param language Language of the translation to delete. (required) + * @param offerId Offer identifier. (required) + * @param element Offer element for which translation should be deleted. If not provided, translations for all elements will be deleted. (optional) + * @param productsId ProductId for which safety information translation should be deleted. If not provided, safety information translations for all products in offer will be deleted. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Delete successful -
204 No Content -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call deleteManualTranslationUsingDELETECall(@javax.annotation.Nonnull String language, @javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String element, @javax.annotation.Nullable UUID productsId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers/{offerId}/translations/{language}" + .replace("{" + "language" + "}", localVarApiClient.escapeString(language.toString())) + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (element != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("element", element)); + } + + if (productsId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("products.id", productsId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteManualTranslationUsingDELETEValidateBeforeCall(@javax.annotation.Nonnull String language, @javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String element, @javax.annotation.Nullable UUID productsId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'language' is set + if (language == null) { + throw new ApiException("Missing the required parameter 'language' when calling deleteManualTranslationUsingDELETE(Async)"); + } + + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling deleteManualTranslationUsingDELETE(Async)"); + } + + return deleteManualTranslationUsingDELETECall(language, offerId, element, productsId, _callback); + + } + + /** + * Delete offer translation + * Delete single element or entire manual translation. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#offer-translations\" target=\"_blank\">EN</a>. + * @param language Language of the translation to delete. (required) + * @param offerId Offer identifier. (required) + * @param element Offer element for which translation should be deleted. If not provided, translations for all elements will be deleted. (optional) + * @param productsId ProductId for which safety information translation should be deleted. If not provided, safety information translations for all products in offer will be deleted. (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Delete successful -
204 No Content -
401 Unauthorized -
403 Forbidden -
+ */ + public void deleteManualTranslationUsingDELETE(@javax.annotation.Nonnull String language, @javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String element, @javax.annotation.Nullable UUID productsId) throws ApiException { + deleteManualTranslationUsingDELETEWithHttpInfo(language, offerId, element, productsId); + } + + /** + * Delete offer translation + * Delete single element or entire manual translation. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#offer-translations\" target=\"_blank\">EN</a>. + * @param language Language of the translation to delete. (required) + * @param offerId Offer identifier. (required) + * @param element Offer element for which translation should be deleted. If not provided, translations for all elements will be deleted. (optional) + * @param productsId ProductId for which safety information translation should be deleted. If not provided, safety information translations for all products in offer will be deleted. (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Delete successful -
204 No Content -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse deleteManualTranslationUsingDELETEWithHttpInfo(@javax.annotation.Nonnull String language, @javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String element, @javax.annotation.Nullable UUID productsId) throws ApiException { + okhttp3.Call localVarCall = deleteManualTranslationUsingDELETEValidateBeforeCall(language, offerId, element, productsId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete offer translation (asynchronously) + * Delete single element or entire manual translation. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#offer-translations\" target=\"_blank\">EN</a>. + * @param language Language of the translation to delete. (required) + * @param offerId Offer identifier. (required) + * @param element Offer element for which translation should be deleted. If not provided, translations for all elements will be deleted. (optional) + * @param productsId ProductId for which safety information translation should be deleted. If not provided, safety information translations for all products in offer will be deleted. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Delete successful -
204 No Content -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call deleteManualTranslationUsingDELETEAsync(@javax.annotation.Nonnull String language, @javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String element, @javax.annotation.Nullable UUID productsId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteManualTranslationUsingDELETEValidateBeforeCall(language, offerId, element, productsId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getOfferTranslationUsingGET + * @param offerId Offer identifier. (required) + * @param language Language for translation to retrieve. If not provided, all translations as well as base content for offer will be returned. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offer translations returned successfully. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getOfferTranslationUsingGETCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers/{offerId}/translations" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (language != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("language", language)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOfferTranslationUsingGETValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling getOfferTranslationUsingGET(Async)"); + } + + return getOfferTranslationUsingGETCall(offerId, language, _callback); + + } + + /** + * Get offer translations + * Get offer translation for given language or all present. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#offer-translations\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param language Language for translation to retrieve. If not provided, all translations as well as base content for offer will be returned. (optional) + * @return OfferTranslations + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offer translations returned successfully. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public OfferTranslations getOfferTranslationUsingGET(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String language) throws ApiException { + ApiResponse localVarResp = getOfferTranslationUsingGETWithHttpInfo(offerId, language); + return localVarResp.getData(); + } + + /** + * Get offer translations + * Get offer translation for given language or all present. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#offer-translations\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param language Language for translation to retrieve. If not provided, all translations as well as base content for offer will be returned. (optional) + * @return ApiResponse<OfferTranslations> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offer translations returned successfully. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getOfferTranslationUsingGETWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String language) throws ApiException { + okhttp3.Call localVarCall = getOfferTranslationUsingGETValidateBeforeCall(offerId, language, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get offer translations (asynchronously) + * Get offer translation for given language or all present. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#offer-translations\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param language Language for translation to retrieve. If not provided, all translations as well as base content for offer will be 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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offer translations returned successfully. -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getOfferTranslationUsingGETAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOfferTranslationUsingGETValidateBeforeCall(offerId, language, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateOfferTranslationUsingPATCH + * @param language Language of the provided translation. (required) + * @param offerId Offer identifier. (required) + * @param manualTranslationUpdateRequest Request with manual translation for offer, must contain at least one translated offer element (title, description or safety information). (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Update successful -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateOfferTranslationUsingPATCHCall(@javax.annotation.Nonnull String language, @javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull ManualTranslationUpdateRequest manualTranslationUpdateRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = manualTranslationUpdateRequest; + + // create path and map variables + String localVarPath = "/sale/offers/{offerId}/translations/{language}" + .replace("{" + "language" + "}", localVarApiClient.escapeString(language.toString())) + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateOfferTranslationUsingPATCHValidateBeforeCall(@javax.annotation.Nonnull String language, @javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull ManualTranslationUpdateRequest manualTranslationUpdateRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'language' is set + if (language == null) { + throw new ApiException("Missing the required parameter 'language' when calling updateOfferTranslationUsingPATCH(Async)"); + } + + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling updateOfferTranslationUsingPATCH(Async)"); + } + + // verify the required parameter 'manualTranslationUpdateRequest' is set + if (manualTranslationUpdateRequest == null) { + throw new ApiException("Missing the required parameter 'manualTranslationUpdateRequest' when calling updateOfferTranslationUsingPATCH(Async)"); + } + + return updateOfferTranslationUsingPATCHCall(language, offerId, manualTranslationUpdateRequest, _callback); + + } + + /** + * Update offer translation + * Update manual translation for offer. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#offer-translations\" target=\"_blank\">EN</a>. + * @param language Language of the provided translation. (required) + * @param offerId Offer identifier. (required) + * @param manualTranslationUpdateRequest Request with manual translation for offer, must contain at least one translated offer element (title, description or safety information). (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Update successful -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public void updateOfferTranslationUsingPATCH(@javax.annotation.Nonnull String language, @javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull ManualTranslationUpdateRequest manualTranslationUpdateRequest) throws ApiException { + updateOfferTranslationUsingPATCHWithHttpInfo(language, offerId, manualTranslationUpdateRequest); + } + + /** + * Update offer translation + * Update manual translation for offer. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#offer-translations\" target=\"_blank\">EN</a>. + * @param language Language of the provided translation. (required) + * @param offerId Offer identifier. (required) + * @param manualTranslationUpdateRequest Request with manual translation for offer, must contain at least one translated offer element (title, description or safety information). (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Update successful -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse updateOfferTranslationUsingPATCHWithHttpInfo(@javax.annotation.Nonnull String language, @javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull ManualTranslationUpdateRequest manualTranslationUpdateRequest) throws ApiException { + okhttp3.Call localVarCall = updateOfferTranslationUsingPATCHValidateBeforeCall(language, offerId, manualTranslationUpdateRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update offer translation (asynchronously) + * Update manual translation for offer. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#tlumaczenia-ofert\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#offer-translations\" target=\"_blank\">EN</a>. + * @param language Language of the provided translation. (required) + * @param offerId Offer identifier. (required) + * @param manualTranslationUpdateRequest Request with manual translation for offer, must contain at least one translated offer element (title, description or safety information). (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Update successful -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateOfferTranslationUsingPATCHAsync(@javax.annotation.Nonnull String language, @javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull ManualTranslationUpdateRequest manualTranslationUpdateRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateOfferTranslationUsingPATCHValidateBeforeCall(language, offerId, manualTranslationUpdateRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/OfferVariantsApi.java b/src/main/java/pl/wtx/allegro/api/client/OfferVariantsApi.java new file mode 100644 index 0000000..6f38723 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/OfferVariantsApi.java @@ -0,0 +1,787 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.VariantSet; +import pl.wtx.allegro.api.client.model.VariantSetResponse; +import pl.wtx.allegro.api.client.model.VariantSets; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class OfferVariantsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public OfferVariantsApi() { + this(Configuration.getDefaultApiClient()); + } + + public OfferVariantsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createVariantSet + * @param variantSet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Variant set created successfully -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createVariantSetCall(@javax.annotation.Nonnull VariantSet variantSet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = variantSet; + + // create path and map variables + String localVarPath = "/sale/offer-variants"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createVariantSetValidateBeforeCall(@javax.annotation.Nonnull VariantSet variantSet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'variantSet' is set + if (variantSet == null) { + throw new ApiException("Missing the required parameter 'variantSet' when calling createVariantSet(Async)"); + } + + return createVariantSetCall(variantSet, _callback); + + } + + /** + * Create variant set + * Use this resource to create variant set. A valid variant set must consist of three required elements: - name: - it can't be blank and must not be longer than 75 characters - parameters: - it should contain parameter identifiers used for offer grouping - parameter identifiers from the offers and special `color/pattern` value (for grouping via image) are permitted - it must contain at least one element (up to 2) - offers: - it must contain at least 2 offers (500 at most) - `colorPattern` value must be set for every offer if `color/pattern` parameter is used - `colorPattern` value can't be blank and must not be longer than 50 characters - `colorPattern` can take arbitrary string value like `red`, `b323592c-522f-4ec1-b9ea-3764538e0ac4` (UUID), etc. - offers having the same image should have identical `colorPattern` value - offers must have `publication.marketplaces.base` equal to `allegro-pl` Let's assume we have 4 offers: - offer with id 2 having an image of a red t-shirt and S as a value of parameter with id 21 - offer with id 3 having an image of a red t-shirt and M as a value of parameter with id 21 - offer with id 4 having an image of a blue t-shirt and S as a value of parameter with id 21 - offer with id 5 having an image of a blue t-shirt and M as a value of parameter with id 21 You can build a variant set by grouping offers using combination of available parameters - examples are available in <i>Request samples</i>. More general information about variant sets can be found [here](https://allegro.pl/pomoc/faq/wielowariantowosc-jak-polaczyc-oferty-xGgaOByGgTb#dodatkowe-informacje). Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#utworz-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#create-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param variantSet (required) + * @return VariantSetResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Variant set created successfully -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public VariantSetResponse createVariantSet(@javax.annotation.Nonnull VariantSet variantSet) throws ApiException { + ApiResponse localVarResp = createVariantSetWithHttpInfo(variantSet); + return localVarResp.getData(); + } + + /** + * Create variant set + * Use this resource to create variant set. A valid variant set must consist of three required elements: - name: - it can't be blank and must not be longer than 75 characters - parameters: - it should contain parameter identifiers used for offer grouping - parameter identifiers from the offers and special `color/pattern` value (for grouping via image) are permitted - it must contain at least one element (up to 2) - offers: - it must contain at least 2 offers (500 at most) - `colorPattern` value must be set for every offer if `color/pattern` parameter is used - `colorPattern` value can't be blank and must not be longer than 50 characters - `colorPattern` can take arbitrary string value like `red`, `b323592c-522f-4ec1-b9ea-3764538e0ac4` (UUID), etc. - offers having the same image should have identical `colorPattern` value - offers must have `publication.marketplaces.base` equal to `allegro-pl` Let's assume we have 4 offers: - offer with id 2 having an image of a red t-shirt and S as a value of parameter with id 21 - offer with id 3 having an image of a red t-shirt and M as a value of parameter with id 21 - offer with id 4 having an image of a blue t-shirt and S as a value of parameter with id 21 - offer with id 5 having an image of a blue t-shirt and M as a value of parameter with id 21 You can build a variant set by grouping offers using combination of available parameters - examples are available in <i>Request samples</i>. More general information about variant sets can be found [here](https://allegro.pl/pomoc/faq/wielowariantowosc-jak-polaczyc-oferty-xGgaOByGgTb#dodatkowe-informacje). Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#utworz-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#create-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param variantSet (required) + * @return ApiResponse<VariantSetResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Variant set created successfully -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse createVariantSetWithHttpInfo(@javax.annotation.Nonnull VariantSet variantSet) throws ApiException { + okhttp3.Call localVarCall = createVariantSetValidateBeforeCall(variantSet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create variant set (asynchronously) + * Use this resource to create variant set. A valid variant set must consist of three required elements: - name: - it can't be blank and must not be longer than 75 characters - parameters: - it should contain parameter identifiers used for offer grouping - parameter identifiers from the offers and special `color/pattern` value (for grouping via image) are permitted - it must contain at least one element (up to 2) - offers: - it must contain at least 2 offers (500 at most) - `colorPattern` value must be set for every offer if `color/pattern` parameter is used - `colorPattern` value can't be blank and must not be longer than 50 characters - `colorPattern` can take arbitrary string value like `red`, `b323592c-522f-4ec1-b9ea-3764538e0ac4` (UUID), etc. - offers having the same image should have identical `colorPattern` value - offers must have `publication.marketplaces.base` equal to `allegro-pl` Let's assume we have 4 offers: - offer with id 2 having an image of a red t-shirt and S as a value of parameter with id 21 - offer with id 3 having an image of a red t-shirt and M as a value of parameter with id 21 - offer with id 4 having an image of a blue t-shirt and S as a value of parameter with id 21 - offer with id 5 having an image of a blue t-shirt and M as a value of parameter with id 21 You can build a variant set by grouping offers using combination of available parameters - examples are available in <i>Request samples</i>. More general information about variant sets can be found [here](https://allegro.pl/pomoc/faq/wielowariantowosc-jak-polaczyc-oferty-xGgaOByGgTb#dodatkowe-informacje). Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#utworz-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#create-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param variantSet (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Variant set created successfully -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createVariantSetAsync(@javax.annotation.Nonnull VariantSet variantSet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createVariantSetValidateBeforeCall(variantSet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteVariantSet + * @param setId Variant set identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Variant set deleted successfully -
401 Unauthorized -
403 Forbidden -
404 Variant set not found -
+ */ + public okhttp3.Call deleteVariantSetCall(@javax.annotation.Nonnull String setId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-variants/{setId}" + .replace("{" + "setId" + "}", localVarApiClient.escapeString(setId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteVariantSetValidateBeforeCall(@javax.annotation.Nonnull String setId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'setId' is set + if (setId == null) { + throw new ApiException("Missing the required parameter 'setId' when calling deleteVariantSet(Async)"); + } + + return deleteVariantSetCall(setId, _callback); + + } + + /** + * Delete a variant set + * Use this resource to delete variant set by id. Offers included in variant set will not be stopped or modified by this operation. Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#usun-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#remove-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param setId Variant set identifier. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Variant set deleted successfully -
401 Unauthorized -
403 Forbidden -
404 Variant set not found -
+ */ + public void deleteVariantSet(@javax.annotation.Nonnull String setId) throws ApiException { + deleteVariantSetWithHttpInfo(setId); + } + + /** + * Delete a variant set + * Use this resource to delete variant set by id. Offers included in variant set will not be stopped or modified by this operation. Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#usun-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#remove-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param setId Variant set identifier. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Variant set deleted successfully -
401 Unauthorized -
403 Forbidden -
404 Variant set not found -
+ */ + public ApiResponse deleteVariantSetWithHttpInfo(@javax.annotation.Nonnull String setId) throws ApiException { + okhttp3.Call localVarCall = deleteVariantSetValidateBeforeCall(setId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a variant set (asynchronously) + * Use this resource to delete variant set by id. Offers included in variant set will not be stopped or modified by this operation. Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#usun-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#remove-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param setId Variant set identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 Variant set deleted successfully -
401 Unauthorized -
403 Forbidden -
404 Variant set not found -
+ */ + public okhttp3.Call deleteVariantSetAsync(@javax.annotation.Nonnull String setId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteVariantSetValidateBeforeCall(setId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getVariantSet + * @param setId Variant set identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant set returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getVariantSetCall(@javax.annotation.Nonnull String setId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-variants/{setId}" + .replace("{" + "setId" + "}", localVarApiClient.escapeString(setId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getVariantSetValidateBeforeCall(@javax.annotation.Nonnull String setId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'setId' is set + if (setId == null) { + throw new ApiException("Missing the required parameter 'setId' when calling getVariantSet(Async)"); + } + + return getVariantSetCall(setId, _callback); + + } + + /** + * Get a variant set + * Use this resource to get variant set by set id. Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#edytuj-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#update-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param setId Variant set identifier. (required) + * @return VariantSetResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant set returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public VariantSetResponse getVariantSet(@javax.annotation.Nonnull String setId) throws ApiException { + ApiResponse localVarResp = getVariantSetWithHttpInfo(setId); + return localVarResp.getData(); + } + + /** + * Get a variant set + * Use this resource to get variant set by set id. Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#edytuj-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#update-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param setId Variant set identifier. (required) + * @return ApiResponse<VariantSetResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant set returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getVariantSetWithHttpInfo(@javax.annotation.Nonnull String setId) throws ApiException { + okhttp3.Call localVarCall = getVariantSetValidateBeforeCall(setId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a variant set (asynchronously) + * Use this resource to get variant set by set id. Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#edytuj-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#update-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param setId Variant set identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant set returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getVariantSetAsync(@javax.annotation.Nonnull String setId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getVariantSetValidateBeforeCall(setId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getVariantSets + * @param offset Index of first returned variant set. (optional, default to 0) + * @param limit Maximum number of returned variant sets. (optional, default to 10) + * @param query Filter variant sets by name or offer id. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant sets returned successfully -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getVariantSetsCall(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String query, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-variants"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (query != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getVariantSetsValidateBeforeCall(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String query, final ApiCallback _callback) throws ApiException { + return getVariantSetsCall(offset, limit, query, _callback); + + } + + /** + * Get the user's variant sets + * Use this resource to get created variant sets. The returned variant sets are ordered by name. Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#pobierz-liste-ofert-wielowariantowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#retrieve-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param offset Index of first returned variant set. (optional, default to 0) + * @param limit Maximum number of returned variant sets. (optional, default to 10) + * @param query Filter variant sets by name or offer id. (optional) + * @return VariantSets + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant sets returned successfully -
401 Unauthorized -
403 Forbidden -
+ */ + public VariantSets getVariantSets(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String query) throws ApiException { + ApiResponse localVarResp = getVariantSetsWithHttpInfo(offset, limit, query); + return localVarResp.getData(); + } + + /** + * Get the user's variant sets + * Use this resource to get created variant sets. The returned variant sets are ordered by name. Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#pobierz-liste-ofert-wielowariantowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#retrieve-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param offset Index of first returned variant set. (optional, default to 0) + * @param limit Maximum number of returned variant sets. (optional, default to 10) + * @param query Filter variant sets by name or offer id. (optional) + * @return ApiResponse<VariantSets> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant sets returned successfully -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse getVariantSetsWithHttpInfo(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String query) throws ApiException { + okhttp3.Call localVarCall = getVariantSetsValidateBeforeCall(offset, limit, query, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's variant sets (asynchronously) + * Use this resource to get created variant sets. The returned variant sets are ordered by name. Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#pobierz-liste-ofert-wielowariantowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#retrieve-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param offset Index of first returned variant set. (optional, default to 0) + * @param limit Maximum number of returned variant sets. (optional, default to 10) + * @param query Filter variant sets by name or offer id. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant sets returned successfully -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getVariantSetsAsync(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String query, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getVariantSetsValidateBeforeCall(offset, limit, query, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateVariantSet + * @param setId Variant set identifier. (required) + * @param variantSet (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant set updated successfully -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateVariantSetCall(@javax.annotation.Nonnull String setId, @javax.annotation.Nonnull VariantSet variantSet, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = variantSet; + + // create path and map variables + String localVarPath = "/sale/offer-variants/{setId}" + .replace("{" + "setId" + "}", localVarApiClient.escapeString(setId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateVariantSetValidateBeforeCall(@javax.annotation.Nonnull String setId, @javax.annotation.Nonnull VariantSet variantSet, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'setId' is set + if (setId == null) { + throw new ApiException("Missing the required parameter 'setId' when calling updateVariantSet(Async)"); + } + + // verify the required parameter 'variantSet' is set + if (variantSet == null) { + throw new ApiException("Missing the required parameter 'variantSet' when calling updateVariantSet(Async)"); + } + + return updateVariantSetCall(setId, variantSet, _callback); + + } + + /** + * Update variant set + * Use this resource to edit variant set. A valid variant set must consist of three required elements: - name: - it can't be blank and must not be longer than 75 characters - parameters: - it should contain parameter identifiers used for offer grouping - parameter identifiers from the offers and special `color/pattern` value (for grouping via image) are permitted - it must contain at least one element (up to 2) - offers: - it must contain at least 2 offers (500 at most) - `colorPattern` value must be set for every offer if `color/pattern` parameter is used - `colorPattern` value can't be blank and must not be longer than 50 characters - `colorPattern` can take arbitrary string value like `red`, `b323592c-522f-4ec1-b9ea-3764538e0ac4` (UUID), etc. - offers having the same image should have identical `colorPattern` value - offers must have `publication.marketplaces.base` equal to `allegro-pl` Let's assume we have 4 offers: - offer with id 2 having an image of a red t-shirt and S as a value of parameter with id 21 - offer with id 3 having an image of a red t-shirt and M as a value of parameter with id 21 - offer with id 4 having an image of a blue t-shirt and S as a value of parameter with id 21 - offer with id 5 having an image of a blue t-shirt and M as a value of parameter with id 21 You can build a variant set by grouping offers using combination of available parameters - examples are available in <i>Request samples</i>. More general information about variant sets can be found [here](https://allegro.pl/pomoc/faq/wielowariantowosc-jak-polaczyc-oferty-xGgaOByGgTb#dodatkowe-informacje). Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#edytuj-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#update-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param setId Variant set identifier. (required) + * @param variantSet (required) + * @return VariantSetResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant set updated successfully -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public VariantSetResponse updateVariantSet(@javax.annotation.Nonnull String setId, @javax.annotation.Nonnull VariantSet variantSet) throws ApiException { + ApiResponse localVarResp = updateVariantSetWithHttpInfo(setId, variantSet); + return localVarResp.getData(); + } + + /** + * Update variant set + * Use this resource to edit variant set. A valid variant set must consist of three required elements: - name: - it can't be blank and must not be longer than 75 characters - parameters: - it should contain parameter identifiers used for offer grouping - parameter identifiers from the offers and special `color/pattern` value (for grouping via image) are permitted - it must contain at least one element (up to 2) - offers: - it must contain at least 2 offers (500 at most) - `colorPattern` value must be set for every offer if `color/pattern` parameter is used - `colorPattern` value can't be blank and must not be longer than 50 characters - `colorPattern` can take arbitrary string value like `red`, `b323592c-522f-4ec1-b9ea-3764538e0ac4` (UUID), etc. - offers having the same image should have identical `colorPattern` value - offers must have `publication.marketplaces.base` equal to `allegro-pl` Let's assume we have 4 offers: - offer with id 2 having an image of a red t-shirt and S as a value of parameter with id 21 - offer with id 3 having an image of a red t-shirt and M as a value of parameter with id 21 - offer with id 4 having an image of a blue t-shirt and S as a value of parameter with id 21 - offer with id 5 having an image of a blue t-shirt and M as a value of parameter with id 21 You can build a variant set by grouping offers using combination of available parameters - examples are available in <i>Request samples</i>. More general information about variant sets can be found [here](https://allegro.pl/pomoc/faq/wielowariantowosc-jak-polaczyc-oferty-xGgaOByGgTb#dodatkowe-informacje). Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#edytuj-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#update-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param setId Variant set identifier. (required) + * @param variantSet (required) + * @return ApiResponse<VariantSetResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant set updated successfully -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse updateVariantSetWithHttpInfo(@javax.annotation.Nonnull String setId, @javax.annotation.Nonnull VariantSet variantSet) throws ApiException { + okhttp3.Call localVarCall = updateVariantSetValidateBeforeCall(setId, variantSet, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update variant set (asynchronously) + * Use this resource to edit variant set. A valid variant set must consist of three required elements: - name: - it can't be blank and must not be longer than 75 characters - parameters: - it should contain parameter identifiers used for offer grouping - parameter identifiers from the offers and special `color/pattern` value (for grouping via image) are permitted - it must contain at least one element (up to 2) - offers: - it must contain at least 2 offers (500 at most) - `colorPattern` value must be set for every offer if `color/pattern` parameter is used - `colorPattern` value can't be blank and must not be longer than 50 characters - `colorPattern` can take arbitrary string value like `red`, `b323592c-522f-4ec1-b9ea-3764538e0ac4` (UUID), etc. - offers having the same image should have identical `colorPattern` value - offers must have `publication.marketplaces.base` equal to `allegro-pl` Let's assume we have 4 offers: - offer with id 2 having an image of a red t-shirt and S as a value of parameter with id 21 - offer with id 3 having an image of a red t-shirt and M as a value of parameter with id 21 - offer with id 4 having an image of a blue t-shirt and S as a value of parameter with id 21 - offer with id 5 having an image of a blue t-shirt and M as a value of parameter with id 21 You can build a variant set by grouping offers using combination of available parameters - examples are available in <i>Request samples</i>. More general information about variant sets can be found [here](https://allegro.pl/pomoc/faq/wielowariantowosc-jak-polaczyc-oferty-xGgaOByGgTb#dodatkowe-informacje). Read more: <a href=\"../../tutorials/jak-utworzyc-oferte-wielowariantowa-oA6ZYBg5XFo#edytuj-oferte-wielowariantowa\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-create-a-multi-variant-offer-nn9DOL3nXs2#update-a-multi-variant-offer\" target=\"_blank\">EN</a>. + * @param setId Variant set identifier. (required) + * @param variantSet (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Variant set updated successfully -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call updateVariantSetAsync(@javax.annotation.Nonnull String setId, @javax.annotation.Nonnull VariantSet variantSet, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateVariantSetValidateBeforeCall(setId, variantSet, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/OrderManagementApi.java b/src/main/java/pl/wtx/allegro/api/client/OrderManagementApi.java new file mode 100644 index 0000000..e8c8bc7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/OrderManagementApi.java @@ -0,0 +1,2082 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AllegroCarrier; +import pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointsResponse; +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.CarrierParcelTrackingResponse; +import pl.wtx.allegro.api.client.model.CheckFormsNewOrderInvoice; +import pl.wtx.allegro.api.client.model.CheckFormsNewOrderInvoiceId; +import pl.wtx.allegro.api.client.model.CheckoutForm; +import pl.wtx.allegro.api.client.model.CheckoutFormAddWaybillCreated; +import pl.wtx.allegro.api.client.model.CheckoutFormAddWaybillRequest; +import pl.wtx.allegro.api.client.model.CheckoutFormFulfillment; +import pl.wtx.allegro.api.client.model.CheckoutFormOrderWaybillResponse; +import pl.wtx.allegro.api.client.model.CheckoutForms; +import pl.wtx.allegro.api.client.model.CheckoutFormsOrderInvoices; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import java.io.File; +import java.time.OffsetDateTime; +import pl.wtx.allegro.api.client.model.OrderEventStats; +import pl.wtx.allegro.api.client.model.OrderEventsList; +import pl.wtx.allegro.api.client.model.OrdersShippingCarriersResponse; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class OrderManagementApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public OrderManagementApi() { + this(Configuration.getDefaultApiClient()); + } + + public OrderManagementApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addOrderInvoicesMetadata + * @param id Order identifier. (required) + * @param checkFormsNewOrderInvoice request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Invoice created successfully -
403 You do not have permission to access this order -
404 Order with given id does not exist -
409 Order with given id already has seller invoice -
422 Some of the provided data is invalid or order does not allow an invoice or order's payment is rejected or previously uploaded file is still in scanning. -
429 You're trying to add another metadata too fast. Upload a file to previously added metadata or wait a few seconds before adding next metadata. -
+ */ + public okhttp3.Call addOrderInvoicesMetadataCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckFormsNewOrderInvoice checkFormsNewOrderInvoice, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = checkFormsNewOrderInvoice; + + // create path and map variables + String localVarPath = "/order/checkout-forms/{id}/invoices" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addOrderInvoicesMetadataValidateBeforeCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckFormsNewOrderInvoice checkFormsNewOrderInvoice, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling addOrderInvoicesMetadata(Async)"); + } + + // verify the required parameter 'checkFormsNewOrderInvoice' is set + if (checkFormsNewOrderInvoice == null) { + throw new ApiException("Missing the required parameter 'checkFormsNewOrderInvoice' when calling addOrderInvoicesMetadata(Async)"); + } + + return addOrderInvoicesMetadataCall(id, checkFormsNewOrderInvoice, _callback); + + } + + /** + * Post new invoice + * Use to add new invoice metadata. Before you send an invoice file, you need to initialize the invoice instance with the required parameters. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-dodac-fakture-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#add-an-invoice-to-the-order\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param checkFormsNewOrderInvoice request (required) + * @return CheckFormsNewOrderInvoiceId + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Invoice created successfully -
403 You do not have permission to access this order -
404 Order with given id does not exist -
409 Order with given id already has seller invoice -
422 Some of the provided data is invalid or order does not allow an invoice or order's payment is rejected or previously uploaded file is still in scanning. -
429 You're trying to add another metadata too fast. Upload a file to previously added metadata or wait a few seconds before adding next metadata. -
+ */ + public CheckFormsNewOrderInvoiceId addOrderInvoicesMetadata(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckFormsNewOrderInvoice checkFormsNewOrderInvoice) throws ApiException { + ApiResponse localVarResp = addOrderInvoicesMetadataWithHttpInfo(id, checkFormsNewOrderInvoice); + return localVarResp.getData(); + } + + /** + * Post new invoice + * Use to add new invoice metadata. Before you send an invoice file, you need to initialize the invoice instance with the required parameters. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-dodac-fakture-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#add-an-invoice-to-the-order\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param checkFormsNewOrderInvoice request (required) + * @return ApiResponse<CheckFormsNewOrderInvoiceId> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Invoice created successfully -
403 You do not have permission to access this order -
404 Order with given id does not exist -
409 Order with given id already has seller invoice -
422 Some of the provided data is invalid or order does not allow an invoice or order's payment is rejected or previously uploaded file is still in scanning. -
429 You're trying to add another metadata too fast. Upload a file to previously added metadata or wait a few seconds before adding next metadata. -
+ */ + public ApiResponse addOrderInvoicesMetadataWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckFormsNewOrderInvoice checkFormsNewOrderInvoice) throws ApiException { + okhttp3.Call localVarCall = addOrderInvoicesMetadataValidateBeforeCall(id, checkFormsNewOrderInvoice, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Post new invoice (asynchronously) + * Use to add new invoice metadata. Before you send an invoice file, you need to initialize the invoice instance with the required parameters. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-dodac-fakture-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#add-an-invoice-to-the-order\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param checkFormsNewOrderInvoice request (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Invoice created successfully -
403 You do not have permission to access this order -
404 Order with given id does not exist -
409 Order with given id already has seller invoice -
422 Some of the provided data is invalid or order does not allow an invoice or order's payment is rejected or previously uploaded file is still in scanning. -
429 You're trying to add another metadata too fast. Upload a file to previously added metadata or wait a few seconds before adding next metadata. -
+ */ + public okhttp3.Call addOrderInvoicesMetadataAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckFormsNewOrderInvoice checkFormsNewOrderInvoice, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addOrderInvoicesMetadataValidateBeforeCall(id, checkFormsNewOrderInvoice, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createOrderShipmentsUsingPOST + * @param id Order identifier. (required) + * @param checkoutFormAddWaybillRequest request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The request is OK and the parcel tracking number will be assigned to the order -
400 Missing required field or invalid value in the request (e.g. unknown carrier id, carrier name too long, invalid tracking number structure) -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
409 Maximum waybill usage exceeded (e.g. used in too many orders) -
422 Some of the provided data is invalid, e.g. line item doesn’t belong to the order -
+ */ + public okhttp3.Call createOrderShipmentsUsingPOSTCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckoutFormAddWaybillRequest checkoutFormAddWaybillRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = checkoutFormAddWaybillRequest; + + // create path and map variables + String localVarPath = "/order/checkout-forms/{id}/shipments" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createOrderShipmentsUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckoutFormAddWaybillRequest checkoutFormAddWaybillRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling createOrderShipmentsUsingPOST(Async)"); + } + + // verify the required parameter 'checkoutFormAddWaybillRequest' is set + if (checkoutFormAddWaybillRequest == null) { + throw new ApiException("Missing the required parameter 'checkoutFormAddWaybillRequest' when calling createOrderShipmentsUsingPOST(Async)"); + } + + return createOrderShipmentsUsingPOSTCall(id, checkoutFormAddWaybillRequest, _callback); + + } + + /** + * Add a parcel tracking number + * Add a parcel tracking number (shipment) to given order line items. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-dodac-numer-przesylki-do-przedmiotu-w-zamowieniu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#add-tracking-number-to-order\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param checkoutFormAddWaybillRequest request (required) + * @return CheckoutFormAddWaybillCreated + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The request is OK and the parcel tracking number will be assigned to the order -
400 Missing required field or invalid value in the request (e.g. unknown carrier id, carrier name too long, invalid tracking number structure) -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
409 Maximum waybill usage exceeded (e.g. used in too many orders) -
422 Some of the provided data is invalid, e.g. line item doesn’t belong to the order -
+ */ + public CheckoutFormAddWaybillCreated createOrderShipmentsUsingPOST(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckoutFormAddWaybillRequest checkoutFormAddWaybillRequest) throws ApiException { + ApiResponse localVarResp = createOrderShipmentsUsingPOSTWithHttpInfo(id, checkoutFormAddWaybillRequest); + return localVarResp.getData(); + } + + /** + * Add a parcel tracking number + * Add a parcel tracking number (shipment) to given order line items. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-dodac-numer-przesylki-do-przedmiotu-w-zamowieniu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#add-tracking-number-to-order\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param checkoutFormAddWaybillRequest request (required) + * @return ApiResponse<CheckoutFormAddWaybillCreated> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The request is OK and the parcel tracking number will be assigned to the order -
400 Missing required field or invalid value in the request (e.g. unknown carrier id, carrier name too long, invalid tracking number structure) -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
409 Maximum waybill usage exceeded (e.g. used in too many orders) -
422 Some of the provided data is invalid, e.g. line item doesn’t belong to the order -
+ */ + public ApiResponse createOrderShipmentsUsingPOSTWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckoutFormAddWaybillRequest checkoutFormAddWaybillRequest) throws ApiException { + okhttp3.Call localVarCall = createOrderShipmentsUsingPOSTValidateBeforeCall(id, checkoutFormAddWaybillRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add a parcel tracking number (asynchronously) + * Add a parcel tracking number (shipment) to given order line items. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-dodac-numer-przesylki-do-przedmiotu-w-zamowieniu\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#add-tracking-number-to-order\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param checkoutFormAddWaybillRequest request (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 The request is OK and the parcel tracking number will be assigned to the order -
400 Missing required field or invalid value in the request (e.g. unknown carrier id, carrier name too long, invalid tracking number structure) -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
409 Maximum waybill usage exceeded (e.g. used in too many orders) -
422 Some of the provided data is invalid, e.g. line item doesn’t belong to the order -
+ */ + public okhttp3.Call createOrderShipmentsUsingPOSTAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckoutFormAddWaybillRequest checkoutFormAddWaybillRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createOrderShipmentsUsingPOSTValidateBeforeCall(id, checkoutFormAddWaybillRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getAllegroPickupDropOffPointsGET + * @param carriers List of carrier ids to filter the drop off/pick up points to only the ones where any of the listed carriers operate. In case of an empty list, all points are returned. (optional) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. Information about date (the same HTTP-date format) of last modified data is available in response - `Last-Modified`. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns a list of Allegro pickup drop off points -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request. Invalid query parameters. -
401 Authentication failed, e.g. token is expired -
+ */ + public okhttp3.Call getAllegroPickupDropOffPointsGETCall(@javax.annotation.Nullable List carriers, @javax.annotation.Nullable String ifModifiedSince, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/carriers/ALLEGRO/points"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (carriers != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "carriers", carriers)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (ifModifiedSince != null) { + localVarHeaderParams.put("If-Modified-Since", localVarApiClient.parameterToString(ifModifiedSince)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAllegroPickupDropOffPointsGETValidateBeforeCall(@javax.annotation.Nullable List carriers, @javax.annotation.Nullable String ifModifiedSince, final ApiCallback _callback) throws ApiException { + return getAllegroPickupDropOffPointsGETCall(carriers, ifModifiedSince, _callback); + + } + + /** + * Get Allegro pickup drop off points + * Get a list of Allegro pickup drop off points. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-liste-punktow-allegro\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-list-of-allegro-pickup-drop-off-points\" target=\"_blank\">EN</a>. + * @param carriers List of carrier ids to filter the drop off/pick up points to only the ones where any of the listed carriers operate. In case of an empty list, all points are returned. (optional) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. Information about date (the same HTTP-date format) of last modified data is available in response - `Last-Modified`. (optional) + * @return AllegroPickupDropOffPointsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns a list of Allegro pickup drop off points -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request. Invalid query parameters. -
401 Authentication failed, e.g. token is expired -
+ */ + public AllegroPickupDropOffPointsResponse getAllegroPickupDropOffPointsGET(@javax.annotation.Nullable List carriers, @javax.annotation.Nullable String ifModifiedSince) throws ApiException { + ApiResponse localVarResp = getAllegroPickupDropOffPointsGETWithHttpInfo(carriers, ifModifiedSince); + return localVarResp.getData(); + } + + /** + * Get Allegro pickup drop off points + * Get a list of Allegro pickup drop off points. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-liste-punktow-allegro\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-list-of-allegro-pickup-drop-off-points\" target=\"_blank\">EN</a>. + * @param carriers List of carrier ids to filter the drop off/pick up points to only the ones where any of the listed carriers operate. In case of an empty list, all points are returned. (optional) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. Information about date (the same HTTP-date format) of last modified data is available in response - `Last-Modified`. (optional) + * @return ApiResponse<AllegroPickupDropOffPointsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns a list of Allegro pickup drop off points -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request. Invalid query parameters. -
401 Authentication failed, e.g. token is expired -
+ */ + public ApiResponse getAllegroPickupDropOffPointsGETWithHttpInfo(@javax.annotation.Nullable List carriers, @javax.annotation.Nullable String ifModifiedSince) throws ApiException { + okhttp3.Call localVarCall = getAllegroPickupDropOffPointsGETValidateBeforeCall(carriers, ifModifiedSince, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Allegro pickup drop off points (asynchronously) + * Get a list of Allegro pickup drop off points. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-liste-punktow-allegro\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-list-of-allegro-pickup-drop-off-points\" target=\"_blank\">EN</a>. + * @param carriers List of carrier ids to filter the drop off/pick up points to only the ones where any of the listed carriers operate. In case of an empty list, all points are returned. (optional) + * @param ifModifiedSince Date of last data modification. If data has been modified after specified date, full set of data is returned. If header is not specified, full set of data is returned. Date has to be provided in HTTP-date format. Information about date (the same HTTP-date format) of last modified data is available in response - `Last-Modified`. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns a list of Allegro pickup drop off points -
304 Data has not been modified after the date provided in If-Modified-Since header. -
400 Bad request. Invalid query parameters. -
401 Authentication failed, e.g. token is expired -
+ */ + public okhttp3.Call getAllegroPickupDropOffPointsGETAsync(@javax.annotation.Nullable List carriers, @javax.annotation.Nullable String ifModifiedSince, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAllegroPickupDropOffPointsGETValidateBeforeCall(carriers, ifModifiedSince, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getListOfOrdersUsingGET + * @param offset Index of first returned checkout-form from all search results. (optional, default to 0) + * @param limit Maximum number of checkout-forms in response. (optional, default to 100) + * @param status Specify status value that checkout-forms must have to be included in the output. Allowed values are: * `BOUGHT`: purchase without checkout form filled in. * `FILLED_IN`: checkout form filled in but payment is not completed yet so data could still change. * `READY_FOR_PROCESSING`: payment completed. Purchase is ready for processing. * `CANCELLED`: purchase cancelled by buyer. (optional) + * @param fulfillmentStatus Specify seller status value that checkout-forms must have to be included in the output. Allowed values are: * `NEW` * `PROCESSING` * `READY_FOR_SHIPMENT` * `READY_FOR_PICKUP` * `SENT` * `PICKED_UP` * `CANCELLED` * `SUSPENDED` * `RETURNED`. (optional) + * @param fulfillmentShipmentSummaryLineItemsSent Specify filter for line items sending status. Allowed values are: * `NONE`: none of line items have tracking number specified * `SOME`: some of line items have tracking number specified * `ALL`: all of line items have tracking number specified. (optional) + * @param lineItemsBoughtAtLte Latest line item bought date. The upper bound of date time range from which checkout forms will be taken. (optional) + * @param lineItemsBoughtAtGte Latest line item bought date. The lower bound of date time range from which checkout forms will be taken. (optional) + * @param paymentId Find checkout-forms having specified payment id. (optional) + * @param surchargesId Find checkout-forms having specified surcharge id. (optional) + * @param deliveryMethodId Find checkout-forms having specified delivery method id. (optional) + * @param buyerLogin Find checkout-forms having specified buyer login. (optional) + * @param marketplaceId Find checkout-forms of orders purchased on specified marketplace. (optional) + * @param updatedAtLte Checkout form last modification date. The upper bound of date time range from which checkout forms will be taken. (optional) + * @param updatedAtGte Checkout form last modification date. The lower bound of date time range from which checkout forms will be taken. (optional) + * @param sort The results' sorting order. No prefix in the value means ascending order. `-` prefix means descending order. If you don't provide the sort parameter, the list is sorted by line item boughtAt date, descending. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request - Returned when request parameters contains illegal values. -
401 Unauthorized -
406 Not Acceptable -
422 Unprocessable Entity - Returned when limit or offset value is outside an acceptable range -
+ */ + public okhttp3.Call getListOfOrdersUsingGETCall(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String status, @javax.annotation.Nullable String fulfillmentStatus, @javax.annotation.Nullable String fulfillmentShipmentSummaryLineItemsSent, @javax.annotation.Nullable OffsetDateTime lineItemsBoughtAtLte, @javax.annotation.Nullable OffsetDateTime lineItemsBoughtAtGte, @javax.annotation.Nullable String paymentId, @javax.annotation.Nullable String surchargesId, @javax.annotation.Nullable String deliveryMethodId, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable OffsetDateTime updatedAtLte, @javax.annotation.Nullable OffsetDateTime updatedAtGte, @javax.annotation.Nullable String sort, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/checkout-forms"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (status != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("status", status)); + } + + if (fulfillmentStatus != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fulfillment.status", fulfillmentStatus)); + } + + if (fulfillmentShipmentSummaryLineItemsSent != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fulfillment.shipmentSummary.lineItemsSent", fulfillmentShipmentSummaryLineItemsSent)); + } + + if (lineItemsBoughtAtLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("lineItems.boughtAt.lte", lineItemsBoughtAtLte)); + } + + if (lineItemsBoughtAtGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("lineItems.boughtAt.gte", lineItemsBoughtAtGte)); + } + + if (paymentId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("payment.id", paymentId)); + } + + if (surchargesId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("surcharges.id", surchargesId)); + } + + if (deliveryMethodId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("delivery.method.id", deliveryMethodId)); + } + + if (buyerLogin != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("buyer.login", buyerLogin)); + } + + if (marketplaceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplace.id", marketplaceId)); + } + + if (updatedAtLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("updatedAt.lte", updatedAtLte)); + } + + if (updatedAtGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("updatedAt.gte", updatedAtGte)); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getListOfOrdersUsingGETValidateBeforeCall(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String status, @javax.annotation.Nullable String fulfillmentStatus, @javax.annotation.Nullable String fulfillmentShipmentSummaryLineItemsSent, @javax.annotation.Nullable OffsetDateTime lineItemsBoughtAtLte, @javax.annotation.Nullable OffsetDateTime lineItemsBoughtAtGte, @javax.annotation.Nullable String paymentId, @javax.annotation.Nullable String surchargesId, @javax.annotation.Nullable String deliveryMethodId, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable OffsetDateTime updatedAtLte, @javax.annotation.Nullable OffsetDateTime updatedAtGte, @javax.annotation.Nullable String sort, final ApiCallback _callback) throws ApiException { + return getListOfOrdersUsingGETCall(offset, limit, status, fulfillmentStatus, fulfillmentShipmentSummaryLineItemsSent, lineItemsBoughtAtLte, lineItemsBoughtAtGte, paymentId, surchargesId, deliveryMethodId, buyerLogin, marketplaceId, updatedAtLte, updatedAtGte, sort, _callback); + + } + + /** + * Get the user's orders + * Use this resource to get an order list. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#lista-zamowien\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#order-list\" target=\"_blank\">EN</a>. + * @param offset Index of first returned checkout-form from all search results. (optional, default to 0) + * @param limit Maximum number of checkout-forms in response. (optional, default to 100) + * @param status Specify status value that checkout-forms must have to be included in the output. Allowed values are: * `BOUGHT`: purchase without checkout form filled in. * `FILLED_IN`: checkout form filled in but payment is not completed yet so data could still change. * `READY_FOR_PROCESSING`: payment completed. Purchase is ready for processing. * `CANCELLED`: purchase cancelled by buyer. (optional) + * @param fulfillmentStatus Specify seller status value that checkout-forms must have to be included in the output. Allowed values are: * `NEW` * `PROCESSING` * `READY_FOR_SHIPMENT` * `READY_FOR_PICKUP` * `SENT` * `PICKED_UP` * `CANCELLED` * `SUSPENDED` * `RETURNED`. (optional) + * @param fulfillmentShipmentSummaryLineItemsSent Specify filter for line items sending status. Allowed values are: * `NONE`: none of line items have tracking number specified * `SOME`: some of line items have tracking number specified * `ALL`: all of line items have tracking number specified. (optional) + * @param lineItemsBoughtAtLte Latest line item bought date. The upper bound of date time range from which checkout forms will be taken. (optional) + * @param lineItemsBoughtAtGte Latest line item bought date. The lower bound of date time range from which checkout forms will be taken. (optional) + * @param paymentId Find checkout-forms having specified payment id. (optional) + * @param surchargesId Find checkout-forms having specified surcharge id. (optional) + * @param deliveryMethodId Find checkout-forms having specified delivery method id. (optional) + * @param buyerLogin Find checkout-forms having specified buyer login. (optional) + * @param marketplaceId Find checkout-forms of orders purchased on specified marketplace. (optional) + * @param updatedAtLte Checkout form last modification date. The upper bound of date time range from which checkout forms will be taken. (optional) + * @param updatedAtGte Checkout form last modification date. The lower bound of date time range from which checkout forms will be taken. (optional) + * @param sort The results' sorting order. No prefix in the value means ascending order. `-` prefix means descending order. If you don't provide the sort parameter, the list is sorted by line item boughtAt date, descending. (optional) + * @return CheckoutForms + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request - Returned when request parameters contains illegal values. -
401 Unauthorized -
406 Not Acceptable -
422 Unprocessable Entity - Returned when limit or offset value is outside an acceptable range -
+ */ + public CheckoutForms getListOfOrdersUsingGET(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String status, @javax.annotation.Nullable String fulfillmentStatus, @javax.annotation.Nullable String fulfillmentShipmentSummaryLineItemsSent, @javax.annotation.Nullable OffsetDateTime lineItemsBoughtAtLte, @javax.annotation.Nullable OffsetDateTime lineItemsBoughtAtGte, @javax.annotation.Nullable String paymentId, @javax.annotation.Nullable String surchargesId, @javax.annotation.Nullable String deliveryMethodId, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable OffsetDateTime updatedAtLte, @javax.annotation.Nullable OffsetDateTime updatedAtGte, @javax.annotation.Nullable String sort) throws ApiException { + ApiResponse localVarResp = getListOfOrdersUsingGETWithHttpInfo(offset, limit, status, fulfillmentStatus, fulfillmentShipmentSummaryLineItemsSent, lineItemsBoughtAtLte, lineItemsBoughtAtGte, paymentId, surchargesId, deliveryMethodId, buyerLogin, marketplaceId, updatedAtLte, updatedAtGte, sort); + return localVarResp.getData(); + } + + /** + * Get the user's orders + * Use this resource to get an order list. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#lista-zamowien\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#order-list\" target=\"_blank\">EN</a>. + * @param offset Index of first returned checkout-form from all search results. (optional, default to 0) + * @param limit Maximum number of checkout-forms in response. (optional, default to 100) + * @param status Specify status value that checkout-forms must have to be included in the output. Allowed values are: * `BOUGHT`: purchase without checkout form filled in. * `FILLED_IN`: checkout form filled in but payment is not completed yet so data could still change. * `READY_FOR_PROCESSING`: payment completed. Purchase is ready for processing. * `CANCELLED`: purchase cancelled by buyer. (optional) + * @param fulfillmentStatus Specify seller status value that checkout-forms must have to be included in the output. Allowed values are: * `NEW` * `PROCESSING` * `READY_FOR_SHIPMENT` * `READY_FOR_PICKUP` * `SENT` * `PICKED_UP` * `CANCELLED` * `SUSPENDED` * `RETURNED`. (optional) + * @param fulfillmentShipmentSummaryLineItemsSent Specify filter for line items sending status. Allowed values are: * `NONE`: none of line items have tracking number specified * `SOME`: some of line items have tracking number specified * `ALL`: all of line items have tracking number specified. (optional) + * @param lineItemsBoughtAtLte Latest line item bought date. The upper bound of date time range from which checkout forms will be taken. (optional) + * @param lineItemsBoughtAtGte Latest line item bought date. The lower bound of date time range from which checkout forms will be taken. (optional) + * @param paymentId Find checkout-forms having specified payment id. (optional) + * @param surchargesId Find checkout-forms having specified surcharge id. (optional) + * @param deliveryMethodId Find checkout-forms having specified delivery method id. (optional) + * @param buyerLogin Find checkout-forms having specified buyer login. (optional) + * @param marketplaceId Find checkout-forms of orders purchased on specified marketplace. (optional) + * @param updatedAtLte Checkout form last modification date. The upper bound of date time range from which checkout forms will be taken. (optional) + * @param updatedAtGte Checkout form last modification date. The lower bound of date time range from which checkout forms will be taken. (optional) + * @param sort The results' sorting order. No prefix in the value means ascending order. `-` prefix means descending order. If you don't provide the sort parameter, the list is sorted by line item boughtAt date, descending. (optional) + * @return ApiResponse<CheckoutForms> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request - Returned when request parameters contains illegal values. -
401 Unauthorized -
406 Not Acceptable -
422 Unprocessable Entity - Returned when limit or offset value is outside an acceptable range -
+ */ + public ApiResponse getListOfOrdersUsingGETWithHttpInfo(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String status, @javax.annotation.Nullable String fulfillmentStatus, @javax.annotation.Nullable String fulfillmentShipmentSummaryLineItemsSent, @javax.annotation.Nullable OffsetDateTime lineItemsBoughtAtLte, @javax.annotation.Nullable OffsetDateTime lineItemsBoughtAtGte, @javax.annotation.Nullable String paymentId, @javax.annotation.Nullable String surchargesId, @javax.annotation.Nullable String deliveryMethodId, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable OffsetDateTime updatedAtLte, @javax.annotation.Nullable OffsetDateTime updatedAtGte, @javax.annotation.Nullable String sort) throws ApiException { + okhttp3.Call localVarCall = getListOfOrdersUsingGETValidateBeforeCall(offset, limit, status, fulfillmentStatus, fulfillmentShipmentSummaryLineItemsSent, lineItemsBoughtAtLte, lineItemsBoughtAtGte, paymentId, surchargesId, deliveryMethodId, buyerLogin, marketplaceId, updatedAtLte, updatedAtGte, sort, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's orders (asynchronously) + * Use this resource to get an order list. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#lista-zamowien\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#order-list\" target=\"_blank\">EN</a>. + * @param offset Index of first returned checkout-form from all search results. (optional, default to 0) + * @param limit Maximum number of checkout-forms in response. (optional, default to 100) + * @param status Specify status value that checkout-forms must have to be included in the output. Allowed values are: * `BOUGHT`: purchase without checkout form filled in. * `FILLED_IN`: checkout form filled in but payment is not completed yet so data could still change. * `READY_FOR_PROCESSING`: payment completed. Purchase is ready for processing. * `CANCELLED`: purchase cancelled by buyer. (optional) + * @param fulfillmentStatus Specify seller status value that checkout-forms must have to be included in the output. Allowed values are: * `NEW` * `PROCESSING` * `READY_FOR_SHIPMENT` * `READY_FOR_PICKUP` * `SENT` * `PICKED_UP` * `CANCELLED` * `SUSPENDED` * `RETURNED`. (optional) + * @param fulfillmentShipmentSummaryLineItemsSent Specify filter for line items sending status. Allowed values are: * `NONE`: none of line items have tracking number specified * `SOME`: some of line items have tracking number specified * `ALL`: all of line items have tracking number specified. (optional) + * @param lineItemsBoughtAtLte Latest line item bought date. The upper bound of date time range from which checkout forms will be taken. (optional) + * @param lineItemsBoughtAtGte Latest line item bought date. The lower bound of date time range from which checkout forms will be taken. (optional) + * @param paymentId Find checkout-forms having specified payment id. (optional) + * @param surchargesId Find checkout-forms having specified surcharge id. (optional) + * @param deliveryMethodId Find checkout-forms having specified delivery method id. (optional) + * @param buyerLogin Find checkout-forms having specified buyer login. (optional) + * @param marketplaceId Find checkout-forms of orders purchased on specified marketplace. (optional) + * @param updatedAtLte Checkout form last modification date. The upper bound of date time range from which checkout forms will be taken. (optional) + * @param updatedAtGte Checkout form last modification date. The lower bound of date time range from which checkout forms will be taken. (optional) + * @param sort The results' sorting order. No prefix in the value means ascending order. `-` prefix means descending order. If you don't provide the sort parameter, the list is sorted by line item boughtAt date, descending. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request - Returned when request parameters contains illegal values. -
401 Unauthorized -
406 Not Acceptable -
422 Unprocessable Entity - Returned when limit or offset value is outside an acceptable range -
+ */ + public okhttp3.Call getListOfOrdersUsingGETAsync(@javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String status, @javax.annotation.Nullable String fulfillmentStatus, @javax.annotation.Nullable String fulfillmentShipmentSummaryLineItemsSent, @javax.annotation.Nullable OffsetDateTime lineItemsBoughtAtLte, @javax.annotation.Nullable OffsetDateTime lineItemsBoughtAtGte, @javax.annotation.Nullable String paymentId, @javax.annotation.Nullable String surchargesId, @javax.annotation.Nullable String deliveryMethodId, @javax.annotation.Nullable String buyerLogin, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable OffsetDateTime updatedAtLte, @javax.annotation.Nullable OffsetDateTime updatedAtGte, @javax.annotation.Nullable String sort, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getListOfOrdersUsingGETValidateBeforeCall(offset, limit, status, fulfillmentStatus, fulfillmentShipmentSummaryLineItemsSent, lineItemsBoughtAtLte, lineItemsBoughtAtGte, paymentId, surchargesId, deliveryMethodId, buyerLogin, marketplaceId, updatedAtLte, updatedAtGte, sort, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderEventsStatisticsUsingGET + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ */ + public okhttp3.Call getOrderEventsStatisticsUsingGETCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/event-stats"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderEventsStatisticsUsingGETValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getOrderEventsStatisticsUsingGETCall(_callback); + + } + + /** + * Get order events statistics + * Use this resource to returns object that contains event id and occurrence date of the latest event. It gives you current starting point for reading events. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-znalezc-najnowsze-zdarzenie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-find-the-newest-event\" target=\"_blank\">EN</a>. + * @return OrderEventStats + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ */ + public OrderEventStats getOrderEventsStatisticsUsingGET() throws ApiException { + ApiResponse localVarResp = getOrderEventsStatisticsUsingGETWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get order events statistics + * Use this resource to returns object that contains event id and occurrence date of the latest event. It gives you current starting point for reading events. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-znalezc-najnowsze-zdarzenie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-find-the-newest-event\" target=\"_blank\">EN</a>. + * @return ApiResponse<OrderEventStats> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ */ + public ApiResponse getOrderEventsStatisticsUsingGETWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getOrderEventsStatisticsUsingGETValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get order events statistics (asynchronously) + * Use this resource to returns object that contains event id and occurrence date of the latest event. It gives you current starting point for reading events. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-znalezc-najnowsze-zdarzenie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-find-the-newest-event\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
+ */ + public okhttp3.Call getOrderEventsStatisticsUsingGETAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderEventsStatisticsUsingGETValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderEventsUsingGET + * @param from You can use the event ID to retrieve subsequent chunks of events. (optional) + * @param type Specify array of event types for filtering. Allowed values are: * `BOUGHT`: purchase without checkout form filled in * `FILLED_IN`: checkout form filled in but payment is not completed yet so data could still change * `READY_FOR_PROCESSING`: payment completed. Purchase is ready for processing * `BUYER_CANCELLED`: purchase was cancelled by buyer * `FULFILLMENT_STATUS_CHANGED`: fulfillment status changed * `AUTO_CANCELLED`: purchase was cancelled automatically by Allegro. (optional) + * @param limit The maximum number of events returned in the response. (optional, default to 100) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity - Returned when query parameters are incorrect. -
+ */ + public okhttp3.Call getOrderEventsUsingGETCall(@javax.annotation.Nullable String from, @javax.annotation.Nullable List type, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/events"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (from != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("from", from)); + } + + if (type != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "type", type)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderEventsUsingGETValidateBeforeCall(@javax.annotation.Nullable String from, @javax.annotation.Nullable List type, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + return getOrderEventsUsingGETCall(from, type, limit, _callback); + + } + + /** + * Get order events + * Use this resource to return events that allow you to monitor actions which clients perform, i.e. making a purchase, filling in the checkout form (FOD), finishing payment process, making a surcharge. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#dziennik-zdarzen\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#event-log\" target=\"_blank\">EN</a>. + * @param from You can use the event ID to retrieve subsequent chunks of events. (optional) + * @param type Specify array of event types for filtering. Allowed values are: * `BOUGHT`: purchase without checkout form filled in * `FILLED_IN`: checkout form filled in but payment is not completed yet so data could still change * `READY_FOR_PROCESSING`: payment completed. Purchase is ready for processing * `BUYER_CANCELLED`: purchase was cancelled by buyer * `FULFILLMENT_STATUS_CHANGED`: fulfillment status changed * `AUTO_CANCELLED`: purchase was cancelled automatically by Allegro. (optional) + * @param limit The maximum number of events returned in the response. (optional, default to 100) + * @return OrderEventsList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity - Returned when query parameters are incorrect. -
+ */ + public OrderEventsList getOrderEventsUsingGET(@javax.annotation.Nullable String from, @javax.annotation.Nullable List type, @javax.annotation.Nullable Integer limit) throws ApiException { + ApiResponse localVarResp = getOrderEventsUsingGETWithHttpInfo(from, type, limit); + return localVarResp.getData(); + } + + /** + * Get order events + * Use this resource to return events that allow you to monitor actions which clients perform, i.e. making a purchase, filling in the checkout form (FOD), finishing payment process, making a surcharge. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#dziennik-zdarzen\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#event-log\" target=\"_blank\">EN</a>. + * @param from You can use the event ID to retrieve subsequent chunks of events. (optional) + * @param type Specify array of event types for filtering. Allowed values are: * `BOUGHT`: purchase without checkout form filled in * `FILLED_IN`: checkout form filled in but payment is not completed yet so data could still change * `READY_FOR_PROCESSING`: payment completed. Purchase is ready for processing * `BUYER_CANCELLED`: purchase was cancelled by buyer * `FULFILLMENT_STATUS_CHANGED`: fulfillment status changed * `AUTO_CANCELLED`: purchase was cancelled automatically by Allegro. (optional) + * @param limit The maximum number of events returned in the response. (optional, default to 100) + * @return ApiResponse<OrderEventsList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity - Returned when query parameters are incorrect. -
+ */ + public ApiResponse getOrderEventsUsingGETWithHttpInfo(@javax.annotation.Nullable String from, @javax.annotation.Nullable List type, @javax.annotation.Nullable Integer limit) throws ApiException { + okhttp3.Call localVarCall = getOrderEventsUsingGETValidateBeforeCall(from, type, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get order events (asynchronously) + * Use this resource to return events that allow you to monitor actions which clients perform, i.e. making a purchase, filling in the checkout form (FOD), finishing payment process, making a surcharge. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#dziennik-zdarzen\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#event-log\" target=\"_blank\">EN</a>. + * @param from You can use the event ID to retrieve subsequent chunks of events. (optional) + * @param type Specify array of event types for filtering. Allowed values are: * `BOUGHT`: purchase without checkout form filled in * `FILLED_IN`: checkout form filled in but payment is not completed yet so data could still change * `READY_FOR_PROCESSING`: payment completed. Purchase is ready for processing * `BUYER_CANCELLED`: purchase was cancelled by buyer * `FULFILLMENT_STATUS_CHANGED`: fulfillment status changed * `AUTO_CANCELLED`: purchase was cancelled automatically by Allegro. (optional) + * @param limit The maximum number of events returned in the response. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity - Returned when query parameters are incorrect. -
+ */ + public okhttp3.Call getOrderEventsUsingGETAsync(@javax.annotation.Nullable String from, @javax.annotation.Nullable List type, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderEventsUsingGETValidateBeforeCall(from, type, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderInvoicesDetails + * @param id Order identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Invoices fetched successfully -
403 You do not have permission to access this order -
404 Order with given id does not exist -
+ */ + public okhttp3.Call getOrderInvoicesDetailsCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/checkout-forms/{id}/invoices" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderInvoicesDetailsValidateBeforeCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getOrderInvoicesDetails(Async)"); + } + + return getOrderInvoicesDetailsCall(id, _callback); + + } + + /** + * Get order invoices details + * Use to get invoices details including antivirus scan results and EPT invoice verification status. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-informacje-o-fakturach-dodanych-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#retrieve-information-about-invoices\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @return CheckoutFormsOrderInvoices + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Invoices fetched successfully -
403 You do not have permission to access this order -
404 Order with given id does not exist -
+ */ + public CheckoutFormsOrderInvoices getOrderInvoicesDetails(@javax.annotation.Nonnull String id) throws ApiException { + ApiResponse localVarResp = getOrderInvoicesDetailsWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get order invoices details + * Use to get invoices details including antivirus scan results and EPT invoice verification status. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-informacje-o-fakturach-dodanych-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#retrieve-information-about-invoices\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @return ApiResponse<CheckoutFormsOrderInvoices> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Invoices fetched successfully -
403 You do not have permission to access this order -
404 Order with given id does not exist -
+ */ + public ApiResponse getOrderInvoicesDetailsWithHttpInfo(@javax.annotation.Nonnull String id) throws ApiException { + okhttp3.Call localVarCall = getOrderInvoicesDetailsValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get order invoices details (asynchronously) + * Use to get invoices details including antivirus scan results and EPT invoice verification status. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-informacje-o-fakturach-dodanych-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#retrieve-information-about-invoices\" target=\"_blank\">EN</a>. + * @param id Order identifier. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Invoices fetched successfully -
403 You do not have permission to access this order -
404 Order with given id does not exist -
+ */ + public okhttp3.Call getOrderInvoicesDetailsAsync(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderInvoicesDetailsValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrderShipmentsUsingGET + * @param id Order identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns a list of parcel tracking numbers (shipments) -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
+ */ + public okhttp3.Call getOrderShipmentsUsingGETCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/checkout-forms/{id}/shipments" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrderShipmentsUsingGETValidateBeforeCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getOrderShipmentsUsingGET(Async)"); + } + + return getOrderShipmentsUsingGETCall(id, _callback); + + } + + /** + * Get a list of parcel tracking numbers + * Get a list of parcel tracking numbers currently assigned to the order. Orders can be retrieved using REST API resource GET /order/checkout-forms. Please note that the shipment list may contain parcel tracking numbers added through other channels such as Moje Allegro or by the carrier that delivers the parcel. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-numery-przesylek-dodane-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#retrieving-tracking-numbers\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @return CheckoutFormOrderWaybillResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns a list of parcel tracking numbers (shipments) -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
+ */ + public CheckoutFormOrderWaybillResponse getOrderShipmentsUsingGET(@javax.annotation.Nonnull String id) throws ApiException { + ApiResponse localVarResp = getOrderShipmentsUsingGETWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get a list of parcel tracking numbers + * Get a list of parcel tracking numbers currently assigned to the order. Orders can be retrieved using REST API resource GET /order/checkout-forms. Please note that the shipment list may contain parcel tracking numbers added through other channels such as Moje Allegro or by the carrier that delivers the parcel. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-numery-przesylek-dodane-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#retrieving-tracking-numbers\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @return ApiResponse<CheckoutFormOrderWaybillResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns a list of parcel tracking numbers (shipments) -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
+ */ + public ApiResponse getOrderShipmentsUsingGETWithHttpInfo(@javax.annotation.Nonnull String id) throws ApiException { + okhttp3.Call localVarCall = getOrderShipmentsUsingGETValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of parcel tracking numbers (asynchronously) + * Get a list of parcel tracking numbers currently assigned to the order. Orders can be retrieved using REST API resource GET /order/checkout-forms. Please note that the shipment list may contain parcel tracking numbers added through other channels such as Moje Allegro or by the carrier that delivers the parcel. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-numery-przesylek-dodane-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#retrieving-tracking-numbers\" target=\"_blank\">EN</a>. + * @param id Order identifier. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns a list of parcel tracking numbers (shipments) -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
+ */ + public okhttp3.Call getOrderShipmentsUsingGETAsync(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrderShipmentsUsingGETValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrdersCarriersUsingGET + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 List of available shipping carriers. -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call getOrdersCarriersUsingGETCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/carriers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrdersCarriersUsingGETValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getOrdersCarriersUsingGETCall(_callback); + + } + + /** + * Get a list of available shipping carriers + * Shipping carriers are essential to provide accurate tracking experience for customers. Use this resource to get a list of all available shipping carriers. The response of this resource can be stored in accordance with returned caching headers. Read more: <a href=\"../../news/nowy-zasob-do-pobrania-identyfikatorow-przewoznikow-8dmljjGRGUE\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resource-to-retrieve-available-delivery-company-id-VL6zDDdr4hk\" target=\"_blank\">EN</a>. + * @return OrdersShippingCarriersResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 List of available shipping carriers. -
401 Unauthorized -
404 Not Found -
+ */ + public OrdersShippingCarriersResponse getOrdersCarriersUsingGET() throws ApiException { + ApiResponse localVarResp = getOrdersCarriersUsingGETWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get a list of available shipping carriers + * Shipping carriers are essential to provide accurate tracking experience for customers. Use this resource to get a list of all available shipping carriers. The response of this resource can be stored in accordance with returned caching headers. Read more: <a href=\"../../news/nowy-zasob-do-pobrania-identyfikatorow-przewoznikow-8dmljjGRGUE\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resource-to-retrieve-available-delivery-company-id-VL6zDDdr4hk\" target=\"_blank\">EN</a>. + * @return ApiResponse<OrdersShippingCarriersResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 List of available shipping carriers. -
401 Unauthorized -
404 Not Found -
+ */ + public ApiResponse getOrdersCarriersUsingGETWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getOrdersCarriersUsingGETValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of available shipping carriers (asynchronously) + * Shipping carriers are essential to provide accurate tracking experience for customers. Use this resource to get a list of all available shipping carriers. The response of this resource can be stored in accordance with returned caching headers. Read more: <a href=\"../../news/nowy-zasob-do-pobrania-identyfikatorow-przewoznikow-8dmljjGRGUE\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resource-to-retrieve-available-delivery-company-id-VL6zDDdr4hk\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 List of available shipping carriers. -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call getOrdersCarriersUsingGETAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrdersCarriersUsingGETValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOrdersDetailsUsingGET + * @param id Checkout form identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
406 Not Acceptable -
422 Unprocessable Entity - Returned when order id is malformed UUID. -
+ */ + public okhttp3.Call getOrdersDetailsUsingGETCall(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/checkout-forms/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrdersDetailsUsingGETValidateBeforeCall(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getOrdersDetailsUsingGET(Async)"); + } + + return getOrdersDetailsUsingGETCall(id, _callback); + + } + + /** + * Get an order's details + * Use this resource to get an order details. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#szczegoly-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#order-details\" target=\"_blank\">EN</a>. + * @param id Checkout form identifier. (required) + * @return CheckoutForm + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
406 Not Acceptable -
422 Unprocessable Entity - Returned when order id is malformed UUID. -
+ */ + public CheckoutForm getOrdersDetailsUsingGET(@javax.annotation.Nonnull UUID id) throws ApiException { + ApiResponse localVarResp = getOrdersDetailsUsingGETWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get an order's details + * Use this resource to get an order details. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#szczegoly-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#order-details\" target=\"_blank\">EN</a>. + * @param id Checkout form identifier. (required) + * @return ApiResponse<CheckoutForm> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
406 Not Acceptable -
422 Unprocessable Entity - Returned when order id is malformed UUID. -
+ */ + public ApiResponse getOrdersDetailsUsingGETWithHttpInfo(@javax.annotation.Nonnull UUID id) throws ApiException { + okhttp3.Call localVarCall = getOrdersDetailsUsingGETValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get an order's details (asynchronously) + * Use this resource to get an order details. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#szczegoly-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#order-details\" target=\"_blank\">EN</a>. + * @param id Checkout form identifier. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
406 Not Acceptable -
422 Unprocessable Entity - Returned when order id is malformed UUID. -
+ */ + public okhttp3.Call getOrdersDetailsUsingGETAsync(@javax.annotation.Nonnull UUID id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrdersDetailsUsingGETValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getParcelTrackingUsingGET + * @param carrierId Carrier identifier. (required) + * @param waybill Waybill number (parcel tracking number). Example: `waybill=AAA0000E5D201&waybill=BBB00000E5D202` - returns parcel tracking history for `AAA0000E5D201` as well as for `BBB00000E5D202`. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns parcel tracking history for given waybills -
400 Bad request, e.g. unknown carrier id, missing or too many waybills in query parameter -
401 Unauthorized, e.g. token is expired -
+ */ + public okhttp3.Call getParcelTrackingUsingGETCall(@javax.annotation.Nonnull String carrierId, @javax.annotation.Nonnull List waybill, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/order/carriers/{carrierId}/tracking" + .replace("{" + "carrierId" + "}", localVarApiClient.escapeString(carrierId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (waybill != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "waybill", waybill)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getParcelTrackingUsingGETValidateBeforeCall(@javax.annotation.Nonnull String carrierId, @javax.annotation.Nonnull List waybill, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'carrierId' is set + if (carrierId == null) { + throw new ApiException("Missing the required parameter 'carrierId' when calling getParcelTrackingUsingGET(Async)"); + } + + // verify the required parameter 'waybill' is set + if (waybill == null) { + throw new ApiException("Missing the required parameter 'waybill' when calling getParcelTrackingUsingGET(Async)"); + } + + return getParcelTrackingUsingGETCall(carrierId, waybill, _callback); + + } + + /** + * Get carrier parcel tracking history + * Get tracking history for parcels. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-historie-statusow-przesylek\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-parcels-statuses-history\" target=\"_blank\">EN</a>. + * @param carrierId Carrier identifier. (required) + * @param waybill Waybill number (parcel tracking number). Example: `waybill=AAA0000E5D201&waybill=BBB00000E5D202` - returns parcel tracking history for `AAA0000E5D201` as well as for `BBB00000E5D202`. (required) + * @return CarrierParcelTrackingResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns parcel tracking history for given waybills -
400 Bad request, e.g. unknown carrier id, missing or too many waybills in query parameter -
401 Unauthorized, e.g. token is expired -
+ */ + public CarrierParcelTrackingResponse getParcelTrackingUsingGET(@javax.annotation.Nonnull String carrierId, @javax.annotation.Nonnull List waybill) throws ApiException { + ApiResponse localVarResp = getParcelTrackingUsingGETWithHttpInfo(carrierId, waybill); + return localVarResp.getData(); + } + + /** + * Get carrier parcel tracking history + * Get tracking history for parcels. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-historie-statusow-przesylek\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-parcels-statuses-history\" target=\"_blank\">EN</a>. + * @param carrierId Carrier identifier. (required) + * @param waybill Waybill number (parcel tracking number). Example: `waybill=AAA0000E5D201&waybill=BBB00000E5D202` - returns parcel tracking history for `AAA0000E5D201` as well as for `BBB00000E5D202`. (required) + * @return ApiResponse<CarrierParcelTrackingResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns parcel tracking history for given waybills -
400 Bad request, e.g. unknown carrier id, missing or too many waybills in query parameter -
401 Unauthorized, e.g. token is expired -
+ */ + public ApiResponse getParcelTrackingUsingGETWithHttpInfo(@javax.annotation.Nonnull String carrierId, @javax.annotation.Nonnull List waybill) throws ApiException { + okhttp3.Call localVarCall = getParcelTrackingUsingGETValidateBeforeCall(carrierId, waybill, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get carrier parcel tracking history (asynchronously) + * Get tracking history for parcels. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-historie-statusow-przesylek\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-parcels-statuses-history\" target=\"_blank\">EN</a>. + * @param carrierId Carrier identifier. (required) + * @param waybill Waybill number (parcel tracking number). Example: `waybill=AAA0000E5D201&waybill=BBB00000E5D202` - returns parcel tracking history for `AAA0000E5D201` as well as for `BBB00000E5D202`. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns parcel tracking history for given waybills -
400 Bad request, e.g. unknown carrier id, missing or too many waybills in query parameter -
401 Unauthorized, e.g. token is expired -
+ */ + public okhttp3.Call getParcelTrackingUsingGETAsync(@javax.annotation.Nonnull String carrierId, @javax.annotation.Nonnull List waybill, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getParcelTrackingUsingGETValidateBeforeCall(carrierId, waybill, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for setOrderFulfillmentUsingPUT + * @param id Order identifier. (required) + * @param checkoutFormFulfillment request (required) + * @param checkoutFormRevision Checkout form revision. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Fulfillment set successfully -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
409 Conflict. Provided revision is outdated. -
422 Some of the provided data is invalid, e.g. unrecognized status value or given status is not allowed to be set (e.g. `RETURNED` status). -
+ */ + public okhttp3.Call setOrderFulfillmentUsingPUTCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckoutFormFulfillment checkoutFormFulfillment, @javax.annotation.Nullable String checkoutFormRevision, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = checkoutFormFulfillment; + + // create path and map variables + String localVarPath = "/order/checkout-forms/{id}/fulfillment" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (checkoutFormRevision != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("checkoutForm.revision", checkoutFormRevision)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call setOrderFulfillmentUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckoutFormFulfillment checkoutFormFulfillment, @javax.annotation.Nullable String checkoutFormRevision, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling setOrderFulfillmentUsingPUT(Async)"); + } + + // verify the required parameter 'checkoutFormFulfillment' is set + if (checkoutFormFulfillment == null) { + throw new ApiException("Missing the required parameter 'checkoutFormFulfillment' when calling setOrderFulfillmentUsingPUT(Async)"); + } + + return setOrderFulfillmentUsingPUTCall(id, checkoutFormFulfillment, checkoutFormRevision, _callback); + + } + + /** + * Set seller order status + * Use to set seller order status. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#zmiana-statusu-realizacji-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#order-fulfillment-status-change\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param checkoutFormFulfillment request (required) + * @param checkoutFormRevision Checkout form revision. (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Fulfillment set successfully -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
409 Conflict. Provided revision is outdated. -
422 Some of the provided data is invalid, e.g. unrecognized status value or given status is not allowed to be set (e.g. `RETURNED` status). -
+ */ + public void setOrderFulfillmentUsingPUT(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckoutFormFulfillment checkoutFormFulfillment, @javax.annotation.Nullable String checkoutFormRevision) throws ApiException { + setOrderFulfillmentUsingPUTWithHttpInfo(id, checkoutFormFulfillment, checkoutFormRevision); + } + + /** + * Set seller order status + * Use to set seller order status. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#zmiana-statusu-realizacji-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#order-fulfillment-status-change\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param checkoutFormFulfillment request (required) + * @param checkoutFormRevision Checkout form revision. (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Fulfillment set successfully -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
409 Conflict. Provided revision is outdated. -
422 Some of the provided data is invalid, e.g. unrecognized status value or given status is not allowed to be set (e.g. `RETURNED` status). -
+ */ + public ApiResponse setOrderFulfillmentUsingPUTWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckoutFormFulfillment checkoutFormFulfillment, @javax.annotation.Nullable String checkoutFormRevision) throws ApiException { + okhttp3.Call localVarCall = setOrderFulfillmentUsingPUTValidateBeforeCall(id, checkoutFormFulfillment, checkoutFormRevision, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Set seller order status (asynchronously) + * Use to set seller order status. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#zmiana-statusu-realizacji-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#order-fulfillment-status-change\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param checkoutFormFulfillment request (required) + * @param checkoutFormRevision Checkout form revision. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 Fulfillment set successfully -
401 Authentication failed, e.g. token is expired -
404 Order not found or doesn’t belong to the seller -
409 Conflict. Provided revision is outdated. -
422 Some of the provided data is invalid, e.g. unrecognized status value or given status is not allowed to be set (e.g. `RETURNED` status). -
+ */ + public okhttp3.Call setOrderFulfillmentUsingPUTAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull CheckoutFormFulfillment checkoutFormFulfillment, @javax.annotation.Nullable String checkoutFormRevision, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = setOrderFulfillmentUsingPUTValidateBeforeCall(id, checkoutFormFulfillment, checkoutFormRevision, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for uploadOrderInvoiceFile + * @param id Order identifier. (required) + * @param invoiceId Invoice identifier. (required) + * @param body (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Invoice file uploaded successfully -
403 You do not have permission to access this order -
404 Order or invoice with given id does not exist -
409 Invoice with given id already has invoice file uploaded -
413 The file is too large. Max file size is 3MB -
422 Uploaded file is empty or order's payment is rejected -
+ */ + public okhttp3.Call uploadOrderInvoiceFileCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull String invoiceId, @javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/order/checkout-forms/{id}/invoices/{invoiceId}/file" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())) + .replace("{" + "invoiceId" + "}", localVarApiClient.escapeString(invoiceId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/pdf" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadOrderInvoiceFileValidateBeforeCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull String invoiceId, @javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling uploadOrderInvoiceFile(Async)"); + } + + // verify the required parameter 'invoiceId' is set + if (invoiceId == null) { + throw new ApiException("Missing the required parameter 'invoiceId' when calling uploadOrderInvoiceFile(Async)"); + } + + return uploadOrderInvoiceFileCall(id, invoiceId, body, _callback); + + } + + /** + * Upload invoice file + * Use to upload invoice file to match created invoice metadata. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-dodac-fakture-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#add-an-invoice-to-the-order\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param invoiceId Invoice identifier. (required) + * @param body (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Invoice file uploaded successfully -
403 You do not have permission to access this order -
404 Order or invoice with given id does not exist -
409 Invoice with given id already has invoice file uploaded -
413 The file is too large. Max file size is 3MB -
422 Uploaded file is empty or order's payment is rejected -
+ */ + public void uploadOrderInvoiceFile(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull String invoiceId, @javax.annotation.Nullable File body) throws ApiException { + uploadOrderInvoiceFileWithHttpInfo(id, invoiceId, body); + } + + /** + * Upload invoice file + * Use to upload invoice file to match created invoice metadata. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-dodac-fakture-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#add-an-invoice-to-the-order\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param invoiceId Invoice identifier. (required) + * @param body (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Invoice file uploaded successfully -
403 You do not have permission to access this order -
404 Order or invoice with given id does not exist -
409 Invoice with given id already has invoice file uploaded -
413 The file is too large. Max file size is 3MB -
422 Uploaded file is empty or order's payment is rejected -
+ */ + public ApiResponse uploadOrderInvoiceFileWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull String invoiceId, @javax.annotation.Nullable File body) throws ApiException { + okhttp3.Call localVarCall = uploadOrderInvoiceFileValidateBeforeCall(id, invoiceId, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Upload invoice file (asynchronously) + * Use to upload invoice file to match created invoice metadata. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-dodac-fakture-do-zamowienia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#add-an-invoice-to-the-order\" target=\"_blank\">EN</a>. + * @param id Order identifier. (required) + * @param invoiceId Invoice identifier. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Invoice file uploaded successfully -
403 You do not have permission to access this order -
404 Order or invoice with given id does not exist -
409 Invoice with given id already has invoice file uploaded -
413 The file is too large. Max file size is 3MB -
422 Uploaded file is empty or order's payment is rejected -
+ */ + public okhttp3.Call uploadOrderInvoiceFileAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull String invoiceId, @javax.annotation.Nullable File body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadOrderInvoiceFileValidateBeforeCall(id, invoiceId, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/PaymentsApi.java b/src/main/java/pl/wtx/allegro/api/client/PaymentsApi.java new file mode 100644 index 0000000..0b0bfd1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/PaymentsApi.java @@ -0,0 +1,631 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.GetOfferSmartClassificationGET403Response; +import pl.wtx.allegro.api.client.model.GetRefundedPayments200Response; +import pl.wtx.allegro.api.client.model.InitializeRefund; +import java.time.OffsetDateTime; +import pl.wtx.allegro.api.client.model.PaymentOperations; +import pl.wtx.allegro.api.client.model.RefundDetails; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PaymentsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PaymentsApi() { + this(Configuration.getDefaultApiClient()); + } + + public PaymentsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getPaymentsOperationHistory + * @param walletType Type of the wallet: * AVAILABLE - operations available for payout. * WAITING - operations temporarily suspended for payout. (optional, default to AVAILABLE) + * @param walletPaymentOperator Payment operator: * PAYU - operations processed by PAYU operator. * P24 - operations processed by PRZELEWY24 operator. * AF - operations processed by Allegro Finance operator. * AF_P24 - operations processed by Allegro Finance with PRZELEWY24. * AF_PAYU - operations processed by Allegro Finance with PAYU. (optional) + * @param paymentId The payment ID. (optional) + * @param participantLogin Login of the participant. In case of REFUND_INCREASE operation this is the login of the seller, in other cases, of the buyer. (optional) + * @param occurredAtGte The minimum date and time of operation occurrence in ISO 8601 format. (optional) + * @param occurredAtLte The maximum date and time of operation occurrence in ISO 8601 format. (optional) + * @param group Group of operation types: * INCOME - CONTRIBUTION, SURCHARGE, CORRECTION, DEDUCTION_INCREASE, COMPENSATION. * OUTCOME - PAYOUT, PAYOUT_CANCEL, DEDUCTION_CHARGE. * REFUND - REFUND_CHARGE, REFUND_CANCEL, REFUND_INCREASE, CORRECTION, PROVIDER_REFUND_TRANSFER_CHARGE, PROVIDER_REFUND_TRANSFER_INCREASE. * BLOCKADES - BLOCKADE, BLOCKADE_RELEASE. (optional) + * @param marketplaceId The marketplace ID where operation was made. When the parameter is omitted, searches for operations with all marketplaces. Note, that there are operations not assigned to any marketplace. (optional) + * @param currency Currency of the operations. (optional) + * @param limit Number of returned operations. (optional, default to 50) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
401 Unauthorized -
200 The payment operations history for given search criteria returned successfully. -
422 Returned when any of the given search parameters have an invalid value or when the search result reached the limit of found operations - 10000. -
+ */ + public okhttp3.Call getPaymentsOperationHistoryCall(@javax.annotation.Nullable String walletType, @javax.annotation.Nullable String walletPaymentOperator, @javax.annotation.Nullable UUID paymentId, @javax.annotation.Nullable String participantLogin, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List group, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String currency, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/payments/payment-operations"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (walletType != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("wallet.type", walletType)); + } + + if (walletPaymentOperator != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("wallet.paymentOperator", walletPaymentOperator)); + } + + if (paymentId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("payment.id", paymentId)); + } + + if (participantLogin != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("participant.login", participantLogin)); + } + + if (occurredAtGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("occurredAt.gte", occurredAtGte)); + } + + if (occurredAtLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("occurredAt.lte", occurredAtLte)); + } + + if (group != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "group", group)); + } + + if (marketplaceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplaceId", marketplaceId)); + } + + if (currency != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("currency", currency)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPaymentsOperationHistoryValidateBeforeCall(@javax.annotation.Nullable String walletType, @javax.annotation.Nullable String walletPaymentOperator, @javax.annotation.Nullable UUID paymentId, @javax.annotation.Nullable String participantLogin, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List group, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String currency, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + return getPaymentsOperationHistoryCall(walletType, walletPaymentOperator, paymentId, participantLogin, occurredAtGte, occurredAtLte, group, marketplaceId, currency, limit, offset, _callback); + + } + + /** + * Payment operations history + * Use this endpoint to get the list of the seller payment operations. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#historia-operacji-platniczych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#payment-operations\" target=\"_blank\">EN</a>. + * @param walletType Type of the wallet: * AVAILABLE - operations available for payout. * WAITING - operations temporarily suspended for payout. (optional, default to AVAILABLE) + * @param walletPaymentOperator Payment operator: * PAYU - operations processed by PAYU operator. * P24 - operations processed by PRZELEWY24 operator. * AF - operations processed by Allegro Finance operator. * AF_P24 - operations processed by Allegro Finance with PRZELEWY24. * AF_PAYU - operations processed by Allegro Finance with PAYU. (optional) + * @param paymentId The payment ID. (optional) + * @param participantLogin Login of the participant. In case of REFUND_INCREASE operation this is the login of the seller, in other cases, of the buyer. (optional) + * @param occurredAtGte The minimum date and time of operation occurrence in ISO 8601 format. (optional) + * @param occurredAtLte The maximum date and time of operation occurrence in ISO 8601 format. (optional) + * @param group Group of operation types: * INCOME - CONTRIBUTION, SURCHARGE, CORRECTION, DEDUCTION_INCREASE, COMPENSATION. * OUTCOME - PAYOUT, PAYOUT_CANCEL, DEDUCTION_CHARGE. * REFUND - REFUND_CHARGE, REFUND_CANCEL, REFUND_INCREASE, CORRECTION, PROVIDER_REFUND_TRANSFER_CHARGE, PROVIDER_REFUND_TRANSFER_INCREASE. * BLOCKADES - BLOCKADE, BLOCKADE_RELEASE. (optional) + * @param marketplaceId The marketplace ID where operation was made. When the parameter is omitted, searches for operations with all marketplaces. Note, that there are operations not assigned to any marketplace. (optional) + * @param currency Currency of the operations. (optional) + * @param limit Number of returned operations. (optional, default to 50) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @return PaymentOperations + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
401 Unauthorized -
200 The payment operations history for given search criteria returned successfully. -
422 Returned when any of the given search parameters have an invalid value or when the search result reached the limit of found operations - 10000. -
+ */ + public PaymentOperations getPaymentsOperationHistory(@javax.annotation.Nullable String walletType, @javax.annotation.Nullable String walletPaymentOperator, @javax.annotation.Nullable UUID paymentId, @javax.annotation.Nullable String participantLogin, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List group, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String currency, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getPaymentsOperationHistoryWithHttpInfo(walletType, walletPaymentOperator, paymentId, participantLogin, occurredAtGte, occurredAtLte, group, marketplaceId, currency, limit, offset); + return localVarResp.getData(); + } + + /** + * Payment operations history + * Use this endpoint to get the list of the seller payment operations. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#historia-operacji-platniczych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#payment-operations\" target=\"_blank\">EN</a>. + * @param walletType Type of the wallet: * AVAILABLE - operations available for payout. * WAITING - operations temporarily suspended for payout. (optional, default to AVAILABLE) + * @param walletPaymentOperator Payment operator: * PAYU - operations processed by PAYU operator. * P24 - operations processed by PRZELEWY24 operator. * AF - operations processed by Allegro Finance operator. * AF_P24 - operations processed by Allegro Finance with PRZELEWY24. * AF_PAYU - operations processed by Allegro Finance with PAYU. (optional) + * @param paymentId The payment ID. (optional) + * @param participantLogin Login of the participant. In case of REFUND_INCREASE operation this is the login of the seller, in other cases, of the buyer. (optional) + * @param occurredAtGte The minimum date and time of operation occurrence in ISO 8601 format. (optional) + * @param occurredAtLte The maximum date and time of operation occurrence in ISO 8601 format. (optional) + * @param group Group of operation types: * INCOME - CONTRIBUTION, SURCHARGE, CORRECTION, DEDUCTION_INCREASE, COMPENSATION. * OUTCOME - PAYOUT, PAYOUT_CANCEL, DEDUCTION_CHARGE. * REFUND - REFUND_CHARGE, REFUND_CANCEL, REFUND_INCREASE, CORRECTION, PROVIDER_REFUND_TRANSFER_CHARGE, PROVIDER_REFUND_TRANSFER_INCREASE. * BLOCKADES - BLOCKADE, BLOCKADE_RELEASE. (optional) + * @param marketplaceId The marketplace ID where operation was made. When the parameter is omitted, searches for operations with all marketplaces. Note, that there are operations not assigned to any marketplace. (optional) + * @param currency Currency of the operations. (optional) + * @param limit Number of returned operations. (optional, default to 50) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @return ApiResponse<PaymentOperations> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
401 Unauthorized -
200 The payment operations history for given search criteria returned successfully. -
422 Returned when any of the given search parameters have an invalid value or when the search result reached the limit of found operations - 10000. -
+ */ + public ApiResponse getPaymentsOperationHistoryWithHttpInfo(@javax.annotation.Nullable String walletType, @javax.annotation.Nullable String walletPaymentOperator, @javax.annotation.Nullable UUID paymentId, @javax.annotation.Nullable String participantLogin, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List group, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String currency, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getPaymentsOperationHistoryValidateBeforeCall(walletType, walletPaymentOperator, paymentId, participantLogin, occurredAtGte, occurredAtLte, group, marketplaceId, currency, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Payment operations history (asynchronously) + * Use this endpoint to get the list of the seller payment operations. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#historia-operacji-platniczych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#payment-operations\" target=\"_blank\">EN</a>. + * @param walletType Type of the wallet: * AVAILABLE - operations available for payout. * WAITING - operations temporarily suspended for payout. (optional, default to AVAILABLE) + * @param walletPaymentOperator Payment operator: * PAYU - operations processed by PAYU operator. * P24 - operations processed by PRZELEWY24 operator. * AF - operations processed by Allegro Finance operator. * AF_P24 - operations processed by Allegro Finance with PRZELEWY24. * AF_PAYU - operations processed by Allegro Finance with PAYU. (optional) + * @param paymentId The payment ID. (optional) + * @param participantLogin Login of the participant. In case of REFUND_INCREASE operation this is the login of the seller, in other cases, of the buyer. (optional) + * @param occurredAtGte The minimum date and time of operation occurrence in ISO 8601 format. (optional) + * @param occurredAtLte The maximum date and time of operation occurrence in ISO 8601 format. (optional) + * @param group Group of operation types: * INCOME - CONTRIBUTION, SURCHARGE, CORRECTION, DEDUCTION_INCREASE, COMPENSATION. * OUTCOME - PAYOUT, PAYOUT_CANCEL, DEDUCTION_CHARGE. * REFUND - REFUND_CHARGE, REFUND_CANCEL, REFUND_INCREASE, CORRECTION, PROVIDER_REFUND_TRANSFER_CHARGE, PROVIDER_REFUND_TRANSFER_INCREASE. * BLOCKADES - BLOCKADE, BLOCKADE_RELEASE. (optional) + * @param marketplaceId The marketplace ID where operation was made. When the parameter is omitted, searches for operations with all marketplaces. Note, that there are operations not assigned to any marketplace. (optional) + * @param currency Currency of the operations. (optional) + * @param limit Number of returned operations. (optional, default to 50) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
401 Unauthorized -
200 The payment operations history for given search criteria returned successfully. -
422 Returned when any of the given search parameters have an invalid value or when the search result reached the limit of found operations - 10000. -
+ */ + public okhttp3.Call getPaymentsOperationHistoryAsync(@javax.annotation.Nullable String walletType, @javax.annotation.Nullable String walletPaymentOperator, @javax.annotation.Nullable UUID paymentId, @javax.annotation.Nullable String participantLogin, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List group, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String currency, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPaymentsOperationHistoryValidateBeforeCall(walletType, walletPaymentOperator, paymentId, participantLogin, occurredAtGte, occurredAtLte, group, marketplaceId, currency, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getRefundedPayments + * @param limit Number of returned operations. (optional, default to 50) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @param id ID of the refund. (optional) + * @param paymentId ID of the payment. (optional) + * @param orderId ID of the order. (optional) + * @param occurredAtGte Minimum date and time when the refund occurred provided in ISO 8601 format. (optional) + * @param occurredAtLte Maximum date and time when the refund occurred provided in ISO 8601 format. (optional) + * @param status Current status of payment refund. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of payments refunds returned successfully. -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity. Returned when any of the given search parameters have an invalid value. -
+ */ + public okhttp3.Call getRefundedPaymentsCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable UUID id, @javax.annotation.Nullable UUID paymentId, @javax.annotation.Nullable UUID orderId, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List status, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/payments/refunds"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (id != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("id", id)); + } + + if (paymentId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("payment.id", paymentId)); + } + + if (orderId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("order.id", orderId)); + } + + if (occurredAtGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("occurredAt.gte", occurredAtGte)); + } + + if (occurredAtLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("occurredAt.lte", occurredAtLte)); + } + + if (status != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "status", status)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getRefundedPaymentsValidateBeforeCall(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable UUID id, @javax.annotation.Nullable UUID paymentId, @javax.annotation.Nullable UUID orderId, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List status, final ApiCallback _callback) throws ApiException { + return getRefundedPaymentsCall(limit, offset, id, paymentId, orderId, occurredAtGte, occurredAtLte, status, _callback); + + } + + /** + * Get a list of refunded payments + * Get a list of refunded payments. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-liste-zwrotow-platnosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-a-list-of-refunded-payment\" target=\"_blank\">EN</a>. + * @param limit Number of returned operations. (optional, default to 50) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @param id ID of the refund. (optional) + * @param paymentId ID of the payment. (optional) + * @param orderId ID of the order. (optional) + * @param occurredAtGte Minimum date and time when the refund occurred provided in ISO 8601 format. (optional) + * @param occurredAtLte Maximum date and time when the refund occurred provided in ISO 8601 format. (optional) + * @param status Current status of payment refund. (optional) + * @return GetRefundedPayments200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of payments refunds returned successfully. -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity. Returned when any of the given search parameters have an invalid value. -
+ */ + public GetRefundedPayments200Response getRefundedPayments(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable UUID id, @javax.annotation.Nullable UUID paymentId, @javax.annotation.Nullable UUID orderId, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List status) throws ApiException { + ApiResponse localVarResp = getRefundedPaymentsWithHttpInfo(limit, offset, id, paymentId, orderId, occurredAtGte, occurredAtLte, status); + return localVarResp.getData(); + } + + /** + * Get a list of refunded payments + * Get a list of refunded payments. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-liste-zwrotow-platnosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-a-list-of-refunded-payment\" target=\"_blank\">EN</a>. + * @param limit Number of returned operations. (optional, default to 50) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @param id ID of the refund. (optional) + * @param paymentId ID of the payment. (optional) + * @param orderId ID of the order. (optional) + * @param occurredAtGte Minimum date and time when the refund occurred provided in ISO 8601 format. (optional) + * @param occurredAtLte Maximum date and time when the refund occurred provided in ISO 8601 format. (optional) + * @param status Current status of payment refund. (optional) + * @return ApiResponse<GetRefundedPayments200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of payments refunds returned successfully. -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity. Returned when any of the given search parameters have an invalid value. -
+ */ + public ApiResponse getRefundedPaymentsWithHttpInfo(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable UUID id, @javax.annotation.Nullable UUID paymentId, @javax.annotation.Nullable UUID orderId, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List status) throws ApiException { + okhttp3.Call localVarCall = getRefundedPaymentsValidateBeforeCall(limit, offset, id, paymentId, orderId, occurredAtGte, occurredAtLte, status, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a list of refunded payments (asynchronously) + * Get a list of refunded payments. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-pobrac-liste-zwrotow-platnosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-retrieve-a-list-of-refunded-payment\" target=\"_blank\">EN</a>. + * @param limit Number of returned operations. (optional, default to 50) + * @param offset Index of the first returned payment operation from all search results. (optional, default to 0) + * @param id ID of the refund. (optional) + * @param paymentId ID of the payment. (optional) + * @param orderId ID of the order. (optional) + * @param occurredAtGte Minimum date and time when the refund occurred provided in ISO 8601 format. (optional) + * @param occurredAtLte Maximum date and time when the refund occurred provided in ISO 8601 format. (optional) + * @param status Current status of payment refund. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 List of payments refunds returned successfully. -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity. Returned when any of the given search parameters have an invalid value. -
+ */ + public okhttp3.Call getRefundedPaymentsAsync(@javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable UUID id, @javax.annotation.Nullable UUID paymentId, @javax.annotation.Nullable UUID orderId, @javax.annotation.Nullable OffsetDateTime occurredAtGte, @javax.annotation.Nullable OffsetDateTime occurredAtLte, @javax.annotation.Nullable List status, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getRefundedPaymentsValidateBeforeCall(limit, offset, id, paymentId, orderId, occurredAtGte, occurredAtLte, status, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for initiateRefund + * @param initializeRefund (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Refund request created successfully. -
400 Syntactically incorrect request. -
401 Unauthorized. -
422 Unprocessable Entity. -
403 Forbidden -
404 Payment not found. -
+ */ + public okhttp3.Call initiateRefundCall(@javax.annotation.Nullable InitializeRefund initializeRefund, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = initializeRefund; + + // create path and map variables + String localVarPath = "/payments/refunds"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call initiateRefundValidateBeforeCall(@javax.annotation.Nullable InitializeRefund initializeRefund, final ApiCallback _callback) throws ApiException { + return initiateRefundCall(initializeRefund, _callback); + + } + + /** + * Initiate a refund of a payment + * Use this endpoint to initiate a refund of a payment. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-wykonac-zwrot-platnosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-refund-a-payment\" target=\"_blank\">EN</a>. + * @param initializeRefund (optional) + * @return RefundDetails + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Refund request created successfully. -
400 Syntactically incorrect request. -
401 Unauthorized. -
422 Unprocessable Entity. -
403 Forbidden -
404 Payment not found. -
+ */ + public RefundDetails initiateRefund(@javax.annotation.Nullable InitializeRefund initializeRefund) throws ApiException { + ApiResponse localVarResp = initiateRefundWithHttpInfo(initializeRefund); + return localVarResp.getData(); + } + + /** + * Initiate a refund of a payment + * Use this endpoint to initiate a refund of a payment. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-wykonac-zwrot-platnosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-refund-a-payment\" target=\"_blank\">EN</a>. + * @param initializeRefund (optional) + * @return ApiResponse<RefundDetails> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Refund request created successfully. -
400 Syntactically incorrect request. -
401 Unauthorized. -
422 Unprocessable Entity. -
403 Forbidden -
404 Payment not found. -
+ */ + public ApiResponse initiateRefundWithHttpInfo(@javax.annotation.Nullable InitializeRefund initializeRefund) throws ApiException { + okhttp3.Call localVarCall = initiateRefundValidateBeforeCall(initializeRefund, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Initiate a refund of a payment (asynchronously) + * Use this endpoint to initiate a refund of a payment. Read more: <a href=\"../../tutorials/jak-obslugiwac-zamowienia-GRaj0qyvwtR#jak-wykonac-zwrot-platnosci\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/process-orders-PgPMlWDr8Cv#how-to-refund-a-payment\" target=\"_blank\">EN</a>. + * @param initializeRefund (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Refund request created successfully. -
400 Syntactically incorrect request. -
401 Unauthorized. -
422 Unprocessable Entity. -
403 Forbidden -
404 Payment not found. -
+ */ + public okhttp3.Call initiateRefundAsync(@javax.annotation.Nullable InitializeRefund initializeRefund, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = initiateRefundValidateBeforeCall(initializeRefund, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/PointsOfServiceApi.java b/src/main/java/pl/wtx/allegro/api/client/PointsOfServiceApi.java new file mode 100644 index 0000000..214a5c5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/PointsOfServiceApi.java @@ -0,0 +1,809 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.Pos; +import pl.wtx.allegro.api.client.model.SearchResult; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PointsOfServiceApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PointsOfServiceApi() { + this(Configuration.getDefaultApiClient()); + } + + public PointsOfServiceApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createPOSUsingPOST + * @param pos Point of service (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - similar Point of Service already exists. Url of the existing POS is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createPOSUsingPOSTCall(@javax.annotation.Nonnull Pos pos, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pos; + + // create path and map variables + String localVarPath = "/points-of-service"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createPOSUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull Pos pos, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pos' is set + if (pos == null) { + throw new ApiException("Missing the required parameter 'pos' when calling createPOSUsingPOST(Async)"); + } + + return createPOSUsingPOSTCall(pos, _callback); + + } + + /** + * Create a point of service + * Use this resource to create a point of service. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param pos Point of service (required) + * @return Pos + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - similar Point of Service already exists. Url of the existing POS is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public Pos createPOSUsingPOST(@javax.annotation.Nonnull Pos pos) throws ApiException { + ApiResponse localVarResp = createPOSUsingPOSTWithHttpInfo(pos); + return localVarResp.getData(); + } + + /** + * Create a point of service + * Use this resource to create a point of service. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param pos Point of service (required) + * @return ApiResponse<Pos> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - similar Point of Service already exists. Url of the existing POS is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public ApiResponse createPOSUsingPOSTWithHttpInfo(@javax.annotation.Nonnull Pos pos) throws ApiException { + okhttp3.Call localVarCall = createPOSUsingPOSTValidateBeforeCall(pos, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a point of service (asynchronously) + * Use this resource to create a point of service. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param pos Point of service (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - similar Point of Service already exists. Url of the existing POS is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public okhttp3.Call createPOSUsingPOSTAsync(@javax.annotation.Nonnull Pos pos, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createPOSUsingPOSTValidateBeforeCall(pos, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deletePOSUsingDELETE + * @param id Point of service ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call deletePOSUsingDELETECall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/points-of-service/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePOSUsingDELETEValidateBeforeCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling deletePOSUsingDELETE(Async)"); + } + + return deletePOSUsingDELETECall(id, _callback); + + } + + /** + * Delete a point of service + * Use this resource to delete a point of service. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param id Point of service ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public void deletePOSUsingDELETE(@javax.annotation.Nonnull String id) throws ApiException { + deletePOSUsingDELETEWithHttpInfo(id); + } + + /** + * Delete a point of service + * Use this resource to delete a point of service. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param id Point of service ID. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse deletePOSUsingDELETEWithHttpInfo(@javax.annotation.Nonnull String id) throws ApiException { + okhttp3.Call localVarCall = deletePOSUsingDELETEValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a point of service (asynchronously) + * Use this resource to delete a point of service. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param id Point of service 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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
204 No content -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call deletePOSUsingDELETEAsync(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deletePOSUsingDELETEValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getPOSDataUsingGET + * @param id Point of service ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getPOSDataUsingGETCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/points-of-service/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPOSDataUsingGETValidateBeforeCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getPOSDataUsingGET(Async)"); + } + + return getPOSDataUsingGETCall(id, _callback); + + } + + /** + * Get the details of a point of service + * Use this resource to get a details of a point of service for a given ID. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param id Point of service ID. (required) + * @return Pos + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public Pos getPOSDataUsingGET(@javax.annotation.Nonnull String id) throws ApiException { + ApiResponse localVarResp = getPOSDataUsingGETWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Get the details of a point of service + * Use this resource to get a details of a point of service for a given ID. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param id Point of service ID. (required) + * @return ApiResponse<Pos> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getPOSDataUsingGETWithHttpInfo(@javax.annotation.Nonnull String id) throws ApiException { + okhttp3.Call localVarCall = getPOSDataUsingGETValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the details of a point of service (asynchronously) + * Use this resource to get a details of a point of service for a given ID. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param id Point of service 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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getPOSDataUsingGETAsync(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPOSDataUsingGETValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPOSListUsingGET + * @param sellerId User identifier. (required) + * @param countryCode Country code identifier in ISO format. In case of incorrect or unsupported country code, empty list is returned. If missing, list of all defined points is returned. If present, correct and supported, list of all points with given country code for the user is returned. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call getPOSListUsingGETCall(@javax.annotation.Nonnull String sellerId, @javax.annotation.Nullable String countryCode, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/points-of-service"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (sellerId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("seller.id", sellerId)); + } + + if (countryCode != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("countryCode", countryCode)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPOSListUsingGETValidateBeforeCall(@javax.annotation.Nonnull String sellerId, @javax.annotation.Nullable String countryCode, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'sellerId' is set + if (sellerId == null) { + throw new ApiException("Missing the required parameter 'sellerId' when calling getPOSListUsingGET(Async)"); + } + + return getPOSListUsingGETCall(sellerId, countryCode, _callback); + + } + + /** + * Get the user's points of service + * Use this resource to get a list of points of service by seller ID. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param sellerId User identifier. (required) + * @param countryCode Country code identifier in ISO format. In case of incorrect or unsupported country code, empty list is returned. If missing, list of all defined points is returned. If present, correct and supported, list of all points with given country code for the user is returned. (optional) + * @return SearchResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public SearchResult getPOSListUsingGET(@javax.annotation.Nonnull String sellerId, @javax.annotation.Nullable String countryCode) throws ApiException { + ApiResponse localVarResp = getPOSListUsingGETWithHttpInfo(sellerId, countryCode); + return localVarResp.getData(); + } + + /** + * Get the user's points of service + * Use this resource to get a list of points of service by seller ID. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param sellerId User identifier. (required) + * @param countryCode Country code identifier in ISO format. In case of incorrect or unsupported country code, empty list is returned. If missing, list of all defined points is returned. If present, correct and supported, list of all points with given country code for the user is returned. (optional) + * @return ApiResponse<SearchResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public ApiResponse getPOSListUsingGETWithHttpInfo(@javax.annotation.Nonnull String sellerId, @javax.annotation.Nullable String countryCode) throws ApiException { + okhttp3.Call localVarCall = getPOSListUsingGETValidateBeforeCall(sellerId, countryCode, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's points of service (asynchronously) + * Use this resource to get a list of points of service by seller ID. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param sellerId User identifier. (required) + * @param countryCode Country code identifier in ISO format. In case of incorrect or unsupported country code, empty list is returned. If missing, list of all defined points is returned. If present, correct and supported, list of all points with given country code for the user is 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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
404 Not Found -
+ */ + public okhttp3.Call getPOSListUsingGETAsync(@javax.annotation.Nonnull String sellerId, @javax.annotation.Nullable String countryCode, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPOSListUsingGETValidateBeforeCall(sellerId, countryCode, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for modifyPOSUsingPUT + * @param id Point of service ID. Must match values with 'id' property from the body. (required) + * @param pos Point of service (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - similar Point of Service already exists. Url of the existing POS is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public okhttp3.Call modifyPOSUsingPUTCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull Pos pos, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pos; + + // create path and map variables + String localVarPath = "/points-of-service/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call modifyPOSUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull Pos pos, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling modifyPOSUsingPUT(Async)"); + } + + // verify the required parameter 'pos' is set + if (pos == null) { + throw new ApiException("Missing the required parameter 'pos' when calling modifyPOSUsingPUT(Async)"); + } + + return modifyPOSUsingPUTCall(id, pos, _callback); + + } + + /** + * Modify a point of service + * Use this resource to modify a point of service. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param id Point of service ID. Must match values with 'id' property from the body. (required) + * @param pos Point of service (required) + * @return Pos + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - similar Point of Service already exists. Url of the existing POS is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public Pos modifyPOSUsingPUT(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull Pos pos) throws ApiException { + ApiResponse localVarResp = modifyPOSUsingPUTWithHttpInfo(id, pos); + return localVarResp.getData(); + } + + /** + * Modify a point of service + * Use this resource to modify a point of service. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param id Point of service ID. Must match values with 'id' property from the body. (required) + * @param pos Point of service (required) + * @return ApiResponse<Pos> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - similar Point of Service already exists. Url of the existing POS is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public ApiResponse modifyPOSUsingPUTWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull Pos pos) throws ApiException { + okhttp3.Call localVarCall = modifyPOSUsingPUTValidateBeforeCall(id, pos, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Modify a point of service (asynchronously) + * Use this resource to modify a point of service. Read more: <a href=\"../../news/punkty-odbioru-osobistego-8dmlj8qk7ik\" target=\"_blank\">PL</a> / <a href=\"../../news/points-of-service-Rdoz09ZE7sW\" target=\"_blank\">EN</a>. + * @param id Point of service ID. Must match values with 'id' property from the body. (required) + * @param pos Point of service (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict - similar Point of Service already exists. Url of the existing POS is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public okhttp3.Call modifyPOSUsingPUTAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull Pos pos, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = modifyPOSUsingPUTValidateBeforeCall(id, pos, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/PricingApi.java b/src/main/java/pl/wtx/allegro/api/client/PricingApi.java new file mode 100644 index 0000000..511ddf2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/PricingApi.java @@ -0,0 +1,364 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.FeePreviewResponse; +import pl.wtx.allegro.api.client.model.OfferQuotesDto; +import pl.wtx.allegro.api.client.model.PublicOfferPreviewRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PricingApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PricingApi() { + this(Configuration.getDefaultApiClient()); + } + + public PricingApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for calculateFeePreviewUsingPOST + * @param publicOfferPreviewRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Fee calculated successfully. -
400 Bad request -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public okhttp3.Call calculateFeePreviewUsingPOSTCall(@javax.annotation.Nonnull PublicOfferPreviewRequest publicOfferPreviewRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = publicOfferPreviewRequest; + + // create path and map variables + String localVarPath = "/pricing/offer-fee-preview"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call calculateFeePreviewUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull PublicOfferPreviewRequest publicOfferPreviewRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'publicOfferPreviewRequest' is set + if (publicOfferPreviewRequest == null) { + throw new ApiException("Missing the required parameter 'publicOfferPreviewRequest' when calling calculateFeePreviewUsingPOST(Async)"); + } + + return calculateFeePreviewUsingPOSTCall(publicOfferPreviewRequest, _callback); + + } + + /** + * Calculate fee and commission for an offer + * Provides information about fee and commission for an offer. This resource is limited to 25 requests per second for a single user. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#kalkulator-oplat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#fee-calculator\" target=\"_blank\">EN</a>. + * @param publicOfferPreviewRequest (required) + * @return FeePreviewResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Fee calculated successfully. -
400 Bad request -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public FeePreviewResponse calculateFeePreviewUsingPOST(@javax.annotation.Nonnull PublicOfferPreviewRequest publicOfferPreviewRequest) throws ApiException { + ApiResponse localVarResp = calculateFeePreviewUsingPOSTWithHttpInfo(publicOfferPreviewRequest); + return localVarResp.getData(); + } + + /** + * Calculate fee and commission for an offer + * Provides information about fee and commission for an offer. This resource is limited to 25 requests per second for a single user. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#kalkulator-oplat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#fee-calculator\" target=\"_blank\">EN</a>. + * @param publicOfferPreviewRequest (required) + * @return ApiResponse<FeePreviewResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Fee calculated successfully. -
400 Bad request -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public ApiResponse calculateFeePreviewUsingPOSTWithHttpInfo(@javax.annotation.Nonnull PublicOfferPreviewRequest publicOfferPreviewRequest) throws ApiException { + okhttp3.Call localVarCall = calculateFeePreviewUsingPOSTValidateBeforeCall(publicOfferPreviewRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Calculate fee and commission for an offer (asynchronously) + * Provides information about fee and commission for an offer. This resource is limited to 25 requests per second for a single user. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#kalkulator-oplat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#fee-calculator\" target=\"_blank\">EN</a>. + * @param publicOfferPreviewRequest (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Fee calculated successfully. -
400 Bad request -
401 Unauthorized -
422 Unprocessable Entity -
+ */ + public okhttp3.Call calculateFeePreviewUsingPOSTAsync(@javax.annotation.Nonnull PublicOfferPreviewRequest publicOfferPreviewRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = calculateFeePreviewUsingPOSTValidateBeforeCall(publicOfferPreviewRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for offerQuotesPublicUsingGET + * @param offerId List of offer Ids, maximum 20 values. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns current offer quotes -
400 Invalid request. -
401 Full authentication is required to access this resource -
403 Forbidden -
503 Service is currently unavailable. Please try again later. -
+ */ + public okhttp3.Call offerQuotesPublicUsingGETCall(@javax.annotation.Nonnull List offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/pricing/offer-quotes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offerId != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "offer.id", offerId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call offerQuotesPublicUsingGETValidateBeforeCall(@javax.annotation.Nonnull List offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling offerQuotesPublicUsingGET(Async)"); + } + + return offerQuotesPublicUsingGETCall(offerId, _callback); + + } + + /** + * Get the user's current offer quotes + * This endpoint returns current offer quotes (listing and promo fees) cycles for authenticated user and list of offers. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#data-naliczenia-kolejnej-oplaty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#check-when-a-fee-is-charged\" target=\"_blank\">EN</a>. + * @param offerId List of offer Ids, maximum 20 values. (required) + * @return OfferQuotesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns current offer quotes -
400 Invalid request. -
401 Full authentication is required to access this resource -
403 Forbidden -
503 Service is currently unavailable. Please try again later. -
+ */ + public OfferQuotesDto offerQuotesPublicUsingGET(@javax.annotation.Nonnull List offerId) throws ApiException { + ApiResponse localVarResp = offerQuotesPublicUsingGETWithHttpInfo(offerId); + return localVarResp.getData(); + } + + /** + * Get the user's current offer quotes + * This endpoint returns current offer quotes (listing and promo fees) cycles for authenticated user and list of offers. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#data-naliczenia-kolejnej-oplaty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#check-when-a-fee-is-charged\" target=\"_blank\">EN</a>. + * @param offerId List of offer Ids, maximum 20 values. (required) + * @return ApiResponse<OfferQuotesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns current offer quotes -
400 Invalid request. -
401 Full authentication is required to access this resource -
403 Forbidden -
503 Service is currently unavailable. Please try again later. -
+ */ + public ApiResponse offerQuotesPublicUsingGETWithHttpInfo(@javax.annotation.Nonnull List offerId) throws ApiException { + okhttp3.Call localVarCall = offerQuotesPublicUsingGETValidateBeforeCall(offerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's current offer quotes (asynchronously) + * This endpoint returns current offer quotes (listing and promo fees) cycles for authenticated user and list of offers. Read more: <a href=\"../../tutorials/jak-sprawdzic-oplaty-nn9DOL5PASX#data-naliczenia-kolejnej-oplaty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-check-the-fees-3An6Wame3Um#check-when-a-fee-is-charged\" target=\"_blank\">EN</a>. + * @param offerId List of offer Ids, maximum 20 values. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns current offer quotes -
400 Invalid request. -
401 Full authentication is required to access this resource -
403 Forbidden -
503 Service is currently unavailable. Please try again later. -
+ */ + public okhttp3.Call offerQuotesPublicUsingGETAsync(@javax.annotation.Nonnull List offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = offerQuotesPublicUsingGETValidateBeforeCall(offerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/ProductsApi.java b/src/main/java/pl/wtx/allegro/api/client/ProductsApi.java new file mode 100644 index 0000000..3da47de --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/ProductsApi.java @@ -0,0 +1,1040 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.CategoryProductParameterList; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.GetSaleProductsResponse; +import pl.wtx.allegro.api.client.model.ProductChangeProposalDto; +import pl.wtx.allegro.api.client.model.ProductChangeProposalRequest; +import pl.wtx.allegro.api.client.model.ProductProposalsRequest; +import pl.wtx.allegro.api.client.model.ProductProposalsResponse; +import pl.wtx.allegro.api.client.model.SaleProductDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ProductsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ProductsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ProductsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getFlatProductParametersUsingGET + * @param categoryId The category ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of product parameters for the category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public okhttp3.Call getFlatProductParametersUsingGETCall(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/categories/{categoryId}/product-parameters" + .replace("{" + "categoryId" + "}", localVarApiClient.escapeString(categoryId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getFlatProductParametersUsingGETValidateBeforeCall(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'categoryId' is set + if (categoryId == null) { + throw new ApiException("Missing the required parameter 'categoryId' when calling getFlatProductParametersUsingGET(Async)"); + } + + return getFlatProductParametersUsingGETCall(categoryId, _callback); + + } + + /** + * Get product parameters available in given category + * Use this resource to get the list of product parameters available in given category. You can use these parameters to create a new product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-utworzyc-nowy-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-create-a-product\" target=\"_blank\">EN</a>. + * @param categoryId The category ID. (required) + * @return CategoryProductParameterList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of product parameters for the category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public CategoryProductParameterList getFlatProductParametersUsingGET(@javax.annotation.Nonnull String categoryId) throws ApiException { + ApiResponse localVarResp = getFlatProductParametersUsingGETWithHttpInfo(categoryId); + return localVarResp.getData(); + } + + /** + * Get product parameters available in given category + * Use this resource to get the list of product parameters available in given category. You can use these parameters to create a new product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-utworzyc-nowy-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-create-a-product\" target=\"_blank\">EN</a>. + * @param categoryId The category ID. (required) + * @return ApiResponse<CategoryProductParameterList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of product parameters for the category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public ApiResponse getFlatProductParametersUsingGETWithHttpInfo(@javax.annotation.Nonnull String categoryId) throws ApiException { + okhttp3.Call localVarCall = getFlatProductParametersUsingGETValidateBeforeCall(categoryId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get product parameters available in given category (asynchronously) + * Use this resource to get the list of product parameters available in given category. You can use these parameters to create a new product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-utworzyc-nowy-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-create-a-product\" target=\"_blank\">EN</a>. + * @param categoryId The category 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 + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 The list of product parameters for the category returned successfully. -
404 The category with the given ID does not exist. -
+ */ + public okhttp3.Call getFlatProductParametersUsingGETAsync(@javax.annotation.Nonnull String categoryId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getFlatProductParametersUsingGETValidateBeforeCall(categoryId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getProductChangeProposal + * @param changeProposalId The product changes proposal identifier. (required) + * @param acceptLanguage Expected language of messages. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Product changes proposal returned successfully. -
401 Unauthorized. -
403 You do not have permission to access change proposal that not belong to you -
404 Not Found. -
+ */ + public okhttp3.Call getProductChangeProposalCall(@javax.annotation.Nonnull String changeProposalId, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/products/change-proposals/{changeProposalId}" + .replace("{" + "changeProposalId" + "}", localVarApiClient.escapeString(changeProposalId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getProductChangeProposalValidateBeforeCall(@javax.annotation.Nonnull String changeProposalId, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'changeProposalId' is set + if (changeProposalId == null) { + throw new ApiException("Missing the required parameter 'changeProposalId' when calling getProductChangeProposal(Async)"); + } + + return getProductChangeProposalCall(changeProposalId, acceptLanguage, _callback); + + } + + /** + * Get all data of the particular product changes proposal + * Use this resource to retrieve all data of the particular product changes proposal. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-zglosic-blad-w-produkcie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-report-incorrect-data-in-a-product\" target=\"_blank\">EN</a>. + * @param changeProposalId The product changes proposal identifier. (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return ProductChangeProposalDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Product changes proposal returned successfully. -
401 Unauthorized. -
403 You do not have permission to access change proposal that not belong to you -
404 Not Found. -
+ */ + public ProductChangeProposalDto getProductChangeProposal(@javax.annotation.Nonnull String changeProposalId, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + ApiResponse localVarResp = getProductChangeProposalWithHttpInfo(changeProposalId, acceptLanguage); + return localVarResp.getData(); + } + + /** + * Get all data of the particular product changes proposal + * Use this resource to retrieve all data of the particular product changes proposal. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-zglosic-blad-w-produkcie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-report-incorrect-data-in-a-product\" target=\"_blank\">EN</a>. + * @param changeProposalId The product changes proposal identifier. (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return ApiResponse<ProductChangeProposalDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Product changes proposal returned successfully. -
401 Unauthorized. -
403 You do not have permission to access change proposal that not belong to you -
404 Not Found. -
+ */ + public ApiResponse getProductChangeProposalWithHttpInfo(@javax.annotation.Nonnull String changeProposalId, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + okhttp3.Call localVarCall = getProductChangeProposalValidateBeforeCall(changeProposalId, acceptLanguage, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get all data of the particular product changes proposal (asynchronously) + * Use this resource to retrieve all data of the particular product changes proposal. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-zglosic-blad-w-produkcie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-report-incorrect-data-in-a-product\" target=\"_blank\">EN</a>. + * @param changeProposalId The product changes proposal identifier. (required) + * @param acceptLanguage Expected language of messages. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Product changes proposal returned successfully. -
401 Unauthorized. -
403 You do not have permission to access change proposal that not belong to you -
404 Not Found. -
+ */ + public okhttp3.Call getProductChangeProposalAsync(@javax.annotation.Nonnull String changeProposalId, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getProductChangeProposalValidateBeforeCall(changeProposalId, acceptLanguage, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getSaleProduct + * @param productId The product identifier. (required) + * @param categoryId The similar category identifier. You can choose a category from 'similar categories' to filter the list of parameters available in the category context. (optional) + * @param includeDrafts Return also if product is in draft state. (optional) + * @param language The language version of product. You can indicate the language for the returned product data. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Product returned successfully -
401 Unauthorized -
404 A product's not found or language version of the product is currently unavailable. -
422 One of parameters have invalid value. -
+ */ + public okhttp3.Call getSaleProductCall(@javax.annotation.Nonnull String productId, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Boolean includeDrafts, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/products/{productId}" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (categoryId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("category.id", categoryId)); + } + + if (includeDrafts != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("includeDrafts", includeDrafts)); + } + + if (language != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("language", language)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSaleProductValidateBeforeCall(@javax.annotation.Nonnull String productId, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Boolean includeDrafts, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'productId' is set + if (productId == null) { + throw new ApiException("Missing the required parameter 'productId' when calling getSaleProduct(Async)"); + } + + return getSaleProductCall(productId, categoryId, includeDrafts, language, _callback); + + } + + /** + * Get all data of the particular product + * Use this resource to retrieve all data of the particular product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-pobrac-pelne-dane-o-produkcie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-retrieve-product-data\" target=\"_blank\">EN</a>. This resource is limited with <a href=\"../../tutorials/basic-information-VL6YelvVKTn#limiting-the-number-of-queries-limits\" target=\"_blank\">Leaky Bucket</a> mechanism. + * @param productId The product identifier. (required) + * @param categoryId The similar category identifier. You can choose a category from 'similar categories' to filter the list of parameters available in the category context. (optional) + * @param includeDrafts Return also if product is in draft state. (optional) + * @param language The language version of product. You can indicate the language for the returned product data. (optional) + * @return SaleProductDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Product returned successfully -
401 Unauthorized -
404 A product's not found or language version of the product is currently unavailable. -
422 One of parameters have invalid value. -
+ */ + public SaleProductDto getSaleProduct(@javax.annotation.Nonnull String productId, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Boolean includeDrafts, @javax.annotation.Nullable String language) throws ApiException { + ApiResponse localVarResp = getSaleProductWithHttpInfo(productId, categoryId, includeDrafts, language); + return localVarResp.getData(); + } + + /** + * Get all data of the particular product + * Use this resource to retrieve all data of the particular product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-pobrac-pelne-dane-o-produkcie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-retrieve-product-data\" target=\"_blank\">EN</a>. This resource is limited with <a href=\"../../tutorials/basic-information-VL6YelvVKTn#limiting-the-number-of-queries-limits\" target=\"_blank\">Leaky Bucket</a> mechanism. + * @param productId The product identifier. (required) + * @param categoryId The similar category identifier. You can choose a category from 'similar categories' to filter the list of parameters available in the category context. (optional) + * @param includeDrafts Return also if product is in draft state. (optional) + * @param language The language version of product. You can indicate the language for the returned product data. (optional) + * @return ApiResponse<SaleProductDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Product returned successfully -
401 Unauthorized -
404 A product's not found or language version of the product is currently unavailable. -
422 One of parameters have invalid value. -
+ */ + public ApiResponse getSaleProductWithHttpInfo(@javax.annotation.Nonnull String productId, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Boolean includeDrafts, @javax.annotation.Nullable String language) throws ApiException { + okhttp3.Call localVarCall = getSaleProductValidateBeforeCall(productId, categoryId, includeDrafts, language, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get all data of the particular product (asynchronously) + * Use this resource to retrieve all data of the particular product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-pobrac-pelne-dane-o-produkcie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-retrieve-product-data\" target=\"_blank\">EN</a>. This resource is limited with <a href=\"../../tutorials/basic-information-VL6YelvVKTn#limiting-the-number-of-queries-limits\" target=\"_blank\">Leaky Bucket</a> mechanism. + * @param productId The product identifier. (required) + * @param categoryId The similar category identifier. You can choose a category from 'similar categories' to filter the list of parameters available in the category context. (optional) + * @param includeDrafts Return also if product is in draft state. (optional) + * @param language The language version of product. You can indicate the language for the returned product data. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Product returned successfully -
401 Unauthorized -
404 A product's not found or language version of the product is currently unavailable. -
422 One of parameters have invalid value. -
+ */ + public okhttp3.Call getSaleProductAsync(@javax.annotation.Nonnull String productId, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Boolean includeDrafts, @javax.annotation.Nullable String language, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSaleProductValidateBeforeCall(productId, categoryId, includeDrafts, language, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getSaleProducts + * @param ean The EAN values can include EAN, ISBN, and UPC identifier types. Parameter is depracated and will be removed in the future. Please use combination of phrase and mode (`GTIN`) parameters instead. (optional) + * @param phrase Search phrase. (optional) + * @param mode Search mode. If not specified, we are searching by GTIN, MPN, product's name, parameters, etc. - `GTIN` - restricts the search filtering to GTINs (Global Trade Item Number), e.g. EAN, ISBN, UPC. - `MPN` - restricts the search filtering to MPNs (Manufacturer Part Number). (optional) + * @param language Language indicates the language for searching products. Allows to specify the language of the given phrase. (optional) + * @param categoryId The category identifier to filter results. This can only be used when searching by phrase. (optional) + * @param dynamicFilters You can filter and customize your search results to find exactly what you need by applying filters ids and their dictionary values to query according to the flowing pattern: id=value. When the filter definition looks like: ```` { \"id\": \"127448\", \"name\": \"Kolor\", \"type\": \"SINGLE\", \"values\": [ { \"name\": \"biały\", \"value\": \"127448_2\" }, { \"name\": \"czarny\", \"value\": \"127448_1\" } ] } ```` You can use 'Kolor' filter to query results, i.e.: * `127448=127448_2` for \"biały\" * `127448=127448_1` for \"czarny\". (optional) + * @param pageId A \"cursor\" to the next set of results. (optional) + * @param searchFeatures Enables additional search options: - *SIMILAR_CATEGORIES* - searching in the indicated category (category.id) and in 'similar categories' (works only if category.id is a leaf category). (optional) + * @param includeDrafts Include products in draft state. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation. -
401 Unauthorized -
422 One of parameters have invalid value. -
+ */ + public okhttp3.Call getSaleProductsCall(@javax.annotation.Nullable String ean, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String mode, @javax.annotation.Nullable String language, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Map dynamicFilters, @javax.annotation.Nullable String pageId, @javax.annotation.Nullable String searchFeatures, @javax.annotation.Nullable Boolean includeDrafts, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/products"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (ean != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("ean", ean)); + } + + if (phrase != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("phrase", phrase)); + } + + if (mode != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("mode", mode)); + } + + if (language != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("language", language)); + } + + if (categoryId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("category.id", categoryId)); + } + + if (dynamicFilters != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("Dynamic filters", dynamicFilters)); + } + + if (pageId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page.id", pageId)); + } + + if (searchFeatures != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("searchFeatures", searchFeatures)); + } + + if (includeDrafts != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("includeDrafts", includeDrafts)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSaleProductsValidateBeforeCall(@javax.annotation.Nullable String ean, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String mode, @javax.annotation.Nullable String language, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Map dynamicFilters, @javax.annotation.Nullable String pageId, @javax.annotation.Nullable String searchFeatures, @javax.annotation.Nullable Boolean includeDrafts, final ApiCallback _callback) throws ApiException { + return getSaleProductsCall(ean, phrase, mode, language, categoryId, dynamicFilters, pageId, searchFeatures, includeDrafts, _callback); + + } + + /** + * Get search products results + * Use this resource to get a list of products according to provided parameters. At least ean or phrase parameter is required. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-znalezc-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-find-a-product\" target=\"_blank\">EN</a>. This resource is limited with Leaky Bucket mechanism, read more <a href=\"../../tutorials/informacje-podstawowe-b21569boAI1#ograniczenie-liczby-zapytan-limity\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/basic-information-VL6YelvVKTn#limiting-the-number-of-queries-limits\" target=\"_blank\">EN</a>. + * @param ean The EAN values can include EAN, ISBN, and UPC identifier types. Parameter is depracated and will be removed in the future. Please use combination of phrase and mode (`GTIN`) parameters instead. (optional) + * @param phrase Search phrase. (optional) + * @param mode Search mode. If not specified, we are searching by GTIN, MPN, product's name, parameters, etc. - `GTIN` - restricts the search filtering to GTINs (Global Trade Item Number), e.g. EAN, ISBN, UPC. - `MPN` - restricts the search filtering to MPNs (Manufacturer Part Number). (optional) + * @param language Language indicates the language for searching products. Allows to specify the language of the given phrase. (optional) + * @param categoryId The category identifier to filter results. This can only be used when searching by phrase. (optional) + * @param dynamicFilters You can filter and customize your search results to find exactly what you need by applying filters ids and their dictionary values to query according to the flowing pattern: id=value. When the filter definition looks like: ```` { \"id\": \"127448\", \"name\": \"Kolor\", \"type\": \"SINGLE\", \"values\": [ { \"name\": \"biały\", \"value\": \"127448_2\" }, { \"name\": \"czarny\", \"value\": \"127448_1\" } ] } ```` You can use 'Kolor' filter to query results, i.e.: * `127448=127448_2` for \"biały\" * `127448=127448_1` for \"czarny\". (optional) + * @param pageId A \"cursor\" to the next set of results. (optional) + * @param searchFeatures Enables additional search options: - *SIMILAR_CATEGORIES* - searching in the indicated category (category.id) and in 'similar categories' (works only if category.id is a leaf category). (optional) + * @param includeDrafts Include products in draft state. (optional) + * @return GetSaleProductsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation. -
401 Unauthorized -
422 One of parameters have invalid value. -
+ */ + public GetSaleProductsResponse getSaleProducts(@javax.annotation.Nullable String ean, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String mode, @javax.annotation.Nullable String language, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Map dynamicFilters, @javax.annotation.Nullable String pageId, @javax.annotation.Nullable String searchFeatures, @javax.annotation.Nullable Boolean includeDrafts) throws ApiException { + ApiResponse localVarResp = getSaleProductsWithHttpInfo(ean, phrase, mode, language, categoryId, dynamicFilters, pageId, searchFeatures, includeDrafts); + return localVarResp.getData(); + } + + /** + * Get search products results + * Use this resource to get a list of products according to provided parameters. At least ean or phrase parameter is required. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-znalezc-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-find-a-product\" target=\"_blank\">EN</a>. This resource is limited with Leaky Bucket mechanism, read more <a href=\"../../tutorials/informacje-podstawowe-b21569boAI1#ograniczenie-liczby-zapytan-limity\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/basic-information-VL6YelvVKTn#limiting-the-number-of-queries-limits\" target=\"_blank\">EN</a>. + * @param ean The EAN values can include EAN, ISBN, and UPC identifier types. Parameter is depracated and will be removed in the future. Please use combination of phrase and mode (`GTIN`) parameters instead. (optional) + * @param phrase Search phrase. (optional) + * @param mode Search mode. If not specified, we are searching by GTIN, MPN, product's name, parameters, etc. - `GTIN` - restricts the search filtering to GTINs (Global Trade Item Number), e.g. EAN, ISBN, UPC. - `MPN` - restricts the search filtering to MPNs (Manufacturer Part Number). (optional) + * @param language Language indicates the language for searching products. Allows to specify the language of the given phrase. (optional) + * @param categoryId The category identifier to filter results. This can only be used when searching by phrase. (optional) + * @param dynamicFilters You can filter and customize your search results to find exactly what you need by applying filters ids and their dictionary values to query according to the flowing pattern: id=value. When the filter definition looks like: ```` { \"id\": \"127448\", \"name\": \"Kolor\", \"type\": \"SINGLE\", \"values\": [ { \"name\": \"biały\", \"value\": \"127448_2\" }, { \"name\": \"czarny\", \"value\": \"127448_1\" } ] } ```` You can use 'Kolor' filter to query results, i.e.: * `127448=127448_2` for \"biały\" * `127448=127448_1` for \"czarny\". (optional) + * @param pageId A \"cursor\" to the next set of results. (optional) + * @param searchFeatures Enables additional search options: - *SIMILAR_CATEGORIES* - searching in the indicated category (category.id) and in 'similar categories' (works only if category.id is a leaf category). (optional) + * @param includeDrafts Include products in draft state. (optional) + * @return ApiResponse<GetSaleProductsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation. -
401 Unauthorized -
422 One of parameters have invalid value. -
+ */ + public ApiResponse getSaleProductsWithHttpInfo(@javax.annotation.Nullable String ean, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String mode, @javax.annotation.Nullable String language, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Map dynamicFilters, @javax.annotation.Nullable String pageId, @javax.annotation.Nullable String searchFeatures, @javax.annotation.Nullable Boolean includeDrafts) throws ApiException { + okhttp3.Call localVarCall = getSaleProductsValidateBeforeCall(ean, phrase, mode, language, categoryId, dynamicFilters, pageId, searchFeatures, includeDrafts, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get search products results (asynchronously) + * Use this resource to get a list of products according to provided parameters. At least ean or phrase parameter is required. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-znalezc-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-find-a-product\" target=\"_blank\">EN</a>. This resource is limited with Leaky Bucket mechanism, read more <a href=\"../../tutorials/informacje-podstawowe-b21569boAI1#ograniczenie-liczby-zapytan-limity\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/basic-information-VL6YelvVKTn#limiting-the-number-of-queries-limits\" target=\"_blank\">EN</a>. + * @param ean The EAN values can include EAN, ISBN, and UPC identifier types. Parameter is depracated and will be removed in the future. Please use combination of phrase and mode (`GTIN`) parameters instead. (optional) + * @param phrase Search phrase. (optional) + * @param mode Search mode. If not specified, we are searching by GTIN, MPN, product's name, parameters, etc. - `GTIN` - restricts the search filtering to GTINs (Global Trade Item Number), e.g. EAN, ISBN, UPC. - `MPN` - restricts the search filtering to MPNs (Manufacturer Part Number). (optional) + * @param language Language indicates the language for searching products. Allows to specify the language of the given phrase. (optional) + * @param categoryId The category identifier to filter results. This can only be used when searching by phrase. (optional) + * @param dynamicFilters You can filter and customize your search results to find exactly what you need by applying filters ids and their dictionary values to query according to the flowing pattern: id=value. When the filter definition looks like: ```` { \"id\": \"127448\", \"name\": \"Kolor\", \"type\": \"SINGLE\", \"values\": [ { \"name\": \"biały\", \"value\": \"127448_2\" }, { \"name\": \"czarny\", \"value\": \"127448_1\" } ] } ```` You can use 'Kolor' filter to query results, i.e.: * `127448=127448_2` for \"biały\" * `127448=127448_1` for \"czarny\". (optional) + * @param pageId A \"cursor\" to the next set of results. (optional) + * @param searchFeatures Enables additional search options: - *SIMILAR_CATEGORIES* - searching in the indicated category (category.id) and in 'similar categories' (works only if category.id is a leaf category). (optional) + * @param includeDrafts Include products in draft state. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successful operation. -
401 Unauthorized -
422 One of parameters have invalid value. -
+ */ + public okhttp3.Call getSaleProductsAsync(@javax.annotation.Nullable String ean, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String mode, @javax.annotation.Nullable String language, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Map dynamicFilters, @javax.annotation.Nullable String pageId, @javax.annotation.Nullable String searchFeatures, @javax.annotation.Nullable Boolean includeDrafts, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSaleProductsValidateBeforeCall(ean, phrase, mode, language, categoryId, dynamicFilters, pageId, searchFeatures, includeDrafts, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for productChangeProposal + * @param productId The product identifier. (required) + * @param productChangeProposalRequest (required) + * @param acceptLanguage Expected language of messages. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Product changes proposed successfully. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
400 Bad request. -
401 Unauthorized. -
404 Product with the given Id not found. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call productChangeProposalCall(@javax.annotation.Nonnull String productId, @javax.annotation.Nonnull ProductChangeProposalRequest productChangeProposalRequest, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = productChangeProposalRequest; + + // create path and map variables + String localVarPath = "/sale/products/{productId}/change-proposals" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call productChangeProposalValidateBeforeCall(@javax.annotation.Nonnull String productId, @javax.annotation.Nonnull ProductChangeProposalRequest productChangeProposalRequest, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'productId' is set + if (productId == null) { + throw new ApiException("Missing the required parameter 'productId' when calling productChangeProposal(Async)"); + } + + // verify the required parameter 'productChangeProposalRequest' is set + if (productChangeProposalRequest == null) { + throw new ApiException("Missing the required parameter 'productChangeProposalRequest' when calling productChangeProposal(Async)"); + } + + return productChangeProposalCall(productId, productChangeProposalRequest, acceptLanguage, _callback); + + } + + /** + * Propose changes in product + * Use this resource to propose changes in product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-zglosic-blad-w-produkcie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-report-incorrect-data-in-a-product\" target=\"_blank\">EN</a>. This resource is limited to 100 suggestions per day for a single user. + * @param productId The product identifier. (required) + * @param productChangeProposalRequest (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return ProductChangeProposalDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Product changes proposed successfully. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
400 Bad request. -
401 Unauthorized. -
404 Product with the given Id not found. -
422 Unprocessable Entity. -
+ */ + public ProductChangeProposalDto productChangeProposal(@javax.annotation.Nonnull String productId, @javax.annotation.Nonnull ProductChangeProposalRequest productChangeProposalRequest, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + ApiResponse localVarResp = productChangeProposalWithHttpInfo(productId, productChangeProposalRequest, acceptLanguage); + return localVarResp.getData(); + } + + /** + * Propose changes in product + * Use this resource to propose changes in product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-zglosic-blad-w-produkcie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-report-incorrect-data-in-a-product\" target=\"_blank\">EN</a>. This resource is limited to 100 suggestions per day for a single user. + * @param productId The product identifier. (required) + * @param productChangeProposalRequest (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return ApiResponse<ProductChangeProposalDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Product changes proposed successfully. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
400 Bad request. -
401 Unauthorized. -
404 Product with the given Id not found. -
422 Unprocessable Entity. -
+ */ + public ApiResponse productChangeProposalWithHttpInfo(@javax.annotation.Nonnull String productId, @javax.annotation.Nonnull ProductChangeProposalRequest productChangeProposalRequest, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + okhttp3.Call localVarCall = productChangeProposalValidateBeforeCall(productId, productChangeProposalRequest, acceptLanguage, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Propose changes in product (asynchronously) + * Use this resource to propose changes in product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-zglosic-blad-w-produkcie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-report-incorrect-data-in-a-product\" target=\"_blank\">EN</a>. This resource is limited to 100 suggestions per day for a single user. + * @param productId The product identifier. (required) + * @param productChangeProposalRequest (required) + * @param acceptLanguage Expected language of messages. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Product changes proposed successfully. * Location - The location URI points to a resource that will display the status of the asynchronous processing.
400 Bad request. -
401 Unauthorized. -
404 Product with the given Id not found. -
422 Unprocessable Entity. -
+ */ + public okhttp3.Call productChangeProposalAsync(@javax.annotation.Nonnull String productId, @javax.annotation.Nonnull ProductChangeProposalRequest productChangeProposalRequest, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = productChangeProposalValidateBeforeCall(productId, productChangeProposalRequest, acceptLanguage, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for proposeSaleProduct + * @param productProposalsRequest (required) + * @param acceptLanguage Expected language of messages. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Product proposed successfully. -
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
409 Product already exists. Url of the existing product is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public okhttp3.Call proposeSaleProductCall(@javax.annotation.Nonnull ProductProposalsRequest productProposalsRequest, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = productProposalsRequest; + + // create path and map variables + String localVarPath = "/sale/product-proposals"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call proposeSaleProductValidateBeforeCall(@javax.annotation.Nonnull ProductProposalsRequest productProposalsRequest, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'productProposalsRequest' is set + if (productProposalsRequest == null) { + throw new ApiException("Missing the required parameter 'productProposalsRequest' when calling proposeSaleProduct(Async)"); + } + + return proposeSaleProductCall(productProposalsRequest, acceptLanguage, _callback); + + } + + /** + * Propose a product + * Use this resource to propose a product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-utworzyc-nowy-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-create-a-product\" target=\"_blank\">EN</a>. + * @param productProposalsRequest (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return ProductProposalsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Product proposed successfully. -
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
409 Product already exists. Url of the existing product is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public ProductProposalsResponse proposeSaleProduct(@javax.annotation.Nonnull ProductProposalsRequest productProposalsRequest, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + ApiResponse localVarResp = proposeSaleProductWithHttpInfo(productProposalsRequest, acceptLanguage); + return localVarResp.getData(); + } + + /** + * Propose a product + * Use this resource to propose a product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-utworzyc-nowy-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-create-a-product\" target=\"_blank\">EN</a>. + * @param productProposalsRequest (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return ApiResponse<ProductProposalsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Product proposed successfully. -
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
409 Product already exists. Url of the existing product is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public ApiResponse proposeSaleProductWithHttpInfo(@javax.annotation.Nonnull ProductProposalsRequest productProposalsRequest, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + okhttp3.Call localVarCall = proposeSaleProductValidateBeforeCall(productProposalsRequest, acceptLanguage, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Propose a product (asynchronously) + * Use this resource to propose a product. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#jak-utworzyc-nowy-produkt\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#how-to-create-a-product\" target=\"_blank\">EN</a>. + * @param productProposalsRequest (required) + * @param acceptLanguage Expected language of messages. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Product proposed successfully. -
400 Bad request -
401 Unauthorized -
403 Forbidden - not allowed to access. -
409 Product already exists. Url of the existing product is provided in the HTTP Location header field of the response. -
422 Unprocessable Entity -
+ */ + public okhttp3.Call proposeSaleProductAsync(@javax.annotation.Nonnull ProductProposalsRequest productProposalsRequest, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = proposeSaleProductValidateBeforeCall(productProposalsRequest, acceptLanguage, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/PublicOfferInformationApi.java b/src/main/java/pl/wtx/allegro/api/client/PublicOfferInformationApi.java new file mode 100644 index 0000000..f2c96e7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/PublicOfferInformationApi.java @@ -0,0 +1,346 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.ListingResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PublicOfferInformationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PublicOfferInformationApi() { + this(Configuration.getDefaultApiClient()); + } + + public PublicOfferInformationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getListing + * @param categoryId The identifier of the category, where you want to search for offers. (optional) + * @param phrase The search phrase. The phrase is searched in different fields of the offers depending on the value of the `searchMode` parameter. (optional) + * @param sellerId The identifier of a seller, to limit the results to offers from this seller. May be provided more than once. Should not be provided when seller.login is given. (optional) + * @param sellerLogin The login of a seller, to limit the results to offers from this seller. May be provided more than once. Should not be provided when seller.id is given. (optional) + * @param marketplaceId Id of a marketplace where offers are visible. *Acceptable values* : `allegro-pl`, `allegro-cz`, `allegro-sk`, `allegro-hu`. (optional, default to allegro-pl) + * @param shippingCountry Expected language of messages. (optional) + * @param currency Currency of the offer prices. *Default value* : depends on marketplace, for allegro-pl: `PLN`, for allegro-cz: `CZK`, for allegro-sk: `EUR`. Check endpoint GET /marketplaces for acceptable currency values. (optional) + * @param acceptLanguage Limits offers to the only translated to specified language. Also expected language of messages. *Default value* : depends on marketplace, for allegro-pl: `pl-PL`, for allegro-cz: `cs-CZ`, for allegro-sk: `sk-SK`. Check endpoint GET /marketplaces for acceptable language values. (optional) + * @param searchMode Defines where the given phrase should be searched in. Allowed values: - *REGULAR* - searching for a phrase in the title, - *CLOSED* - searching for a phrase in the title of closed offers. Available only for `allegro-pl` marketplace. (optional, default to REGULAR) + * @param offset Index of the first returned offer from all search results. Max offset is `600 - <limit>`. (optional, default to 0) + * @param limit The maximum number of offers in a response. (optional, default to 60) + * @param sort Search results sorting order. `+` or no prefix in the value means ascending order. `-` prefix means descending order. (optional, default to relevance) + * @param include Specify parts of the response that should be included in the output. Allowed values are the names of top level entities and *all* as an alias to all entities. By default, all top level entities are included. Use `-` prefix to exclude an entity. Example: `include=-all&include=filters&include=sort` - returns only filters and sort entities. (optional) + * @param fallback Defines the behaviour of the search engine when no results with exact phrase match are found: - *true* - related (not exact) results are returned, - *false* - empty results are returned. (optional, default to true) + * @param dynamicFilters You can filter and customize your search results to find exactly what you need by applying filters ids and their dictionary values to query according to the flowing pattern: id=value. When the filter definition looks like: ```` { \"id\": \"parameter.11323\", \"type\": \"MULTI\", \"name\": \"Stan\", \"values\": [{ \"value\": \"11323_1\", \"name\": \"nowe\", \"count\": 21, \"selected\": false }, { \"value\": \"11323_2\", \"name\": \"używane\", \"count\": 157, \"selected\": false }, { \"value\": \"11323_238066\", \"name\": \"po zwrocie\", \"count\": 1, \"selected\": false } ] } ```` You can use 'Stan' filter to query results, i.e.: * `parameter.11323=11323_1` for \"nowe\" * `parameter.11323=11323_2` for \"używane\" * `parameter.11323=11323_238066` for \"po zwrocie\". (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 The request successfully returns the search result. -
400 Bad request. Check if all necessary parameters are provided. -
403 Access is denied. Application verification required. Read more: <a href=\"../../listing/\" target=\"_blank\">PL</a> / <a href=\"../../en/listing/\" target=\"_blank\">EN</a> -
404 Given category was not found. Check category.id parameter. -
406 Value of one of Accept headers is invalid. -
422 One of parameters have invalid value or given parameters combination is forbidden. -
429 Request was rejected because the limit was exceeded. -
500 Internal service error. -
502 Error caused by upstream service failure. -
+ */ + public okhttp3.Call getListingCall(@javax.annotation.Nullable String categoryId, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String sellerId, @javax.annotation.Nullable String sellerLogin, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String shippingCountry, @javax.annotation.Nullable String currency, @javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable String searchMode, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String sort, @javax.annotation.Nullable String include, @javax.annotation.Nullable Boolean fallback, @javax.annotation.Nullable Map dynamicFilters, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/offers/listing"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (categoryId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("category.id", categoryId)); + } + + if (phrase != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("phrase", phrase)); + } + + if (sellerId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("seller.id", sellerId)); + } + + if (sellerLogin != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("seller.login", sellerLogin)); + } + + if (marketplaceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplaceId", marketplaceId)); + } + + if (shippingCountry != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("shipping.country", shippingCountry)); + } + + if (currency != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("currency", currency)); + } + + if (searchMode != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("searchMode", searchMode)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + if (include != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include", include)); + } + + if (fallback != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fallback", fallback)); + } + + if (dynamicFilters != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("Dynamic filters", dynamicFilters)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user", "bearer-token-for-application" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getListingValidateBeforeCall(@javax.annotation.Nullable String categoryId, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String sellerId, @javax.annotation.Nullable String sellerLogin, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String shippingCountry, @javax.annotation.Nullable String currency, @javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable String searchMode, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String sort, @javax.annotation.Nullable String include, @javax.annotation.Nullable Boolean fallback, @javax.annotation.Nullable Map dynamicFilters, final ApiCallback _callback) throws ApiException { + return getListingCall(categoryId, phrase, sellerId, sellerLogin, marketplaceId, shippingCountry, currency, acceptLanguage, searchMode, offset, limit, sort, include, fallback, dynamicFilters, _callback); + + } + + /** + * Search offers + * <a href=\"../../listing/\" target=\"_blank\">Access for verified applications only</a>. Use this resource to get a list of offers based on the provided query parameters. At least one of: phrase, seller.id or category.id is required. Additional available parameters vary depending on category.id. The parameters are defined in the filters entity. Changing the marketplace, country of delivery, currency or language may impact the availability of offers and filters. Note that requests for closed offers may be limited. Read more: <a href=\"../../tutorials/jak-wyszukiwac-przegladac-oferty-ZM9YAKAwgfk\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-search-and-browse-offers-XxWm2ykMYHl\" target=\"_blank\">EN</a>. + * @param categoryId The identifier of the category, where you want to search for offers. (optional) + * @param phrase The search phrase. The phrase is searched in different fields of the offers depending on the value of the `searchMode` parameter. (optional) + * @param sellerId The identifier of a seller, to limit the results to offers from this seller. May be provided more than once. Should not be provided when seller.login is given. (optional) + * @param sellerLogin The login of a seller, to limit the results to offers from this seller. May be provided more than once. Should not be provided when seller.id is given. (optional) + * @param marketplaceId Id of a marketplace where offers are visible. *Acceptable values* : `allegro-pl`, `allegro-cz`, `allegro-sk`, `allegro-hu`. (optional, default to allegro-pl) + * @param shippingCountry Expected language of messages. (optional) + * @param currency Currency of the offer prices. *Default value* : depends on marketplace, for allegro-pl: `PLN`, for allegro-cz: `CZK`, for allegro-sk: `EUR`. Check endpoint GET /marketplaces for acceptable currency values. (optional) + * @param acceptLanguage Limits offers to the only translated to specified language. Also expected language of messages. *Default value* : depends on marketplace, for allegro-pl: `pl-PL`, for allegro-cz: `cs-CZ`, for allegro-sk: `sk-SK`. Check endpoint GET /marketplaces for acceptable language values. (optional) + * @param searchMode Defines where the given phrase should be searched in. Allowed values: - *REGULAR* - searching for a phrase in the title, - *CLOSED* - searching for a phrase in the title of closed offers. Available only for `allegro-pl` marketplace. (optional, default to REGULAR) + * @param offset Index of the first returned offer from all search results. Max offset is `600 - <limit>`. (optional, default to 0) + * @param limit The maximum number of offers in a response. (optional, default to 60) + * @param sort Search results sorting order. `+` or no prefix in the value means ascending order. `-` prefix means descending order. (optional, default to relevance) + * @param include Specify parts of the response that should be included in the output. Allowed values are the names of top level entities and *all* as an alias to all entities. By default, all top level entities are included. Use `-` prefix to exclude an entity. Example: `include=-all&include=filters&include=sort` - returns only filters and sort entities. (optional) + * @param fallback Defines the behaviour of the search engine when no results with exact phrase match are found: - *true* - related (not exact) results are returned, - *false* - empty results are returned. (optional, default to true) + * @param dynamicFilters You can filter and customize your search results to find exactly what you need by applying filters ids and their dictionary values to query according to the flowing pattern: id=value. When the filter definition looks like: ```` { \"id\": \"parameter.11323\", \"type\": \"MULTI\", \"name\": \"Stan\", \"values\": [{ \"value\": \"11323_1\", \"name\": \"nowe\", \"count\": 21, \"selected\": false }, { \"value\": \"11323_2\", \"name\": \"używane\", \"count\": 157, \"selected\": false }, { \"value\": \"11323_238066\", \"name\": \"po zwrocie\", \"count\": 1, \"selected\": false } ] } ```` You can use 'Stan' filter to query results, i.e.: * `parameter.11323=11323_1` for \"nowe\" * `parameter.11323=11323_2` for \"używane\" * `parameter.11323=11323_238066` for \"po zwrocie\". (optional) + * @return ListingResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 The request successfully returns the search result. -
400 Bad request. Check if all necessary parameters are provided. -
403 Access is denied. Application verification required. Read more: <a href=\"../../listing/\" target=\"_blank\">PL</a> / <a href=\"../../en/listing/\" target=\"_blank\">EN</a> -
404 Given category was not found. Check category.id parameter. -
406 Value of one of Accept headers is invalid. -
422 One of parameters have invalid value or given parameters combination is forbidden. -
429 Request was rejected because the limit was exceeded. -
500 Internal service error. -
502 Error caused by upstream service failure. -
+ */ + public ListingResponse getListing(@javax.annotation.Nullable String categoryId, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String sellerId, @javax.annotation.Nullable String sellerLogin, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String shippingCountry, @javax.annotation.Nullable String currency, @javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable String searchMode, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String sort, @javax.annotation.Nullable String include, @javax.annotation.Nullable Boolean fallback, @javax.annotation.Nullable Map dynamicFilters) throws ApiException { + ApiResponse localVarResp = getListingWithHttpInfo(categoryId, phrase, sellerId, sellerLogin, marketplaceId, shippingCountry, currency, acceptLanguage, searchMode, offset, limit, sort, include, fallback, dynamicFilters); + return localVarResp.getData(); + } + + /** + * Search offers + * <a href=\"../../listing/\" target=\"_blank\">Access for verified applications only</a>. Use this resource to get a list of offers based on the provided query parameters. At least one of: phrase, seller.id or category.id is required. Additional available parameters vary depending on category.id. The parameters are defined in the filters entity. Changing the marketplace, country of delivery, currency or language may impact the availability of offers and filters. Note that requests for closed offers may be limited. Read more: <a href=\"../../tutorials/jak-wyszukiwac-przegladac-oferty-ZM9YAKAwgfk\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-search-and-browse-offers-XxWm2ykMYHl\" target=\"_blank\">EN</a>. + * @param categoryId The identifier of the category, where you want to search for offers. (optional) + * @param phrase The search phrase. The phrase is searched in different fields of the offers depending on the value of the `searchMode` parameter. (optional) + * @param sellerId The identifier of a seller, to limit the results to offers from this seller. May be provided more than once. Should not be provided when seller.login is given. (optional) + * @param sellerLogin The login of a seller, to limit the results to offers from this seller. May be provided more than once. Should not be provided when seller.id is given. (optional) + * @param marketplaceId Id of a marketplace where offers are visible. *Acceptable values* : `allegro-pl`, `allegro-cz`, `allegro-sk`, `allegro-hu`. (optional, default to allegro-pl) + * @param shippingCountry Expected language of messages. (optional) + * @param currency Currency of the offer prices. *Default value* : depends on marketplace, for allegro-pl: `PLN`, for allegro-cz: `CZK`, for allegro-sk: `EUR`. Check endpoint GET /marketplaces for acceptable currency values. (optional) + * @param acceptLanguage Limits offers to the only translated to specified language. Also expected language of messages. *Default value* : depends on marketplace, for allegro-pl: `pl-PL`, for allegro-cz: `cs-CZ`, for allegro-sk: `sk-SK`. Check endpoint GET /marketplaces for acceptable language values. (optional) + * @param searchMode Defines where the given phrase should be searched in. Allowed values: - *REGULAR* - searching for a phrase in the title, - *CLOSED* - searching for a phrase in the title of closed offers. Available only for `allegro-pl` marketplace. (optional, default to REGULAR) + * @param offset Index of the first returned offer from all search results. Max offset is `600 - <limit>`. (optional, default to 0) + * @param limit The maximum number of offers in a response. (optional, default to 60) + * @param sort Search results sorting order. `+` or no prefix in the value means ascending order. `-` prefix means descending order. (optional, default to relevance) + * @param include Specify parts of the response that should be included in the output. Allowed values are the names of top level entities and *all* as an alias to all entities. By default, all top level entities are included. Use `-` prefix to exclude an entity. Example: `include=-all&include=filters&include=sort` - returns only filters and sort entities. (optional) + * @param fallback Defines the behaviour of the search engine when no results with exact phrase match are found: - *true* - related (not exact) results are returned, - *false* - empty results are returned. (optional, default to true) + * @param dynamicFilters You can filter and customize your search results to find exactly what you need by applying filters ids and their dictionary values to query according to the flowing pattern: id=value. When the filter definition looks like: ```` { \"id\": \"parameter.11323\", \"type\": \"MULTI\", \"name\": \"Stan\", \"values\": [{ \"value\": \"11323_1\", \"name\": \"nowe\", \"count\": 21, \"selected\": false }, { \"value\": \"11323_2\", \"name\": \"używane\", \"count\": 157, \"selected\": false }, { \"value\": \"11323_238066\", \"name\": \"po zwrocie\", \"count\": 1, \"selected\": false } ] } ```` You can use 'Stan' filter to query results, i.e.: * `parameter.11323=11323_1` for \"nowe\" * `parameter.11323=11323_2` for \"używane\" * `parameter.11323=11323_238066` for \"po zwrocie\". (optional) + * @return ApiResponse<ListingResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 The request successfully returns the search result. -
400 Bad request. Check if all necessary parameters are provided. -
403 Access is denied. Application verification required. Read more: <a href=\"../../listing/\" target=\"_blank\">PL</a> / <a href=\"../../en/listing/\" target=\"_blank\">EN</a> -
404 Given category was not found. Check category.id parameter. -
406 Value of one of Accept headers is invalid. -
422 One of parameters have invalid value or given parameters combination is forbidden. -
429 Request was rejected because the limit was exceeded. -
500 Internal service error. -
502 Error caused by upstream service failure. -
+ */ + public ApiResponse getListingWithHttpInfo(@javax.annotation.Nullable String categoryId, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String sellerId, @javax.annotation.Nullable String sellerLogin, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String shippingCountry, @javax.annotation.Nullable String currency, @javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable String searchMode, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String sort, @javax.annotation.Nullable String include, @javax.annotation.Nullable Boolean fallback, @javax.annotation.Nullable Map dynamicFilters) throws ApiException { + okhttp3.Call localVarCall = getListingValidateBeforeCall(categoryId, phrase, sellerId, sellerLogin, marketplaceId, shippingCountry, currency, acceptLanguage, searchMode, offset, limit, sort, include, fallback, dynamicFilters, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Search offers (asynchronously) + * <a href=\"../../listing/\" target=\"_blank\">Access for verified applications only</a>. Use this resource to get a list of offers based on the provided query parameters. At least one of: phrase, seller.id or category.id is required. Additional available parameters vary depending on category.id. The parameters are defined in the filters entity. Changing the marketplace, country of delivery, currency or language may impact the availability of offers and filters. Note that requests for closed offers may be limited. Read more: <a href=\"../../tutorials/jak-wyszukiwac-przegladac-oferty-ZM9YAKAwgfk\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-search-and-browse-offers-XxWm2ykMYHl\" target=\"_blank\">EN</a>. + * @param categoryId The identifier of the category, where you want to search for offers. (optional) + * @param phrase The search phrase. The phrase is searched in different fields of the offers depending on the value of the `searchMode` parameter. (optional) + * @param sellerId The identifier of a seller, to limit the results to offers from this seller. May be provided more than once. Should not be provided when seller.login is given. (optional) + * @param sellerLogin The login of a seller, to limit the results to offers from this seller. May be provided more than once. Should not be provided when seller.id is given. (optional) + * @param marketplaceId Id of a marketplace where offers are visible. *Acceptable values* : `allegro-pl`, `allegro-cz`, `allegro-sk`, `allegro-hu`. (optional, default to allegro-pl) + * @param shippingCountry Expected language of messages. (optional) + * @param currency Currency of the offer prices. *Default value* : depends on marketplace, for allegro-pl: `PLN`, for allegro-cz: `CZK`, for allegro-sk: `EUR`. Check endpoint GET /marketplaces for acceptable currency values. (optional) + * @param acceptLanguage Limits offers to the only translated to specified language. Also expected language of messages. *Default value* : depends on marketplace, for allegro-pl: `pl-PL`, for allegro-cz: `cs-CZ`, for allegro-sk: `sk-SK`. Check endpoint GET /marketplaces for acceptable language values. (optional) + * @param searchMode Defines where the given phrase should be searched in. Allowed values: - *REGULAR* - searching for a phrase in the title, - *CLOSED* - searching for a phrase in the title of closed offers. Available only for `allegro-pl` marketplace. (optional, default to REGULAR) + * @param offset Index of the first returned offer from all search results. Max offset is `600 - <limit>`. (optional, default to 0) + * @param limit The maximum number of offers in a response. (optional, default to 60) + * @param sort Search results sorting order. `+` or no prefix in the value means ascending order. `-` prefix means descending order. (optional, default to relevance) + * @param include Specify parts of the response that should be included in the output. Allowed values are the names of top level entities and *all* as an alias to all entities. By default, all top level entities are included. Use `-` prefix to exclude an entity. Example: `include=-all&include=filters&include=sort` - returns only filters and sort entities. (optional) + * @param fallback Defines the behaviour of the search engine when no results with exact phrase match are found: - *true* - related (not exact) results are returned, - *false* - empty results are returned. (optional, default to true) + * @param dynamicFilters You can filter and customize your search results to find exactly what you need by applying filters ids and their dictionary values to query according to the flowing pattern: id=value. When the filter definition looks like: ```` { \"id\": \"parameter.11323\", \"type\": \"MULTI\", \"name\": \"Stan\", \"values\": [{ \"value\": \"11323_1\", \"name\": \"nowe\", \"count\": 21, \"selected\": false }, { \"value\": \"11323_2\", \"name\": \"używane\", \"count\": 157, \"selected\": false }, { \"value\": \"11323_238066\", \"name\": \"po zwrocie\", \"count\": 1, \"selected\": false } ] } ```` You can use 'Stan' filter to query results, i.e.: * `parameter.11323=11323_1` for \"nowe\" * `parameter.11323=11323_2` for \"używane\" * `parameter.11323=11323_238066` for \"po zwrocie\". (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 + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 The request successfully returns the search result. -
400 Bad request. Check if all necessary parameters are provided. -
403 Access is denied. Application verification required. Read more: <a href=\"../../listing/\" target=\"_blank\">PL</a> / <a href=\"../../en/listing/\" target=\"_blank\">EN</a> -
404 Given category was not found. Check category.id parameter. -
406 Value of one of Accept headers is invalid. -
422 One of parameters have invalid value or given parameters combination is forbidden. -
429 Request was rejected because the limit was exceeded. -
500 Internal service error. -
502 Error caused by upstream service failure. -
+ */ + public okhttp3.Call getListingAsync(@javax.annotation.Nullable String categoryId, @javax.annotation.Nullable String phrase, @javax.annotation.Nullable String sellerId, @javax.annotation.Nullable String sellerLogin, @javax.annotation.Nullable String marketplaceId, @javax.annotation.Nullable String shippingCountry, @javax.annotation.Nullable String currency, @javax.annotation.Nullable String acceptLanguage, @javax.annotation.Nullable String searchMode, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable String sort, @javax.annotation.Nullable String include, @javax.annotation.Nullable Boolean fallback, @javax.annotation.Nullable Map dynamicFilters, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getListingValidateBeforeCall(categoryId, phrase, sellerId, sellerLogin, marketplaceId, shippingCountry, currency, acceptLanguage, searchMode, offset, limit, sort, include, fallback, dynamicFilters, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/PublicUserInformationApi.java b/src/main/java/pl/wtx/allegro/api/client/PublicUserInformationApi.java new file mode 100644 index 0000000..b91b9f4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/PublicUserInformationApi.java @@ -0,0 +1,217 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.UserRatingSummaryResponse; +import pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PublicUserInformationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PublicUserInformationApi() { + this(Configuration.getDefaultApiClient()); + } + + public PublicUserInformationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getUserSummaryUsingGET + * @param userId The ID of the user. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Feedback statistics returned successfully. -
401 Unauthorized -
403 Forbidden -
404 User with the given ID not found or user is not a seller. -
+ */ + public okhttp3.Call getUserSummaryUsingGETCall(@javax.annotation.Nonnull String userId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/users/{userId}/ratings-summary" + .replace("{" + "userId" + "}", localVarApiClient.escapeString(userId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/vnd.allegro.beta.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserSummaryUsingGETValidateBeforeCall(@javax.annotation.Nonnull String userId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling getUserSummaryUsingGET(Async)"); + } + + return getUserSummaryUsingGETCall(userId, _callback); + + } + + /** + * Get any user's ratings summary + * Use this resource to receive feedback statistics. Read more: <a href=\"../../news/nowe-zasoby-ktorymi-pobierzesz-informacje-o-ocenach-ZM9L1WPBbUb\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-to-download-sales-feedback-d2VYERBMRiz\" target=\"_blank\">EN</a>. + * @param userId The ID of the user. (required) + * @return UserRatingSummaryResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Feedback statistics returned successfully. -
401 Unauthorized -
403 Forbidden -
404 User with the given ID not found or user is not a seller. -
+ */ + public UserRatingSummaryResponse getUserSummaryUsingGET(@javax.annotation.Nonnull String userId) throws ApiException { + ApiResponse localVarResp = getUserSummaryUsingGETWithHttpInfo(userId); + return localVarResp.getData(); + } + + /** + * Get any user's ratings summary + * Use this resource to receive feedback statistics. Read more: <a href=\"../../news/nowe-zasoby-ktorymi-pobierzesz-informacje-o-ocenach-ZM9L1WPBbUb\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-to-download-sales-feedback-d2VYERBMRiz\" target=\"_blank\">EN</a>. + * @param userId The ID of the user. (required) + * @return ApiResponse<UserRatingSummaryResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Feedback statistics returned successfully. -
401 Unauthorized -
403 Forbidden -
404 User with the given ID not found or user is not a seller. -
+ */ + public ApiResponse getUserSummaryUsingGETWithHttpInfo(@javax.annotation.Nonnull String userId) throws ApiException { + okhttp3.Call localVarCall = getUserSummaryUsingGETValidateBeforeCall(userId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get any user's ratings summary (asynchronously) + * Use this resource to receive feedback statistics. Read more: <a href=\"../../news/nowe-zasoby-ktorymi-pobierzesz-informacje-o-ocenach-ZM9L1WPBbUb\" target=\"_blank\">PL</a> / <a href=\"../../news/new-resources-to-download-sales-feedback-d2VYERBMRiz\" target=\"_blank\">EN</a>. + * @param userId The ID of the user. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Feedback statistics returned successfully. -
401 Unauthorized -
403 Forbidden -
404 User with the given ID not found or user is not a seller. -
+ */ + public okhttp3.Call getUserSummaryUsingGETAsync(@javax.annotation.Nonnull String userId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserSummaryUsingGETValidateBeforeCall(userId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/RebatesAndPromotionsApi.java b/src/main/java/pl/wtx/allegro/api/client/RebatesAndPromotionsApi.java new file mode 100644 index 0000000..7f911ac --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/RebatesAndPromotionsApi.java @@ -0,0 +1,1256 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.NullableTurnoverDiscountDto; +import pl.wtx.allegro.api.client.model.SellerCreateRebateRequestDto; +import pl.wtx.allegro.api.client.model.SellerRebateDto; +import pl.wtx.allegro.api.client.model.SellerRebatesDto; +import pl.wtx.allegro.api.client.model.TurnoverDiscountDto; +import pl.wtx.allegro.api.client.model.TurnoverDiscountRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class RebatesAndPromotionsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public RebatesAndPromotionsApi() { + this(Configuration.getDefaultApiClient()); + } + + public RebatesAndPromotionsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createOrModifyTurnoverDiscountUsingPUT + * @param marketplaceId Marketplace identifier. (required) + * @param turnoverDiscountRequest request (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully created/modified turnover discount for marketplace -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Marketplace not supported -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call createOrModifyTurnoverDiscountUsingPUTCall(@javax.annotation.Nonnull String marketplaceId, @javax.annotation.Nonnull TurnoverDiscountRequest turnoverDiscountRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = turnoverDiscountRequest; + + // create path and map variables + String localVarPath = "/sale/turnover-discount/{marketplaceId}" + .replace("{" + "marketplaceId" + "}", localVarApiClient.escapeString(marketplaceId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createOrModifyTurnoverDiscountUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String marketplaceId, @javax.annotation.Nonnull TurnoverDiscountRequest turnoverDiscountRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'marketplaceId' is set + if (marketplaceId == null) { + throw new ApiException("Missing the required parameter 'marketplaceId' when calling createOrModifyTurnoverDiscountUsingPUT(Async)"); + } + + // verify the required parameter 'turnoverDiscountRequest' is set + if (turnoverDiscountRequest == null) { + throw new ApiException("Missing the required parameter 'turnoverDiscountRequest' when calling createOrModifyTurnoverDiscountUsingPUT(Async)"); + } + + return createOrModifyTurnoverDiscountUsingPUTCall(marketplaceId, turnoverDiscountRequest, _callback); + + } + + /** + * Create/modify turnover discount for marketplace + * Create or modify the turnover discount for the specified marketplace. Currently, the only supported marketplace is `allegro-business-cz`. <br/> Turnover discount is assigned to all offers available on the given marketplace. Only B2B users will see and be eligible for this discount. In order to create a turnover discount definition, you also have to be a B2B user. <br/> Created turnover discount becomes visible for B2B users with the first day of the next month. Since that day, B2B users begin cumulating their spending on your offers they purchased. Turnover cumulated within the month translate into appropriate percentage of the discount for all orders of your offers in the following month. <br/> Turnover discount created in a given month is susceptible for change only until the end of that month. After that, as mentioned before, turnover discount becomes available for the users and can no longer be modified instantly. Modifying turnover discount in such case will result in creation of the new definition of the discount. This new definition will become available for the users on the same basis that the previously created one, with the start of the next month. Also, similarly, newly created definition can be modified only until the the end of the month. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#utworz-lub-edytuj-rabat-obrotowy\" target=\"_blank\">PL</a> / <a href=\"../..//tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#create-or-edit-turnover-discount\" target=\"_blank\">EN</a>. + * @param marketplaceId Marketplace identifier. (required) + * @param turnoverDiscountRequest request (required) + * @return TurnoverDiscountDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully created/modified turnover discount for marketplace -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Marketplace not supported -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public TurnoverDiscountDto createOrModifyTurnoverDiscountUsingPUT(@javax.annotation.Nonnull String marketplaceId, @javax.annotation.Nonnull TurnoverDiscountRequest turnoverDiscountRequest) throws ApiException { + ApiResponse localVarResp = createOrModifyTurnoverDiscountUsingPUTWithHttpInfo(marketplaceId, turnoverDiscountRequest); + return localVarResp.getData(); + } + + /** + * Create/modify turnover discount for marketplace + * Create or modify the turnover discount for the specified marketplace. Currently, the only supported marketplace is `allegro-business-cz`. <br/> Turnover discount is assigned to all offers available on the given marketplace. Only B2B users will see and be eligible for this discount. In order to create a turnover discount definition, you also have to be a B2B user. <br/> Created turnover discount becomes visible for B2B users with the first day of the next month. Since that day, B2B users begin cumulating their spending on your offers they purchased. Turnover cumulated within the month translate into appropriate percentage of the discount for all orders of your offers in the following month. <br/> Turnover discount created in a given month is susceptible for change only until the end of that month. After that, as mentioned before, turnover discount becomes available for the users and can no longer be modified instantly. Modifying turnover discount in such case will result in creation of the new definition of the discount. This new definition will become available for the users on the same basis that the previously created one, with the start of the next month. Also, similarly, newly created definition can be modified only until the the end of the month. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#utworz-lub-edytuj-rabat-obrotowy\" target=\"_blank\">PL</a> / <a href=\"../..//tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#create-or-edit-turnover-discount\" target=\"_blank\">EN</a>. + * @param marketplaceId Marketplace identifier. (required) + * @param turnoverDiscountRequest request (required) + * @return ApiResponse<TurnoverDiscountDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully created/modified turnover discount for marketplace -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Marketplace not supported -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public ApiResponse createOrModifyTurnoverDiscountUsingPUTWithHttpInfo(@javax.annotation.Nonnull String marketplaceId, @javax.annotation.Nonnull TurnoverDiscountRequest turnoverDiscountRequest) throws ApiException { + okhttp3.Call localVarCall = createOrModifyTurnoverDiscountUsingPUTValidateBeforeCall(marketplaceId, turnoverDiscountRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create/modify turnover discount for marketplace (asynchronously) + * Create or modify the turnover discount for the specified marketplace. Currently, the only supported marketplace is `allegro-business-cz`. <br/> Turnover discount is assigned to all offers available on the given marketplace. Only B2B users will see and be eligible for this discount. In order to create a turnover discount definition, you also have to be a B2B user. <br/> Created turnover discount becomes visible for B2B users with the first day of the next month. Since that day, B2B users begin cumulating their spending on your offers they purchased. Turnover cumulated within the month translate into appropriate percentage of the discount for all orders of your offers in the following month. <br/> Turnover discount created in a given month is susceptible for change only until the end of that month. After that, as mentioned before, turnover discount becomes available for the users and can no longer be modified instantly. Modifying turnover discount in such case will result in creation of the new definition of the discount. This new definition will become available for the users on the same basis that the previously created one, with the start of the next month. Also, similarly, newly created definition can be modified only until the the end of the month. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#utworz-lub-edytuj-rabat-obrotowy\" target=\"_blank\">PL</a> / <a href=\"../..//tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#create-or-edit-turnover-discount\" target=\"_blank\">EN</a>. + * @param marketplaceId Marketplace identifier. (required) + * @param turnoverDiscountRequest request (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully created/modified turnover discount for marketplace -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Marketplace not supported -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call createOrModifyTurnoverDiscountUsingPUTAsync(@javax.annotation.Nonnull String marketplaceId, @javax.annotation.Nonnull TurnoverDiscountRequest turnoverDiscountRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createOrModifyTurnoverDiscountUsingPUTValidateBeforeCall(marketplaceId, turnoverDiscountRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createPromotionUsingPOST1 + * @param sellerCreateRebateRequestDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Successfully created the requested promotion -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Offer/Offers not found -
412 Validation failed – request had correct syntax, but promotion properties exceeds acceptable limits -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call createPromotionUsingPOST1Call(@javax.annotation.Nonnull SellerCreateRebateRequestDto sellerCreateRebateRequestDto, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = sellerCreateRebateRequestDto; + + // create path and map variables + String localVarPath = "/sale/loyalty/promotions"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createPromotionUsingPOST1ValidateBeforeCall(@javax.annotation.Nonnull SellerCreateRebateRequestDto sellerCreateRebateRequestDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'sellerCreateRebateRequestDto' is set + if (sellerCreateRebateRequestDto == null) { + throw new ApiException("Missing the required parameter 'sellerCreateRebateRequestDto' when calling createPromotionUsingPOST1(Async)"); + } + + return createPromotionUsingPOST1Call(sellerCreateRebateRequestDto, _callback); + + } + + /** + * Create a new promotion + * This endpoint creates a new promotion. You can create promotions only if your base marketplace is `allegro-pl`. Created promotions are visible only on the `allegro-pl` marketplace. You can define the following types of promotions: 1. Large order discount <br> Only company users will see and be eligible for this type of promotion. In order to create a large order discount, you also have to be a company user. Furthermore, you are allowed to have only one active order discount at a time. Define a promotion with a single benefit of type **LARGE_ORDER_DISCOUNT** and a single criterion of type **ALL_OFFERS**. The benefit specification should contain a list of order value based discount thresholds. Threshold's order value defines the minimum total value of an order for which the threshold is applicable (`lowerBound`). Threshold's discount defines the discount percentage applied when the threshold is applied. The percentage's fractional part must be equal to 0. Only the highest applicable threshold (if any) will be applied to the total value of the order. A threshold with a higher order value than another threshold in the order discount must also have a higher discount. Large order discount is assigned automatically to all seller's offers. Moreover, it will be assigned to all newly added seller's offers once activated. Please note that it may take some time to propagate this type of promotion to all of your offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#dodaj-rabat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#add-large-order-discount\" target=\"_blank\">EN</a>. 2. Wholesale price list <br> Only company users will see and be eligible for this type of promotion. In order to create a wholesale price list, you also have to be a company user. Define a promotion with a single benefit of type **WHOLESALE_PRICE_LIST** and a single criterion of type **OFFERS_ASSIGNED_EXTERNALLY**. The benefit specification should contain a name (it will be visible to you only) and a list of quantity based discount thresholds. Threshold's quantity defines the minimum number of units of an offer for which the threshold is applicable (`lowerBound`). Threshold's discount defines the discount percentage applied when the threshold is applied. The percentage's fractional part must be equal to 0. Only the highest applicable threshold (if any) will be applied to the total price of units of the offer bought. A threshold with a higher quantity than another threshold in the price list must also have a higher discount. In order to assign offers to a wholesale price list, use `discounts` field in <a href=\"#operation/modificationCommandUsingPUT\">batch offer modification</a>. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#dodaj-cennik-hurtowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#add-wholesale-price-list\" target=\"_blank\">EN</a>. 3. Multipack <br> In order to create a new multipack, you have to define a promotion with a single benefit of type **UNIT_PERCENTAGE_DISCOUNT** and a single criterion of type **CONTAINS_OFFERS**. The benefit specification should contain a configuration section with a percentage which indicates the specific discount for the discounted offer. This percentage should be an integer value greater than 15 for quantity 2, greater than 30 for quantity 3, greater than 40 for quantity 4, greater than 50 for quantity 5 and lower than or equal to 100. The specification should also contain a trigger section with a field forEachQuantity that defines the amount of items in the multipack which is necessary to trigger the benefit. Additionally, the discountedNumber field must be set to 1 by default as you can only discount one unit in a multipack. Finally, the offer criterion specifies the offer for which the multipack promotion will take effect. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#dodaj-rabat-ilosciowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#add-quantitative-discount\" target=\"_blank\">EN</a> 4. Cross-offer multipack <br> A cross-offer multipack is created in the same fashion as a standard multipack. The only difference is that you need to pass more than 1 offer in the offer criterion section. This group of offers is then considered as a pool from which users can pick and choose forEachQuantity offers and the cheapest of them gets a discount. + * @param sellerCreateRebateRequestDto (required) + * @return SellerRebateDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Successfully created the requested promotion -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Offer/Offers not found -
412 Validation failed – request had correct syntax, but promotion properties exceeds acceptable limits -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public SellerRebateDto createPromotionUsingPOST1(@javax.annotation.Nonnull SellerCreateRebateRequestDto sellerCreateRebateRequestDto) throws ApiException { + ApiResponse localVarResp = createPromotionUsingPOST1WithHttpInfo(sellerCreateRebateRequestDto); + return localVarResp.getData(); + } + + /** + * Create a new promotion + * This endpoint creates a new promotion. You can create promotions only if your base marketplace is `allegro-pl`. Created promotions are visible only on the `allegro-pl` marketplace. You can define the following types of promotions: 1. Large order discount <br> Only company users will see and be eligible for this type of promotion. In order to create a large order discount, you also have to be a company user. Furthermore, you are allowed to have only one active order discount at a time. Define a promotion with a single benefit of type **LARGE_ORDER_DISCOUNT** and a single criterion of type **ALL_OFFERS**. The benefit specification should contain a list of order value based discount thresholds. Threshold's order value defines the minimum total value of an order for which the threshold is applicable (`lowerBound`). Threshold's discount defines the discount percentage applied when the threshold is applied. The percentage's fractional part must be equal to 0. Only the highest applicable threshold (if any) will be applied to the total value of the order. A threshold with a higher order value than another threshold in the order discount must also have a higher discount. Large order discount is assigned automatically to all seller's offers. Moreover, it will be assigned to all newly added seller's offers once activated. Please note that it may take some time to propagate this type of promotion to all of your offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#dodaj-rabat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#add-large-order-discount\" target=\"_blank\">EN</a>. 2. Wholesale price list <br> Only company users will see and be eligible for this type of promotion. In order to create a wholesale price list, you also have to be a company user. Define a promotion with a single benefit of type **WHOLESALE_PRICE_LIST** and a single criterion of type **OFFERS_ASSIGNED_EXTERNALLY**. The benefit specification should contain a name (it will be visible to you only) and a list of quantity based discount thresholds. Threshold's quantity defines the minimum number of units of an offer for which the threshold is applicable (`lowerBound`). Threshold's discount defines the discount percentage applied when the threshold is applied. The percentage's fractional part must be equal to 0. Only the highest applicable threshold (if any) will be applied to the total price of units of the offer bought. A threshold with a higher quantity than another threshold in the price list must also have a higher discount. In order to assign offers to a wholesale price list, use `discounts` field in <a href=\"#operation/modificationCommandUsingPUT\">batch offer modification</a>. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#dodaj-cennik-hurtowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#add-wholesale-price-list\" target=\"_blank\">EN</a>. 3. Multipack <br> In order to create a new multipack, you have to define a promotion with a single benefit of type **UNIT_PERCENTAGE_DISCOUNT** and a single criterion of type **CONTAINS_OFFERS**. The benefit specification should contain a configuration section with a percentage which indicates the specific discount for the discounted offer. This percentage should be an integer value greater than 15 for quantity 2, greater than 30 for quantity 3, greater than 40 for quantity 4, greater than 50 for quantity 5 and lower than or equal to 100. The specification should also contain a trigger section with a field forEachQuantity that defines the amount of items in the multipack which is necessary to trigger the benefit. Additionally, the discountedNumber field must be set to 1 by default as you can only discount one unit in a multipack. Finally, the offer criterion specifies the offer for which the multipack promotion will take effect. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#dodaj-rabat-ilosciowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#add-quantitative-discount\" target=\"_blank\">EN</a> 4. Cross-offer multipack <br> A cross-offer multipack is created in the same fashion as a standard multipack. The only difference is that you need to pass more than 1 offer in the offer criterion section. This group of offers is then considered as a pool from which users can pick and choose forEachQuantity offers and the cheapest of them gets a discount. + * @param sellerCreateRebateRequestDto (required) + * @return ApiResponse<SellerRebateDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Successfully created the requested promotion -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Offer/Offers not found -
412 Validation failed – request had correct syntax, but promotion properties exceeds acceptable limits -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public ApiResponse createPromotionUsingPOST1WithHttpInfo(@javax.annotation.Nonnull SellerCreateRebateRequestDto sellerCreateRebateRequestDto) throws ApiException { + okhttp3.Call localVarCall = createPromotionUsingPOST1ValidateBeforeCall(sellerCreateRebateRequestDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a new promotion (asynchronously) + * This endpoint creates a new promotion. You can create promotions only if your base marketplace is `allegro-pl`. Created promotions are visible only on the `allegro-pl` marketplace. You can define the following types of promotions: 1. Large order discount <br> Only company users will see and be eligible for this type of promotion. In order to create a large order discount, you also have to be a company user. Furthermore, you are allowed to have only one active order discount at a time. Define a promotion with a single benefit of type **LARGE_ORDER_DISCOUNT** and a single criterion of type **ALL_OFFERS**. The benefit specification should contain a list of order value based discount thresholds. Threshold's order value defines the minimum total value of an order for which the threshold is applicable (`lowerBound`). Threshold's discount defines the discount percentage applied when the threshold is applied. The percentage's fractional part must be equal to 0. Only the highest applicable threshold (if any) will be applied to the total value of the order. A threshold with a higher order value than another threshold in the order discount must also have a higher discount. Large order discount is assigned automatically to all seller's offers. Moreover, it will be assigned to all newly added seller's offers once activated. Please note that it may take some time to propagate this type of promotion to all of your offers. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#dodaj-rabat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#add-large-order-discount\" target=\"_blank\">EN</a>. 2. Wholesale price list <br> Only company users will see and be eligible for this type of promotion. In order to create a wholesale price list, you also have to be a company user. Define a promotion with a single benefit of type **WHOLESALE_PRICE_LIST** and a single criterion of type **OFFERS_ASSIGNED_EXTERNALLY**. The benefit specification should contain a name (it will be visible to you only) and a list of quantity based discount thresholds. Threshold's quantity defines the minimum number of units of an offer for which the threshold is applicable (`lowerBound`). Threshold's discount defines the discount percentage applied when the threshold is applied. The percentage's fractional part must be equal to 0. Only the highest applicable threshold (if any) will be applied to the total price of units of the offer bought. A threshold with a higher quantity than another threshold in the price list must also have a higher discount. In order to assign offers to a wholesale price list, use `discounts` field in <a href=\"#operation/modificationCommandUsingPUT\">batch offer modification</a>. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#dodaj-cennik-hurtowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#add-wholesale-price-list\" target=\"_blank\">EN</a>. 3. Multipack <br> In order to create a new multipack, you have to define a promotion with a single benefit of type **UNIT_PERCENTAGE_DISCOUNT** and a single criterion of type **CONTAINS_OFFERS**. The benefit specification should contain a configuration section with a percentage which indicates the specific discount for the discounted offer. This percentage should be an integer value greater than 15 for quantity 2, greater than 30 for quantity 3, greater than 40 for quantity 4, greater than 50 for quantity 5 and lower than or equal to 100. The specification should also contain a trigger section with a field forEachQuantity that defines the amount of items in the multipack which is necessary to trigger the benefit. Additionally, the discountedNumber field must be set to 1 by default as you can only discount one unit in a multipack. Finally, the offer criterion specifies the offer for which the multipack promotion will take effect. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#dodaj-rabat-ilosciowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#add-quantitative-discount\" target=\"_blank\">EN</a> 4. Cross-offer multipack <br> A cross-offer multipack is created in the same fashion as a standard multipack. The only difference is that you need to pass more than 1 offer in the offer criterion section. This group of offers is then considered as a pool from which users can pick and choose forEachQuantity offers and the cheapest of them gets a discount. + * @param sellerCreateRebateRequestDto (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Successfully created the requested promotion -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Offer/Offers not found -
412 Validation failed – request had correct syntax, but promotion properties exceeds acceptable limits -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call createPromotionUsingPOST1Async(@javax.annotation.Nonnull SellerCreateRebateRequestDto sellerCreateRebateRequestDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createPromotionUsingPOST1ValidateBeforeCall(sellerCreateRebateRequestDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deactivatePromotionUsingDELETE + * @param promotionId Promotion identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deactivated the requested promotion -
401 Unauthorized action -
404 Promotion not found -
+ */ + public okhttp3.Call deactivatePromotionUsingDELETECall(@javax.annotation.Nonnull String promotionId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/loyalty/promotions/{promotionId}" + .replace("{" + "promotionId" + "}", localVarApiClient.escapeString(promotionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "*/*" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deactivatePromotionUsingDELETEValidateBeforeCall(@javax.annotation.Nonnull String promotionId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'promotionId' is set + if (promotionId == null) { + throw new ApiException("Missing the required parameter 'promotionId' when calling deactivatePromotionUsingDELETE(Async)"); + } + + return deactivatePromotionUsingDELETECall(promotionId, _callback); + + } + + /** + * Deactivate a promotion by id + * Use this resource to deactivate the requested promotion. You need to use its unique id. <br> Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-rabat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-large-order-discount\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-cennik\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-wholesale-price-list\" target=\"_blank\">EN</a>, Multipack <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-rabat-ilosciowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-an-quantitative-discount\" target=\"_blank\">EN</a>. + * @param promotionId Promotion identifier. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deactivated the requested promotion -
401 Unauthorized action -
404 Promotion not found -
+ */ + public void deactivatePromotionUsingDELETE(@javax.annotation.Nonnull String promotionId) throws ApiException { + deactivatePromotionUsingDELETEWithHttpInfo(promotionId); + } + + /** + * Deactivate a promotion by id + * Use this resource to deactivate the requested promotion. You need to use its unique id. <br> Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-rabat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-large-order-discount\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-cennik\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-wholesale-price-list\" target=\"_blank\">EN</a>, Multipack <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-rabat-ilosciowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-an-quantitative-discount\" target=\"_blank\">EN</a>. + * @param promotionId Promotion identifier. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deactivated the requested promotion -
401 Unauthorized action -
404 Promotion not found -
+ */ + public ApiResponse deactivatePromotionUsingDELETEWithHttpInfo(@javax.annotation.Nonnull String promotionId) throws ApiException { + okhttp3.Call localVarCall = deactivatePromotionUsingDELETEValidateBeforeCall(promotionId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deactivate a promotion by id (asynchronously) + * Use this resource to deactivate the requested promotion. You need to use its unique id. <br> Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-rabat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-large-order-discount\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-cennik\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-wholesale-price-list\" target=\"_blank\">EN</a>, Multipack <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#usun-rabat-ilosciowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#remove-an-quantitative-discount\" target=\"_blank\">EN</a>. + * @param promotionId Promotion identifier. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
204 Successfully deactivated the requested promotion -
401 Unauthorized action -
404 Promotion not found -
+ */ + public okhttp3.Call deactivatePromotionUsingDELETEAsync(@javax.annotation.Nonnull String promotionId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deactivatePromotionUsingDELETEValidateBeforeCall(promotionId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deactivateTurnoverDiscountsUsingPUT + * @param marketplaceId Marketplace identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Turnover discount for marketplace after deactivation -
204 Discount with `ACTIVATING` status was deactivated -
401 Unauthorized action -
403 Forbidden action -
404 Marketplace not supported -
+ */ + public okhttp3.Call deactivateTurnoverDiscountsUsingPUTCall(@javax.annotation.Nonnull String marketplaceId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/turnover-discount/{marketplaceId}/deactivate" + .replace("{" + "marketplaceId" + "}", localVarApiClient.escapeString(marketplaceId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deactivateTurnoverDiscountsUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String marketplaceId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'marketplaceId' is set + if (marketplaceId == null) { + throw new ApiException("Missing the required parameter 'marketplaceId' when calling deactivateTurnoverDiscountsUsingPUT(Async)"); + } + + return deactivateTurnoverDiscountsUsingPUTCall(marketplaceId, _callback); + + } + + /** + * Deactivate turnover discount for marketplace + * Deactivate turnover discount for a given marketplace. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#deaktywuj-rabat-obrotowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#deactivate-turnover-discount\" target=\"_blank\">EN</a>. Currently, the only supported marketplace is `allegro-business-cz`. <br/> Turnover discount will stop being cumulated with the end of the current month. Discount based on cumulated turnover will stop being applied with the end of the next month. After that, the discount will be completely deactivated. <br/> When deactivating the discount that still has `ACTIVATING` status, turnover discount is deactivated immediately. In that case, no turnover discount will start being cumulated with the new month. + * @param marketplaceId Marketplace identifier. (required) + * @return TurnoverDiscountDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Turnover discount for marketplace after deactivation -
204 Discount with `ACTIVATING` status was deactivated -
401 Unauthorized action -
403 Forbidden action -
404 Marketplace not supported -
+ */ + public TurnoverDiscountDto deactivateTurnoverDiscountsUsingPUT(@javax.annotation.Nonnull String marketplaceId) throws ApiException { + ApiResponse localVarResp = deactivateTurnoverDiscountsUsingPUTWithHttpInfo(marketplaceId); + return localVarResp.getData(); + } + + /** + * Deactivate turnover discount for marketplace + * Deactivate turnover discount for a given marketplace. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#deaktywuj-rabat-obrotowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#deactivate-turnover-discount\" target=\"_blank\">EN</a>. Currently, the only supported marketplace is `allegro-business-cz`. <br/> Turnover discount will stop being cumulated with the end of the current month. Discount based on cumulated turnover will stop being applied with the end of the next month. After that, the discount will be completely deactivated. <br/> When deactivating the discount that still has `ACTIVATING` status, turnover discount is deactivated immediately. In that case, no turnover discount will start being cumulated with the new month. + * @param marketplaceId Marketplace identifier. (required) + * @return ApiResponse<TurnoverDiscountDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Turnover discount for marketplace after deactivation -
204 Discount with `ACTIVATING` status was deactivated -
401 Unauthorized action -
403 Forbidden action -
404 Marketplace not supported -
+ */ + public ApiResponse deactivateTurnoverDiscountsUsingPUTWithHttpInfo(@javax.annotation.Nonnull String marketplaceId) throws ApiException { + okhttp3.Call localVarCall = deactivateTurnoverDiscountsUsingPUTValidateBeforeCall(marketplaceId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Deactivate turnover discount for marketplace (asynchronously) + * Deactivate turnover discount for a given marketplace. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#deaktywuj-rabat-obrotowy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#deactivate-turnover-discount\" target=\"_blank\">EN</a>. Currently, the only supported marketplace is `allegro-business-cz`. <br/> Turnover discount will stop being cumulated with the end of the current month. Discount based on cumulated turnover will stop being applied with the end of the next month. After that, the discount will be completely deactivated. <br/> When deactivating the discount that still has `ACTIVATING` status, turnover discount is deactivated immediately. In that case, no turnover discount will start being cumulated with the new month. + * @param marketplaceId Marketplace identifier. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Turnover discount for marketplace after deactivation -
204 Discount with `ACTIVATING` status was deactivated -
401 Unauthorized action -
403 Forbidden action -
404 Marketplace not supported -
+ */ + public okhttp3.Call deactivateTurnoverDiscountsUsingPUTAsync(@javax.annotation.Nonnull String marketplaceId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deactivateTurnoverDiscountsUsingPUTValidateBeforeCall(marketplaceId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPromotionUsingGET + * @param promotionId Promotion identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested promotion -
401 Unauthorized action -
404 Promotion not found -
+ */ + public okhttp3.Call getPromotionUsingGETCall(@javax.annotation.Nonnull String promotionId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/loyalty/promotions/{promotionId}" + .replace("{" + "promotionId" + "}", localVarApiClient.escapeString(promotionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPromotionUsingGETValidateBeforeCall(@javax.annotation.Nonnull String promotionId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'promotionId' is set + if (promotionId == null) { + throw new ApiException("Missing the required parameter 'promotionId' when calling getPromotionUsingGET(Async)"); + } + + return getPromotionUsingGETCall(promotionId, _callback); + + } + + /** + * Get a promotion data by id + * <br> Use this resource to return the requested promotion. You need to use its unique id. <br> Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-informacje-o-rabacie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-information-about-large-order-discount\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-informacje-o-cenniku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-information-about-wholesale-price-list\" target=\"_blank\">EN</a>, Multipack <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-informacje-o-rabacie-ilosciowym\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#information-about-an-quantitative-discount\" target=\"_blank\">EN</a>. + * @param promotionId Promotion identifier. (required) + * @return SellerRebateDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested promotion -
401 Unauthorized action -
404 Promotion not found -
+ */ + public SellerRebateDto getPromotionUsingGET(@javax.annotation.Nonnull String promotionId) throws ApiException { + ApiResponse localVarResp = getPromotionUsingGETWithHttpInfo(promotionId); + return localVarResp.getData(); + } + + /** + * Get a promotion data by id + * <br> Use this resource to return the requested promotion. You need to use its unique id. <br> Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-informacje-o-rabacie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-information-about-large-order-discount\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-informacje-o-cenniku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-information-about-wholesale-price-list\" target=\"_blank\">EN</a>, Multipack <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-informacje-o-rabacie-ilosciowym\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#information-about-an-quantitative-discount\" target=\"_blank\">EN</a>. + * @param promotionId Promotion identifier. (required) + * @return ApiResponse<SellerRebateDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested promotion -
401 Unauthorized action -
404 Promotion not found -
+ */ + public ApiResponse getPromotionUsingGETWithHttpInfo(@javax.annotation.Nonnull String promotionId) throws ApiException { + okhttp3.Call localVarCall = getPromotionUsingGETValidateBeforeCall(promotionId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a promotion data by id (asynchronously) + * <br> Use this resource to return the requested promotion. You need to use its unique id. <br> Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-informacje-o-rabacie\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-information-about-large-order-discount\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-informacje-o-cenniku\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-information-about-wholesale-price-list\" target=\"_blank\">EN</a>, Multipack <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-informacje-o-rabacie-ilosciowym\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#information-about-an-quantitative-discount\" target=\"_blank\">EN</a>. + * @param promotionId Promotion identifier. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested promotion -
401 Unauthorized action -
404 Promotion not found -
+ */ + public okhttp3.Call getPromotionUsingGETAsync(@javax.annotation.Nonnull String promotionId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPromotionUsingGETValidateBeforeCall(promotionId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getTurnoverDiscountsUsingGET + * @param marketplaceId List of marketplace identifiers. Only turnover discounts for specified marketplaces are returned. <br/> Currently, only `allegro-business-cz` is supported. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 List of turnover discounts for marketplaces -
401 Unauthorized action -
403 Forbidden action -
+ */ + public okhttp3.Call getTurnoverDiscountsUsingGETCall(@javax.annotation.Nullable List marketplaceId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/turnover-discount"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marketplaceId != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "marketplaceId", marketplaceId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTurnoverDiscountsUsingGETValidateBeforeCall(@javax.annotation.Nullable List marketplaceId, final ApiCallback _callback) throws ApiException { + return getTurnoverDiscountsUsingGETCall(marketplaceId, _callback); + + } + + /** + * Get the list of turnover discounts + * Get a list of turnover discounts for all supported marketplaces. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-liste-rabatow-obrotowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-the-list-of-turnover-discounts\" target=\"_blank\">EN</a>. Currently, the only supported marketplace is `allegro-business-cz`. <br/> Turnover discount for the marketplace can have one of the three statuses: 1. `ACTIVATING` - neither accumulation of the turnover, nor applying of the discount has started yet. Turnover will be being accumulated from the beginning of the next month. 2. `ACTIVE` - there is ongoing accumulation of the turnover and/or applying of the discount. The latest discount definition does not have fields `cumulatingToDate` and `spendingToDate` set to a specific date. There may be multiple (up to 3) definitions of the discount returned for each marketplace. Only one definition can be accumulated against, and only one definition can be applied at the same time - appropriate periods from different definitions will not overlap. 3. `DEACTIVATING` - there is ongoing accumulation of the turnover and/or applying of the discount. Accumulation of the turnover will be continued until `cumulatingToDate` of the last definition. Applying of the discount will be continued until `spendingToDate` of the last definition. + * @param marketplaceId List of marketplace identifiers. Only turnover discounts for specified marketplaces are returned. <br/> Currently, only `allegro-business-cz` is supported. (optional) + * @return List<NullableTurnoverDiscountDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 List of turnover discounts for marketplaces -
401 Unauthorized action -
403 Forbidden action -
+ */ + public List getTurnoverDiscountsUsingGET(@javax.annotation.Nullable List marketplaceId) throws ApiException { + ApiResponse> localVarResp = getTurnoverDiscountsUsingGETWithHttpInfo(marketplaceId); + return localVarResp.getData(); + } + + /** + * Get the list of turnover discounts + * Get a list of turnover discounts for all supported marketplaces. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-liste-rabatow-obrotowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-the-list-of-turnover-discounts\" target=\"_blank\">EN</a>. Currently, the only supported marketplace is `allegro-business-cz`. <br/> Turnover discount for the marketplace can have one of the three statuses: 1. `ACTIVATING` - neither accumulation of the turnover, nor applying of the discount has started yet. Turnover will be being accumulated from the beginning of the next month. 2. `ACTIVE` - there is ongoing accumulation of the turnover and/or applying of the discount. The latest discount definition does not have fields `cumulatingToDate` and `spendingToDate` set to a specific date. There may be multiple (up to 3) definitions of the discount returned for each marketplace. Only one definition can be accumulated against, and only one definition can be applied at the same time - appropriate periods from different definitions will not overlap. 3. `DEACTIVATING` - there is ongoing accumulation of the turnover and/or applying of the discount. Accumulation of the turnover will be continued until `cumulatingToDate` of the last definition. Applying of the discount will be continued until `spendingToDate` of the last definition. + * @param marketplaceId List of marketplace identifiers. Only turnover discounts for specified marketplaces are returned. <br/> Currently, only `allegro-business-cz` is supported. (optional) + * @return ApiResponse<List<NullableTurnoverDiscountDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 List of turnover discounts for marketplaces -
401 Unauthorized action -
403 Forbidden action -
+ */ + public ApiResponse> getTurnoverDiscountsUsingGETWithHttpInfo(@javax.annotation.Nullable List marketplaceId) throws ApiException { + okhttp3.Call localVarCall = getTurnoverDiscountsUsingGETValidateBeforeCall(marketplaceId, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the list of turnover discounts (asynchronously) + * Get a list of turnover discounts for all supported marketplaces. Read more: <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-liste-rabatow-obrotowych\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-the-list-of-turnover-discounts\" target=\"_blank\">EN</a>. Currently, the only supported marketplace is `allegro-business-cz`. <br/> Turnover discount for the marketplace can have one of the three statuses: 1. `ACTIVATING` - neither accumulation of the turnover, nor applying of the discount has started yet. Turnover will be being accumulated from the beginning of the next month. 2. `ACTIVE` - there is ongoing accumulation of the turnover and/or applying of the discount. The latest discount definition does not have fields `cumulatingToDate` and `spendingToDate` set to a specific date. There may be multiple (up to 3) definitions of the discount returned for each marketplace. Only one definition can be accumulated against, and only one definition can be applied at the same time - appropriate periods from different definitions will not overlap. 3. `DEACTIVATING` - there is ongoing accumulation of the turnover and/or applying of the discount. Accumulation of the turnover will be continued until `cumulatingToDate` of the last definition. Applying of the discount will be continued until `spendingToDate` of the last definition. + * @param marketplaceId List of marketplace identifiers. Only turnover discounts for specified marketplaces are returned. <br/> Currently, only `allegro-business-cz` is supported. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 List of turnover discounts for marketplaces -
401 Unauthorized action -
403 Forbidden action -
+ */ + public okhttp3.Call getTurnoverDiscountsUsingGETAsync(@javax.annotation.Nullable List marketplaceId, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getTurnoverDiscountsUsingGETValidateBeforeCall(marketplaceId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listSellerPromotionsUsingGET1 + * @param promotionType Filter by promotion type. (required) + * @param limit Limit of promotions per page. (optional, default to 50) + * @param offset Distance between the beginning of the document and the point from which promotions are returned. (optional, default to 0) + * @param offerId Filter by offer id. No promotions with `OFFERS_ASSIGNED_EXTERNALLY` or `ALL_OFFERS` criteria will be returned if this parameter is present. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested list of promotions -
400 Bad request -
401 Unauthorized action -
422 Restrictions were not satisfied -
+ */ + public okhttp3.Call listSellerPromotionsUsingGET1Call(@javax.annotation.Nonnull String promotionType, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/loyalty/promotions"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (offerId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offer.id", offerId)); + } + + if (promotionType != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("promotionType", promotionType)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listSellerPromotionsUsingGET1ValidateBeforeCall(@javax.annotation.Nonnull String promotionType, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'promotionType' is set + if (promotionType == null) { + throw new ApiException("Missing the required parameter 'promotionType' when calling listSellerPromotionsUsingGET1(Async)"); + } + + return listSellerPromotionsUsingGET1Call(promotionType, limit, offset, offerId, _callback); + + } + + /** + * Get the user's list of promotions + * Get a list of promotions defined by the authorized user and filtered by promotion type. <p>Restrictions:</p> <p>Filtering by promotion type is required.</p> <p>Sum of limit and offset must be equal to or lower than 50000. Limit must be equal to or lower than 5000.</p> <p>Example:</p> <p>offset = 49950 and limit = 50 will return promotions</p> <p>offset = 49950 and limit = 51 will return 422 http error</p> <p>offset = 0 and limit = 5000 will return promotions</p> <p>offset = 0 and limit = 5001 will return 422 http error</p> <p>Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-dostepne-rabaty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-large-order-discount\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-dostepne-cenniki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-wholesale-price-lists\" target=\"_blank\">EN</a>, Multipack <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-dostepne-rabaty-ilosciowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-promotional-sets\" target=\"_blank\">EN</a>.</p> + * @param promotionType Filter by promotion type. (required) + * @param limit Limit of promotions per page. (optional, default to 50) + * @param offset Distance between the beginning of the document and the point from which promotions are returned. (optional, default to 0) + * @param offerId Filter by offer id. No promotions with `OFFERS_ASSIGNED_EXTERNALLY` or `ALL_OFFERS` criteria will be returned if this parameter is present. (optional) + * @return SellerRebatesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested list of promotions -
400 Bad request -
401 Unauthorized action -
422 Restrictions were not satisfied -
+ */ + public SellerRebatesDto listSellerPromotionsUsingGET1(@javax.annotation.Nonnull String promotionType, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String offerId) throws ApiException { + ApiResponse localVarResp = listSellerPromotionsUsingGET1WithHttpInfo(promotionType, limit, offset, offerId); + return localVarResp.getData(); + } + + /** + * Get the user's list of promotions + * Get a list of promotions defined by the authorized user and filtered by promotion type. <p>Restrictions:</p> <p>Filtering by promotion type is required.</p> <p>Sum of limit and offset must be equal to or lower than 50000. Limit must be equal to or lower than 5000.</p> <p>Example:</p> <p>offset = 49950 and limit = 50 will return promotions</p> <p>offset = 49950 and limit = 51 will return 422 http error</p> <p>offset = 0 and limit = 5000 will return promotions</p> <p>offset = 0 and limit = 5001 will return 422 http error</p> <p>Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-dostepne-rabaty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-large-order-discount\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-dostepne-cenniki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-wholesale-price-lists\" target=\"_blank\">EN</a>, Multipack <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-dostepne-rabaty-ilosciowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-promotional-sets\" target=\"_blank\">EN</a>.</p> + * @param promotionType Filter by promotion type. (required) + * @param limit Limit of promotions per page. (optional, default to 50) + * @param offset Distance between the beginning of the document and the point from which promotions are returned. (optional, default to 0) + * @param offerId Filter by offer id. No promotions with `OFFERS_ASSIGNED_EXTERNALLY` or `ALL_OFFERS` criteria will be returned if this parameter is present. (optional) + * @return ApiResponse<SellerRebatesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested list of promotions -
400 Bad request -
401 Unauthorized action -
422 Restrictions were not satisfied -
+ */ + public ApiResponse listSellerPromotionsUsingGET1WithHttpInfo(@javax.annotation.Nonnull String promotionType, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String offerId) throws ApiException { + okhttp3.Call localVarCall = listSellerPromotionsUsingGET1ValidateBeforeCall(promotionType, limit, offset, offerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's list of promotions (asynchronously) + * Get a list of promotions defined by the authorized user and filtered by promotion type. <p>Restrictions:</p> <p>Filtering by promotion type is required.</p> <p>Sum of limit and offset must be equal to or lower than 50000. Limit must be equal to or lower than 5000.</p> <p>Example:</p> <p>offset = 49950 and limit = 50 will return promotions</p> <p>offset = 49950 and limit = 51 will return 422 http error</p> <p>offset = 0 and limit = 5000 will return promotions</p> <p>offset = 0 and limit = 5001 will return 422 http error</p> <p>Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-dostepne-rabaty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-large-order-discount\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-dostepne-cenniki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-wholesale-price-lists\" target=\"_blank\">EN</a>, Multipack <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#pobierz-dostepne-rabaty-ilosciowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#retrieve-promotional-sets\" target=\"_blank\">EN</a>.</p> + * @param promotionType Filter by promotion type. (required) + * @param limit Limit of promotions per page. (optional, default to 50) + * @param offset Distance between the beginning of the document and the point from which promotions are returned. (optional, default to 0) + * @param offerId Filter by offer id. No promotions with `OFFERS_ASSIGNED_EXTERNALLY` or `ALL_OFFERS` criteria will be returned if this parameter is present. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned the requested list of promotions -
400 Bad request -
401 Unauthorized action -
422 Restrictions were not satisfied -
+ */ + public okhttp3.Call listSellerPromotionsUsingGET1Async(@javax.annotation.Nonnull String promotionType, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listSellerPromotionsUsingGET1ValidateBeforeCall(promotionType, limit, offset, offerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updatePromotionUsingPUT + * @param promotionId Promotion identifier. (required) + * @param sellerCreateRebateRequestDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully updated the requested promotion -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Promotion not found -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call updatePromotionUsingPUTCall(@javax.annotation.Nonnull String promotionId, @javax.annotation.Nonnull SellerCreateRebateRequestDto sellerCreateRebateRequestDto, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = sellerCreateRebateRequestDto; + + // create path and map variables + String localVarPath = "/sale/loyalty/promotions/{promotionId}" + .replace("{" + "promotionId" + "}", localVarApiClient.escapeString(promotionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePromotionUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String promotionId, @javax.annotation.Nonnull SellerCreateRebateRequestDto sellerCreateRebateRequestDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'promotionId' is set + if (promotionId == null) { + throw new ApiException("Missing the required parameter 'promotionId' when calling updatePromotionUsingPUT(Async)"); + } + + // verify the required parameter 'sellerCreateRebateRequestDto' is set + if (sellerCreateRebateRequestDto == null) { + throw new ApiException("Missing the required parameter 'sellerCreateRebateRequestDto' when calling updatePromotionUsingPUT(Async)"); + } + + return updatePromotionUsingPUTCall(promotionId, sellerCreateRebateRequestDto, _callback); + + } + + /** + * Modify a promotion + * Use this resource to update a promotion by its unique id. <br> It supports editing bundle's discount, wholesale price lists and large order discounts. Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#edytuj-progi-rabatowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#edit-discount-thresholds\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#edytuj-cennik\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#edit-wholesale-price-list\" target=\"_blank\">EN</a>. + * @param promotionId Promotion identifier. (required) + * @param sellerCreateRebateRequestDto (required) + * @return SellerRebateDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully updated the requested promotion -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Promotion not found -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public SellerRebateDto updatePromotionUsingPUT(@javax.annotation.Nonnull String promotionId, @javax.annotation.Nonnull SellerCreateRebateRequestDto sellerCreateRebateRequestDto) throws ApiException { + ApiResponse localVarResp = updatePromotionUsingPUTWithHttpInfo(promotionId, sellerCreateRebateRequestDto); + return localVarResp.getData(); + } + + /** + * Modify a promotion + * Use this resource to update a promotion by its unique id. <br> It supports editing bundle's discount, wholesale price lists and large order discounts. Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#edytuj-progi-rabatowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#edit-discount-thresholds\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#edytuj-cennik\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#edit-wholesale-price-list\" target=\"_blank\">EN</a>. + * @param promotionId Promotion identifier. (required) + * @param sellerCreateRebateRequestDto (required) + * @return ApiResponse<SellerRebateDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully updated the requested promotion -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Promotion not found -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public ApiResponse updatePromotionUsingPUTWithHttpInfo(@javax.annotation.Nonnull String promotionId, @javax.annotation.Nonnull SellerCreateRebateRequestDto sellerCreateRebateRequestDto) throws ApiException { + okhttp3.Call localVarCall = updatePromotionUsingPUTValidateBeforeCall(promotionId, sellerCreateRebateRequestDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Modify a promotion (asynchronously) + * Use this resource to update a promotion by its unique id. <br> It supports editing bundle's discount, wholesale price lists and large order discounts. Read more about: Large order discount <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#edytuj-progi-rabatowe\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#edit-discount-thresholds\" target=\"_blank\">EN</a>, Wholesale price list <a href=\"../../tutorials/jak-zarzadzac-rabatami-promocjami-yPya2mj6zUP#edytuj-cennik\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-rebates-and-promotions-g05avdL0vT4#edit-wholesale-price-list\" target=\"_blank\">EN</a>. + * @param promotionId Promotion identifier. (required) + * @param sellerCreateRebateRequestDto (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully updated the requested promotion -
400 Bad request -
401 Unauthorized action -
403 Forbidden action -
404 Promotion not found -
422 Validation failed – request had correct syntax, but violated validation rules -
+ */ + public okhttp3.Call updatePromotionUsingPUTAsync(@javax.annotation.Nonnull String promotionId, @javax.annotation.Nonnull SellerCreateRebateRequestDto sellerCreateRebateRequestDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePromotionUsingPUTValidateBeforeCall(promotionId, sellerCreateRebateRequestDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/ResponsiblePersonsApi.java b/src/main/java/pl/wtx/allegro/api/client/ResponsiblePersonsApi.java new file mode 100644 index 0000000..bfb9401 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/ResponsiblePersonsApi.java @@ -0,0 +1,599 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.CreateResponsiblePersonRequest; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.ResponsiblePersonResponse; +import pl.wtx.allegro.api.client.model.ResponsiblePersonsGET200Response; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.UpdateResponsiblePersonRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ResponsiblePersonsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ResponsiblePersonsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ResponsiblePersonsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for responsiblePersonsGET + * @param accept Acceptable representation of the response. (required) + * @param offset Index of first returned responsible persons data from all search results. (optional, default to 0) + * @param limit Number of returned responsible persons data. (optional, default to 1000) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsiblePersonsGETCall(@javax.annotation.Nonnull String accept, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/responsible-persons"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (accept != null) { + localVarHeaderParams.put("Accept", localVarApiClient.parameterToString(accept)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call responsiblePersonsGETValidateBeforeCall(@javax.annotation.Nonnull String accept, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accept' is set + if (accept == null) { + throw new ApiException("Missing the required parameter 'accept' when calling responsiblePersonsGET(Async)"); + } + + return responsiblePersonsGETCall(accept, offset, limit, _callback); + + } + + /** + * Get the list of responsible persons + * Use this resource to get a list of responsible persons for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#osoba-odpowiedzialna-za-zgodnosc-produktu-z-przepisami-unijnymi\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-persons-for-the-compliance-of-the-product-with-eu-regulations\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param offset Index of first returned responsible persons data from all search results. (optional, default to 0) + * @param limit Number of returned responsible persons data. (optional, default to 1000) + * @return ResponsiblePersonsGET200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ResponsiblePersonsGET200Response responsiblePersonsGET(@javax.annotation.Nonnull String accept, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + ApiResponse localVarResp = responsiblePersonsGETWithHttpInfo(accept, offset, limit); + return localVarResp.getData(); + } + + /** + * Get the list of responsible persons + * Use this resource to get a list of responsible persons for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#osoba-odpowiedzialna-za-zgodnosc-produktu-z-przepisami-unijnymi\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-persons-for-the-compliance-of-the-product-with-eu-regulations\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param offset Index of first returned responsible persons data from all search results. (optional, default to 0) + * @param limit Number of returned responsible persons data. (optional, default to 1000) + * @return ApiResponse<ResponsiblePersonsGET200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse responsiblePersonsGETWithHttpInfo(@javax.annotation.Nonnull String accept, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + okhttp3.Call localVarCall = responsiblePersonsGETValidateBeforeCall(accept, offset, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the list of responsible persons (asynchronously) + * Use this resource to get a list of responsible persons for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#osoba-odpowiedzialna-za-zgodnosc-produktu-z-przepisami-unijnymi\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-persons-for-the-compliance-of-the-product-with-eu-regulations\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param offset Index of first returned responsible persons data from all search results. (optional, default to 0) + * @param limit Number of returned responsible persons data. (optional, default to 1000) + * @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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsiblePersonsGETAsync(@javax.annotation.Nonnull String accept, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = responsiblePersonsGETValidateBeforeCall(accept, offset, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for responsiblePersonsPOST + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param createResponsiblePersonRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsiblePersonsPOSTCall(@javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull CreateResponsiblePersonRequest createResponsiblePersonRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createResponsiblePersonRequest; + + // create path and map variables + String localVarPath = "/sale/responsible-persons"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (accept != null) { + localVarHeaderParams.put("Accept", localVarApiClient.parameterToString(accept)); + } + + + if (contentType != null) { + localVarHeaderParams.put("Content-Type", localVarApiClient.parameterToString(contentType)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call responsiblePersonsPOSTValidateBeforeCall(@javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull CreateResponsiblePersonRequest createResponsiblePersonRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accept' is set + if (accept == null) { + throw new ApiException("Missing the required parameter 'accept' when calling responsiblePersonsPOST(Async)"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException("Missing the required parameter 'contentType' when calling responsiblePersonsPOST(Async)"); + } + + // verify the required parameter 'createResponsiblePersonRequest' is set + if (createResponsiblePersonRequest == null) { + throw new ApiException("Missing the required parameter 'createResponsiblePersonRequest' when calling responsiblePersonsPOST(Async)"); + } + + return responsiblePersonsPOSTCall(accept, contentType, createResponsiblePersonRequest, _callback); + + } + + /** + * Create responsible person + * Use this resource to create a new responsible person for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#osoba-odpowiedzialna-za-zgodnosc-produktu-z-przepisami-unijnymi\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-persons-for-the-compliance-of-the-product-with-eu-regulations\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param createResponsiblePersonRequest (required) + * @return ResponsiblePersonResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ResponsiblePersonResponse responsiblePersonsPOST(@javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull CreateResponsiblePersonRequest createResponsiblePersonRequest) throws ApiException { + ApiResponse localVarResp = responsiblePersonsPOSTWithHttpInfo(accept, contentType, createResponsiblePersonRequest); + return localVarResp.getData(); + } + + /** + * Create responsible person + * Use this resource to create a new responsible person for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#osoba-odpowiedzialna-za-zgodnosc-produktu-z-przepisami-unijnymi\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-persons-for-the-compliance-of-the-product-with-eu-regulations\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param createResponsiblePersonRequest (required) + * @return ApiResponse<ResponsiblePersonResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse responsiblePersonsPOSTWithHttpInfo(@javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull CreateResponsiblePersonRequest createResponsiblePersonRequest) throws ApiException { + okhttp3.Call localVarCall = responsiblePersonsPOSTValidateBeforeCall(accept, contentType, createResponsiblePersonRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create responsible person (asynchronously) + * Use this resource to create a new responsible person for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#osoba-odpowiedzialna-za-zgodnosc-produktu-z-przepisami-unijnymi\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-persons-for-the-compliance-of-the-product-with-eu-regulations\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param createResponsiblePersonRequest (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsiblePersonsPOSTAsync(@javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull CreateResponsiblePersonRequest createResponsiblePersonRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = responsiblePersonsPOSTValidateBeforeCall(accept, contentType, createResponsiblePersonRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for responsiblePersonsPUT + * @param id Responsible person ID. (required) + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param updateResponsiblePersonRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsiblePersonsPUTCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull UpdateResponsiblePersonRequest updateResponsiblePersonRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateResponsiblePersonRequest; + + // create path and map variables + String localVarPath = "/sale/responsible-persons/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (accept != null) { + localVarHeaderParams.put("Accept", localVarApiClient.parameterToString(accept)); + } + + + if (contentType != null) { + localVarHeaderParams.put("Content-Type", localVarApiClient.parameterToString(contentType)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call responsiblePersonsPUTValidateBeforeCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull UpdateResponsiblePersonRequest updateResponsiblePersonRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling responsiblePersonsPUT(Async)"); + } + + // verify the required parameter 'accept' is set + if (accept == null) { + throw new ApiException("Missing the required parameter 'accept' when calling responsiblePersonsPUT(Async)"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException("Missing the required parameter 'contentType' when calling responsiblePersonsPUT(Async)"); + } + + // verify the required parameter 'updateResponsiblePersonRequest' is set + if (updateResponsiblePersonRequest == null) { + throw new ApiException("Missing the required parameter 'updateResponsiblePersonRequest' when calling responsiblePersonsPUT(Async)"); + } + + return responsiblePersonsPUTCall(id, accept, contentType, updateResponsiblePersonRequest, _callback); + + } + + /** + * Update responsible person + * Use this resource to update the responsible person for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#osoba-odpowiedzialna-za-zgodnosc-produktu-z-przepisami-unijnymi\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-persons-for-the-compliance-of-the-product-with-eu-regulations\" target=\"_blank\">EN</a>. + * @param id Responsible person ID. (required) + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param updateResponsiblePersonRequest (required) + * @return ResponsiblePersonResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ResponsiblePersonResponse responsiblePersonsPUT(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull UpdateResponsiblePersonRequest updateResponsiblePersonRequest) throws ApiException { + ApiResponse localVarResp = responsiblePersonsPUTWithHttpInfo(id, accept, contentType, updateResponsiblePersonRequest); + return localVarResp.getData(); + } + + /** + * Update responsible person + * Use this resource to update the responsible person for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#osoba-odpowiedzialna-za-zgodnosc-produktu-z-przepisami-unijnymi\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-persons-for-the-compliance-of-the-product-with-eu-regulations\" target=\"_blank\">EN</a>. + * @param id Responsible person ID. (required) + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param updateResponsiblePersonRequest (required) + * @return ApiResponse<ResponsiblePersonResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse responsiblePersonsPUTWithHttpInfo(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull UpdateResponsiblePersonRequest updateResponsiblePersonRequest) throws ApiException { + okhttp3.Call localVarCall = responsiblePersonsPUTValidateBeforeCall(id, accept, contentType, updateResponsiblePersonRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update responsible person (asynchronously) + * Use this resource to update the responsible person for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#osoba-odpowiedzialna-za-zgodnosc-produktu-z-przepisami-unijnymi\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-persons-for-the-compliance-of-the-product-with-eu-regulations\" target=\"_blank\">EN</a>. + * @param id Responsible person ID. (required) + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param updateResponsiblePersonRequest (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsiblePersonsPUTAsync(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull UpdateResponsiblePersonRequest updateResponsiblePersonRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = responsiblePersonsPUTValidateBeforeCall(id, accept, contentType, updateResponsiblePersonRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/ResponsibleProducersApi.java b/src/main/java/pl/wtx/allegro/api/client/ResponsibleProducersApi.java new file mode 100644 index 0000000..2e86c0f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/ResponsibleProducersApi.java @@ -0,0 +1,757 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.CreateResponsibleProducerRequest; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.ResponsibleProducerResponse; +import pl.wtx.allegro.api.client.model.ResponsibleProducersGET200Response; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.UpdateResponsibleProducerRequest; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ResponsibleProducersApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ResponsibleProducersApi() { + this(Configuration.getDefaultApiClient()); + } + + public ResponsibleProducersApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for responsibleProducerGET + * @param id Responsible producer ID. (required) + * @param accept Acceptable representation of the response. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsibleProducerGETCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/responsible-producers/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (accept != null) { + localVarHeaderParams.put("Accept", localVarApiClient.parameterToString(accept)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call responsibleProducerGETValidateBeforeCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling responsibleProducerGET(Async)"); + } + + // verify the required parameter 'accept' is set + if (accept == null) { + throw new ApiException("Missing the required parameter 'accept' when calling responsibleProducerGET(Async)"); + } + + return responsibleProducerGETCall(id, accept, _callback); + + } + + /** + * Get responsible producer + * Use this resource to get a responsible producer for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param id Responsible producer ID. (required) + * @param accept Acceptable representation of the response. (required) + * @return ResponsibleProducerResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ResponsibleProducerResponse responsibleProducerGET(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept) throws ApiException { + ApiResponse localVarResp = responsibleProducerGETWithHttpInfo(id, accept); + return localVarResp.getData(); + } + + /** + * Get responsible producer + * Use this resource to get a responsible producer for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param id Responsible producer ID. (required) + * @param accept Acceptable representation of the response. (required) + * @return ApiResponse<ResponsibleProducerResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public ApiResponse responsibleProducerGETWithHttpInfo(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept) throws ApiException { + okhttp3.Call localVarCall = responsibleProducerGETValidateBeforeCall(id, accept, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get responsible producer (asynchronously) + * Use this resource to get a responsible producer for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param id Responsible producer ID. (required) + * @param accept Acceptable representation of the response. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsibleProducerGETAsync(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = responsibleProducerGETValidateBeforeCall(id, accept, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for responsibleProducersGET + * @param accept Acceptable representation of the response. (required) + * @param offset Index of first returned responsible producers data from all search results. (optional, default to 0) + * @param limit Number of returned responsible producers data. (optional, default to 1000) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsibleProducersGETCall(@javax.annotation.Nonnull String accept, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/responsible-producers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (accept != null) { + localVarHeaderParams.put("Accept", localVarApiClient.parameterToString(accept)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call responsibleProducersGETValidateBeforeCall(@javax.annotation.Nonnull String accept, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accept' is set + if (accept == null) { + throw new ApiException("Missing the required parameter 'accept' when calling responsibleProducersGET(Async)"); + } + + return responsibleProducersGETCall(accept, offset, limit, _callback); + + } + + /** + * Get the list of responsible producers + * Use this resource to get a list of responsible producers for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param offset Index of first returned responsible producers data from all search results. (optional, default to 0) + * @param limit Number of returned responsible producers data. (optional, default to 1000) + * @return ResponsibleProducersGET200Response + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ResponsibleProducersGET200Response responsibleProducersGET(@javax.annotation.Nonnull String accept, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + ApiResponse localVarResp = responsibleProducersGETWithHttpInfo(accept, offset, limit); + return localVarResp.getData(); + } + + /** + * Get the list of responsible producers + * Use this resource to get a list of responsible producers for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param offset Index of first returned responsible producers data from all search results. (optional, default to 0) + * @param limit Number of returned responsible producers data. (optional, default to 1000) + * @return ApiResponse<ResponsibleProducersGET200Response> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse responsibleProducersGETWithHttpInfo(@javax.annotation.Nonnull String accept, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit) throws ApiException { + okhttp3.Call localVarCall = responsibleProducersGETValidateBeforeCall(accept, offset, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the list of responsible producers (asynchronously) + * Use this resource to get a list of responsible producers for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param offset Index of first returned responsible producers data from all search results. (optional, default to 0) + * @param limit Number of returned responsible producers data. (optional, default to 1000) + * @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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsibleProducersGETAsync(@javax.annotation.Nonnull String accept, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = responsibleProducersGETValidateBeforeCall(accept, offset, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for responsibleProducersPOST + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param createResponsibleProducerRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsibleProducersPOSTCall(@javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull CreateResponsibleProducerRequest createResponsibleProducerRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createResponsibleProducerRequest; + + // create path and map variables + String localVarPath = "/sale/responsible-producers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (accept != null) { + localVarHeaderParams.put("Accept", localVarApiClient.parameterToString(accept)); + } + + + if (contentType != null) { + localVarHeaderParams.put("Content-Type", localVarApiClient.parameterToString(contentType)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call responsibleProducersPOSTValidateBeforeCall(@javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull CreateResponsibleProducerRequest createResponsibleProducerRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accept' is set + if (accept == null) { + throw new ApiException("Missing the required parameter 'accept' when calling responsibleProducersPOST(Async)"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException("Missing the required parameter 'contentType' when calling responsibleProducersPOST(Async)"); + } + + // verify the required parameter 'createResponsibleProducerRequest' is set + if (createResponsibleProducerRequest == null) { + throw new ApiException("Missing the required parameter 'createResponsibleProducerRequest' when calling responsibleProducersPOST(Async)"); + } + + return responsibleProducersPOSTCall(accept, contentType, createResponsibleProducerRequest, _callback); + + } + + /** + * Create responsible producer + * Use this resource to create a new responsible producer for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param createResponsibleProducerRequest (required) + * @return ResponsibleProducerResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ResponsibleProducerResponse responsibleProducersPOST(@javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull CreateResponsibleProducerRequest createResponsibleProducerRequest) throws ApiException { + ApiResponse localVarResp = responsibleProducersPOSTWithHttpInfo(accept, contentType, createResponsibleProducerRequest); + return localVarResp.getData(); + } + + /** + * Create responsible producer + * Use this resource to create a new responsible producer for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param createResponsibleProducerRequest (required) + * @return ApiResponse<ResponsibleProducerResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse responsibleProducersPOSTWithHttpInfo(@javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull CreateResponsibleProducerRequest createResponsibleProducerRequest) throws ApiException { + okhttp3.Call localVarCall = responsibleProducersPOSTValidateBeforeCall(accept, contentType, createResponsibleProducerRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create responsible producer (asynchronously) + * Use this resource to create a new responsible producer for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param createResponsibleProducerRequest (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsibleProducersPOSTAsync(@javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull CreateResponsibleProducerRequest createResponsibleProducerRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = responsibleProducersPOSTValidateBeforeCall(accept, contentType, createResponsibleProducerRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for responsibleProducersPUT + * @param id Responsible producer ID. (required) + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param updateResponsibleProducerRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsibleProducersPUTCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull UpdateResponsibleProducerRequest updateResponsibleProducerRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateResponsibleProducerRequest; + + // create path and map variables + String localVarPath = "/sale/responsible-producers/{id}" + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (accept != null) { + localVarHeaderParams.put("Accept", localVarApiClient.parameterToString(accept)); + } + + + if (contentType != null) { + localVarHeaderParams.put("Content-Type", localVarApiClient.parameterToString(contentType)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call responsibleProducersPUTValidateBeforeCall(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull UpdateResponsibleProducerRequest updateResponsibleProducerRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling responsibleProducersPUT(Async)"); + } + + // verify the required parameter 'accept' is set + if (accept == null) { + throw new ApiException("Missing the required parameter 'accept' when calling responsibleProducersPUT(Async)"); + } + + // verify the required parameter 'contentType' is set + if (contentType == null) { + throw new ApiException("Missing the required parameter 'contentType' when calling responsibleProducersPUT(Async)"); + } + + // verify the required parameter 'updateResponsibleProducerRequest' is set + if (updateResponsibleProducerRequest == null) { + throw new ApiException("Missing the required parameter 'updateResponsibleProducerRequest' when calling responsibleProducersPUT(Async)"); + } + + return responsibleProducersPUTCall(id, accept, contentType, updateResponsibleProducerRequest, _callback); + + } + + /** + * Update responsible producer + * Use this resource to update the responsible producer for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param id Responsible producer ID. (required) + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param updateResponsibleProducerRequest (required) + * @return ResponsibleProducerResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ResponsibleProducerResponse responsibleProducersPUT(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull UpdateResponsibleProducerRequest updateResponsibleProducerRequest) throws ApiException { + ApiResponse localVarResp = responsibleProducersPUTWithHttpInfo(id, accept, contentType, updateResponsibleProducerRequest); + return localVarResp.getData(); + } + + /** + * Update responsible producer + * Use this resource to update the responsible producer for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param id Responsible producer ID. (required) + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param updateResponsibleProducerRequest (required) + * @return ApiResponse<ResponsibleProducerResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public ApiResponse responsibleProducersPUTWithHttpInfo(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull UpdateResponsibleProducerRequest updateResponsibleProducerRequest) throws ApiException { + okhttp3.Call localVarCall = responsibleProducersPUTValidateBeforeCall(id, accept, contentType, updateResponsibleProducerRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update responsible producer (asynchronously) + * Use this resource to update the responsible producer for the compliance of the product with EU regulations. Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#dane-teleadresowe-producenta\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#responsible-producers-contact-information\" target=\"_blank\">EN</a>. + * @param id Responsible producer ID. (required) + * @param accept Acceptable representation of the response. (required) + * @param contentType Content type of the request body. (required) + * @param updateResponsibleProducerRequest (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
422 Unprocessable Entity -
+ */ + public okhttp3.Call responsibleProducersPUTAsync(@javax.annotation.Nonnull UUID id, @javax.annotation.Nonnull String accept, @javax.annotation.Nonnull String contentType, @javax.annotation.Nonnull UpdateResponsibleProducerRequest updateResponsibleProducerRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = responsibleProducersPUTValidateBeforeCall(id, accept, contentType, updateResponsibleProducerRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/ShipmentManagementApi.java b/src/main/java/pl/wtx/allegro/api/client/ShipmentManagementApi.java new file mode 100644 index 0000000..5a5a528 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/ShipmentManagementApi.java @@ -0,0 +1,1677 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import pl.wtx.allegro.api.client.model.CancelShipmentCommandStatusDto; +import pl.wtx.allegro.api.client.model.CreatePickupCommandStatusDto; +import pl.wtx.allegro.api.client.model.CreateShipmentCommandStatusDto; +import pl.wtx.allegro.api.client.model.DeliveryServicesDto; +import java.io.File; +import pl.wtx.allegro.api.client.model.GetDeliveryServices504Response; +import pl.wtx.allegro.api.client.model.GetOfferSmartClassificationGET400Response; +import pl.wtx.allegro.api.client.model.GetOfferSmartClassificationGET403Response; +import pl.wtx.allegro.api.client.model.GetShipmentDetails404Response; +import pl.wtx.allegro.api.client.model.LabelRequestDto; +import pl.wtx.allegro.api.client.model.PickupCreateCommandDto; +import pl.wtx.allegro.api.client.model.PickupProposalsRequestDto; +import pl.wtx.allegro.api.client.model.PickupProposalsResponseDto; +import pl.wtx.allegro.api.client.model.ShipmentCancelCommandDto; +import pl.wtx.allegro.api.client.model.ShipmentCreateCommandDto; +import pl.wtx.allegro.api.client.model.ShipmentDto; +import pl.wtx.allegro.api.client.model.ShipmentIdsDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ShipmentManagementApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ShipmentManagementApi() { + this(Configuration.getDefaultApiClient()); + } + + public ShipmentManagementApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for cancelShipment + * @param shipmentCancelCommandDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad request -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call cancelShipmentCall(@javax.annotation.Nonnull ShipmentCancelCommandDto shipmentCancelCommandDto, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = shipmentCancelCommandDto; + + // create path and map variables + String localVarPath = "/shipment-management/shipments/cancel-commands"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call cancelShipmentValidateBeforeCall(@javax.annotation.Nonnull ShipmentCancelCommandDto shipmentCancelCommandDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'shipmentCancelCommandDto' is set + if (shipmentCancelCommandDto == null) { + throw new ApiException("Missing the required parameter 'shipmentCancelCommandDto' when calling cancelShipment(Async)"); + } + + return cancelShipmentCall(shipmentCancelCommandDto, _callback); + + } + + /** + * Cancel shipment + * Use this resource to cancel parcel. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-anulowac-paczke\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-cancel-a-shipment\" target=\"_blank\">EN</a>. + * @param shipmentCancelCommandDto (required) + * @return ShipmentCancelCommandDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad request -
401 Unauthorized -
403 Forbidden -
+ */ + public ShipmentCancelCommandDto cancelShipment(@javax.annotation.Nonnull ShipmentCancelCommandDto shipmentCancelCommandDto) throws ApiException { + ApiResponse localVarResp = cancelShipmentWithHttpInfo(shipmentCancelCommandDto); + return localVarResp.getData(); + } + + /** + * Cancel shipment + * Use this resource to cancel parcel. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-anulowac-paczke\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-cancel-a-shipment\" target=\"_blank\">EN</a>. + * @param shipmentCancelCommandDto (required) + * @return ApiResponse<ShipmentCancelCommandDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad request -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse cancelShipmentWithHttpInfo(@javax.annotation.Nonnull ShipmentCancelCommandDto shipmentCancelCommandDto) throws ApiException { + okhttp3.Call localVarCall = cancelShipmentValidateBeforeCall(shipmentCancelCommandDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Cancel shipment (asynchronously) + * Use this resource to cancel parcel. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-anulowac-paczke\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-cancel-a-shipment\" target=\"_blank\">EN</a>. + * @param shipmentCancelCommandDto (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad request -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call cancelShipmentAsync(@javax.annotation.Nonnull ShipmentCancelCommandDto shipmentCancelCommandDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = cancelShipmentValidateBeforeCall(shipmentCancelCommandDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createNewShipment + * @param shipmentCreateCommandDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public okhttp3.Call createNewShipmentCall(@javax.annotation.Nonnull ShipmentCreateCommandDto shipmentCreateCommandDto, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = shipmentCreateCommandDto; + + // create path and map variables + String localVarPath = "/shipment-management/shipments/create-commands"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createNewShipmentValidateBeforeCall(@javax.annotation.Nonnull ShipmentCreateCommandDto shipmentCreateCommandDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'shipmentCreateCommandDto' is set + if (shipmentCreateCommandDto == null) { + throw new ApiException("Missing the required parameter 'shipmentCreateCommandDto' when calling createNewShipment(Async)"); + } + + return createNewShipmentCall(shipmentCreateCommandDto, _callback); + + } + + /** + * Create new shipment + * Use this resource to create shipment for delivery. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-utworzyc-nowa-paczke\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-create-a-new-shipment\" target=\"_blank\">EN</a>. + * @param shipmentCreateCommandDto (required) + * @return ShipmentCreateCommandDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public ShipmentCreateCommandDto createNewShipment(@javax.annotation.Nonnull ShipmentCreateCommandDto shipmentCreateCommandDto) throws ApiException { + ApiResponse localVarResp = createNewShipmentWithHttpInfo(shipmentCreateCommandDto); + return localVarResp.getData(); + } + + /** + * Create new shipment + * Use this resource to create shipment for delivery. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-utworzyc-nowa-paczke\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-create-a-new-shipment\" target=\"_blank\">EN</a>. + * @param shipmentCreateCommandDto (required) + * @return ApiResponse<ShipmentCreateCommandDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public ApiResponse createNewShipmentWithHttpInfo(@javax.annotation.Nonnull ShipmentCreateCommandDto shipmentCreateCommandDto) throws ApiException { + okhttp3.Call localVarCall = createNewShipmentValidateBeforeCall(shipmentCreateCommandDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new shipment (asynchronously) + * Use this resource to create shipment for delivery. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-utworzyc-nowa-paczke\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-create-a-new-shipment\" target=\"_blank\">EN</a>. + * @param shipmentCreateCommandDto (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public okhttp3.Call createNewShipmentAsync(@javax.annotation.Nonnull ShipmentCreateCommandDto shipmentCreateCommandDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createNewShipmentValidateBeforeCall(shipmentCreateCommandDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createPickup + * @param pickupCreateCommandDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad request -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call createPickupCall(@javax.annotation.Nonnull PickupCreateCommandDto pickupCreateCommandDto, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pickupCreateCommandDto; + + // create path and map variables + String localVarPath = "/shipment-management/pickups/create-commands"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createPickupValidateBeforeCall(@javax.annotation.Nonnull PickupCreateCommandDto pickupCreateCommandDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pickupCreateCommandDto' is set + if (pickupCreateCommandDto == null) { + throw new ApiException("Missing the required parameter 'pickupCreateCommandDto' when calling createPickup(Async)"); + } + + return createPickupCall(pickupCreateCommandDto, _callback); + + } + + /** + * Request shipments pickup + * Use this resource to request a pickup of shipments. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-zamowic-odbior-paczek-przez-kuriera\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-request-shipment-pickup-by-a-courier\" target=\"_blank\">EN</a>. + * @param pickupCreateCommandDto (required) + * @return PickupCreateCommandDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad request -
401 Unauthorized -
403 Forbidden -
+ */ + public PickupCreateCommandDto createPickup(@javax.annotation.Nonnull PickupCreateCommandDto pickupCreateCommandDto) throws ApiException { + ApiResponse localVarResp = createPickupWithHttpInfo(pickupCreateCommandDto); + return localVarResp.getData(); + } + + /** + * Request shipments pickup + * Use this resource to request a pickup of shipments. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-zamowic-odbior-paczek-przez-kuriera\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-request-shipment-pickup-by-a-courier\" target=\"_blank\">EN</a>. + * @param pickupCreateCommandDto (required) + * @return ApiResponse<PickupCreateCommandDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad request -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse createPickupWithHttpInfo(@javax.annotation.Nonnull PickupCreateCommandDto pickupCreateCommandDto) throws ApiException { + okhttp3.Call localVarCall = createPickupValidateBeforeCall(pickupCreateCommandDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Request shipments pickup (asynchronously) + * Use this resource to request a pickup of shipments. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-zamowic-odbior-paczek-przez-kuriera\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-request-shipment-pickup-by-a-courier\" target=\"_blank\">EN</a>. + * @param pickupCreateCommandDto (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad request -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call createPickupAsync(@javax.annotation.Nonnull PickupCreateCommandDto pickupCreateCommandDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createPickupValidateBeforeCall(pickupCreateCommandDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createPickupStatus + * @param commandId Command UUID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call createPickupStatusCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/shipment-management/pickups/create-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createPickupStatusValidateBeforeCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling createPickupStatus(Async)"); + } + + return createPickupStatusCall(commandId, _callback); + + } + + /** + * Create pickup command status + * Use this resource to get pickup request status. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-status-zamowienia-odbioru-paczek\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-shipment-pickup-request-status\" target=\"_blank\">EN</a>. + * @param commandId Command UUID. (required) + * @return CreatePickupCommandStatusDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public CreatePickupCommandStatusDto createPickupStatus(@javax.annotation.Nonnull String commandId) throws ApiException { + ApiResponse localVarResp = createPickupStatusWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Create pickup command status + * Use this resource to get pickup request status. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-status-zamowienia-odbioru-paczek\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-shipment-pickup-request-status\" target=\"_blank\">EN</a>. + * @param commandId Command UUID. (required) + * @return ApiResponse<CreatePickupCommandStatusDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public ApiResponse createPickupStatusWithHttpInfo(@javax.annotation.Nonnull String commandId) throws ApiException { + okhttp3.Call localVarCall = createPickupStatusValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create pickup command status (asynchronously) + * Use this resource to get pickup request status. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-status-zamowienia-odbioru-paczek\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-shipment-pickup-request-status\" target=\"_blank\">EN</a>. + * @param commandId Command UUID. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call createPickupStatusAsync(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createPickupStatusValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getDeliveryServices + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public okhttp3.Call getDeliveryServicesCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/shipment-management/delivery-services"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getDeliveryServicesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getDeliveryServicesCall(_callback); + + } + + /** + * Get available delivery services + * Use this resource to get delivery services available for user. It returns services provided by Allegro and contracts with carriers owned by user and configured by GUI. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-liste-uslug-dostawy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-a-list-of-delivery-services\" target=\"_blank\">EN</a>. + * @return DeliveryServicesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public DeliveryServicesDto getDeliveryServices() throws ApiException { + ApiResponse localVarResp = getDeliveryServicesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get available delivery services + * Use this resource to get delivery services available for user. It returns services provided by Allegro and contracts with carriers owned by user and configured by GUI. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-liste-uslug-dostawy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-a-list-of-delivery-services\" target=\"_blank\">EN</a>. + * @return ApiResponse<DeliveryServicesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public ApiResponse getDeliveryServicesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getDeliveryServicesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get available delivery services (asynchronously) + * Use this resource to get delivery services available for user. It returns services provided by Allegro and contracts with carriers owned by user and configured by GUI. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-liste-uslug-dostawy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-a-list-of-delivery-services\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public okhttp3.Call getDeliveryServicesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getDeliveryServicesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPickupProposals + * @param pickupProposalsRequestDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public okhttp3.Call getPickupProposalsCall(@javax.annotation.Nonnull PickupProposalsRequestDto pickupProposalsRequestDto, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = pickupProposalsRequestDto; + + // create path and map variables + String localVarPath = "/shipment-management/pickup-proposals"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPickupProposalsValidateBeforeCall(@javax.annotation.Nonnull PickupProposalsRequestDto pickupProposalsRequestDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'pickupProposalsRequestDto' is set + if (pickupProposalsRequestDto == null) { + throw new ApiException("Missing the required parameter 'pickupProposalsRequestDto' when calling getPickupProposals(Async)"); + } + + return getPickupProposalsCall(pickupProposalsRequestDto, _callback); + + } + + /** + * Get shipments pickup proposals + * Use this resource to get parcels pickup date proposals. Pickup takes place, when courier arrives to take parcels for shipment. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-proponowana-date-odbioru-paczek-przez-kuriera\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-pickup-date-proposals\" target=\"_blank\">EN</a>. + * @param pickupProposalsRequestDto (required) + * @return List<PickupProposalsResponseDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public List getPickupProposals(@javax.annotation.Nonnull PickupProposalsRequestDto pickupProposalsRequestDto) throws ApiException { + ApiResponse> localVarResp = getPickupProposalsWithHttpInfo(pickupProposalsRequestDto); + return localVarResp.getData(); + } + + /** + * Get shipments pickup proposals + * Use this resource to get parcels pickup date proposals. Pickup takes place, when courier arrives to take parcels for shipment. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-proponowana-date-odbioru-paczek-przez-kuriera\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-pickup-date-proposals\" target=\"_blank\">EN</a>. + * @param pickupProposalsRequestDto (required) + * @return ApiResponse<List<PickupProposalsResponseDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public ApiResponse> getPickupProposalsWithHttpInfo(@javax.annotation.Nonnull PickupProposalsRequestDto pickupProposalsRequestDto) throws ApiException { + okhttp3.Call localVarCall = getPickupProposalsValidateBeforeCall(pickupProposalsRequestDto, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get shipments pickup proposals (asynchronously) + * Use this resource to get parcels pickup date proposals. Pickup takes place, when courier arrives to take parcels for shipment. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-proponowana-date-odbioru-paczek-przez-kuriera\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-pickup-date-proposals\" target=\"_blank\">EN</a>. + * @param pickupProposalsRequestDto (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad request -
401 Unauthorized -
403 Forbidden -
504 Gateway Timeout -
+ */ + public okhttp3.Call getPickupProposalsAsync(@javax.annotation.Nonnull PickupProposalsRequestDto pickupProposalsRequestDto, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getPickupProposalsValidateBeforeCall(pickupProposalsRequestDto, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getShipmentCancellationStatus + * @param commandId Command UUID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call getShipmentCancellationStatusCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/shipment-management/shipments/cancel-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getShipmentCancellationStatusValidateBeforeCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getShipmentCancellationStatus(Async)"); + } + + return getShipmentCancellationStatusCall(commandId, _callback); + + } + + /** + * Get shipment cancellation status + * Use this resource to get parcel cancellation status. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-status-anulowania-paczki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-shipment-cancellation-status\" target=\"_blank\">EN</a>. + * @param commandId Command UUID. (required) + * @return CancelShipmentCommandStatusDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public CancelShipmentCommandStatusDto getShipmentCancellationStatus(@javax.annotation.Nonnull String commandId) throws ApiException { + ApiResponse localVarResp = getShipmentCancellationStatusWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Get shipment cancellation status + * Use this resource to get parcel cancellation status. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-status-anulowania-paczki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-shipment-cancellation-status\" target=\"_blank\">EN</a>. + * @param commandId Command UUID. (required) + * @return ApiResponse<CancelShipmentCommandStatusDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public ApiResponse getShipmentCancellationStatusWithHttpInfo(@javax.annotation.Nonnull String commandId) throws ApiException { + okhttp3.Call localVarCall = getShipmentCancellationStatusValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get shipment cancellation status (asynchronously) + * Use this resource to get parcel cancellation status. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-status-anulowania-paczki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-shipment-cancellation-status\" target=\"_blank\">EN</a>. + * @param commandId Command UUID. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK * Retry-After - Suggested time interval (in seconds) between follow-up command status queries.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call getShipmentCancellationStatusAsync(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getShipmentCancellationStatusValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getShipmentCreationStatus + * @param commandId Command UUID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call getShipmentCreationStatusCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/shipment-management/shipments/create-commands/{commandId}" + .replace("{" + "commandId" + "}", localVarApiClient.escapeString(commandId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getShipmentCreationStatusValidateBeforeCall(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'commandId' is set + if (commandId == null) { + throw new ApiException("Missing the required parameter 'commandId' when calling getShipmentCreationStatus(Async)"); + } + + return getShipmentCreationStatusCall(commandId, _callback); + + } + + /** + * Get shipment creation command status + * Use this resource to get shipment creation status. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-status-utworzenia-paczki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-the-creation-status-of-a-shipment\" target=\"_blank\">EN</a>. + * @param commandId Command UUID. (required) + * @return CreateShipmentCommandStatusDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public CreateShipmentCommandStatusDto getShipmentCreationStatus(@javax.annotation.Nonnull String commandId) throws ApiException { + ApiResponse localVarResp = getShipmentCreationStatusWithHttpInfo(commandId); + return localVarResp.getData(); + } + + /** + * Get shipment creation command status + * Use this resource to get shipment creation status. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-status-utworzenia-paczki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-the-creation-status-of-a-shipment\" target=\"_blank\">EN</a>. + * @param commandId Command UUID. (required) + * @return ApiResponse<CreateShipmentCommandStatusDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public ApiResponse getShipmentCreationStatusWithHttpInfo(@javax.annotation.Nonnull String commandId) throws ApiException { + okhttp3.Call localVarCall = getShipmentCreationStatusValidateBeforeCall(commandId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get shipment creation command status (asynchronously) + * Use this resource to get shipment creation status. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-sprawdzic-status-utworzenia-paczki\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-check-the-creation-status-of-a-shipment\" target=\"_blank\">EN</a>. + * @param commandId Command UUID. (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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call getShipmentCreationStatusAsync(@javax.annotation.Nonnull String commandId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getShipmentCreationStatusValidateBeforeCall(commandId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getShipmentDetails + * @param shipmentId Shipment id. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call getShipmentDetailsCall(@javax.annotation.Nonnull String shipmentId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/shipment-management/shipments/{shipmentId}" + .replace("{" + "shipmentId" + "}", localVarApiClient.escapeString(shipmentId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getShipmentDetailsValidateBeforeCall(@javax.annotation.Nonnull String shipmentId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'shipmentId' is set + if (shipmentId == null) { + throw new ApiException("Missing the required parameter 'shipmentId' when calling getShipmentDetails(Async)"); + } + + return getShipmentDetailsCall(shipmentId, _callback); + + } + + /** + * Get shipment details + * Use this resource to get parcel details. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-szczegolowe-informacje-o-paczce\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-shipment-details\" target=\"_blank\">EN</a>. + * @param shipmentId Shipment id. (required) + * @return ShipmentDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public ShipmentDto getShipmentDetails(@javax.annotation.Nonnull String shipmentId) throws ApiException { + ApiResponse localVarResp = getShipmentDetailsWithHttpInfo(shipmentId); + return localVarResp.getData(); + } + + /** + * Get shipment details + * Use this resource to get parcel details. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-szczegolowe-informacje-o-paczce\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-shipment-details\" target=\"_blank\">EN</a>. + * @param shipmentId Shipment id. (required) + * @return ApiResponse<ShipmentDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public ApiResponse getShipmentDetailsWithHttpInfo(@javax.annotation.Nonnull String shipmentId) throws ApiException { + okhttp3.Call localVarCall = getShipmentDetailsValidateBeforeCall(shipmentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get shipment details (asynchronously) + * Use this resource to get parcel details. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-szczegolowe-informacje-o-paczce\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-shipment-details\" target=\"_blank\">EN</a>. + * @param shipmentId Shipment 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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call getShipmentDetailsAsync(@javax.annotation.Nonnull String shipmentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getShipmentDetailsValidateBeforeCall(shipmentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getShipmentLabels + * @param labelRequestDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
204 No Label For Given Parcel -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Shipment Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call getShipmentLabelsCall(@javax.annotation.Nonnull LabelRequestDto labelRequestDto, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = labelRequestDto; + + // create path and map variables + String localVarPath = "/shipment-management/label"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/octet-stream", + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getShipmentLabelsValidateBeforeCall(@javax.annotation.Nonnull LabelRequestDto labelRequestDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'labelRequestDto' is set + if (labelRequestDto == null) { + throw new ApiException("Missing the required parameter 'labelRequestDto' when calling getShipmentLabels(Async)"); + } + + return getShipmentLabelsCall(labelRequestDto, _callback); + + } + + /** + * Get shipments labels + * Use this resource to get label for created shipment. <br/>Returned content type depends on created shipment. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-utworzyc-etykiete-na-paczke\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-create-a-label-for-shipment\" target=\"_blank\">EN</a>. + * @param labelRequestDto (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
204 No Label For Given Parcel -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Shipment Not Found -
504 Gateway Timeout -
+ */ + public File getShipmentLabels(@javax.annotation.Nonnull LabelRequestDto labelRequestDto) throws ApiException { + ApiResponse localVarResp = getShipmentLabelsWithHttpInfo(labelRequestDto); + return localVarResp.getData(); + } + + /** + * Get shipments labels + * Use this resource to get label for created shipment. <br/>Returned content type depends on created shipment. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-utworzyc-etykiete-na-paczke\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-create-a-label-for-shipment\" target=\"_blank\">EN</a>. + * @param labelRequestDto (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
204 No Label For Given Parcel -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Shipment Not Found -
504 Gateway Timeout -
+ */ + public ApiResponse getShipmentLabelsWithHttpInfo(@javax.annotation.Nonnull LabelRequestDto labelRequestDto) throws ApiException { + okhttp3.Call localVarCall = getShipmentLabelsValidateBeforeCall(labelRequestDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get shipments labels (asynchronously) + * Use this resource to get label for created shipment. <br/>Returned content type depends on created shipment. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-utworzyc-etykiete-na-paczke\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-create-a-label-for-shipment\" target=\"_blank\">EN</a>. + * @param labelRequestDto (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
204 No Label For Given Parcel -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Shipment Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call getShipmentLabelsAsync(@javax.annotation.Nonnull LabelRequestDto labelRequestDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getShipmentLabelsValidateBeforeCall(labelRequestDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getShipmentProtocol + * @param shipmentIdsDto (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
204 No Protocol For Given Parcels -
401 Unauthorized -
400 Bad Request -
403 Forbidden -
404 Shipment Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call getShipmentProtocolCall(@javax.annotation.Nonnull ShipmentIdsDto shipmentIdsDto, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = shipmentIdsDto; + + // create path and map variables + String localVarPath = "/shipment-management/protocol"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/octet-stream", + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getShipmentProtocolValidateBeforeCall(@javax.annotation.Nonnull ShipmentIdsDto shipmentIdsDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'shipmentIdsDto' is set + if (shipmentIdsDto == null) { + throw new ApiException("Missing the required parameter 'shipmentIdsDto' when calling getShipmentProtocol(Async)"); + } + + return getShipmentProtocolCall(shipmentIdsDto, _callback); + + } + + /** + * Get shipments protocol + * Protocol availability depends on Carrier. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-protokol-nadania-przesylek\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-shipment-protocol\" target=\"_blank\">EN</a>. + * @param shipmentIdsDto (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
204 No Protocol For Given Parcels -
401 Unauthorized -
400 Bad Request -
403 Forbidden -
404 Shipment Not Found -
504 Gateway Timeout -
+ */ + public File getShipmentProtocol(@javax.annotation.Nonnull ShipmentIdsDto shipmentIdsDto) throws ApiException { + ApiResponse localVarResp = getShipmentProtocolWithHttpInfo(shipmentIdsDto); + return localVarResp.getData(); + } + + /** + * Get shipments protocol + * Protocol availability depends on Carrier. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-protokol-nadania-przesylek\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-shipment-protocol\" target=\"_blank\">EN</a>. + * @param shipmentIdsDto (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
204 No Protocol For Given Parcels -
401 Unauthorized -
400 Bad Request -
403 Forbidden -
404 Shipment Not Found -
504 Gateway Timeout -
+ */ + public ApiResponse getShipmentProtocolWithHttpInfo(@javax.annotation.Nonnull ShipmentIdsDto shipmentIdsDto) throws ApiException { + okhttp3.Call localVarCall = getShipmentProtocolValidateBeforeCall(shipmentIdsDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get shipments protocol (asynchronously) + * Protocol availability depends on Carrier. Read more: <a href=\"../../tutorials/jak-zarzadzac-przesylkami-przez-wysylam-z-allegro-LRVjK7K21sY#jak-pobrac-protokol-nadania-przesylek\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-manage-parcels-via-ship-with-allegro-ZM9YAyGKWTV#how-to-retrieve-shipment-protocol\" target=\"_blank\">EN</a>. + * @param shipmentIdsDto (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
204 No Protocol For Given Parcels -
401 Unauthorized -
400 Bad Request -
403 Forbidden -
404 Shipment Not Found -
504 Gateway Timeout -
+ */ + public okhttp3.Call getShipmentProtocolAsync(@javax.annotation.Nonnull ShipmentIdsDto shipmentIdsDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getShipmentProtocolValidateBeforeCall(shipmentIdsDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/SizeTablesApi.java b/src/main/java/pl/wtx/allegro/api/client/SizeTablesApi.java new file mode 100644 index 0000000..d6a2f17 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/SizeTablesApi.java @@ -0,0 +1,760 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.PublicTableDto; +import pl.wtx.allegro.api.client.model.PublicTablesDto; +import pl.wtx.allegro.api.client.model.SizeTablePostRequest; +import pl.wtx.allegro.api.client.model.SizeTablePutRequest; +import pl.wtx.allegro.api.client.model.SizeTableTemplatesResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SizeTablesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public SizeTablesApi() { + this(Configuration.getDefaultApiClient()); + } + + public SizeTablesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createTableUsingPOST + * @param sizeTablePostRequest Size table details (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Size table created successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call createTableUsingPOSTCall(@javax.annotation.Nonnull SizeTablePostRequest sizeTablePostRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = sizeTablePostRequest; + + // create path and map variables + String localVarPath = "/sale/size-tables"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createTableUsingPOSTValidateBeforeCall(@javax.annotation.Nonnull SizeTablePostRequest sizeTablePostRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'sizeTablePostRequest' is set + if (sizeTablePostRequest == null) { + throw new ApiException("Missing the required parameter 'sizeTablePostRequest' when calling createTableUsingPOST(Async)"); + } + + return createTableUsingPOSTCall(sizeTablePostRequest, _callback); + + } + + /** + * Create a size table + * Use this resource to create size table. Read more: <a href=\"../../news/tabele-rozmiarow-zmieniamy-istniejacy-zasob-i-dodajemy-nowe-zasoby-do-ich-obslugi-k1nyd21A4fP\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-we-change-the-existing-resource-and-add-new-resources-to-handle-them-jn91bynlbC9\" target=\"_blank\">EN</a>. + * @param sizeTablePostRequest Size table details (required) + * @return PublicTableDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Size table created successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public PublicTableDto createTableUsingPOST(@javax.annotation.Nonnull SizeTablePostRequest sizeTablePostRequest) throws ApiException { + ApiResponse localVarResp = createTableUsingPOSTWithHttpInfo(sizeTablePostRequest); + return localVarResp.getData(); + } + + /** + * Create a size table + * Use this resource to create size table. Read more: <a href=\"../../news/tabele-rozmiarow-zmieniamy-istniejacy-zasob-i-dodajemy-nowe-zasoby-do-ich-obslugi-k1nyd21A4fP\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-we-change-the-existing-resource-and-add-new-resources-to-handle-them-jn91bynlbC9\" target=\"_blank\">EN</a>. + * @param sizeTablePostRequest Size table details (required) + * @return ApiResponse<PublicTableDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Size table created successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse createTableUsingPOSTWithHttpInfo(@javax.annotation.Nonnull SizeTablePostRequest sizeTablePostRequest) throws ApiException { + okhttp3.Call localVarCall = createTableUsingPOSTValidateBeforeCall(sizeTablePostRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a size table (asynchronously) + * Use this resource to create size table. Read more: <a href=\"../../news/tabele-rozmiarow-zmieniamy-istniejacy-zasob-i-dodajemy-nowe-zasoby-do-ich-obslugi-k1nyd21A4fP\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-we-change-the-existing-resource-and-add-new-resources-to-handle-them-jn91bynlbC9\" target=\"_blank\">EN</a>. + * @param sizeTablePostRequest Size table details (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
201 Size table created successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call createTableUsingPOSTAsync(@javax.annotation.Nonnull SizeTablePostRequest sizeTablePostRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createTableUsingPOSTValidateBeforeCall(sizeTablePostRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getTableUsingGET + * @param tableId Table identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size table returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getTableUsingGETCall(@javax.annotation.Nonnull String tableId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/size-tables/{tableId}" + .replace("{" + "tableId" + "}", localVarApiClient.escapeString(tableId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTableUsingGETValidateBeforeCall(@javax.annotation.Nonnull String tableId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tableId' is set + if (tableId == null) { + throw new ApiException("Missing the required parameter 'tableId' when calling getTableUsingGET(Async)"); + } + + return getTableUsingGETCall(tableId, _callback); + + } + + /** + * Get a size table + * Use this resource to get selected size table. Read more: <a href=\"../../news/tabele-rozmiarow-w-rest-api-LRV05q2dGtV\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-in-rest-api-D7KP4DE1BH3\" target=\"_blank\">EN</a>. + * @param tableId Table identifier. (required) + * @return PublicTableDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size table returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public PublicTableDto getTableUsingGET(@javax.annotation.Nonnull String tableId) throws ApiException { + ApiResponse localVarResp = getTableUsingGETWithHttpInfo(tableId); + return localVarResp.getData(); + } + + /** + * Get a size table + * Use this resource to get selected size table. Read more: <a href=\"../../news/tabele-rozmiarow-w-rest-api-LRV05q2dGtV\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-in-rest-api-D7KP4DE1BH3\" target=\"_blank\">EN</a>. + * @param tableId Table identifier. (required) + * @return ApiResponse<PublicTableDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size table returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getTableUsingGETWithHttpInfo(@javax.annotation.Nonnull String tableId) throws ApiException { + okhttp3.Call localVarCall = getTableUsingGETValidateBeforeCall(tableId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a size table (asynchronously) + * Use this resource to get selected size table. Read more: <a href=\"../../news/tabele-rozmiarow-w-rest-api-LRV05q2dGtV\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-in-rest-api-D7KP4DE1BH3\" target=\"_blank\">EN</a>. + * @param tableId Table identifier. (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size table returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getTableUsingGETAsync(@javax.annotation.Nonnull String tableId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTableUsingGETValidateBeforeCall(tableId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getTablesTemplatesUsingGET + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Size tables templates returned successfully -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getTablesTemplatesUsingGETCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/size-tables-templates"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTablesTemplatesUsingGETValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getTablesTemplatesUsingGETCall(_callback); + + } + + /** + * Get the size tables templates + * Use this resource to get all size tables templates. Read more: <a href=\"../../news/tabele-rozmiarow-zmieniamy-istniejacy-zasob-i-dodajemy-nowe-zasoby-do-ich-obslugi-k1nyd21A4fP\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-we-change-the-existing-resource-and-add-new-resources-to-handle-them-jn91bynlbC9\" target=\"_blank\">EN</a>. + * @return SizeTableTemplatesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Size tables templates returned successfully -
401 Unauthorized -
403 Forbidden -
+ */ + public SizeTableTemplatesResponse getTablesTemplatesUsingGET() throws ApiException { + ApiResponse localVarResp = getTablesTemplatesUsingGETWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get the size tables templates + * Use this resource to get all size tables templates. Read more: <a href=\"../../news/tabele-rozmiarow-zmieniamy-istniejacy-zasob-i-dodajemy-nowe-zasoby-do-ich-obslugi-k1nyd21A4fP\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-we-change-the-existing-resource-and-add-new-resources-to-handle-them-jn91bynlbC9\" target=\"_blank\">EN</a>. + * @return ApiResponse<SizeTableTemplatesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Size tables templates returned successfully -
401 Unauthorized -
403 Forbidden -
+ */ + public ApiResponse getTablesTemplatesUsingGETWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getTablesTemplatesUsingGETValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the size tables templates (asynchronously) + * Use this resource to get all size tables templates. Read more: <a href=\"../../news/tabele-rozmiarow-zmieniamy-istniejacy-zasob-i-dodajemy-nowe-zasoby-do-ich-obslugi-k1nyd21A4fP\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-we-change-the-existing-resource-and-add-new-resources-to-handle-them-jn91bynlbC9\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 Size tables templates returned successfully -
401 Unauthorized -
403 Forbidden -
+ */ + public okhttp3.Call getTablesTemplatesUsingGETAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTablesTemplatesUsingGETValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getTablesUsingGET + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size tables returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getTablesUsingGETCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/size-tables"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTablesUsingGETValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getTablesUsingGETCall(_callback); + + } + + /** + * Get the user's size tables + * Use this resource to get all size tables assigned to a seller account. Read more: <a href=\"../../news/tabele-rozmiarow-w-rest-api-LRV05q2dGtV\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-in-rest-api-D7KP4DE1BH3\" target=\"_blank\">EN</a>. + * @return PublicTablesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size tables returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public PublicTablesDto getTablesUsingGET() throws ApiException { + ApiResponse localVarResp = getTablesUsingGETWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get the user's size tables + * Use this resource to get all size tables assigned to a seller account. Read more: <a href=\"../../news/tabele-rozmiarow-w-rest-api-LRV05q2dGtV\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-in-rest-api-D7KP4DE1BH3\" target=\"_blank\">EN</a>. + * @return ApiResponse<PublicTablesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size tables returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getTablesUsingGETWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getTablesUsingGETValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the user's size tables (asynchronously) + * Use this resource to get all size tables assigned to a seller account. Read more: <a href=\"../../news/tabele-rozmiarow-w-rest-api-LRV05q2dGtV\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-in-rest-api-D7KP4DE1BH3\" target=\"_blank\">EN</a>. + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size tables returned successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getTablesUsingGETAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTablesUsingGETValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for modifyTableUsingPUT + * @param tableId Table identifier. (required) + * @param sizeTablePutRequest Size table details (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size table updated successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call modifyTableUsingPUTCall(@javax.annotation.Nonnull String tableId, @javax.annotation.Nonnull SizeTablePutRequest sizeTablePutRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = sizeTablePutRequest; + + // create path and map variables + String localVarPath = "/sale/size-tables/{tableId}" + .replace("{" + "tableId" + "}", localVarApiClient.escapeString(tableId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call modifyTableUsingPUTValidateBeforeCall(@javax.annotation.Nonnull String tableId, @javax.annotation.Nonnull SizeTablePutRequest sizeTablePutRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'tableId' is set + if (tableId == null) { + throw new ApiException("Missing the required parameter 'tableId' when calling modifyTableUsingPUT(Async)"); + } + + // verify the required parameter 'sizeTablePutRequest' is set + if (sizeTablePutRequest == null) { + throw new ApiException("Missing the required parameter 'sizeTablePutRequest' when calling modifyTableUsingPUT(Async)"); + } + + return modifyTableUsingPUTCall(tableId, sizeTablePutRequest, _callback); + + } + + /** + * Update a size table + * Use this resource to update selected size table. Read more: <a href=\"../../news/tabele-rozmiarow-zmieniamy-istniejacy-zasob-i-dodajemy-nowe-zasoby-do-ich-obslugi-k1nyd21A4fP\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-we-change-the-existing-resource-and-add-new-resources-to-handle-them-jn91bynlbC9\" target=\"_blank\">EN</a>. + * @param tableId Table identifier. (required) + * @param sizeTablePutRequest Size table details (required) + * @return PublicTableDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size table updated successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public PublicTableDto modifyTableUsingPUT(@javax.annotation.Nonnull String tableId, @javax.annotation.Nonnull SizeTablePutRequest sizeTablePutRequest) throws ApiException { + ApiResponse localVarResp = modifyTableUsingPUTWithHttpInfo(tableId, sizeTablePutRequest); + return localVarResp.getData(); + } + + /** + * Update a size table + * Use this resource to update selected size table. Read more: <a href=\"../../news/tabele-rozmiarow-zmieniamy-istniejacy-zasob-i-dodajemy-nowe-zasoby-do-ich-obslugi-k1nyd21A4fP\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-we-change-the-existing-resource-and-add-new-resources-to-handle-them-jn91bynlbC9\" target=\"_blank\">EN</a>. + * @param tableId Table identifier. (required) + * @param sizeTablePutRequest Size table details (required) + * @return ApiResponse<PublicTableDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size table updated successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse modifyTableUsingPUTWithHttpInfo(@javax.annotation.Nonnull String tableId, @javax.annotation.Nonnull SizeTablePutRequest sizeTablePutRequest) throws ApiException { + okhttp3.Call localVarCall = modifyTableUsingPUTValidateBeforeCall(tableId, sizeTablePutRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a size table (asynchronously) + * Use this resource to update selected size table. Read more: <a href=\"../../news/tabele-rozmiarow-zmieniamy-istniejacy-zasob-i-dodajemy-nowe-zasoby-do-ich-obslugi-k1nyd21A4fP\" target=\"_blank\">PL</a> / <a href=\"../../news/size-tables-we-change-the-existing-resource-and-add-new-resources-to-handle-them-jn91bynlbC9\" target=\"_blank\">EN</a>. + * @param tableId Table identifier. (required) + * @param sizeTablePutRequest Size table details (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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Size table updated successfully -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call modifyTableUsingPUTAsync(@javax.annotation.Nonnull String tableId, @javax.annotation.Nonnull SizeTablePutRequest sizeTablePutRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = modifyTableUsingPUTValidateBeforeCall(tableId, sizeTablePutRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/TaxIdentificationNumberApi.java b/src/main/java/pl/wtx/allegro/api/client/TaxIdentificationNumberApi.java new file mode 100644 index 0000000..edd3dc2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/TaxIdentificationNumberApi.java @@ -0,0 +1,484 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.TaxIdRequest; +import pl.wtx.allegro.api.client.model.TaxIdResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TaxIdentificationNumberApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public TaxIdentificationNumberApi() { + this(Configuration.getDefaultApiClient()); + } + + public TaxIdentificationNumberApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for addTaxId + * @param taxIdRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Tax identification number successfully added -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Tax identification number is invalid -
+ */ + public okhttp3.Call addTaxIdCall(@javax.annotation.Nonnull TaxIdRequest taxIdRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = taxIdRequest; + + // create path and map variables + String localVarPath = "/fulfillment/tax-id"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addTaxIdValidateBeforeCall(@javax.annotation.Nonnull TaxIdRequest taxIdRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'taxIdRequest' is set + if (taxIdRequest == null) { + throw new ApiException("Missing the required parameter 'taxIdRequest' when calling addTaxId(Async)"); + } + + return addTaxIdCall(taxIdRequest, _callback); + + } + + /** + * Add tax identification number + * Use this resource to add tax identification number. For international sellers only. + * @param taxIdRequest (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Tax identification number successfully added -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Tax identification number is invalid -
+ */ + public void addTaxId(@javax.annotation.Nonnull TaxIdRequest taxIdRequest) throws ApiException { + addTaxIdWithHttpInfo(taxIdRequest); + } + + /** + * Add tax identification number + * Use this resource to add tax identification number. For international sellers only. + * @param taxIdRequest (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Tax identification number successfully added -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Tax identification number is invalid -
+ */ + public ApiResponse addTaxIdWithHttpInfo(@javax.annotation.Nonnull TaxIdRequest taxIdRequest) throws ApiException { + okhttp3.Call localVarCall = addTaxIdValidateBeforeCall(taxIdRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Add tax identification number (asynchronously) + * Use this resource to add tax identification number. For international sellers only. + * @param taxIdRequest (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Tax identification number successfully added -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Tax identification number is invalid -
+ */ + public okhttp3.Call addTaxIdAsync(@javax.annotation.Nonnull TaxIdRequest taxIdRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addTaxIdValidateBeforeCall(taxIdRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getTaxId + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns tax identification number with verification status information -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getTaxIdCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fulfillment/tax-id"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTaxIdValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getTaxIdCall(_callback); + + } + + /** + * Get tax identification number + * Use this resource to get tax identification number with verification status. After adding or updating the tax identification number the status will be NOT_VERIFIED and you will have to wait for acceptance status to start selling. + * @return TaxIdResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns tax identification number with verification status information -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public TaxIdResponse getTaxId() throws ApiException { + ApiResponse localVarResp = getTaxIdWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get tax identification number + * Use this resource to get tax identification number with verification status. After adding or updating the tax identification number the status will be NOT_VERIFIED and you will have to wait for acceptance status to start selling. + * @return ApiResponse<TaxIdResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns tax identification number with verification status information -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getTaxIdWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getTaxIdValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get tax identification number (asynchronously) + * Use this resource to get tax identification number with verification status. After adding or updating the tax identification number the status will be NOT_VERIFIED and you will have to wait for acceptance status to start selling. + * @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 + * @http.response.details + + + + + + + +
Response Details
Status Code Description Response Headers
200 Returns tax identification number with verification status information -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getTaxIdAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTaxIdValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateTaxId + * @param taxIdRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Tax identification number updated -
401 Unauthorized -
403 Forbidden -
422 Tax identification number is invalid -
404 Not Found -
+ */ + public okhttp3.Call updateTaxIdCall(@javax.annotation.Nonnull TaxIdRequest taxIdRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = taxIdRequest; + + // create path and map variables + String localVarPath = "/fulfillment/tax-id"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateTaxIdValidateBeforeCall(@javax.annotation.Nonnull TaxIdRequest taxIdRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'taxIdRequest' is set + if (taxIdRequest == null) { + throw new ApiException("Missing the required parameter 'taxIdRequest' when calling updateTaxId(Async)"); + } + + return updateTaxIdCall(taxIdRequest, _callback); + + } + + /** + * Update tax identification number + * Use this resource to update tax identification number. For international sellers only. + * @param taxIdRequest (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Tax identification number updated -
401 Unauthorized -
403 Forbidden -
422 Tax identification number is invalid -
404 Not Found -
+ */ + public void updateTaxId(@javax.annotation.Nonnull TaxIdRequest taxIdRequest) throws ApiException { + updateTaxIdWithHttpInfo(taxIdRequest); + } + + /** + * Update tax identification number + * Use this resource to update tax identification number. For international sellers only. + * @param taxIdRequest (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Tax identification number updated -
401 Unauthorized -
403 Forbidden -
422 Tax identification number is invalid -
404 Not Found -
+ */ + public ApiResponse updateTaxIdWithHttpInfo(@javax.annotation.Nonnull TaxIdRequest taxIdRequest) throws ApiException { + okhttp3.Call localVarCall = updateTaxIdValidateBeforeCall(taxIdRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update tax identification number (asynchronously) + * Use this resource to update tax identification number. For international sellers only. + * @param taxIdRequest (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Tax identification number updated -
401 Unauthorized -
403 Forbidden -
422 Tax identification number is invalid -
404 Not Found -
+ */ + public okhttp3.Call updateTaxIdAsync(@javax.annotation.Nonnull TaxIdRequest taxIdRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateTaxIdValidateBeforeCall(taxIdRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/TaxSettingsApi.java b/src/main/java/pl/wtx/allegro/api/client/TaxSettingsApi.java new file mode 100644 index 0000000..1cac2b9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/TaxSettingsApi.java @@ -0,0 +1,235 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.CategoryTaxSettings; +import pl.wtx.allegro.api.client.model.ErrorsHolder; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TaxSettingsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public TaxSettingsApi() { + this(Configuration.getDefaultApiClient()); + } + + public TaxSettingsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getTaxSettingsForCategory + * @param categoryId An identifier of a category for which all available tax settings will be returned. (required) + * @param countryCode Country code for which tax settings will be returned. If not provided settings for all countries will be returned. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Tax settings for given category returned successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
+ */ + public okhttp3.Call getTaxSettingsForCategoryCall(@javax.annotation.Nonnull String categoryId, @javax.annotation.Nullable List countryCode, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/tax-settings"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (categoryId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("category.id", categoryId)); + } + + if (countryCode != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "countryCode", countryCode)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/vnd.allegro.beta.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTaxSettingsForCategoryValidateBeforeCall(@javax.annotation.Nonnull String categoryId, @javax.annotation.Nullable List countryCode, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'categoryId' is set + if (categoryId == null) { + throw new ApiException("Missing the required parameter 'categoryId' when calling getTaxSettingsForCategory(Async)"); + } + + return getTaxSettingsForCategoryCall(categoryId, countryCode, _callback); + + } + + /** + * Get all tax settings for category + * Use this resource to receive tax settings for given category. Based on received settings you may set VAT tax settings for your offers. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#opcje-faktury-i-stawki-vat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#invoice-and-vat-settings\" target=\"_blank\">EN</a>. + * @param categoryId An identifier of a category for which all available tax settings will be returned. (required) + * @param countryCode Country code for which tax settings will be returned. If not provided settings for all countries will be returned. (optional) + * @return CategoryTaxSettings + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Tax settings for given category returned successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
+ */ + public CategoryTaxSettings getTaxSettingsForCategory(@javax.annotation.Nonnull String categoryId, @javax.annotation.Nullable List countryCode) throws ApiException { + ApiResponse localVarResp = getTaxSettingsForCategoryWithHttpInfo(categoryId, countryCode); + return localVarResp.getData(); + } + + /** + * Get all tax settings for category + * Use this resource to receive tax settings for given category. Based on received settings you may set VAT tax settings for your offers. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#opcje-faktury-i-stawki-vat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#invoice-and-vat-settings\" target=\"_blank\">EN</a>. + * @param categoryId An identifier of a category for which all available tax settings will be returned. (required) + * @param countryCode Country code for which tax settings will be returned. If not provided settings for all countries will be returned. (optional) + * @return ApiResponse<CategoryTaxSettings> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Tax settings for given category returned successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
+ */ + public ApiResponse getTaxSettingsForCategoryWithHttpInfo(@javax.annotation.Nonnull String categoryId, @javax.annotation.Nullable List countryCode) throws ApiException { + okhttp3.Call localVarCall = getTaxSettingsForCategoryValidateBeforeCall(categoryId, countryCode, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get all tax settings for category (asynchronously) + * Use this resource to receive tax settings for given category. Based on received settings you may set VAT tax settings for your offers. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#opcje-faktury-i-stawki-vat\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#invoice-and-vat-settings\" target=\"_blank\">EN</a>. + * @param categoryId An identifier of a category for which all available tax settings will be returned. (required) + * @param countryCode Country code for which tax settings will be returned. If not provided settings for all countries will be 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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Tax settings for given category returned successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
+ */ + public okhttp3.Call getTaxSettingsForCategoryAsync(@javax.annotation.Nonnull String categoryId, @javax.annotation.Nullable List countryCode, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTaxSettingsForCategoryValidateBeforeCall(categoryId, countryCode, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/UsersOfferInformationApi.java b/src/main/java/pl/wtx/allegro/api/client/UsersOfferInformationApi.java new file mode 100644 index 0000000..facc35f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/UsersOfferInformationApi.java @@ -0,0 +1,999 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client; + +import pl.wtx.allegro.api.client.invoker.ApiCallback; +import pl.wtx.allegro.api.client.invoker.ApiClient; +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.ApiResponse; +import pl.wtx.allegro.api.client.invoker.Configuration; +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ProgressRequestBody; +import pl.wtx.allegro.api.client.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import pl.wtx.allegro.api.client.model.AuthError; +import java.math.BigDecimal; +import pl.wtx.allegro.api.client.model.ErrorsHolder; +import pl.wtx.allegro.api.client.model.GetOfferSmartClassificationGET400Response; +import pl.wtx.allegro.api.client.model.GetOfferSmartClassificationGET403Response; +import pl.wtx.allegro.api.client.model.OffersSearchResultDto; +import pl.wtx.allegro.api.client.model.SalePartialProductOfferResponse; +import pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1; +import pl.wtx.allegro.api.client.model.SellerOfferEventsResponse; +import pl.wtx.allegro.api.client.model.SmartOfferClassificationReport; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UsersOfferInformationApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UsersOfferInformationApi() { + this(Configuration.getDefaultApiClient()); + } + + public UsersOfferInformationApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getOfferEvents + * @param from The ID of the last seen event. Events that occured after the given event will be returned. (optional) + * @param limit The number of events that will be returned in the response. (optional, default to 100) + * @param type The types of events that will be returned in the response. All types of events are returned by default. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offer events returned successfully. -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public okhttp3.Call getOfferEventsCall(@javax.annotation.Nullable String from, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List type, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offer-events"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (from != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("from", from)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (type != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "type", type)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOfferEventsValidateBeforeCall(@javax.annotation.Nullable String from, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List type, final ApiCallback _callback) throws ApiException { + return getOfferEventsCall(from, limit, type, _callback); + + } + + /** + * Get events about the seller's offers + * Use this endpoint to get events from the last 24 hours concerning changes in the authorized seller's offers. At present we support the following events: - OFFER_ACTIVATED - offer is visible on site and available for purchase, occurs when offer status changes from ACTIVATING to ACTIVE. - OFFER_CHANGED - occurs when offer's fields has been changed e.g. description or photos. - OFFER_ENDED - offer is no longer available for purchase, occurs when offer status changes from ACTIVE to ENDED. - OFFER_STOCK_CHANGED - stock in an offer was changed either via purchase or by seller. - OFFER_PRICE_CHANGED - occurs when price in an offer was changed. - OFFER_ARCHIVED - offer is no longer available on listing and has been archived. - OFFER_BID_PLACED - bid was placed on the offer. - OFFER_BID_CANCELED - bid for offer was canceled. - OFFER_TRANSLATION_UPDATED - translation of offer was updated. - OFFER_VISIBILITY_CHANGED - visibility of offer was changed on marketplaces. Returned events may occur by actions made via browser or API. The resource allows you to get events concerning active offers and offers scheduled for activation (status ACTIVE and ACTIVATING). Returned events do not concern offers in INACTIVE and ENDED status (the exception is OFFER_ARCHIVED event). External id is returned for all event types except OFFER_BID_PLACED and OFFER_BID_CANCELED. Please note that one change may result in more than one event. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#dziennik-zdarzen-w-ofertach-sprzedawcy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#event-journal-concerning-changes-in-seller-s-offers\" target=\"_blank\">EN</a>. + * @param from The ID of the last seen event. Events that occured after the given event will be returned. (optional) + * @param limit The number of events that will be returned in the response. (optional, default to 100) + * @param type The types of events that will be returned in the response. All types of events are returned by default. (optional) + * @return SellerOfferEventsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offer events returned successfully. -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public SellerOfferEventsResponse getOfferEvents(@javax.annotation.Nullable String from, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List type) throws ApiException { + ApiResponse localVarResp = getOfferEventsWithHttpInfo(from, limit, type); + return localVarResp.getData(); + } + + /** + * Get events about the seller's offers + * Use this endpoint to get events from the last 24 hours concerning changes in the authorized seller's offers. At present we support the following events: - OFFER_ACTIVATED - offer is visible on site and available for purchase, occurs when offer status changes from ACTIVATING to ACTIVE. - OFFER_CHANGED - occurs when offer's fields has been changed e.g. description or photos. - OFFER_ENDED - offer is no longer available for purchase, occurs when offer status changes from ACTIVE to ENDED. - OFFER_STOCK_CHANGED - stock in an offer was changed either via purchase or by seller. - OFFER_PRICE_CHANGED - occurs when price in an offer was changed. - OFFER_ARCHIVED - offer is no longer available on listing and has been archived. - OFFER_BID_PLACED - bid was placed on the offer. - OFFER_BID_CANCELED - bid for offer was canceled. - OFFER_TRANSLATION_UPDATED - translation of offer was updated. - OFFER_VISIBILITY_CHANGED - visibility of offer was changed on marketplaces. Returned events may occur by actions made via browser or API. The resource allows you to get events concerning active offers and offers scheduled for activation (status ACTIVE and ACTIVATING). Returned events do not concern offers in INACTIVE and ENDED status (the exception is OFFER_ARCHIVED event). External id is returned for all event types except OFFER_BID_PLACED and OFFER_BID_CANCELED. Please note that one change may result in more than one event. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#dziennik-zdarzen-w-ofertach-sprzedawcy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#event-journal-concerning-changes-in-seller-s-offers\" target=\"_blank\">EN</a>. + * @param from The ID of the last seen event. Events that occured after the given event will be returned. (optional) + * @param limit The number of events that will be returned in the response. (optional, default to 100) + * @param type The types of events that will be returned in the response. All types of events are returned by default. (optional) + * @return ApiResponse<SellerOfferEventsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offer events returned successfully. -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public ApiResponse getOfferEventsWithHttpInfo(@javax.annotation.Nullable String from, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List type) throws ApiException { + okhttp3.Call localVarCall = getOfferEventsValidateBeforeCall(from, limit, type, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get events about the seller's offers (asynchronously) + * Use this endpoint to get events from the last 24 hours concerning changes in the authorized seller's offers. At present we support the following events: - OFFER_ACTIVATED - offer is visible on site and available for purchase, occurs when offer status changes from ACTIVATING to ACTIVE. - OFFER_CHANGED - occurs when offer's fields has been changed e.g. description or photos. - OFFER_ENDED - offer is no longer available for purchase, occurs when offer status changes from ACTIVE to ENDED. - OFFER_STOCK_CHANGED - stock in an offer was changed either via purchase or by seller. - OFFER_PRICE_CHANGED - occurs when price in an offer was changed. - OFFER_ARCHIVED - offer is no longer available on listing and has been archived. - OFFER_BID_PLACED - bid was placed on the offer. - OFFER_BID_CANCELED - bid for offer was canceled. - OFFER_TRANSLATION_UPDATED - translation of offer was updated. - OFFER_VISIBILITY_CHANGED - visibility of offer was changed on marketplaces. Returned events may occur by actions made via browser or API. The resource allows you to get events concerning active offers and offers scheduled for activation (status ACTIVE and ACTIVATING). Returned events do not concern offers in INACTIVE and ENDED status (the exception is OFFER_ARCHIVED event). External id is returned for all event types except OFFER_BID_PLACED and OFFER_BID_CANCELED. Please note that one change may result in more than one event. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#dziennik-zdarzen-w-ofertach-sprzedawcy\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#event-journal-concerning-changes-in-seller-s-offers\" target=\"_blank\">EN</a>. + * @param from The ID of the last seen event. Events that occured after the given event will be returned. (optional) + * @param limit The number of events that will be returned in the response. (optional, default to 100) + * @param type The types of events that will be returned in the response. All types of events are returned by default. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offer events returned successfully. -
400 Invalid parameters supplied in the request. -
401 Unauthorized -
+ */ + public okhttp3.Call getOfferEventsAsync(@javax.annotation.Nullable String from, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable List type, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOfferEventsValidateBeforeCall(from, limit, type, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOfferSmartClassificationGET + * @param offerId Offer identifier. (required) + * @param marketplaceId Marketplace for which offer classification report will be returned. If not specified, the result of the offer's base marketplace will be returned. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned offer Smart! classification report -
400 Bad Request -
401 Unauthorized action -
403 Offer does not belong to seller -
404 Not Found -
422 Unprocessable entity - The offer is being created in our system and we are not able to process it yet. Try again later. - Provided marketplaceId is not supported. -
+ */ + public okhttp3.Call getOfferSmartClassificationGETCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers/{offerId}/smart" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (marketplaceId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("marketplaceId", marketplaceId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOfferSmartClassificationGETValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling getOfferSmartClassificationGET(Async)"); + } + + return getOfferSmartClassificationGETCall(offerId, marketplaceId, _callback); + + } + + /** + * Get Smart! classification report of the particular offer + * Use this resource to get a full Smart! offer classification report of one of your offers. Please keep in mind you have to meet Smart! seller conditions first - for more details, use *GET /sale/smart*. To learn more about Smart! offer requirements, see our knowledge base article: [PL](https://allegro.pl/pomoc/dla-sprzedajacych/informacje-dla-sprzedajacych/co-zrobic-aby-moje-oferty-byly-oznaczone-ikona-allegro-smart-lDkP8VbKncV) / [EN](https://allegro.pl/help/for-sellers/allegro-smart-for-sellers/how-can-i-make-my-offers-be-marked-with-the-allegro-smart-badge-rKD1RV30jFM). Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#kwalifikacja-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#offer-qualification\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param marketplaceId Marketplace for which offer classification report will be returned. If not specified, the result of the offer's base marketplace will be returned. (optional) + * @return SmartOfferClassificationReport + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned offer Smart! classification report -
400 Bad Request -
401 Unauthorized action -
403 Offer does not belong to seller -
404 Not Found -
422 Unprocessable entity - The offer is being created in our system and we are not able to process it yet. Try again later. - Provided marketplaceId is not supported. -
+ */ + public SmartOfferClassificationReport getOfferSmartClassificationGET(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String marketplaceId) throws ApiException { + ApiResponse localVarResp = getOfferSmartClassificationGETWithHttpInfo(offerId, marketplaceId); + return localVarResp.getData(); + } + + /** + * Get Smart! classification report of the particular offer + * Use this resource to get a full Smart! offer classification report of one of your offers. Please keep in mind you have to meet Smart! seller conditions first - for more details, use *GET /sale/smart*. To learn more about Smart! offer requirements, see our knowledge base article: [PL](https://allegro.pl/pomoc/dla-sprzedajacych/informacje-dla-sprzedajacych/co-zrobic-aby-moje-oferty-byly-oznaczone-ikona-allegro-smart-lDkP8VbKncV) / [EN](https://allegro.pl/help/for-sellers/allegro-smart-for-sellers/how-can-i-make-my-offers-be-marked-with-the-allegro-smart-badge-rKD1RV30jFM). Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#kwalifikacja-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#offer-qualification\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param marketplaceId Marketplace for which offer classification report will be returned. If not specified, the result of the offer's base marketplace will be returned. (optional) + * @return ApiResponse<SmartOfferClassificationReport> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned offer Smart! classification report -
400 Bad Request -
401 Unauthorized action -
403 Offer does not belong to seller -
404 Not Found -
422 Unprocessable entity - The offer is being created in our system and we are not able to process it yet. Try again later. - Provided marketplaceId is not supported. -
+ */ + public ApiResponse getOfferSmartClassificationGETWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String marketplaceId) throws ApiException { + okhttp3.Call localVarCall = getOfferSmartClassificationGETValidateBeforeCall(offerId, marketplaceId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Smart! classification report of the particular offer (asynchronously) + * Use this resource to get a full Smart! offer classification report of one of your offers. Please keep in mind you have to meet Smart! seller conditions first - for more details, use *GET /sale/smart*. To learn more about Smart! offer requirements, see our knowledge base article: [PL](https://allegro.pl/pomoc/dla-sprzedajacych/informacje-dla-sprzedajacych/co-zrobic-aby-moje-oferty-byly-oznaczone-ikona-allegro-smart-lDkP8VbKncV) / [EN](https://allegro.pl/help/for-sellers/allegro-smart-for-sellers/how-can-i-make-my-offers-be-marked-with-the-allegro-smart-badge-rKD1RV30jFM). Read more: <a href=\"../../tutorials/jak-zarzadzac-kontem-danymi-uzytkownika-ZM9YAKgPgi2#kwalifikacja-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/account-and-user-data-management-jn9vBjqjnsw#offer-qualification\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @param marketplaceId Marketplace for which offer classification report will be returned. If not specified, the result of the offer's base marketplace will be 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 + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Successfully returned offer Smart! classification report -
400 Bad Request -
401 Unauthorized action -
403 Offer does not belong to seller -
404 Not Found -
422 Unprocessable entity - The offer is being created in our system and we are not able to process it yet. Try again later. - Provided marketplaceId is not supported. -
+ */ + public okhttp3.Call getOfferSmartClassificationGETAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nullable String marketplaceId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOfferSmartClassificationGETValidateBeforeCall(offerId, marketplaceId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPartialProductOffer + * @param offerId Offer identifier. (required) + * @param include Selection of parts intended to retrieve. Multiple parts can be specified at the same time. (required) + * @param acceptLanguage Expected language of messages. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer returned successfully -
400 Invalid offer ID format or unsupported part name -
401 Unauthorized - access to this resource requires authorization -
403 Access to offer is forbidden for this account -
404 Offer not found -
+ */ + public okhttp3.Call getPartialProductOfferCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull List include, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/product-offers/{offerId}/parts" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (include != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "include", include)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + if (acceptLanguage != null) { + localVarHeaderParams.put("Accept-Language", localVarApiClient.parameterToString(acceptLanguage)); + } + + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPartialProductOfferValidateBeforeCall(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull List include, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling getPartialProductOffer(Async)"); + } + + // verify the required parameter 'include' is set + if (include == null) { + throw new ApiException("Missing the required parameter 'include' when calling getPartialProductOffer(Async)"); + } + + return getPartialProductOfferCall(offerId, include, acceptLanguage, _callback); + + } + + /** + * Get selected data of the particular product-offer + * Use this resource to retrieve selected data of the particular product-offer. The model and functionality is a subset of the full product offer get endpoint (`GET /sale/product-offers/{offerId}`), but it is faster and more reliable. + * @param offerId Offer identifier. (required) + * @param include Selection of parts intended to retrieve. Multiple parts can be specified at the same time. (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return SalePartialProductOfferResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer returned successfully -
400 Invalid offer ID format or unsupported part name -
401 Unauthorized - access to this resource requires authorization -
403 Access to offer is forbidden for this account -
404 Offer not found -
+ */ + public SalePartialProductOfferResponse getPartialProductOffer(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull List include, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + ApiResponse localVarResp = getPartialProductOfferWithHttpInfo(offerId, include, acceptLanguage); + return localVarResp.getData(); + } + + /** + * Get selected data of the particular product-offer + * Use this resource to retrieve selected data of the particular product-offer. The model and functionality is a subset of the full product offer get endpoint (`GET /sale/product-offers/{offerId}`), but it is faster and more reliable. + * @param offerId Offer identifier. (required) + * @param include Selection of parts intended to retrieve. Multiple parts can be specified at the same time. (required) + * @param acceptLanguage Expected language of messages. (optional) + * @return ApiResponse<SalePartialProductOfferResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer returned successfully -
400 Invalid offer ID format or unsupported part name -
401 Unauthorized - access to this resource requires authorization -
403 Access to offer is forbidden for this account -
404 Offer not found -
+ */ + public ApiResponse getPartialProductOfferWithHttpInfo(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull List include, @javax.annotation.Nullable String acceptLanguage) throws ApiException { + okhttp3.Call localVarCall = getPartialProductOfferValidateBeforeCall(offerId, include, acceptLanguage, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get selected data of the particular product-offer (asynchronously) + * Use this resource to retrieve selected data of the particular product-offer. The model and functionality is a subset of the full product offer get endpoint (`GET /sale/product-offers/{offerId}`), but it is faster and more reliable. + * @param offerId Offer identifier. (required) + * @param include Selection of parts intended to retrieve. Multiple parts can be specified at the same time. (required) + * @param acceptLanguage Expected language of messages. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer returned successfully -
400 Invalid offer ID format or unsupported part name -
401 Unauthorized - access to this resource requires authorization -
403 Access to offer is forbidden for this account -
404 Offer not found -
+ */ + public okhttp3.Call getPartialProductOfferAsync(@javax.annotation.Nonnull String offerId, @javax.annotation.Nonnull List include, @javax.annotation.Nullable String acceptLanguage, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPartialProductOfferValidateBeforeCall(offerId, include, acceptLanguage, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getProductOffer + * @param offerId Offer identifier. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer returned successfully -
400 Invalid offer ID format -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getProductOfferCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/product-offers/{offerId}" + .replace("{" + "offerId" + "}", localVarApiClient.escapeString(offerId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getProductOfferValidateBeforeCall(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'offerId' is set + if (offerId == null) { + throw new ApiException("Missing the required parameter 'offerId' when calling getProductOffer(Async)"); + } + + return getProductOfferCall(offerId, _callback); + + } + + /** + * Get all data of the particular product-offer + * Use this resource to retrieve all data of the particular product-offer. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#publikacja-oferty-w-asynchronicznym-api\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-publication-in-asynchronous-api\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @return SaleProductOfferResponseV1 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer returned successfully -
400 Invalid offer ID format -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public SaleProductOfferResponseV1 getProductOffer(@javax.annotation.Nonnull String offerId) throws ApiException { + ApiResponse localVarResp = getProductOfferWithHttpInfo(offerId); + return localVarResp.getData(); + } + + /** + * Get all data of the particular product-offer + * Use this resource to retrieve all data of the particular product-offer. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#publikacja-oferty-w-asynchronicznym-api\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-publication-in-asynchronous-api\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (required) + * @return ApiResponse<SaleProductOfferResponseV1> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer returned successfully -
400 Invalid offer ID format -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public ApiResponse getProductOfferWithHttpInfo(@javax.annotation.Nonnull String offerId) throws ApiException { + okhttp3.Call localVarCall = getProductOfferValidateBeforeCall(offerId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get all data of the particular product-offer (asynchronously) + * Use this resource to retrieve all data of the particular product-offer. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#publikacja-oferty-w-asynchronicznym-api\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-publication-in-asynchronous-api\" target=\"_blank\">EN</a>. + * @param offerId Offer identifier. (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 + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Offer returned successfully -
400 Invalid offer ID format -
401 Unauthorized -
403 Forbidden -
404 Not Found -
+ */ + public okhttp3.Call getProductOfferAsync(@javax.annotation.Nonnull String offerId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getProductOfferValidateBeforeCall(offerId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for searchOffersUsingGET + * @param offerId Offer ID. (optional) + * @param name The text to search in the offer title. (optional) + * @param sellingModePriceAmountGte The lower threshold of price. If additionally a `publication.marketplace` is provided, searches using the price on the given marketplace. (optional) + * @param sellingModePriceAmountLte The upper threshold of price. If additionally a `publication.marketplace` is provided, searches using the price on the given marketplace. (optional) + * @param sellingModePriceAutomationRuleId The ID of price automation rule. Returns offers with given price automation rule ID. If additionally a `publication.marketplace` is provided, searches using the price automation rule on the given marketplace. (optional) + * @param sellingModePriceAutomationRuleIdEmpty Allows to filter offers by existence of price automation rule ID. Passing 'false' will return offers with any price automation rule, passing 'true' will return offers without any price automation rules. If additionally a `publication.marketplace` is provided, searches using the price automation rule on the given marketplace. (optional) + * @param publicationStatus The publication status of the offer. Passing more than one value will search for offers with any of the given statuses. By default all statuses are included. Example: `publication.status=INACTIVE&publication.status=ACTIVE` - returns offers with status `INACTIVE` or `ACTIVE`. (optional) + * @param publicationMarketplace Either the base marketplace or an additional marketplace of the offer. When passing the parameter `publication.marketplace`, searches for offers with the given marketplace as either its base marketplace or one of its additional marketplaces. When the parameter is omitted, searches for offers with all marketplaces. In addition to searching, passing the parameter also influences the functionality of other query parameter by searching and sorting by data (e.g. price) on the given marketplace. (optional) + * @param sellingModeFormat The offer's selling format. Passing more than one value will search for offers with any of the given formats. By default all formats are included. Example: `sellingMode.format=BUY_NOW&sellingMode.format=ADVERTISEMENT` - returns offers with with format `BUY_NOW` or `ADVERTISEMENT`. (optional) + * @param externalId The ID from the client's external system. Passing more than one value will search for offers with any of the given IDs. By default no ID is included. Example: `external.id=1233&external.id=1234` - returns offers with ID `1233` or `1234`. Single ID length shouldn't exceed 100 characters. (optional) + * @param deliveryShippingRatesId The ID of shipping rates. Returns offers with given shipping rates ID. (optional) + * @param deliveryShippingRatesIdEmpty Allows to filter offers by existence of shipping rates ID. (optional) + * @param sort The results' sorting order. No prefix in the value means ascending order. `-` prefix means descending order. If you don't provide the sort parameter, the list is sorted by offer creation time, descending. If additionally a `publication.marketplace` is provided, sorts by price and `stock.sold` using the data on the given marketplace. (optional) + * @param limit The maximum number of offers returned in the response. (optional, default to 20) + * @param offset Index of the first returned offer from all search results. Maximum sum of offset and limit is 10 000 000. (optional) + * @param categoryId The identifier of the category, where you want to search for offers. (optional) + * @param productIdEmpty Allows to filter offers by existence of product ID. (optional) + * @param productizationRequired Allows to search for offers from categories where productization is required. (optional) + * @param b2bBuyableOnlyByBusiness Allows to search for offers buyable only by businesses. (optional) + * @param fundraisingCampaignId ID of the charity fundraising campaign that benefits from this offer. (optional) + * @param fundraisingCampaignIdEmpty Allows to search for charity or commercial offers. (optional) + * @param afterSalesServicesReturnPolicyId The ID of return policy. Returns offers with given return policy ID. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offers returned successfully. -
400 The request query parameters are invalid. -
403 The user has no rights to query offers or provided token is invalid. -
+ */ + public okhttp3.Call searchOffersUsingGETCall(@javax.annotation.Nullable List offerId, @javax.annotation.Nullable String name, @javax.annotation.Nullable BigDecimal sellingModePriceAmountGte, @javax.annotation.Nullable BigDecimal sellingModePriceAmountLte, @javax.annotation.Nullable String sellingModePriceAutomationRuleId, @javax.annotation.Nullable Boolean sellingModePriceAutomationRuleIdEmpty, @javax.annotation.Nullable List publicationStatus, @javax.annotation.Nullable String publicationMarketplace, @javax.annotation.Nullable List sellingModeFormat, @javax.annotation.Nullable List externalId, @javax.annotation.Nullable UUID deliveryShippingRatesId, @javax.annotation.Nullable Boolean deliveryShippingRatesIdEmpty, @javax.annotation.Nullable String sort, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Boolean productIdEmpty, @javax.annotation.Nullable Boolean productizationRequired, @javax.annotation.Nullable Boolean b2bBuyableOnlyByBusiness, @javax.annotation.Nullable UUID fundraisingCampaignId, @javax.annotation.Nullable Boolean fundraisingCampaignIdEmpty, @javax.annotation.Nullable UUID afterSalesServicesReturnPolicyId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/sale/offers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (offerId != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "offer.id", offerId)); + } + + if (name != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("name", name)); + } + + if (sellingModePriceAmountGte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sellingMode.price.amount.gte", sellingModePriceAmountGte)); + } + + if (sellingModePriceAmountLte != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sellingMode.price.amount.lte", sellingModePriceAmountLte)); + } + + if (sellingModePriceAutomationRuleId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sellingMode.priceAutomation.rule.id", sellingModePriceAutomationRuleId)); + } + + if (sellingModePriceAutomationRuleIdEmpty != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sellingMode.priceAutomation.rule.id.empty", sellingModePriceAutomationRuleIdEmpty)); + } + + if (publicationStatus != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "publication.status", publicationStatus)); + } + + if (publicationMarketplace != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("publication.marketplace", publicationMarketplace)); + } + + if (sellingModeFormat != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "sellingMode.format", sellingModeFormat)); + } + + if (externalId != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "external.id", externalId)); + } + + if (deliveryShippingRatesId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("delivery.shippingRates.id", deliveryShippingRatesId)); + } + + if (deliveryShippingRatesIdEmpty != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("delivery.shippingRates.id.empty", deliveryShippingRatesIdEmpty)); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (categoryId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("category.id", categoryId)); + } + + if (productIdEmpty != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("product.id.empty", productIdEmpty)); + } + + if (productizationRequired != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("productizationRequired", productizationRequired)); + } + + if (b2bBuyableOnlyByBusiness != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("b2b.buyableOnlyByBusiness", b2bBuyableOnlyByBusiness)); + } + + if (fundraisingCampaignId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fundraisingCampaign.id", fundraisingCampaignId)); + } + + if (fundraisingCampaignIdEmpty != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fundraisingCampaign.id.empty", fundraisingCampaignIdEmpty)); + } + + if (afterSalesServicesReturnPolicyId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("afterSalesServices.returnPolicy.id", afterSalesServicesReturnPolicyId)); + } + + final String[] localVarAccepts = { + "application/vnd.allegro.public.v1+json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "bearer-token-for-user" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call searchOffersUsingGETValidateBeforeCall(@javax.annotation.Nullable List offerId, @javax.annotation.Nullable String name, @javax.annotation.Nullable BigDecimal sellingModePriceAmountGte, @javax.annotation.Nullable BigDecimal sellingModePriceAmountLte, @javax.annotation.Nullable String sellingModePriceAutomationRuleId, @javax.annotation.Nullable Boolean sellingModePriceAutomationRuleIdEmpty, @javax.annotation.Nullable List publicationStatus, @javax.annotation.Nullable String publicationMarketplace, @javax.annotation.Nullable List sellingModeFormat, @javax.annotation.Nullable List externalId, @javax.annotation.Nullable UUID deliveryShippingRatesId, @javax.annotation.Nullable Boolean deliveryShippingRatesIdEmpty, @javax.annotation.Nullable String sort, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Boolean productIdEmpty, @javax.annotation.Nullable Boolean productizationRequired, @javax.annotation.Nullable Boolean b2bBuyableOnlyByBusiness, @javax.annotation.Nullable UUID fundraisingCampaignId, @javax.annotation.Nullable Boolean fundraisingCampaignIdEmpty, @javax.annotation.Nullable UUID afterSalesServicesReturnPolicyId, final ApiCallback _callback) throws ApiException { + return searchOffersUsingGETCall(offerId, name, sellingModePriceAmountGte, sellingModePriceAmountLte, sellingModePriceAutomationRuleId, sellingModePriceAutomationRuleIdEmpty, publicationStatus, publicationMarketplace, sellingModeFormat, externalId, deliveryShippingRatesId, deliveryShippingRatesIdEmpty, sort, limit, offset, categoryId, productIdEmpty, productizationRequired, b2bBuyableOnlyByBusiness, fundraisingCampaignId, fundraisingCampaignIdEmpty, afterSalesServicesReturnPolicyId, _callback); + + } + + /** + * Get seller's offers + * Use this resource to get the list of the seller's offers. You can use different query parameters to filter the list. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-moje-oferty-w-rest-api\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#list-of-offers\" target=\"_blank\">EN</a>. + * @param offerId Offer ID. (optional) + * @param name The text to search in the offer title. (optional) + * @param sellingModePriceAmountGte The lower threshold of price. If additionally a `publication.marketplace` is provided, searches using the price on the given marketplace. (optional) + * @param sellingModePriceAmountLte The upper threshold of price. If additionally a `publication.marketplace` is provided, searches using the price on the given marketplace. (optional) + * @param sellingModePriceAutomationRuleId The ID of price automation rule. Returns offers with given price automation rule ID. If additionally a `publication.marketplace` is provided, searches using the price automation rule on the given marketplace. (optional) + * @param sellingModePriceAutomationRuleIdEmpty Allows to filter offers by existence of price automation rule ID. Passing 'false' will return offers with any price automation rule, passing 'true' will return offers without any price automation rules. If additionally a `publication.marketplace` is provided, searches using the price automation rule on the given marketplace. (optional) + * @param publicationStatus The publication status of the offer. Passing more than one value will search for offers with any of the given statuses. By default all statuses are included. Example: `publication.status=INACTIVE&publication.status=ACTIVE` - returns offers with status `INACTIVE` or `ACTIVE`. (optional) + * @param publicationMarketplace Either the base marketplace or an additional marketplace of the offer. When passing the parameter `publication.marketplace`, searches for offers with the given marketplace as either its base marketplace or one of its additional marketplaces. When the parameter is omitted, searches for offers with all marketplaces. In addition to searching, passing the parameter also influences the functionality of other query parameter by searching and sorting by data (e.g. price) on the given marketplace. (optional) + * @param sellingModeFormat The offer's selling format. Passing more than one value will search for offers with any of the given formats. By default all formats are included. Example: `sellingMode.format=BUY_NOW&sellingMode.format=ADVERTISEMENT` - returns offers with with format `BUY_NOW` or `ADVERTISEMENT`. (optional) + * @param externalId The ID from the client's external system. Passing more than one value will search for offers with any of the given IDs. By default no ID is included. Example: `external.id=1233&external.id=1234` - returns offers with ID `1233` or `1234`. Single ID length shouldn't exceed 100 characters. (optional) + * @param deliveryShippingRatesId The ID of shipping rates. Returns offers with given shipping rates ID. (optional) + * @param deliveryShippingRatesIdEmpty Allows to filter offers by existence of shipping rates ID. (optional) + * @param sort The results' sorting order. No prefix in the value means ascending order. `-` prefix means descending order. If you don't provide the sort parameter, the list is sorted by offer creation time, descending. If additionally a `publication.marketplace` is provided, sorts by price and `stock.sold` using the data on the given marketplace. (optional) + * @param limit The maximum number of offers returned in the response. (optional, default to 20) + * @param offset Index of the first returned offer from all search results. Maximum sum of offset and limit is 10 000 000. (optional) + * @param categoryId The identifier of the category, where you want to search for offers. (optional) + * @param productIdEmpty Allows to filter offers by existence of product ID. (optional) + * @param productizationRequired Allows to search for offers from categories where productization is required. (optional) + * @param b2bBuyableOnlyByBusiness Allows to search for offers buyable only by businesses. (optional) + * @param fundraisingCampaignId ID of the charity fundraising campaign that benefits from this offer. (optional) + * @param fundraisingCampaignIdEmpty Allows to search for charity or commercial offers. (optional) + * @param afterSalesServicesReturnPolicyId The ID of return policy. Returns offers with given return policy ID. (optional) + * @return OffersSearchResultDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offers returned successfully. -
400 The request query parameters are invalid. -
403 The user has no rights to query offers or provided token is invalid. -
+ */ + public OffersSearchResultDto searchOffersUsingGET(@javax.annotation.Nullable List offerId, @javax.annotation.Nullable String name, @javax.annotation.Nullable BigDecimal sellingModePriceAmountGte, @javax.annotation.Nullable BigDecimal sellingModePriceAmountLte, @javax.annotation.Nullable String sellingModePriceAutomationRuleId, @javax.annotation.Nullable Boolean sellingModePriceAutomationRuleIdEmpty, @javax.annotation.Nullable List publicationStatus, @javax.annotation.Nullable String publicationMarketplace, @javax.annotation.Nullable List sellingModeFormat, @javax.annotation.Nullable List externalId, @javax.annotation.Nullable UUID deliveryShippingRatesId, @javax.annotation.Nullable Boolean deliveryShippingRatesIdEmpty, @javax.annotation.Nullable String sort, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Boolean productIdEmpty, @javax.annotation.Nullable Boolean productizationRequired, @javax.annotation.Nullable Boolean b2bBuyableOnlyByBusiness, @javax.annotation.Nullable UUID fundraisingCampaignId, @javax.annotation.Nullable Boolean fundraisingCampaignIdEmpty, @javax.annotation.Nullable UUID afterSalesServicesReturnPolicyId) throws ApiException { + ApiResponse localVarResp = searchOffersUsingGETWithHttpInfo(offerId, name, sellingModePriceAmountGte, sellingModePriceAmountLte, sellingModePriceAutomationRuleId, sellingModePriceAutomationRuleIdEmpty, publicationStatus, publicationMarketplace, sellingModeFormat, externalId, deliveryShippingRatesId, deliveryShippingRatesIdEmpty, sort, limit, offset, categoryId, productIdEmpty, productizationRequired, b2bBuyableOnlyByBusiness, fundraisingCampaignId, fundraisingCampaignIdEmpty, afterSalesServicesReturnPolicyId); + return localVarResp.getData(); + } + + /** + * Get seller's offers + * Use this resource to get the list of the seller's offers. You can use different query parameters to filter the list. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-moje-oferty-w-rest-api\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#list-of-offers\" target=\"_blank\">EN</a>. + * @param offerId Offer ID. (optional) + * @param name The text to search in the offer title. (optional) + * @param sellingModePriceAmountGte The lower threshold of price. If additionally a `publication.marketplace` is provided, searches using the price on the given marketplace. (optional) + * @param sellingModePriceAmountLte The upper threshold of price. If additionally a `publication.marketplace` is provided, searches using the price on the given marketplace. (optional) + * @param sellingModePriceAutomationRuleId The ID of price automation rule. Returns offers with given price automation rule ID. If additionally a `publication.marketplace` is provided, searches using the price automation rule on the given marketplace. (optional) + * @param sellingModePriceAutomationRuleIdEmpty Allows to filter offers by existence of price automation rule ID. Passing 'false' will return offers with any price automation rule, passing 'true' will return offers without any price automation rules. If additionally a `publication.marketplace` is provided, searches using the price automation rule on the given marketplace. (optional) + * @param publicationStatus The publication status of the offer. Passing more than one value will search for offers with any of the given statuses. By default all statuses are included. Example: `publication.status=INACTIVE&publication.status=ACTIVE` - returns offers with status `INACTIVE` or `ACTIVE`. (optional) + * @param publicationMarketplace Either the base marketplace or an additional marketplace of the offer. When passing the parameter `publication.marketplace`, searches for offers with the given marketplace as either its base marketplace or one of its additional marketplaces. When the parameter is omitted, searches for offers with all marketplaces. In addition to searching, passing the parameter also influences the functionality of other query parameter by searching and sorting by data (e.g. price) on the given marketplace. (optional) + * @param sellingModeFormat The offer's selling format. Passing more than one value will search for offers with any of the given formats. By default all formats are included. Example: `sellingMode.format=BUY_NOW&sellingMode.format=ADVERTISEMENT` - returns offers with with format `BUY_NOW` or `ADVERTISEMENT`. (optional) + * @param externalId The ID from the client's external system. Passing more than one value will search for offers with any of the given IDs. By default no ID is included. Example: `external.id=1233&external.id=1234` - returns offers with ID `1233` or `1234`. Single ID length shouldn't exceed 100 characters. (optional) + * @param deliveryShippingRatesId The ID of shipping rates. Returns offers with given shipping rates ID. (optional) + * @param deliveryShippingRatesIdEmpty Allows to filter offers by existence of shipping rates ID. (optional) + * @param sort The results' sorting order. No prefix in the value means ascending order. `-` prefix means descending order. If you don't provide the sort parameter, the list is sorted by offer creation time, descending. If additionally a `publication.marketplace` is provided, sorts by price and `stock.sold` using the data on the given marketplace. (optional) + * @param limit The maximum number of offers returned in the response. (optional, default to 20) + * @param offset Index of the first returned offer from all search results. Maximum sum of offset and limit is 10 000 000. (optional) + * @param categoryId The identifier of the category, where you want to search for offers. (optional) + * @param productIdEmpty Allows to filter offers by existence of product ID. (optional) + * @param productizationRequired Allows to search for offers from categories where productization is required. (optional) + * @param b2bBuyableOnlyByBusiness Allows to search for offers buyable only by businesses. (optional) + * @param fundraisingCampaignId ID of the charity fundraising campaign that benefits from this offer. (optional) + * @param fundraisingCampaignIdEmpty Allows to search for charity or commercial offers. (optional) + * @param afterSalesServicesReturnPolicyId The ID of return policy. Returns offers with given return policy ID. (optional) + * @return ApiResponse<OffersSearchResultDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offers returned successfully. -
400 The request query parameters are invalid. -
403 The user has no rights to query offers or provided token is invalid. -
+ */ + public ApiResponse searchOffersUsingGETWithHttpInfo(@javax.annotation.Nullable List offerId, @javax.annotation.Nullable String name, @javax.annotation.Nullable BigDecimal sellingModePriceAmountGte, @javax.annotation.Nullable BigDecimal sellingModePriceAmountLte, @javax.annotation.Nullable String sellingModePriceAutomationRuleId, @javax.annotation.Nullable Boolean sellingModePriceAutomationRuleIdEmpty, @javax.annotation.Nullable List publicationStatus, @javax.annotation.Nullable String publicationMarketplace, @javax.annotation.Nullable List sellingModeFormat, @javax.annotation.Nullable List externalId, @javax.annotation.Nullable UUID deliveryShippingRatesId, @javax.annotation.Nullable Boolean deliveryShippingRatesIdEmpty, @javax.annotation.Nullable String sort, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Boolean productIdEmpty, @javax.annotation.Nullable Boolean productizationRequired, @javax.annotation.Nullable Boolean b2bBuyableOnlyByBusiness, @javax.annotation.Nullable UUID fundraisingCampaignId, @javax.annotation.Nullable Boolean fundraisingCampaignIdEmpty, @javax.annotation.Nullable UUID afterSalesServicesReturnPolicyId) throws ApiException { + okhttp3.Call localVarCall = searchOffersUsingGETValidateBeforeCall(offerId, name, sellingModePriceAmountGte, sellingModePriceAmountLte, sellingModePriceAutomationRuleId, sellingModePriceAutomationRuleIdEmpty, publicationStatus, publicationMarketplace, sellingModeFormat, externalId, deliveryShippingRatesId, deliveryShippingRatesIdEmpty, sort, limit, offset, categoryId, productIdEmpty, productizationRequired, b2bBuyableOnlyByBusiness, fundraisingCampaignId, fundraisingCampaignIdEmpty, afterSalesServicesReturnPolicyId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get seller's offers (asynchronously) + * Use this resource to get the list of the seller's offers. You can use different query parameters to filter the list. Read more: <a href=\"../../tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-pobrac-moje-oferty-w-rest-api\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-process-list-of-offers-m09BKA5v8H3#list-of-offers\" target=\"_blank\">EN</a>. + * @param offerId Offer ID. (optional) + * @param name The text to search in the offer title. (optional) + * @param sellingModePriceAmountGte The lower threshold of price. If additionally a `publication.marketplace` is provided, searches using the price on the given marketplace. (optional) + * @param sellingModePriceAmountLte The upper threshold of price. If additionally a `publication.marketplace` is provided, searches using the price on the given marketplace. (optional) + * @param sellingModePriceAutomationRuleId The ID of price automation rule. Returns offers with given price automation rule ID. If additionally a `publication.marketplace` is provided, searches using the price automation rule on the given marketplace. (optional) + * @param sellingModePriceAutomationRuleIdEmpty Allows to filter offers by existence of price automation rule ID. Passing 'false' will return offers with any price automation rule, passing 'true' will return offers without any price automation rules. If additionally a `publication.marketplace` is provided, searches using the price automation rule on the given marketplace. (optional) + * @param publicationStatus The publication status of the offer. Passing more than one value will search for offers with any of the given statuses. By default all statuses are included. Example: `publication.status=INACTIVE&publication.status=ACTIVE` - returns offers with status `INACTIVE` or `ACTIVE`. (optional) + * @param publicationMarketplace Either the base marketplace or an additional marketplace of the offer. When passing the parameter `publication.marketplace`, searches for offers with the given marketplace as either its base marketplace or one of its additional marketplaces. When the parameter is omitted, searches for offers with all marketplaces. In addition to searching, passing the parameter also influences the functionality of other query parameter by searching and sorting by data (e.g. price) on the given marketplace. (optional) + * @param sellingModeFormat The offer's selling format. Passing more than one value will search for offers with any of the given formats. By default all formats are included. Example: `sellingMode.format=BUY_NOW&sellingMode.format=ADVERTISEMENT` - returns offers with with format `BUY_NOW` or `ADVERTISEMENT`. (optional) + * @param externalId The ID from the client's external system. Passing more than one value will search for offers with any of the given IDs. By default no ID is included. Example: `external.id=1233&external.id=1234` - returns offers with ID `1233` or `1234`. Single ID length shouldn't exceed 100 characters. (optional) + * @param deliveryShippingRatesId The ID of shipping rates. Returns offers with given shipping rates ID. (optional) + * @param deliveryShippingRatesIdEmpty Allows to filter offers by existence of shipping rates ID. (optional) + * @param sort The results' sorting order. No prefix in the value means ascending order. `-` prefix means descending order. If you don't provide the sort parameter, the list is sorted by offer creation time, descending. If additionally a `publication.marketplace` is provided, sorts by price and `stock.sold` using the data on the given marketplace. (optional) + * @param limit The maximum number of offers returned in the response. (optional, default to 20) + * @param offset Index of the first returned offer from all search results. Maximum sum of offset and limit is 10 000 000. (optional) + * @param categoryId The identifier of the category, where you want to search for offers. (optional) + * @param productIdEmpty Allows to filter offers by existence of product ID. (optional) + * @param productizationRequired Allows to search for offers from categories where productization is required. (optional) + * @param b2bBuyableOnlyByBusiness Allows to search for offers buyable only by businesses. (optional) + * @param fundraisingCampaignId ID of the charity fundraising campaign that benefits from this offer. (optional) + * @param fundraisingCampaignIdEmpty Allows to search for charity or commercial offers. (optional) + * @param afterSalesServicesReturnPolicyId The ID of return policy. Returns offers with given return policy ID. (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 + * @http.response.details + + + + + + +
Response Details
Status Code Description Response Headers
200 The list of offers returned successfully. -
400 The request query parameters are invalid. -
403 The user has no rights to query offers or provided token is invalid. -
+ */ + public okhttp3.Call searchOffersUsingGETAsync(@javax.annotation.Nullable List offerId, @javax.annotation.Nullable String name, @javax.annotation.Nullable BigDecimal sellingModePriceAmountGte, @javax.annotation.Nullable BigDecimal sellingModePriceAmountLte, @javax.annotation.Nullable String sellingModePriceAutomationRuleId, @javax.annotation.Nullable Boolean sellingModePriceAutomationRuleIdEmpty, @javax.annotation.Nullable List publicationStatus, @javax.annotation.Nullable String publicationMarketplace, @javax.annotation.Nullable List sellingModeFormat, @javax.annotation.Nullable List externalId, @javax.annotation.Nullable UUID deliveryShippingRatesId, @javax.annotation.Nullable Boolean deliveryShippingRatesIdEmpty, @javax.annotation.Nullable String sort, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, @javax.annotation.Nullable String categoryId, @javax.annotation.Nullable Boolean productIdEmpty, @javax.annotation.Nullable Boolean productizationRequired, @javax.annotation.Nullable Boolean b2bBuyableOnlyByBusiness, @javax.annotation.Nullable UUID fundraisingCampaignId, @javax.annotation.Nullable Boolean fundraisingCampaignIdEmpty, @javax.annotation.Nullable UUID afterSalesServicesReturnPolicyId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = searchOffersUsingGETValidateBeforeCall(offerId, name, sellingModePriceAmountGte, sellingModePriceAmountLte, sellingModePriceAutomationRuleId, sellingModePriceAutomationRuleIdEmpty, publicationStatus, publicationMarketplace, sellingModeFormat, externalId, deliveryShippingRatesId, deliveryShippingRatesIdEmpty, sort, limit, offset, categoryId, productIdEmpty, productizationRequired, b2bBuyableOnlyByBusiness, fundraisingCampaignId, fundraisingCampaignIdEmpty, afterSalesServicesReturnPolicyId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/config/GsonConfig.java b/src/main/java/pl/wtx/allegro/api/client/config/GsonConfig.java new file mode 100644 index 0000000..70f114b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/config/GsonConfig.java @@ -0,0 +1,21 @@ +package pl.wtx.allegro.api.client.config; +import java.time.OffsetDateTime; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.Strictness; + +public class GsonConfig { + + // Setup for ignoring not recognized fields in the response message and setup date format parsing. + public static Gson createGson() { + + return new GsonBuilder() + .setStrictness(Strictness.LENIENT) + .serializeNulls() + .registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeAdapter()) + .create(); + + } + +} \ No newline at end of file diff --git a/src/main/java/pl/wtx/allegro/api/client/config/OffsetDateTimeAdapter.java b/src/main/java/pl/wtx/allegro/api/client/config/OffsetDateTimeAdapter.java new file mode 100644 index 0000000..23c6f79 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/config/OffsetDateTimeAdapter.java @@ -0,0 +1,44 @@ +package pl.wtx.allegro.api.client.config; + +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; + +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonToken; +import com.google.gson.stream.JsonWriter; + +public class OffsetDateTimeAdapter extends TypeAdapter { + + private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); + + @Override + public void write(JsonWriter out, OffsetDateTime value) throws IOException { + + if (value != null) { + out.value(value.format(FORMATTER)); + } else { + out.nullValue(); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + + if (in.peek() == JsonToken.NULL) { + in.nextNull(); + return null; + } + + String date = in.nextString(); + if (date != null && !date.isEmpty()) { + return OffsetDateTime.parse(date, FORMATTER.withZone(ZoneOffset.UTC)); + } + + return null; + + } + +} diff --git a/src/main/java/pl/wtx/allegro/api/client/config/OkHttpClientConfig.java b/src/main/java/pl/wtx/allegro/api/client/config/OkHttpClientConfig.java new file mode 100644 index 0000000..502e41d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/config/OkHttpClientConfig.java @@ -0,0 +1,17 @@ +package pl.wtx.allegro.api.client.config; + +import okhttp3.OkHttpClient; +import okhttp3.logging.HttpLoggingInterceptor; + +public class OkHttpClientConfig { + + // Logging configuration. + public static OkHttpClient configureClient(OkHttpClient defaultClient) { + + HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); + return defaultClient.newBuilder().addInterceptor(loggingInterceptor).build(); + + } + +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/ApiCallback.java b/src/main/java/pl/wtx/allegro/api/client/invoker/ApiCallback.java new file mode 100644 index 0000000..4ea51e1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/ApiClient.java b/src/main/java/pl/wtx/allegro/api/client/invoker/ApiClient.java new file mode 100644 index 0000000..dcdd4ff --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/ApiClient.java @@ -0,0 +1,1692 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import pl.wtx.allegro.api.client.invoker.auth.Authentication; +import pl.wtx.allegro.api.client.invoker.auth.HttpBasicAuth; +import pl.wtx.allegro.api.client.invoker.auth.HttpBearerAuth; +import pl.wtx.allegro.api.client.invoker.auth.ApiKeyAuth; +import pl.wtx.allegro.api.client.invoker.auth.OAuth; +import pl.wtx.allegro.api.client.invoker.auth.RetryingOAuth; +import pl.wtx.allegro.api.client.invoker.auth.OAuthFlow; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + private String basePath = "https://api.allegro.pl"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "https://api.{environment}", + "No description provided", + new HashMap() {{ + put("environment", new ServerVariable( + "No description provided", + "allegro.pl", + new HashSet( + Arrays.asList( + "allegro.pl", + "allegro.pl.allegrosandbox.pl" + ) + ) + )); + }} + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + private String tempFolderPath = null; + + private Map authentications; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("bearer-token-for-user", new OAuth()); + authentications.put("bearer-token-for-application", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("bearer-token-for-user", new OAuth()); + authentications.put("bearer-token-for-application", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID + * + * @param clientId client ID + */ + public ApiClient(String clientId) { + this(clientId, null, null); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters + * + * @param clientId client ID + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, Map parameters) { + this(clientId, null, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters + * + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String clientId, String clientSecret, Map parameters) { + this(null, clientId, clientSecret, parameters); + } + + /** + * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters + * + * @param basePath base path + * @param clientId client ID + * @param clientSecret client secret + * @param parameters a {@link java.util.Map} of parameters + */ + public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { + init(); + if (basePath != null) { + this.basePath = basePath; + } + + String tokenUrl = "https://allegro.pl/auth/oauth/token"; + if (!"".equals(tokenUrl) && !URI.create(tokenUrl).isAbsolute()) { + URI uri = URI.create(getBasePath()); + tokenUrl = uri.getScheme() + ":" + + (uri.getAuthority() != null ? "//" + uri.getAuthority() : "") + + tokenUrl; + if (!URI.create(tokenUrl).isAbsolute()) { + throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL"); + } + } + RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.ACCESS_CODE, clientSecret, parameters); + authentications.put( + "bearer-token-for-user", + retryingOAuth + ); + initHttpClient(Collections.singletonList(retryingOAuth)); + // Setup authentications (key: authentication name, value: authentication). + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + private void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/latest/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g https://api.allegro.pl + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return Api Client + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link pl.wtx.allegro.api.client.invoker.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link pl.wtx.allegro.api.client.invoker.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link pl.wtx.allegro.api.client.invoker.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link pl.wtx.allegro.api.client.invoker.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link pl.wtx.allegro.api.client.invoker.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(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!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return ApiClient + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = JSON.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + return "application/json"; + } + + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws pl.wtx.allegro.api.client.invoker.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + ResponseBody respBody = response.body(); + if (respBody == null) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws pl.wtx.allegro.api.client.invoker.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws pl.wtx.allegro.api.client.invoker.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws pl.wtx.allegro.api.client.invoker.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws pl.wtx.allegro.api.client.invoker.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws pl.wtx.allegro.api.client.invoker.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @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 cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws pl.wtx.allegro.api.client.invoker.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @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 cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws pl.wtx.allegro.api.client.invoker.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * 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 + * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws pl.wtx.allegro.api.client.invoker.ApiException If fails to update the parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) throws ApiException { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + private Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws pl.wtx.allegro.api.client.invoker.ApiException If fail to serialize the request body object into a string + */ + private String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/ApiException.java b/src/main/java/pl/wtx/allegro/api/client/invoker/ApiException.java new file mode 100644 index 0000000..f2c060e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/ApiException.java @@ -0,0 +1,167 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import java.util.Map; +import java.util.List; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/ApiResponse.java b/src/main/java/pl/wtx/allegro/api/client/invoker/ApiResponse.java new file mode 100644 index 0000000..eef6722 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + *

Constructor for ApiResponse.

+ * + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + /** + *

Get the status code.

+ * + * @return the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/Configuration.java b/src/main/java/pl/wtx/allegro/api/client/invoker/Configuration.java new file mode 100644 index 0000000..7256ef1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/Configuration.java @@ -0,0 +1,63 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Configuration { + public static final String VERSION = "latest"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * 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() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * 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.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/GzipRequestInterceptor.java b/src/main/java/pl/wtx/allegro/api/client/invoker/GzipRequestInterceptor.java new file mode 100644 index 0000000..a0fb7f3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/GzipRequestInterceptor.java @@ -0,0 +1,85 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +import java.io.IOException; + +/** + * Encodes request bodies using gzip. + * + * Taken from https://github.com/square/okhttp/issues/350 + */ +class GzipRequestInterceptor implements Interceptor { + @Override + public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { + return chain.proceed(originalRequest); + } + + Request compressedRequest = originalRequest.newBuilder() + .header("Content-Encoding", "gzip") + .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) + .build(); + return chain.proceed(compressedRequest); + } + + private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() { + return buffer.size(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } + + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } + + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/JSON.java b/src/main/java/pl/wtx/allegro/api/client/invoker/JSON.java new file mode 100644 index 0000000..77e1f1c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/JSON.java @@ -0,0 +1,2286 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + +import okio.ByteString; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + * + * NOTE: in the future, this class may be converted to static, which may break + * backward-compatibility + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + @SuppressWarnings("unchecked") + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder() + .registerTypeSelector(pl.wtx.allegro.api.client.model.AlreadyInWarehouseShipping.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("AlreadyInWarehouseShipping", pl.wtx.allegro.api.client.model.AlreadyInWarehouseShipping.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "method")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.BaseOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BLOCKADE", pl.wtx.allegro.api.client.model.BlockadeOperation.class); + classByDiscriminatorValue.put("BLOCKADE_RELEASE", pl.wtx.allegro.api.client.model.BlockadeReleaseOperation.class); + classByDiscriminatorValue.put("COMPENSATION", pl.wtx.allegro.api.client.model.CompensationOperation.class); + classByDiscriminatorValue.put("CONTRIBUTION", pl.wtx.allegro.api.client.model.ContributionOperation.class); + classByDiscriminatorValue.put("CORRECTION", pl.wtx.allegro.api.client.model.CorrectionOperation.class); + classByDiscriminatorValue.put("DEDUCTION_CHARGE", pl.wtx.allegro.api.client.model.DeductionChargeOperation.class); + classByDiscriminatorValue.put("DEDUCTION_INCREASE", pl.wtx.allegro.api.client.model.DeductionIncreaseOperation.class); + classByDiscriminatorValue.put("PAYOUT", pl.wtx.allegro.api.client.model.PayoutOperation.class); + classByDiscriminatorValue.put("PAYOUT_CANCEL", pl.wtx.allegro.api.client.model.PayoutOperationCancel.class); + classByDiscriminatorValue.put("PROVIDER_REFUND_TRANSFER_CHARGE", pl.wtx.allegro.api.client.model.ProviderRefundTransferChargeOperation.class); + classByDiscriminatorValue.put("PROVIDER_REFUND_TRANSFER_INCREASE", pl.wtx.allegro.api.client.model.ProviderRefundTransferIncreaseOperation.class); + classByDiscriminatorValue.put("REFUND_CANCEL", pl.wtx.allegro.api.client.model.RefundCancelOperation.class); + classByDiscriminatorValue.put("REFUND_CHARGE", pl.wtx.allegro.api.client.model.RefundChargeOperation.class); + classByDiscriminatorValue.put("REFUND_INCREASE", pl.wtx.allegro.api.client.model.RefundIncreaseOperation.class); + classByDiscriminatorValue.put("SURCHARGE", pl.wtx.allegro.api.client.model.SurchargeOperation.class); + classByDiscriminatorValue.put("BaseOperation", pl.wtx.allegro.api.client.model.BaseOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.BenefitSpecification.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("LARGE_ORDER_DISCOUNT", pl.wtx.allegro.api.client.model.LargeOrderDiscountBenefitSpecification.class); + classByDiscriminatorValue.put("UNIT_PERCENTAGE_DISCOUNT", pl.wtx.allegro.api.client.model.MultiPackBenefitSpecification.class); + classByDiscriminatorValue.put("WHOLESALE_PRICE_LIST", pl.wtx.allegro.api.client.model.WholesalePriceListBenefitSpecification.class); + classByDiscriminatorValue.put("BenefitSpecification", pl.wtx.allegro.api.client.model.BenefitSpecification.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.BlockadeOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BlockadeOperation", pl.wtx.allegro.api.client.model.BlockadeOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.BlockadeReleaseOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("BlockadeReleaseOperation", pl.wtx.allegro.api.client.model.BlockadeReleaseOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CategoryBaseEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CATEGORY_CREATED", pl.wtx.allegro.api.client.model.CategoryCreatedEvent.class); + classByDiscriminatorValue.put("CATEGORY_DELETED", pl.wtx.allegro.api.client.model.CategoryDeletedEvent.class); + classByDiscriminatorValue.put("CATEGORY_MOVED", pl.wtx.allegro.api.client.model.CategoryMovedEvent.class); + classByDiscriminatorValue.put("CATEGORY_RENAMED", pl.wtx.allegro.api.client.model.CategoryRenamedEvent.class); + classByDiscriminatorValue.put("CategoryBaseEvent", pl.wtx.allegro.api.client.model.CategoryBaseEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CategoryCreatedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CategoryCreatedEvent", pl.wtx.allegro.api.client.model.CategoryCreatedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CategoryDeletedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CategoryDeletedEvent", pl.wtx.allegro.api.client.model.CategoryDeletedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CategoryMovedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CategoryMovedEvent", pl.wtx.allegro.api.client.model.CategoryMovedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CategoryParameter.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("dictionary", pl.wtx.allegro.api.client.model.DictionaryCategoryParameter.class); + classByDiscriminatorValue.put("float", pl.wtx.allegro.api.client.model.FloatCategoryParameter.class); + classByDiscriminatorValue.put("integer", pl.wtx.allegro.api.client.model.IntegerCategoryParameter.class); + classByDiscriminatorValue.put("string", pl.wtx.allegro.api.client.model.StringCategoryParameter.class); + classByDiscriminatorValue.put("CategoryParameter", pl.wtx.allegro.api.client.model.CategoryParameter.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CategoryParametersScheduledBaseChange.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("REQUIREMENT_CHANGE", pl.wtx.allegro.api.client.model.RequirementChange.class); + classByDiscriminatorValue.put("CategoryParametersScheduledBaseChange", pl.wtx.allegro.api.client.model.CategoryParametersScheduledBaseChange.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CategoryProductParameter.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("dictionary", pl.wtx.allegro.api.client.model.DictionaryCategoryProductParameter.class); + classByDiscriminatorValue.put("float", pl.wtx.allegro.api.client.model.FloatCategoryProductParameter.class); + classByDiscriminatorValue.put("integer", pl.wtx.allegro.api.client.model.IntegerCategoryProductParameter.class); + classByDiscriminatorValue.put("string", pl.wtx.allegro.api.client.model.StringCategoryProductParameter.class); + classByDiscriminatorValue.put("CategoryProductParameter", pl.wtx.allegro.api.client.model.CategoryProductParameter.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CategoryRenamedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CategoryRenamedEvent", pl.wtx.allegro.api.client.model.CategoryRenamedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CompatibilityList.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("MANUAL", pl.wtx.allegro.api.client.model.CompatibilityListManual.class); + classByDiscriminatorValue.put("PRODUCT_BASED", pl.wtx.allegro.api.client.model.CompatibilityListProductBased.class); + classByDiscriminatorValue.put("CompatibilityListProductBasedProductOfferResponse", pl.wtx.allegro.api.client.model.CompatibilityListProductBasedProductOfferResponse.class); + classByDiscriminatorValue.put("CompatibilityList", pl.wtx.allegro.api.client.model.CompatibilityList.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CompatibilityListIdItem.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CompatibilityListIdItem", pl.wtx.allegro.api.client.model.CompatibilityListIdItem.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CompatibilityListItem.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ID", pl.wtx.allegro.api.client.model.CompatibilityListIdItem.class); + classByDiscriminatorValue.put("TEXT", pl.wtx.allegro.api.client.model.CompatibilityListTextItem.class); + classByDiscriminatorValue.put("CompatibilityListItem", pl.wtx.allegro.api.client.model.CompatibilityListItem.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CompatibilityListManual.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CompatibilityListManual", pl.wtx.allegro.api.client.model.CompatibilityListManual.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CompatibilityListProductBased.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CompatibilityListProductBased", pl.wtx.allegro.api.client.model.CompatibilityListProductBased.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CompatibilityListProductBasedProductOfferResponse.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CompatibilityListProductBasedProductOfferResponse", pl.wtx.allegro.api.client.model.CompatibilityListProductBasedProductOfferResponse.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CompatibilityListProductOfferResponse.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CompatibilityListProductOfferResponse", pl.wtx.allegro.api.client.model.CompatibilityListProductOfferResponse.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CompatibilityListTextItem.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CompatibilityListTextItem", pl.wtx.allegro.api.client.model.CompatibilityListTextItem.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CompensationOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CompensationOperation", pl.wtx.allegro.api.client.model.CompensationOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ContributionOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ContributionOperation", pl.wtx.allegro.api.client.model.ContributionOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CorrectionOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CorrectionOperation", pl.wtx.allegro.api.client.model.CorrectionOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.CourierBySellerShipping.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("CourierBySellerShipping", pl.wtx.allegro.api.client.model.CourierBySellerShipping.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "method")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.DeductionChargeOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DeductionChargeOperation", pl.wtx.allegro.api.client.model.DeductionChargeOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.DeductionIncreaseOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DeductionIncreaseOperation", pl.wtx.allegro.api.client.model.DeductionIncreaseOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.DescriptionSectionItem.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("IMAGE", pl.wtx.allegro.api.client.model.DescriptionSectionItemImage.class); + classByDiscriminatorValue.put("TEXT", pl.wtx.allegro.api.client.model.DescriptionSectionItemText.class); + classByDiscriminatorValue.put("DescriptionSectionItem", pl.wtx.allegro.api.client.model.DescriptionSectionItem.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.DescriptionSectionItemImage.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DescriptionSectionItemImage", pl.wtx.allegro.api.client.model.DescriptionSectionItemImage.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.DescriptionSectionItemText.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DescriptionSectionItemText", pl.wtx.allegro.api.client.model.DescriptionSectionItemText.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.DictionaryCategoryParameter.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DictionaryCategoryParameter", pl.wtx.allegro.api.client.model.DictionaryCategoryParameter.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.DictionaryCategoryProductParameter.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DictionaryCategoryProductParameter", pl.wtx.allegro.api.client.model.DictionaryCategoryProductParameter.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.FloatCategoryParameter.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("FloatCategoryParameter", pl.wtx.allegro.api.client.model.FloatCategoryParameter.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.FloatCategoryProductParameter.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("FloatCategoryProductParameter", pl.wtx.allegro.api.client.model.FloatCategoryProductParameter.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.IntegerCategoryParameter.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("IntegerCategoryParameter", pl.wtx.allegro.api.client.model.IntegerCategoryParameter.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.IntegerCategoryProductParameter.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("IntegerCategoryProductParameter", pl.wtx.allegro.api.client.model.IntegerCategoryProductParameter.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.LargeOrderDiscountBenefitSpecification.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("LargeOrderDiscountBenefitSpecification", pl.wtx.allegro.api.client.model.LargeOrderDiscountBenefitSpecification.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ModificationAttachmentSafetyInformation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ModificationAttachmentSafetyInformation", pl.wtx.allegro.api.client.model.ModificationAttachmentSafetyInformation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ModificationNoSafetyInformation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ModificationNoSafetyInformation", pl.wtx.allegro.api.client.model.ModificationNoSafetyInformation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ModificationSafetyInformation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ATTACHMENTS", pl.wtx.allegro.api.client.model.ModificationAttachmentSafetyInformation.class); + classByDiscriminatorValue.put("NO_SAFETY_INFORMATION", pl.wtx.allegro.api.client.model.ModificationNoSafetyInformation.class); + classByDiscriminatorValue.put("TEXT", pl.wtx.allegro.api.client.model.ModificationTextSafetyInformation.class); + classByDiscriminatorValue.put("ModificationSafetyInformation", pl.wtx.allegro.api.client.model.ModificationSafetyInformation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ModificationTextSafetyInformation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ModificationTextSafetyInformation", pl.wtx.allegro.api.client.model.ModificationTextSafetyInformation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.MultiPackBenefitSpecification.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("MultiPackBenefitSpecification", pl.wtx.allegro.api.client.model.MultiPackBenefitSpecification.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.OfferActivatedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OfferActivatedEvent", pl.wtx.allegro.api.client.model.OfferActivatedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.OfferArchivedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OfferArchivedEvent", pl.wtx.allegro.api.client.model.OfferArchivedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.OfferBidCanceledEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OfferBidCanceledEvent", pl.wtx.allegro.api.client.model.OfferBidCanceledEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.OfferBidPlacedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OfferBidPlacedEvent", pl.wtx.allegro.api.client.model.OfferBidPlacedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.OfferChangedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OfferChangedEvent", pl.wtx.allegro.api.client.model.OfferChangedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.OfferEndedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OfferEndedEvent", pl.wtx.allegro.api.client.model.OfferEndedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.OfferPriceChangedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OfferPriceChangedEvent", pl.wtx.allegro.api.client.model.OfferPriceChangedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.OfferStockChangedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OfferStockChangedEvent", pl.wtx.allegro.api.client.model.OfferStockChangedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.OfferTranslationUpdatedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OfferTranslationUpdatedEvent", pl.wtx.allegro.api.client.model.OfferTranslationUpdatedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.OfferVisibilityChangedEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OfferVisibilityChangedEvent", pl.wtx.allegro.api.client.model.OfferVisibilityChangedEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.OwnTransportShipping.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OwnTransportShipping", pl.wtx.allegro.api.client.model.OwnTransportShipping.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "method")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.PayoutOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("PayoutOperation", pl.wtx.allegro.api.client.model.PayoutOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.PayoutOperationCancel.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("PayoutOperationCancel", pl.wtx.allegro.api.client.model.PayoutOperationCancel.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.PriceModification.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DECREASE_PERCENTAGE", pl.wtx.allegro.api.client.model.PriceModificationPercentageChangeDecrease.class); + classByDiscriminatorValue.put("DECREASE_PRICE", pl.wtx.allegro.api.client.model.PriceModificationValueChangeDecrease.class); + classByDiscriminatorValue.put("FIXED_PRICE", pl.wtx.allegro.api.client.model.PriceModificationFixedPrice.class); + classByDiscriminatorValue.put("INCREASE_PERCENTAGE", pl.wtx.allegro.api.client.model.PriceModificationPercentageChangeIncrease.class); + classByDiscriminatorValue.put("INCREASE_PRICE", pl.wtx.allegro.api.client.model.PriceModificationValueChangeIncrease.class); + classByDiscriminatorValue.put("PriceModification", pl.wtx.allegro.api.client.model.PriceModification.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.PriceModificationFixedPrice.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("PriceModificationFixedPrice", pl.wtx.allegro.api.client.model.PriceModificationFixedPrice.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.PriceModificationPercentageChangeDecrease.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("PriceModificationPercentageChangeDecrease", pl.wtx.allegro.api.client.model.PriceModificationPercentageChangeDecrease.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.PriceModificationPercentageChangeIncrease.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("PriceModificationPercentageChangeIncrease", pl.wtx.allegro.api.client.model.PriceModificationPercentageChangeIncrease.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.PriceModificationValueChangeDecrease.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("PriceModificationValueChangeDecrease", pl.wtx.allegro.api.client.model.PriceModificationValueChangeDecrease.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.PriceModificationValueChangeIncrease.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("PriceModificationValueChangeIncrease", pl.wtx.allegro.api.client.model.PriceModificationValueChangeIncrease.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ProductSetElementAttachmentSafetyInformation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ProductSetElementAttachmentSafetyInformation", pl.wtx.allegro.api.client.model.ProductSetElementAttachmentSafetyInformation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ProductSetElementNoSafetyInformation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ProductSetElementNoSafetyInformation", pl.wtx.allegro.api.client.model.ProductSetElementNoSafetyInformation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerIdRequest.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ProductSetElementResponsibleProducerIdRequest", pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerIdRequest.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerNameRequest.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ProductSetElementResponsibleProducerNameRequest", pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerNameRequest.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerRequest.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ID", pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerIdRequest.class); + classByDiscriminatorValue.put("NAME", pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerNameRequest.class); + classByDiscriminatorValue.put("ProductSetElementResponsibleProducerRequest", pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerRequest.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ProductSetElementSafetyInformation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ATTACHMENTS", pl.wtx.allegro.api.client.model.ProductSetElementAttachmentSafetyInformation.class); + classByDiscriminatorValue.put("NO_SAFETY_INFORMATION", pl.wtx.allegro.api.client.model.ProductSetElementNoSafetyInformation.class); + classByDiscriminatorValue.put("TEXT", pl.wtx.allegro.api.client.model.ProductSetElementTextSafetyInformation.class); + classByDiscriminatorValue.put("ProductSetElementSafetyInformation", pl.wtx.allegro.api.client.model.ProductSetElementSafetyInformation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ProductSetElementTextSafetyInformation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ProductSetElementTextSafetyInformation", pl.wtx.allegro.api.client.model.ProductSetElementTextSafetyInformation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ProviderRefundTransferChargeOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ProviderRefundTransferChargeOperation", pl.wtx.allegro.api.client.model.ProviderRefundTransferChargeOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ProviderRefundTransferIncreaseOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ProviderRefundTransferIncreaseOperation", pl.wtx.allegro.api.client.model.ProviderRefundTransferIncreaseOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.RefundCancelOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("RefundCancelOperation", pl.wtx.allegro.api.client.model.RefundCancelOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.RefundChargeOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("RefundChargeOperation", pl.wtx.allegro.api.client.model.RefundChargeOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.RefundIncreaseOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("RefundIncreaseOperation", pl.wtx.allegro.api.client.model.RefundIncreaseOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.RequirementChange.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("RequirementChange", pl.wtx.allegro.api.client.model.RequirementChange.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.SellerOfferBaseEvent.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("OFFER_ACTIVATED", pl.wtx.allegro.api.client.model.OfferActivatedEvent.class); + classByDiscriminatorValue.put("OFFER_ARCHIVED", pl.wtx.allegro.api.client.model.OfferArchivedEvent.class); + classByDiscriminatorValue.put("OFFER_BID_CANCELED", pl.wtx.allegro.api.client.model.OfferBidCanceledEvent.class); + classByDiscriminatorValue.put("OFFER_BID_PLACED", pl.wtx.allegro.api.client.model.OfferBidPlacedEvent.class); + classByDiscriminatorValue.put("OFFER_CHANGED", pl.wtx.allegro.api.client.model.OfferChangedEvent.class); + classByDiscriminatorValue.put("OFFER_ENDED", pl.wtx.allegro.api.client.model.OfferEndedEvent.class); + classByDiscriminatorValue.put("OFFER_PRICE_CHANGED", pl.wtx.allegro.api.client.model.OfferPriceChangedEvent.class); + classByDiscriminatorValue.put("OFFER_STOCK_CHANGED", pl.wtx.allegro.api.client.model.OfferStockChangedEvent.class); + classByDiscriminatorValue.put("OFFER_TRANSLATION_UPDATED", pl.wtx.allegro.api.client.model.OfferTranslationUpdatedEvent.class); + classByDiscriminatorValue.put("OFFER_VISIBILITY_CHANGED", pl.wtx.allegro.api.client.model.OfferVisibilityChangedEvent.class); + classByDiscriminatorValue.put("SellerOfferBaseEvent", pl.wtx.allegro.api.client.model.SellerOfferBaseEvent.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.Shipping.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("COURIER_BY_SELLER", pl.wtx.allegro.api.client.model.CourierBySellerShipping.class); + classByDiscriminatorValue.put("OWN_TRANSPORT", pl.wtx.allegro.api.client.model.OwnTransportShipping.class); + classByDiscriminatorValue.put("THIRD_PARTY_DELIVERY", pl.wtx.allegro.api.client.model.ThirdPartyDeliveryShipping.class); + classByDiscriminatorValue.put("Shipping", pl.wtx.allegro.api.client.model.Shipping.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "method")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ShippingExtended.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ALREADY_IN_WAREHOUSE", pl.wtx.allegro.api.client.model.AlreadyInWarehouseShipping.class); + classByDiscriminatorValue.put("COURIER_BY_SELLER", pl.wtx.allegro.api.client.model.CourierBySellerShipping.class); + classByDiscriminatorValue.put("OWN_TRANSPORT", pl.wtx.allegro.api.client.model.OwnTransportShipping.class); + classByDiscriminatorValue.put("THIRD_PARTY_DELIVERY", pl.wtx.allegro.api.client.model.ThirdPartyDeliveryShipping.class); + classByDiscriminatorValue.put("ShippingExtended", pl.wtx.allegro.api.client.model.ShippingExtended.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "method")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.StringCategoryParameter.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("StringCategoryParameter", pl.wtx.allegro.api.client.model.StringCategoryParameter.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.StringCategoryProductParameter.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("StringCategoryProductParameter", pl.wtx.allegro.api.client.model.StringCategoryProductParameter.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.SubmitCommandOutput.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("FAILED", pl.wtx.allegro.api.client.model.SubmitFailedCommandOutput.class); + classByDiscriminatorValue.put("RUNNING", pl.wtx.allegro.api.client.model.SubmitRunningCommandOutput.class); + classByDiscriminatorValue.put("SUCCESSFUL", pl.wtx.allegro.api.client.model.SubmitSuccessfulCommandOutput.class); + classByDiscriminatorValue.put("SubmitCommandOutput", pl.wtx.allegro.api.client.model.SubmitCommandOutput.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "status")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.SubmitFailedCommandOutput.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("SubmitFailedCommandOutput", pl.wtx.allegro.api.client.model.SubmitFailedCommandOutput.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "status")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.SubmitRunningCommandOutput.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("SubmitRunningCommandOutput", pl.wtx.allegro.api.client.model.SubmitRunningCommandOutput.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "status")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.SubmitSuccessfulCommandOutput.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("SubmitSuccessfulCommandOutput", pl.wtx.allegro.api.client.model.SubmitSuccessfulCommandOutput.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "status")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.SurchargeOperation.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("SurchargeOperation", pl.wtx.allegro.api.client.model.SurchargeOperation.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.ThirdPartyDeliveryShipping.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ThirdPartyDeliveryShipping", pl.wtx.allegro.api.client.model.ThirdPartyDeliveryShipping.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "method")); + } + }) + .registerTypeSelector(pl.wtx.allegro.api.client.model.WholesalePriceListBenefitSpecification.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("WholesalePriceListBenefitSpecification", pl.wtx.allegro.api.client.model.WholesalePriceListBenefitSpecification.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + ; + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + static { + GsonBuilder gsonBuilder = createGson(); + gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); + gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalEmail.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalEmailRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalEmailsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalMarketplacePromoOptionsCommandModification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalMarketplacePromoOptionsModification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalMarketplacePublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalMarketplaceSellingMode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalMarketplacesRefusalReasonResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalMarketplacesRequestValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalMarketplacesRequestValueSellingMode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalMarketplacesResponseValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalMarketplacesResponseValuePublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalMarketplacesVisibility.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalPropertyDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServiceDefinitionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServiceDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServiceGroupTranslation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServiceGroupTranslationPatchResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServiceGroupTranslationResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServiceRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServiceResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServiceTranslation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServicesGroup.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServicesGroupRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServicesGroupResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServicesGroupTranslationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServicesGroupTranslationWrapper.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServicesGroupTranslationWrapperWithType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdditionalServicesGroups.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Address.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AddressDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdvanceShipNotice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdvanceShipNoticeList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AdvanceShipNoticeResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AfterSalesServices.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AfterSalesServicesAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AfterSalesServicesAttachment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AfterSalesServicesProductOfferRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AfterSalesServicesProductOfferRequestImpliedWarranty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AfterSalesServicesProductOfferRequestReturnPolicy.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AfterSalesServicesProductOfferRequestWarranty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AiCoCreatedContent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoAlleDiscount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoBasePrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoProduct.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountGetSubmitCommandResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountGetSubmitCommandResponseOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountGetWithdrawCommandResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountGetWithdrawCommandResponseInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountGetWithdrawCommandResponseOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountListEligibleResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountListSubmittedResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountRequiredMerchantPriceDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandRequestInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandRequestInputCampaign.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandRequestInputOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandRequestInputProposedPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponseInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponseInputCampaign.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponseInputOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponseInputProposedPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponseOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoCampaign.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoPrices.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoPricesProposedPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoProcess.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoProcessErrorsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountWithdrawCommandRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountWithdrawCommandRequestInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountWithdrawCommandResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountWithdrawCommandResponseInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlleDiscountWithdrawCommandResponseOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroMarketplaces.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroParcelTrackingHistory.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroParcelTrackingHistoryTrackingDetails.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroParcelTrackingStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPickupDropOffPoint.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointOpeningInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointPaymentsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointRestrictionsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointServicesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPricesAccountChangeRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPricesAccountChangeRequestAdditionalMarketplacesValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPricesAccountConsentChangeResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPricesEligibilityResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPricesEligibilityResponseAdditionalMarketplacesValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPricesOfferChangeRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPricesOfferConsentChangeResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AllegroPricesQualificationResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AlreadyInWarehouseShipping.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Answer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AnswerVBeta1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ApplicationTimePolicy.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Attachment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AttachmentDeclaration.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AttachmentFile.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AttachmentFileRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AuctionDetails.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AuthError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingOfferRuleConfiguration.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingOfferRuleConfigurationPriceRange.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfiguration.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByAmount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByPercentage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingRulePostRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingRulePutRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingRuleResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AutomaticPricingRulesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AvailableConstraint.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AvailableProductResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AvailableProductsList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AvailablePromotionPackage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AvailablePromotionPackages.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.AverageRates.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.B2b.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Badge.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationBargainPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationCampaign.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationPrices.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationProcess.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationPurchaseConstraints.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationPurchaseConstraintsLimit.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationPurchaseConstraintsLimitPerUser.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationRejectionReason.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationRejectionReasonMessage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationSubsidySellerPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplicationSubsidyTargetPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeApplications.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeCampaign.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeMarketPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeOperationProcess.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgePatchPrices.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgePatchPricesPrices.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgePatchPricesPricesBargain.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgePatchProcess.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgePatchProcessProcess.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgePatchRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgePrices.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeProcess.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgePublicationTimePolicy.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgeSubsidyPrices.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BadgesList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BaseSaleProductResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BasicDefinitionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Benefit.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BidRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BillingEntries.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BillingEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BillingEntryAdditionalInfoInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BillingEntryBalance.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BillingEntryOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BillingEntryOrder.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BillingEntryTax.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BillingEntryType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BillingEntryValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BillingType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BlockadeOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BlockadeReleaseOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BundleDiscountDTO.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BundleMarketplaceDTO.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BundledOfferDTO.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BuyNowPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BuyerParticipant.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BuyerPreferencesReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.BuyerReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CampaignRefusalReason.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CampaignRequestDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CampaignResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CancelShipmentCommandStatusDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Caption.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CarrierParcelTrackingResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CashOnDeliveryDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CashOnDeliveryLimitDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoriesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoriesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Category.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryCreatedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryDefinitionDescriptionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryDefinitionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryDeletedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryDeletedEventAllOfRedirectCategory.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryDtoParent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryEventBaseCategory.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryEventBaseCategoryParent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryEventsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryMovedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryOptionsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryParameterDisplayConditions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryParameterList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryParameterOptions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryParameterRequirementConditions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryParameterWithValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryParameterWithoutValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryParametersScheduledBaseChangeCategory.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryParametersScheduledBaseChangeParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryParametersScheduledChangesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryProductParameterList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryRenamedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategorySuggestionCategoryNode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategorySuggestionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CategoryTaxSettings.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Cells.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ChangePrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ChangePriceInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ChangePriceWithoutOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ChangedParameterDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ChangedTranslation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CharityOrganization.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckFormsNewOrderInvoice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckFormsNewOrderInvoiceFile.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckFormsNewOrderInvoiceId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutForm.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormAddWaybillCreated.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormAddWaybillCreatedLineItemsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormAddWaybillRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormAddWaybillRequestLineItemsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormAdditionalService.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormBuyerAddressReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormBuyerReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormDeliveryAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormDeliveryCancellation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormDeliveryMethod.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormDeliveryPickupPoint.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormDeliveryPickupPointAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormDeliveryReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormDeliveryTime.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormDeliveryTimeDispatch.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormDeliveryTimeGuaranteed.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormDiscount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormFulfillment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormFulfillmentShipmentSummary.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormInvoiceAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormInvoiceAddressCompany.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormInvoiceAddressCompanyId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormInvoiceAddressNaturalPerson.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormInvoiceInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormLineItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormLineItemTax.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormMarketplace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormNoteReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormOrderWaybillResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormPaymentReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormSummary.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormSummaryTotalToPay.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutForms.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormsOrderInvoice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormsOrderInvoiceFile.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormsOrderInvoiceFileSecurityVerification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CheckoutFormsOrderInvoices.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedDailyEventStatResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedEventStat.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedExtension.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedExtraPackage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedPackage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedPackageConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedPackageConfigs.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedPackages.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedPromotion.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedPublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ClassifiedsPackages.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CommandOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CommandTask.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CommentVBeta1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CommissionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Company.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListIdItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListIdItemAdditionalInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListItemProductBased.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListManual.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListManualType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListProductBased.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListProductBasedProductOfferResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListProductOfferResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListSupportedCategoriesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibilityListTextItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibleProductDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibleProductDtoAttributesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibleProductDtoGroup.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibleProductsGroupsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibleProductsGroupsDtoGroupsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompatibleProductsListDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CompensationOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ConstraintCriteria.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Contact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ContactRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ContactResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ContactResponseList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ContributionOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Coordinates.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CorrectionOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Courier.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CourierBySellerShipping.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CreateAdvanceShipNoticeRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CreateAdvanceShipNoticeResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CreateOfferBundleDTO.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CreatePickupCommandStatusDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CreateProductOffers422Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CreateResponsiblePersonRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CreateResponsiblePersonRequestPersonalData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CreateResponsibleProducerRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CreateShipmentCommandStatusDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CurrentPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturn.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnBuyer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnItemReason.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnParcelSender.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnRefund.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnRefundBankAccount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnRefundBankAccountAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnRefundRejectionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnRefundRejectionRequestRejection.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnRejection.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.CustomerReturnReturnParcel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Deduction.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeductionChargeOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeductionIncreaseOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliveryBasic.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliveryFull.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliveryMethodId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliveryProductOfferRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliveryProductOfferRequestShippingRates.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliveryProductOfferResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliveryServiceDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliveryServiceIdDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliveryServicesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliverySettingsRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliverySettingsRequestAbroadFreeDelivery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliverySettingsRequestFreeDelivery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliverySettingsRequestMarketplace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliverySettingsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliverySettingsResponseAbroadFreeDelivery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliverySettingsResponseCustomCost.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliverySettingsResponseFreeDelivery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliverySettingsResponseJoinPolicy.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DeliverySettingsResponseMarketplace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DescribesListingFee.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DescribesSuccessCommissionFee.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DescriptionSection.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DescriptionSectionItemImage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DescriptionSectionItemText.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DictionaryCategoryParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DictionaryCategoryParameterAllOfDictionary.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DictionaryCategoryProductParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DictionaryCategoryProductParameterAllOfDictionary.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DictionaryCategoryProductParameterAllOfRestrictions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DimensionValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Discounts.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DiscountsProductOfferRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DiscountsProductOfferRequestWholesalePriceList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DiscountsProductOfferResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DiscountsWholesalePriceList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Dispute.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DisputeAttachment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DisputeAttachmentId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DisputeAuthor.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DisputeCheckoutForm.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DisputeClaim.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DisputeFirstMessage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DisputeListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DisputeMessage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DisputeMessageAuthor.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DisputeMessageList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.DisputeUser.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.EmailRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.EmailResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Error.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Error200.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Error400.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Error403.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Error404.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Error504.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ErrorsHolder.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Exclusion.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ExternalId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Fee.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.FeePreviewResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.FloatCategoryParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.FloatCategoryProductParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.FloatCategoryProductParameterAllOfRestrictions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.FulfillmentOrder.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.FulfillmentOrderParcel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.FulfillmentOrderParcelItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.FulfillmentRemovalPreference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.FulfillmentWithdrawalAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.FundraisingCampaign.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.FundraisingCampaigns.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GeneralReport.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetBadgeCampaignsList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetDeliveryServices504Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfShippingRatestUsingGET200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetOfferSmartClassificationGET400Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetOfferSmartClassificationGET403Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetRefundApplications200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetRefundedPayments200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetSaleProductsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetSaleProductsResponseNextPage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.GetShipmentDetails404Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.HandlingUnit.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Header.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ImageUrl.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ImpliedWarrantiesListImpliedWarrantyBasic.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ImpliedWarranty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ImpliedWarrantyBasic.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ImpliedWarrantyPeriod.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ImpliedWarrantyRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ImpliedWarrantyResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.InitializeRefund.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.InitializeRefundAdditionalServices.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.InitializeRefundDelivery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.InitializeRefundOverpaid.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.InsuranceDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.IntegerCategoryParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.IntegerCategoryProductParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.IntegerCategoryProductParameterAllOfRestrictions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Interlocutor.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.JustId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Justification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.LabelRequestDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Labels.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.LargeOrderDiscountBenefitSpecification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.LargeOrderDiscountBenefitSpecificationAllOfDiscount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.LargeOrderDiscountBenefitSpecificationAllOfOrderValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.LargeOrderDiscountBenefitSpecificationAllOfThresholds.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.LatestOrderEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.LimitWithCurrencyDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.LineItemDiscount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.LineItemReconciliation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.LineItemVoucher.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.LineItemVoucherValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ListingCategory.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ListingCategoryWithCount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ListingOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ListingResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ListingResponseCategories.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ListingResponseFilters.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ListingResponseFiltersValues.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ListingResponseOffers.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ListingResponseSearchMeta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ListingResponseSort.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Location.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ManualDescriptionTranslation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ManualProductSafetyInformationDescriptionTranslation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ManualSafetyInformationTranslation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ManualTitleTranslation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ManualTranslationUpdateRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MarketedBeforeGPSRObligation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MarketplaceAvailablePromotionPackages.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MarketplaceItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MarketplaceItemCurrencies.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MarketplaceItemCurrency.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MarketplaceItemLanguage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MarketplaceItemLanguages.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MarketplaceItemShippingCountry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MarketplaceOfferPromoOption.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MarketplaceReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MarketplacesVisibility.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MaxPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MeResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MeResponseBaseMarketplace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Message.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MessageAdditionalInformation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MessageAttachmentId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MessageAttachmentInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MessageAuthor.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MessageOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MessageOrder.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MessageRelatedObject.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MessageRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MessageToSellerSettings.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MessagesList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MinimalPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModelConfiguration.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Modification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModificationAttachmentSafetyInformation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModificationAttachmentSafetyInformationAllOfAttachments.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModificationDelivery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModificationDiscounts.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModificationDiscountsWholesalePriceList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModificationNoSafetyInformation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModificationPayments.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModificationPublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModificationResponsiblePerson.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModificationResponsibleProducer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ModificationTextSafetyInformation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MultiPackBenefitSpecification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MultiPackBenefitSpecificationAllOfConfiguration.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MultiPackBenefitSpecificationAllOfTrigger.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.MyBidResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.NetPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.NewAttachmentDeclaration.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.NewMessage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.NewMessageInThread.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.NewProductParameterDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.NullableTurnoverDiscountDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferActivatedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferAdditionalMarketplace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferAdditionalServices.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferArchivedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferAttachment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferAttachmentRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferAutomaticPricingCommand.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferAutomaticPricingCommandModification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationRemove.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationRemoveRemoveInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationSet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationSetSetInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationSetSetInnerRule.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferBadgeCampaign.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferBidCanceledEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferBidPlacedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferBundleDTO.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferBundleDTOPublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferBundlesDTO.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferBundlesDTONextPage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferCategory.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferCategoryRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferChangeCommand.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferChangedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferCriterium.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferDelivery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferDescriptionTranslation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferEndedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferEventBaseOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferEventEndedOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferEventEndedOfferAllOfPublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferEventExternalOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferEventExternalOfferForPriceChanges.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferEventExternalOfferWithPublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferFixedPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferImageLinkUploadRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferImageUploadResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferImages.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoImage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1AdditionalMarketplace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1AdditionalMarketplacePublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1AdditionalMarketplaceSellingMode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1AdditionalMarketplaceStock.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1B2b.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1Delivery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1Publication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1PublicationMarketplaces.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1SaleInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1SellingMode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1Stats.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferListingDtoV1Stock.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferLowestPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferMarketplacesPriceChanges.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferMarketplacesPublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferPriceChangeCommand.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferPriceChangedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferProductSetProductReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferProductSetReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferPromoOption.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferPromoOptions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferPromoOptionsForSeller.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferPromoOptionsPendingChanges.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferPromotion.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferPublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferQuantityChangeCommand.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferQuoteDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferQuotesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferRating.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferRatingScoreDistributionInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferRatingSizeFeedbackInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferRequirements.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferRules.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferRulesRulesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferRulesRulesInnerMarketplace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferRulesRulesInnerRule.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferSafetyInformationTranslation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferSeller.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferSellingMode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferShippingRates.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferStatModelDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferStatResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferStatsResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferStock.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferStockChangedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferTaxRate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferTaxSettings.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferTitleTranslation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferTranslation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferTranslationUpdatedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferTranslations.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferVendor.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OfferVisibilityChangedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OffersSearchResultDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OpenHour.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OperationParticipantAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OperationPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OperationValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Order.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OrderEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OrderEventData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OrderEventStats.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OrderEventsList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OrderLineItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OrderLineItemOfferReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OrderMarketplace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OrderOffersInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OrdersShippingCarrier.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OrdersShippingCarriersResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.OwnTransportShipping.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PackageDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PackageRequestDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Parameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParameterProductOfferRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParameterProductOfferResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParameterRangeValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParametersForPreviewPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParcelAdditionalServicesAvailability.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParcelAdditionalServicesCashOnDeliveryAvailability.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParcelAdditionalServicesOptionAvailability.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParcelCreationAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParcelCreationAddressWithMandatoryPlace.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParcelTrackingHistory.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParcelTrackingHistoryTrackingDetails.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ParcelTrackingStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Participant.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PatchBadge202Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Payment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PaymentOperations.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Payments.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PaymentsSurcharge.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Payout.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PayoutOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PayoutOperationCancel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PhoneNumberWithCountryCode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PhonesRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PhonesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PickupAddressDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PickupCreateCommandDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PickupCreateRequestDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PickupDateProposalDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PickupDateProposalsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PickupProposalsRequestDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PickupProposalsResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Pos.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PosLocation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Price.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PriceAutomation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PriceAutomationRule.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PriceModificationFixedPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PriceModificationFixedPriceHolder.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PriceModificationPercentageChangeDecrease.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PriceModificationPercentageChangeIncrease.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PriceModificationValueChangeDecrease.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PriceModificationValueChangeHolder.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PriceModificationValueChangeIncrease.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PricingOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PricingPublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Product.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductCategory.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductCategoryProposal.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductCategoryWithPath.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductChangeDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductChangeDtoProduct.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductChangeProposalDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductChangeProposalRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductChangesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductImageProposal.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductNameProposal.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductOfferAdditionalServicesRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductOfferAdditionalServicesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductOfferAttachmentInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductOfferBase.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductOfferFundraisingCampaignRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductOfferFundraisingCampaignResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductOfferResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductOfferResponsePublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductParameterDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductParameterDtoOptions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductParameterOptions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductParameterProposal.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductParameterValueProposal.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductProposalsRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductProposalsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductProposalsResponseCategory.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductProposalsResponsePublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSafetyDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSafetyInformationDescription.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElement.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementAttachmentSafetyInformation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementAttachmentSafetyInformationAllOfAttachments.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementNoSafetyInformation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementQuantity.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementQuantityQuantity.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementResponsiblePersonRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementResponsiblePersonRequestResponsiblePerson.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerIdRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerNameRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerRequestWrapper.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementSafetyInformationWrapper.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSetElementTextSafetyInformation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductSimilarCategoryWithPath.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductsCategoryPath.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProductsCategorySubcategories.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromoGeneralReport.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromoModificationReport.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromoModificationTask.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromoOptionsCommand.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromoOptionsCommandModification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromoOptionsCommandModificationPackage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromoOptionsModification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromoOptionsModifications.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Promotion.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromotionCampaignResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromotionCampaignsResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromotionRequestDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PromotionResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProviderRefundTransferChargeOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ProviderRefundTransferIncreaseOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PublicOfferPreviewRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PublicTableDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PublicTablesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Publication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PublicationChangeCommandDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PublicationModification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PublicationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.PublicationTimePolicy.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.QuantityModification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.QuoteResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Rates.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReceiverAddressDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReceivingEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReceivingState.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReceivingStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Recipient.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Reference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundAdditionalServicesValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundCancelOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundChargeOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundClaim.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundClaimBuyer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundClaimCommission.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundClaimLineItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundClaimLineItemOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundClaimRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundClaimRequestLineItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundClaimResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundDeliveryValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundDetails.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundIncreaseOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundLineItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundLineItemValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundOrder.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundOverpaidValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundPayment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundSurchargeValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefundTotalValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefusalMessage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RefusalReason.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RelatedReason.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Removal.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RemovalRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RequirementChange.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReserveInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ResponsiblePersonAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ResponsiblePersonContact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ResponsiblePersonResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ResponsiblePersonResponsePersonalData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ResponsiblePersonsGET200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ResponsibleProducerAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ResponsibleProducerContact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ResponsibleProducerResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ResponsibleProducerResponseProducerData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ResponsibleProducersGET200Response.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.RestrictionCause.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReturnPoliciesListReturnPolicy.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReturnPolicy.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReturnPolicyAddress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReturnPolicyAvailability.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReturnPolicyContact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReturnPolicyOptions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReturnPolicyRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReturnPolicyResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ReturnPolicyReturnCost.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SalePartialProductOfferResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SalePartialProductOfferResponseAdditionalMarketplacesValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SalePartialProductOfferResponseSellingMode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SalePartialProductOfferResponseStock.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductCompatibilityList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductDtoPublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferPatchRequestV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferPatchRequestV1AllOfDelivery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferPatchRequestV1AllOfProductSet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferPublicationMarketplacesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferPublicationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferPublicationResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferRequestBase.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferRequestBaseAllOfContact.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferRequestBaseAllOfDelivery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferRequestBaseAllOfPublication.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferRequestBaseAllOfSizeTable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferRequestV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferRequestV1AllOfDelivery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferRequestV1AllOfProductSet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1AllOfProductSet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1AllOfProductSetAllOfProduct.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1AllOfWarnings.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferStatusResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOfferStatusResponseOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductOffersRequestStock.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SaleProductResponseCategoriesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SalesQualityForDay.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SalesQualityHistoryResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SalesQualityMetric.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SearchResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Seller.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SellerCreateRebateRequestDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SellerOfferEventsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SellerOfferStatsResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SellerParticipant.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SellerRebateDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SellerRebateOfferCriterion.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SellerRebateOfferCriterionOffersInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SellerRebatesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SellerReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SellingMode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SellingModeWithNetPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SenderAddressDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShipmentCancelCommandDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShipmentCancelRequestDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShipmentCreateCommandDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShipmentCreateRequestDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShipmentDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShipmentIdsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShipmentPickupAddressDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShippingRate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShippingRateDeliveryMethod.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShippingRateFirstItemRate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShippingRateMaxPackageWeight.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShippingRateNextItemRate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShippingRateShippingTime.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShippingRates.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ShippingRatesSet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SinglePromotionCampaignResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SizeTable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SizeTablePostRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SizeTablePutRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SizeTableTemplateImageResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SizeTableTemplateResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SizeTableTemplatesResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SmartDeliveryMethod.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SmartOfferClassificationReport.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SmartOfferClassificationReportClassification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SmartOfferClassificationReportConditionsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SmartSellerClassificationReport.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SmartSellerClassificationReportClassification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SmartSellerClassificationReportConditionsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StandardizedDescription.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StartingPrice.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Stock.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StockProduct.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StockProductItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StockProductList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StockQuantity.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StockSellingStats.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StockStorageFee.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StockStorageFeeDetails.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StringCategoryParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StringCategoryProductParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.StringCategoryProductParameterAllOfRestrictions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Subject.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SubmitCommand.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SubmitCommandInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SubmitFailedCommandOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SubmitRunningCommandOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SubmitSuccessfulCommandOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SupplierDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Surcharge.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.SurchargeOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TagId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TagIdsRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TagListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TagRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TagResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TaskCount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TaskReport.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Tax.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TaxExemption.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TaxIdRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TaxIdResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TaxRate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TaxRateValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TaxSubject.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TecdocSpecification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TecdocSpecificationItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ThirdParty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ThirdPartyDeliveryShipping.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Thread.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ThreadId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ThreadReadFlag.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ThreadsList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TrustedContent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TurnoverDiscountDefinitionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TurnoverDiscountDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TurnoverDiscountRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TurnoverDiscountThresholdDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TurnoverDiscountThresholdDtoDiscount.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.TurnoverDiscountThresholdDtoMinimumTurnover.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UnfilledParametersResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UnfilledParametersResponseOffersInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UnfilledParametersResponseOffersInnerCategory.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UnfilledParametersResponseOffersInnerParametersInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UpdateOfferBundleDiscountDTO.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UpdateResponsiblePersonRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UpdateResponsibleProducerRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UpdateSubmittedAdvanceShipNoticeRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UpdateSubmittedHandlingUnitInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UpdateSubmittedShippingInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.User.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserCampaignEligibility.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRating.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingAnswerRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingListResponseVBeta1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingRemovalRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingRemovalRequestRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingSummaryResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingSummaryResponseNotRecommended.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingSummaryResponseRecommended.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2NotRecommended.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2Recommended.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2Statistics.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2StatisticsExcluded.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2StatisticsReceived.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2StatisticsRemoved.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2User.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.UserRatingVBeta1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Validation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ValidationError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.ValidationWarning.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.VariantSet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.VariantSetOffer.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.VariantSetParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.VariantSetResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.VariantSets.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.VariantSetsVariantSet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.VisibilityTimePolicy.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Wallet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WalletBalance.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WarrantiesListWarrantyBasic.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.Warranty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WarrantyAttachment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WarrantyBasic.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WarrantyPeriod.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WarrantyRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WarrantyResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WeightValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WholesalePriceListBenefitSpecification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WholesalePriceListBenefitSpecificationAllOfQuantity.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WholesalePriceListBenefitSpecificationAllOfThresholds.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WrapperTypeForPreviewConditions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new pl.wtx.allegro.api.client.model.WrapsListingAndCommissionsFees.CustomTypeAdapterFactory()); + gson = gsonBuilder.create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public static Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + */ + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public static String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/Pair.java b/src/main/java/pl/wtx/allegro/api/client/invoker/Pair.java new file mode 100644 index 0000000..458a460 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/Pair.java @@ -0,0 +1,57 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + return true; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/ProgressRequestBody.java b/src/main/java/pl/wtx/allegro/api/client/invoker/ProgressRequestBody.java new file mode 100644 index 0000000..8ce458e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/ProgressResponseBody.java b/src/main/java/pl/wtx/allegro/api/client/invoker/ProgressResponseBody.java new file mode 100644 index 0000000..03d9c2c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/ServerConfiguration.java b/src/main/java/pl/wtx/allegro/api/client/invoker/ServerConfiguration.java new file mode 100644 index 0000000..abb8648 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/ServerVariable.java b/src/main/java/pl/wtx/allegro/api/client/invoker/ServerVariable.java new file mode 100644 index 0000000..06fbe3b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/StringUtil.java b/src/main/java/pl/wtx/allegro/api/client/invoker/StringUtil.java new file mode 100644 index 0000000..8f9c7ac --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/StringUtil.java @@ -0,0 +1,83 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker; + +import java.util.Collection; +import java.util.Iterator; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/auth/ApiKeyAuth.java b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/ApiKeyAuth.java new file mode 100644 index 0000000..d014a04 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker.auth; + +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +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, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + 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); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/auth/Authentication.java b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/Authentication.java new file mode 100644 index 0000000..21ccc4f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/Authentication.java @@ -0,0 +1,37 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker.auth; + +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/auth/HttpBasicAuth.java b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/HttpBasicAuth.java new file mode 100644 index 0000000..cb7f8df --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/HttpBasicAuth.java @@ -0,0 +1,55 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker.auth; + +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ApiException; + +import okhttp3.Credentials; + +import java.net.URI; +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, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (username == null && password == null) { + return; + } + headerParams.put("Authorization", Credentials.basic( + username == null ? "" : username, + password == null ? "" : password)); + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/auth/HttpBearerAuth.java b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/HttpBearerAuth.java new file mode 100644 index 0000000..6fea8d4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/HttpBearerAuth.java @@ -0,0 +1,75 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker.auth; + +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.Pair; + +import java.net.URI; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class HttpBearerAuth implements Authentication { + private final String scheme; + private Supplier tokenSupplier; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return tokenSupplier.get(); + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.tokenSupplier = () -> bearerToken; + } + + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); + if (bearerToken == null) { + return; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuth.java b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuth.java new file mode 100644 index 0000000..6a80b2a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuth.java @@ -0,0 +1,42 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker.auth; + +import pl.wtx.allegro.api.client.invoker.Pair; +import pl.wtx.allegro.api.client.invoker.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +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, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (accessToken != null) { + headerParams.put("Authorization", "Bearer " + accessToken); + } + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuthFlow.java b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuthFlow.java new file mode 100644 index 0000000..73fc75a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuthFlow.java @@ -0,0 +1,25 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker.auth; + +/** + * OAuth flows that are supported by this client + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public enum OAuthFlow { + ACCESS_CODE, //called authorizationCode in OpenAPI 3.0 + IMPLICIT, + PASSWORD, + APPLICATION //called clientCredentials in OpenAPI 3.0 +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuthOkHttpClient.java b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuthOkHttpClient.java new file mode 100644 index 0000000..caae0d1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/OAuthOkHttpClient.java @@ -0,0 +1,82 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker.auth; + +import okhttp3.OkHttpClient; +import okhttp3.MediaType; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(request.getBody(), mediaType) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + response.headers().toMultimap(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/invoker/auth/RetryingOAuth.java b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/RetryingOAuth.java new file mode 100644 index 0000000..1c2b8b5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/invoker/auth/RetryingOAuth.java @@ -0,0 +1,223 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.invoker.auth; + +import pl.wtx.allegro.api.client.invoker.ApiException; +import pl.wtx.allegro.api.client.invoker.Pair; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + /** + * @param client An OkHttp client + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + /** + * @param tokenRequestBuilder A token request builder + */ + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + /** + * @param tokenUrl The token URL to be used for this OAuth2 flow. + * Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". + * The value must be an absolute URL. + * @param clientId The OAuth2 client ID for the "clientCredentials" flow. + * @param flow OAuth flow. + * @param clientSecret The OAuth2 client secret for the "clientCredentials" flow. + * @param parameters A map of string. + */ + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (Map.Entry entry : parameters.entrySet()) { + tokenRequestBuilder.setParameter(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Set the OAuth flow + * + * @param flow The OAuth flow. + */ + public void setFlow(OAuthFlow flow) { + switch(flow) { + case ACCESS_CODE: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case IMPLICIT: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case PASSWORD: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case APPLICATION: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.url().toString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (Map.Entry entry : headers.entrySet()) { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /** + * Returns true if the access token has been updated + * + * @param requestAccessToken the request access token + * @return True if the update is successful + * @throws java.io.IOException If fail to update the access token + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + return getAccessToken() == null || !getAccessToken().equals(requestAccessToken); + } + + /** + * Gets the token request builder + * + * @return A token request builder + */ + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + /** + * Sets the token request builder + * + * @param tokenRequestBuilder Token request builder + */ + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + // Applying authorization to parameters is performed in the retryingIntercept method + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + // No implementation necessary + } +} diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AbstractOpenApiSchema.java b/src/main/java/pl/wtx/allegro/api/client/model/AbstractOpenApiSchema.java new file mode 100644 index 0000000..141bd46 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,146 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import pl.wtx.allegro.api.client.invoker.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + //@JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmail.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmail.java new file mode 100644 index 0000000..5b41906 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmail.java @@ -0,0 +1,276 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Details of a single additional email address. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalEmail { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nonnull + private String email; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private String createdAt; + + public AdditionalEmail() { + } + + public AdditionalEmail id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public AdditionalEmail email(@javax.annotation.Nonnull String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nonnull String email) { + this.email = email; + } + + + public AdditionalEmail createdAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalEmail additionalEmail = (AdditionalEmail) o; + return Objects.equals(this.id, additionalEmail.id) && + Objects.equals(this.email, additionalEmail.email) && + Objects.equals(this.createdAt, additionalEmail.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, email, createdAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalEmail {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("email"); + openapiFields.add("createdAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("createdAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalEmail + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalEmail.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalEmail is not found in the empty JSON string", AdditionalEmail.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalEmail.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalEmail` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdditionalEmail.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalEmail.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalEmail' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalEmail.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalEmail value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalEmail read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalEmail given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalEmail + * @throws IOException if the JSON string is invalid with respect to AdditionalEmail + */ + public static AdditionalEmail fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalEmail.class); + } + + /** + * Convert an instance of AdditionalEmail to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmailRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmailRequest.java new file mode 100644 index 0000000..7101892 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmailRequest.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalEmailRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalEmailRequest { + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nonnull + private String email; + + public AdditionalEmailRequest() { + } + + public AdditionalEmailRequest email(@javax.annotation.Nonnull String email) { + this.email = email; + return this; + } + + /** + * A valid email address you want to add to your account. Maximum length of the part before the `@` sign is 64 characters. + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nonnull String email) { + this.email = email; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalEmailRequest additionalEmailRequest = (AdditionalEmailRequest) o; + return Objects.equals(this.email, additionalEmailRequest.email); + } + + @Override + public int hashCode() { + return Objects.hash(email); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalEmailRequest {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("email"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("email"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalEmailRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalEmailRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalEmailRequest is not found in the empty JSON string", AdditionalEmailRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalEmailRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalEmailRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdditionalEmailRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalEmailRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalEmailRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalEmailRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalEmailRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalEmailRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalEmailRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalEmailRequest + * @throws IOException if the JSON string is invalid with respect to AdditionalEmailRequest + */ + public static AdditionalEmailRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalEmailRequest.class); + } + + /** + * Convert an instance of AdditionalEmailRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmailsResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmailsResponse.java new file mode 100644 index 0000000..cd28c1c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalEmailsResponse.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalEmail; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalEmailsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalEmailsResponse { + public static final String SERIALIZED_NAME_ADDITIONAL_EMAILS = "additional-emails"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_EMAILS) + @javax.annotation.Nonnull + private List additionalEmails = new ArrayList<>(); + + public AdditionalEmailsResponse() { + } + + public AdditionalEmailsResponse additionalEmails(@javax.annotation.Nonnull List additionalEmails) { + this.additionalEmails = additionalEmails; + return this; + } + + public AdditionalEmailsResponse addAdditionalEmailsItem(AdditionalEmail additionalEmailsItem) { + if (this.additionalEmails == null) { + this.additionalEmails = new ArrayList<>(); + } + this.additionalEmails.add(additionalEmailsItem); + return this; + } + + /** + * Get additionalEmails + * @return additionalEmails + */ + @javax.annotation.Nonnull + public List getAdditionalEmails() { + return additionalEmails; + } + + public void setAdditionalEmails(@javax.annotation.Nonnull List additionalEmails) { + this.additionalEmails = additionalEmails; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalEmailsResponse additionalEmailsResponse = (AdditionalEmailsResponse) o; + return Objects.equals(this.additionalEmails, additionalEmailsResponse.additionalEmails); + } + + @Override + public int hashCode() { + return Objects.hash(additionalEmails); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalEmailsResponse {\n"); + sb.append(" additionalEmails: ").append(toIndentedString(additionalEmails)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("additional-emails"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("additional-emails"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalEmailsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalEmailsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalEmailsResponse is not found in the empty JSON string", AdditionalEmailsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalEmailsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalEmailsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdditionalEmailsResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("additional-emails").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additional-emails` to be an array in the JSON string but got `%s`", jsonObj.get("additional-emails").toString())); + } + + JsonArray jsonArrayadditionalEmails = jsonObj.getAsJsonArray("additional-emails"); + // validate the required field `additional-emails` (array) + for (int i = 0; i < jsonArrayadditionalEmails.size(); i++) { + AdditionalEmail.validateJsonElement(jsonArrayadditionalEmails.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalEmailsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalEmailsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalEmailsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalEmailsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalEmailsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalEmailsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalEmailsResponse + * @throws IOException if the JSON string is invalid with respect to AdditionalEmailsResponse + */ + public static AdditionalEmailsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalEmailsResponse.class); + } + + /** + * Convert an instance of AdditionalEmailsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePromoOptionsCommandModification.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePromoOptionsCommandModification.java new file mode 100644 index 0000000..27f772e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePromoOptionsCommandModification.java @@ -0,0 +1,238 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.PromoOptionsCommandModification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalMarketplacePromoOptionsCommandModification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalMarketplacePromoOptionsCommandModification { + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + public static final String SERIALIZED_NAME_MODIFICATION = "modification"; + @SerializedName(SERIALIZED_NAME_MODIFICATION) + @javax.annotation.Nullable + private PromoOptionsCommandModification modification; + + public AdditionalMarketplacePromoOptionsCommandModification() { + } + + public AdditionalMarketplacePromoOptionsCommandModification marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * Get marketplaceId + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + public AdditionalMarketplacePromoOptionsCommandModification modification(@javax.annotation.Nullable PromoOptionsCommandModification modification) { + this.modification = modification; + return this; + } + + /** + * Get modification + * @return modification + */ + @javax.annotation.Nullable + public PromoOptionsCommandModification getModification() { + return modification; + } + + public void setModification(@javax.annotation.Nullable PromoOptionsCommandModification modification) { + this.modification = modification; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalMarketplacePromoOptionsCommandModification additionalMarketplacePromoOptionsCommandModification = (AdditionalMarketplacePromoOptionsCommandModification) o; + return Objects.equals(this.marketplaceId, additionalMarketplacePromoOptionsCommandModification.marketplaceId) && + Objects.equals(this.modification, additionalMarketplacePromoOptionsCommandModification.modification); + } + + @Override + public int hashCode() { + return Objects.hash(marketplaceId, modification); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalMarketplacePromoOptionsCommandModification {\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append(" modification: ").append(toIndentedString(modification)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplaceId"); + openapiFields.add("modification"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalMarketplacePromoOptionsCommandModification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalMarketplacePromoOptionsCommandModification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalMarketplacePromoOptionsCommandModification is not found in the empty JSON string", AdditionalMarketplacePromoOptionsCommandModification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalMarketplacePromoOptionsCommandModification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalMarketplacePromoOptionsCommandModification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("marketplaceId") != null && !jsonObj.get("marketplaceId").isJsonNull()) && !jsonObj.get("marketplaceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("marketplaceId").toString())); + } + // validate the optional field `modification` + if (jsonObj.get("modification") != null && !jsonObj.get("modification").isJsonNull()) { + PromoOptionsCommandModification.validateJsonElement(jsonObj.get("modification")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalMarketplacePromoOptionsCommandModification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalMarketplacePromoOptionsCommandModification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalMarketplacePromoOptionsCommandModification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalMarketplacePromoOptionsCommandModification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalMarketplacePromoOptionsCommandModification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalMarketplacePromoOptionsCommandModification given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalMarketplacePromoOptionsCommandModification + * @throws IOException if the JSON string is invalid with respect to AdditionalMarketplacePromoOptionsCommandModification + */ + public static AdditionalMarketplacePromoOptionsCommandModification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalMarketplacePromoOptionsCommandModification.class); + } + + /** + * Convert an instance of AdditionalMarketplacePromoOptionsCommandModification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePromoOptionsModification.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePromoOptionsModification.java new file mode 100644 index 0000000..9c04bb1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePromoOptionsModification.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.PromoOptionsModification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalMarketplacePromoOptionsModification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalMarketplacePromoOptionsModification { + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + public static final String SERIALIZED_NAME_MODIFICATIONS = "modifications"; + @SerializedName(SERIALIZED_NAME_MODIFICATIONS) + @javax.annotation.Nullable + private List modifications = new ArrayList<>(); + + public AdditionalMarketplacePromoOptionsModification() { + } + + public AdditionalMarketplacePromoOptionsModification marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * Get marketplaceId + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + public AdditionalMarketplacePromoOptionsModification modifications(@javax.annotation.Nullable List modifications) { + this.modifications = modifications; + return this; + } + + public AdditionalMarketplacePromoOptionsModification addModificationsItem(PromoOptionsModification modificationsItem) { + if (this.modifications == null) { + this.modifications = new ArrayList<>(); + } + this.modifications.add(modificationsItem); + return this; + } + + /** + * Promo package modifications to be applied on additional marketplace. + * @return modifications + */ + @javax.annotation.Nullable + public List getModifications() { + return modifications; + } + + public void setModifications(@javax.annotation.Nullable List modifications) { + this.modifications = modifications; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalMarketplacePromoOptionsModification additionalMarketplacePromoOptionsModification = (AdditionalMarketplacePromoOptionsModification) o; + return Objects.equals(this.marketplaceId, additionalMarketplacePromoOptionsModification.marketplaceId) && + Objects.equals(this.modifications, additionalMarketplacePromoOptionsModification.modifications); + } + + @Override + public int hashCode() { + return Objects.hash(marketplaceId, modifications); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalMarketplacePromoOptionsModification {\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append(" modifications: ").append(toIndentedString(modifications)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplaceId"); + openapiFields.add("modifications"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalMarketplacePromoOptionsModification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalMarketplacePromoOptionsModification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalMarketplacePromoOptionsModification is not found in the empty JSON string", AdditionalMarketplacePromoOptionsModification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalMarketplacePromoOptionsModification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalMarketplacePromoOptionsModification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("marketplaceId") != null && !jsonObj.get("marketplaceId").isJsonNull()) && !jsonObj.get("marketplaceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("marketplaceId").toString())); + } + if (jsonObj.get("modifications") != null && !jsonObj.get("modifications").isJsonNull()) { + JsonArray jsonArraymodifications = jsonObj.getAsJsonArray("modifications"); + if (jsonArraymodifications != null) { + // ensure the json data is an array + if (!jsonObj.get("modifications").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `modifications` to be an array in the JSON string but got `%s`", jsonObj.get("modifications").toString())); + } + + // validate the optional field `modifications` (array) + for (int i = 0; i < jsonArraymodifications.size(); i++) { + PromoOptionsModification.validateJsonElement(jsonArraymodifications.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalMarketplacePromoOptionsModification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalMarketplacePromoOptionsModification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalMarketplacePromoOptionsModification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalMarketplacePromoOptionsModification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalMarketplacePromoOptionsModification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalMarketplacePromoOptionsModification given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalMarketplacePromoOptionsModification + * @throws IOException if the JSON string is invalid with respect to AdditionalMarketplacePromoOptionsModification + */ + public static AdditionalMarketplacePromoOptionsModification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalMarketplacePromoOptionsModification.class); + } + + /** + * Convert an instance of AdditionalMarketplacePromoOptionsModification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublication.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublication.java new file mode 100644 index 0000000..eda31e0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublication.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacePublicationStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalMarketplacePublication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalMarketplacePublication { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private AdditionalMarketplacePublicationStatus status; + + public AdditionalMarketplacePublication() { + } + + public AdditionalMarketplacePublication status(@javax.annotation.Nullable AdditionalMarketplacePublicationStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public AdditionalMarketplacePublicationStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable AdditionalMarketplacePublicationStatus status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalMarketplacePublication additionalMarketplacePublication = (AdditionalMarketplacePublication) o; + return Objects.equals(this.status, additionalMarketplacePublication.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalMarketplacePublication {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalMarketplacePublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalMarketplacePublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalMarketplacePublication is not found in the empty JSON string", AdditionalMarketplacePublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalMarketplacePublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalMarketplacePublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + AdditionalMarketplacePublicationStatus.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalMarketplacePublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalMarketplacePublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalMarketplacePublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalMarketplacePublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalMarketplacePublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalMarketplacePublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalMarketplacePublication + * @throws IOException if the JSON string is invalid with respect to AdditionalMarketplacePublication + */ + public static AdditionalMarketplacePublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalMarketplacePublication.class); + } + + /** + * Convert an instance of AdditionalMarketplacePublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublicationState.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublicationState.java new file mode 100644 index 0000000..172d31c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublicationState.java @@ -0,0 +1,84 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The publication status of the offer on an additional marketplace. The possible values: - *NOT_REQUESTED* - The seller has not declared their intention to list this offer on the marketplace - *PENDING* - The qualification process has not started; the offer is not listed yet - *IN_PROGRESS* - We are processing whether the offer qualifies to be listed on the marketplace; the offer is not listed yet - *APPROVED* - The offer is approved to be listed on the marketplace - *REFUSED* - The offer will not be listed on the marketplace; the offer may be re-qualified if is corrected + */ +@JsonAdapter(AdditionalMarketplacePublicationState.Adapter.class) +public enum AdditionalMarketplacePublicationState { + + NOT_REQUESTED("NOT_REQUESTED"), + + PENDING("PENDING"), + + IN_PROGRESS("IN_PROGRESS"), + + APPROVED("APPROVED"), + + REFUSED("REFUSED"); + + private String value; + + AdditionalMarketplacePublicationState(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AdditionalMarketplacePublicationState fromValue(String value) { + for (AdditionalMarketplacePublicationState b : AdditionalMarketplacePublicationState.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AdditionalMarketplacePublicationState enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AdditionalMarketplacePublicationState read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AdditionalMarketplacePublicationState.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AdditionalMarketplacePublicationState.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublicationStatus.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublicationStatus.java new file mode 100644 index 0000000..363cab6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacePublicationStatus.java @@ -0,0 +1,84 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The publication status of the offer on additional marketplace. The possible values: - *NOT_REQUESTED* - seller has not declared a willingness to list this offer on given marketplace - *PENDING* - seller declared a willingness to list this offer on given marketplace, but the process has not started yet; e.g. the offer is not published yet - *IN_PROGRESS* - we process the offer's qualification for given marketplace; the offer is not listed yet - *APPROVED* - the offer is approved to list on given marketplace - *REFUSED* - the offer is refused to list on given marketplace + */ +@JsonAdapter(AdditionalMarketplacePublicationStatus.Adapter.class) +public enum AdditionalMarketplacePublicationStatus { + + NOT_REQUESTED("NOT_REQUESTED"), + + PENDING("PENDING"), + + IN_PROGRESS("IN_PROGRESS"), + + APPROVED("APPROVED"), + + REFUSED("REFUSED"); + + private String value; + + AdditionalMarketplacePublicationStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AdditionalMarketplacePublicationStatus fromValue(String value) { + for (AdditionalMarketplacePublicationStatus b : AdditionalMarketplacePublicationStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AdditionalMarketplacePublicationStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AdditionalMarketplacePublicationStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AdditionalMarketplacePublicationStatus.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AdditionalMarketplacePublicationStatus.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplaceSellingMode.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplaceSellingMode.java new file mode 100644 index 0000000..72f0327 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplaceSellingMode.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer's selling mode on given marketplace + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalMarketplaceSellingMode { + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nonnull + private Price price; + + public AdditionalMarketplaceSellingMode() { + } + + public AdditionalMarketplaceSellingMode price(@javax.annotation.Nonnull Price price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nonnull + public Price getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nonnull Price price) { + this.price = price; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalMarketplaceSellingMode additionalMarketplaceSellingMode = (AdditionalMarketplaceSellingMode) o; + return Objects.equals(this.price, additionalMarketplaceSellingMode.price); + } + + @Override + public int hashCode() { + return Objects.hash(price); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalMarketplaceSellingMode {\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("price"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("price"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalMarketplaceSellingMode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalMarketplaceSellingMode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalMarketplaceSellingMode is not found in the empty JSON string", AdditionalMarketplaceSellingMode.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalMarketplaceSellingMode.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalMarketplaceSellingMode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdditionalMarketplaceSellingMode.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `price` + Price.validateJsonElement(jsonObj.get("price")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalMarketplaceSellingMode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalMarketplaceSellingMode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalMarketplaceSellingMode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalMarketplaceSellingMode value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalMarketplaceSellingMode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalMarketplaceSellingMode given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalMarketplaceSellingMode + * @throws IOException if the JSON string is invalid with respect to AdditionalMarketplaceSellingMode + */ + public static AdditionalMarketplaceSellingMode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalMarketplaceSellingMode.class); + } + + /** + * Convert an instance of AdditionalMarketplaceSellingMode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRefusalReasonResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRefusalReasonResponse.java new file mode 100644 index 0000000..a4372af --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRefusalReasonResponse.java @@ -0,0 +1,274 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalMarketplacesRefusalReasonResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalMarketplacesRefusalReasonResponse { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_USER_MESSAGE = "userMessage"; + @SerializedName(SERIALIZED_NAME_USER_MESSAGE) + @javax.annotation.Nullable + private String userMessage; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private Map> parameters = new HashMap<>(); + + public AdditionalMarketplacesRefusalReasonResponse() { + } + + public AdditionalMarketplacesRefusalReasonResponse code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Technical code of the refusal reason + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public AdditionalMarketplacesRefusalReasonResponse userMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + return this; + } + + /** + * Short description of the refusal reason in natural language + * @return userMessage + */ + @javax.annotation.Nullable + public String getUserMessage() { + return userMessage; + } + + public void setUserMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + } + + + public AdditionalMarketplacesRefusalReasonResponse parameters(@javax.annotation.Nullable Map> parameters) { + this.parameters = parameters; + return this; + } + + public AdditionalMarketplacesRefusalReasonResponse putParametersItem(String key, List parametersItem) { + if (this.parameters == null) { + this.parameters = new HashMap<>(); + } + this.parameters.put(key, parametersItem); + return this; + } + + /** + * Additional technical parameters of the refusal reason + * @return parameters + */ + @javax.annotation.Nullable + public Map> getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable Map> parameters) { + this.parameters = parameters; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalMarketplacesRefusalReasonResponse additionalMarketplacesRefusalReasonResponse = (AdditionalMarketplacesRefusalReasonResponse) o; + return Objects.equals(this.code, additionalMarketplacesRefusalReasonResponse.code) && + Objects.equals(this.userMessage, additionalMarketplacesRefusalReasonResponse.userMessage) && + Objects.equals(this.parameters, additionalMarketplacesRefusalReasonResponse.parameters); + } + + @Override + public int hashCode() { + return Objects.hash(code, userMessage, parameters); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalMarketplacesRefusalReasonResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" userMessage: ").append(toIndentedString(userMessage)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("userMessage"); + openapiFields.add("parameters"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalMarketplacesRefusalReasonResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalMarketplacesRefusalReasonResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalMarketplacesRefusalReasonResponse is not found in the empty JSON string", AdditionalMarketplacesRefusalReasonResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalMarketplacesRefusalReasonResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalMarketplacesRefusalReasonResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("userMessage") != null && !jsonObj.get("userMessage").isJsonNull()) && !jsonObj.get("userMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalMarketplacesRefusalReasonResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalMarketplacesRefusalReasonResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalMarketplacesRefusalReasonResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalMarketplacesRefusalReasonResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalMarketplacesRefusalReasonResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalMarketplacesRefusalReasonResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalMarketplacesRefusalReasonResponse + * @throws IOException if the JSON string is invalid with respect to AdditionalMarketplacesRefusalReasonResponse + */ + public static AdditionalMarketplacesRefusalReasonResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalMarketplacesRefusalReasonResponse.class); + } + + /** + * Convert an instance of AdditionalMarketplacesRefusalReasonResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRequestValue.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRequestValue.java new file mode 100644 index 0000000..ef5c65b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRequestValue.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacesRequestValueSellingMode; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalMarketplacesRequestValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalMarketplacesRequestValue { + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private AdditionalMarketplacesRequestValueSellingMode sellingMode; + + public AdditionalMarketplacesRequestValue() { + } + + public AdditionalMarketplacesRequestValue sellingMode(@javax.annotation.Nullable AdditionalMarketplacesRequestValueSellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public AdditionalMarketplacesRequestValueSellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable AdditionalMarketplacesRequestValueSellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalMarketplacesRequestValue additionalMarketplacesRequestValue = (AdditionalMarketplacesRequestValue) o; + return Objects.equals(this.sellingMode, additionalMarketplacesRequestValue.sellingMode); + } + + @Override + public int hashCode() { + return Objects.hash(sellingMode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalMarketplacesRequestValue {\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sellingMode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalMarketplacesRequestValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalMarketplacesRequestValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalMarketplacesRequestValue is not found in the empty JSON string", AdditionalMarketplacesRequestValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalMarketplacesRequestValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalMarketplacesRequestValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + AdditionalMarketplacesRequestValueSellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalMarketplacesRequestValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalMarketplacesRequestValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalMarketplacesRequestValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalMarketplacesRequestValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalMarketplacesRequestValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalMarketplacesRequestValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalMarketplacesRequestValue + * @throws IOException if the JSON string is invalid with respect to AdditionalMarketplacesRequestValue + */ + public static AdditionalMarketplacesRequestValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalMarketplacesRequestValue.class); + } + + /** + * Convert an instance of AdditionalMarketplacesRequestValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRequestValueSellingMode.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRequestValueSellingMode.java new file mode 100644 index 0000000..344a001 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesRequestValueSellingMode.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalMarketplacesRequestValueSellingMode + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalMarketplacesRequestValueSellingMode { + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private Price price; + + public AdditionalMarketplacesRequestValueSellingMode() { + } + + public AdditionalMarketplacesRequestValueSellingMode price(@javax.annotation.Nullable Price price) { + this.price = price; + return this; + } + + /** + * The offer price for the selected additional marketplace. The price in this field must be provided by the seller in the correct currency, which is specified in the `GET /marketplaces` resource. + * @return price + */ + @javax.annotation.Nullable + public Price getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable Price price) { + this.price = price; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalMarketplacesRequestValueSellingMode additionalMarketplacesRequestValueSellingMode = (AdditionalMarketplacesRequestValueSellingMode) o; + return Objects.equals(this.price, additionalMarketplacesRequestValueSellingMode.price); + } + + @Override + public int hashCode() { + return Objects.hash(price); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalMarketplacesRequestValueSellingMode {\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("price"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalMarketplacesRequestValueSellingMode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalMarketplacesRequestValueSellingMode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalMarketplacesRequestValueSellingMode is not found in the empty JSON string", AdditionalMarketplacesRequestValueSellingMode.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalMarketplacesRequestValueSellingMode.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalMarketplacesRequestValueSellingMode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `price` + if (jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("price")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalMarketplacesRequestValueSellingMode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalMarketplacesRequestValueSellingMode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalMarketplacesRequestValueSellingMode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalMarketplacesRequestValueSellingMode value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalMarketplacesRequestValueSellingMode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalMarketplacesRequestValueSellingMode given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalMarketplacesRequestValueSellingMode + * @throws IOException if the JSON string is invalid with respect to AdditionalMarketplacesRequestValueSellingMode + */ + public static AdditionalMarketplacesRequestValueSellingMode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalMarketplacesRequestValueSellingMode.class); + } + + /** + * Convert an instance of AdditionalMarketplacesRequestValueSellingMode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesResponseValue.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesResponseValue.java new file mode 100644 index 0000000..a10a4f3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesResponseValue.java @@ -0,0 +1,240 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacesResponseValuePublication; +import pl.wtx.allegro.api.client.model.SellingMode; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalMarketplacesResponseValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalMarketplacesResponseValue { + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private SellingMode sellingMode; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private AdditionalMarketplacesResponseValuePublication publication; + + public AdditionalMarketplacesResponseValue() { + } + + public AdditionalMarketplacesResponseValue sellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * The offer price for the selected additional marketplace. + * @return sellingMode + */ + @javax.annotation.Nullable + public SellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + public AdditionalMarketplacesResponseValue publication(@javax.annotation.Nullable AdditionalMarketplacesResponseValuePublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public AdditionalMarketplacesResponseValuePublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable AdditionalMarketplacesResponseValuePublication publication) { + this.publication = publication; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalMarketplacesResponseValue additionalMarketplacesResponseValue = (AdditionalMarketplacesResponseValue) o; + return Objects.equals(this.sellingMode, additionalMarketplacesResponseValue.sellingMode) && + Objects.equals(this.publication, additionalMarketplacesResponseValue.publication); + } + + @Override + public int hashCode() { + return Objects.hash(sellingMode, publication); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalMarketplacesResponseValue {\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sellingMode"); + openapiFields.add("publication"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalMarketplacesResponseValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalMarketplacesResponseValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalMarketplacesResponseValue is not found in the empty JSON string", AdditionalMarketplacesResponseValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalMarketplacesResponseValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalMarketplacesResponseValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + SellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + AdditionalMarketplacesResponseValuePublication.validateJsonElement(jsonObj.get("publication")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalMarketplacesResponseValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalMarketplacesResponseValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalMarketplacesResponseValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalMarketplacesResponseValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalMarketplacesResponseValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalMarketplacesResponseValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalMarketplacesResponseValue + * @throws IOException if the JSON string is invalid with respect to AdditionalMarketplacesResponseValue + */ + public static AdditionalMarketplacesResponseValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalMarketplacesResponseValue.class); + } + + /** + * Convert an instance of AdditionalMarketplacesResponseValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesResponseValuePublication.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesResponseValuePublication.java new file mode 100644 index 0000000..08d8838 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesResponseValuePublication.java @@ -0,0 +1,320 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacesRefusalReasonResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * <small>[read-only]</small> Contains information about the visibility status of the listing for the given service. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalMarketplacesResponseValuePublication { + /** + * Possible values:</br> - `APPROVED` - the offer is visible in the given additional marketplace if it is active.</br> - `REFUSED` - the offer or the seller does not meet the conditions required to display the offer in the given additional marketplace.</br> - `IN_PROGRESS` - the process of qualifying the offer visibility in a given additional service is in progress.</br> - `NOT_REQUESTED` - the seller has not indicated the intention of visibility in the given additional service.</br> - `PENDING` - the seller has indicated the intention of visibility on a given additional marketplace, but the qualification process has not started, for example, due to offer status (only active offers are subject to the qualification process). + */ + @JsonAdapter(StateEnum.Adapter.class) + public enum StateEnum { + APPROVED("APPROVED"), + + REFUSED("REFUSED"), + + IN_PROGRESS("IN_PROGRESS"), + + NOT_REQUESTED("NOT_REQUESTED"), + + PENDING("PENDING"); + + private String value; + + StateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StateEnum fromValue(String value) { + for (StateEnum b : StateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StateEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StateEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nullable + private StateEnum state; + + public static final String SERIALIZED_NAME_REFUSAL_REASONS = "refusalReasons"; + @SerializedName(SERIALIZED_NAME_REFUSAL_REASONS) + @javax.annotation.Nullable + private List refusalReasons = new ArrayList<>(); + + public AdditionalMarketplacesResponseValuePublication() { + } + + public AdditionalMarketplacesResponseValuePublication state(@javax.annotation.Nullable StateEnum state) { + this.state = state; + return this; + } + + /** + * Possible values:</br> - `APPROVED` - the offer is visible in the given additional marketplace if it is active.</br> - `REFUSED` - the offer or the seller does not meet the conditions required to display the offer in the given additional marketplace.</br> - `IN_PROGRESS` - the process of qualifying the offer visibility in a given additional service is in progress.</br> - `NOT_REQUESTED` - the seller has not indicated the intention of visibility in the given additional service.</br> - `PENDING` - the seller has indicated the intention of visibility on a given additional marketplace, but the qualification process has not started, for example, due to offer status (only active offers are subject to the qualification process). + * @return state + */ + @javax.annotation.Nullable + public StateEnum getState() { + return state; + } + + public void setState(@javax.annotation.Nullable StateEnum state) { + this.state = state; + } + + + public AdditionalMarketplacesResponseValuePublication refusalReasons(@javax.annotation.Nullable List refusalReasons) { + this.refusalReasons = refusalReasons; + return this; + } + + public AdditionalMarketplacesResponseValuePublication addRefusalReasonsItem(AdditionalMarketplacesRefusalReasonResponse refusalReasonsItem) { + if (this.refusalReasons == null) { + this.refusalReasons = new ArrayList<>(); + } + this.refusalReasons.add(refusalReasonsItem); + return this; + } + + /** + * Reasons for marketplace publication refusal. Empty list for not refused marketplaces. + * @return refusalReasons + */ + @javax.annotation.Nullable + public List getRefusalReasons() { + return refusalReasons; + } + + public void setRefusalReasons(@javax.annotation.Nullable List refusalReasons) { + this.refusalReasons = refusalReasons; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalMarketplacesResponseValuePublication additionalMarketplacesResponseValuePublication = (AdditionalMarketplacesResponseValuePublication) o; + return Objects.equals(this.state, additionalMarketplacesResponseValuePublication.state) && + Objects.equals(this.refusalReasons, additionalMarketplacesResponseValuePublication.refusalReasons); + } + + @Override + public int hashCode() { + return Objects.hash(state, refusalReasons); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalMarketplacesResponseValuePublication {\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" refusalReasons: ").append(toIndentedString(refusalReasons)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("state"); + openapiFields.add("refusalReasons"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalMarketplacesResponseValuePublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalMarketplacesResponseValuePublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalMarketplacesResponseValuePublication is not found in the empty JSON string", AdditionalMarketplacesResponseValuePublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalMarketplacesResponseValuePublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalMarketplacesResponseValuePublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + // validate the optional field `state` + if (jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) { + StateEnum.validateJsonElement(jsonObj.get("state")); + } + if (jsonObj.get("refusalReasons") != null && !jsonObj.get("refusalReasons").isJsonNull()) { + JsonArray jsonArrayrefusalReasons = jsonObj.getAsJsonArray("refusalReasons"); + if (jsonArrayrefusalReasons != null) { + // ensure the json data is an array + if (!jsonObj.get("refusalReasons").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `refusalReasons` to be an array in the JSON string but got `%s`", jsonObj.get("refusalReasons").toString())); + } + + // validate the optional field `refusalReasons` (array) + for (int i = 0; i < jsonArrayrefusalReasons.size(); i++) { + AdditionalMarketplacesRefusalReasonResponse.validateJsonElement(jsonArrayrefusalReasons.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalMarketplacesResponseValuePublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalMarketplacesResponseValuePublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalMarketplacesResponseValuePublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalMarketplacesResponseValuePublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalMarketplacesResponseValuePublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalMarketplacesResponseValuePublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalMarketplacesResponseValuePublication + * @throws IOException if the JSON string is invalid with respect to AdditionalMarketplacesResponseValuePublication + */ + public static AdditionalMarketplacesResponseValuePublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalMarketplacesResponseValuePublication.class); + } + + /** + * Convert an instance of AdditionalMarketplacesResponseValuePublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesVisibility.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesVisibility.java new file mode 100644 index 0000000..f2edbc4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalMarketplacesVisibility.java @@ -0,0 +1,353 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.RefusalReason; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer additional marketplaces visibility information. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalMarketplacesVisibility { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + /** + * Marketplace visibility qualification status. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + APPROVED("APPROVED"), + + REFUSED("REFUSED"), + + IN_PROGRESS("IN_PROGRESS"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public static final String SERIALIZED_NAME_REFUSAL_REASONS = "refusalReasons"; + @SerializedName(SERIALIZED_NAME_REFUSAL_REASONS) + @javax.annotation.Nullable + private List refusalReasons = new ArrayList<>(); + + public AdditionalMarketplacesVisibility() { + } + + public AdditionalMarketplacesVisibility id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Additional marketplace ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public AdditionalMarketplacesVisibility status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Marketplace visibility qualification status. + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + public AdditionalMarketplacesVisibility refusalReasons(@javax.annotation.Nullable List refusalReasons) { + this.refusalReasons = refusalReasons; + return this; + } + + public AdditionalMarketplacesVisibility addRefusalReasonsItem(RefusalReason refusalReasonsItem) { + if (this.refusalReasons == null) { + this.refusalReasons = new ArrayList<>(); + } + this.refusalReasons.add(refusalReasonsItem); + return this; + } + + /** + * Reasons of visibility refusal. + * @return refusalReasons + */ + @javax.annotation.Nullable + public List getRefusalReasons() { + return refusalReasons; + } + + public void setRefusalReasons(@javax.annotation.Nullable List refusalReasons) { + this.refusalReasons = refusalReasons; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalMarketplacesVisibility additionalMarketplacesVisibility = (AdditionalMarketplacesVisibility) o; + return Objects.equals(this.id, additionalMarketplacesVisibility.id) && + Objects.equals(this.status, additionalMarketplacesVisibility.status) && + Objects.equals(this.refusalReasons, additionalMarketplacesVisibility.refusalReasons); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, refusalReasons); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalMarketplacesVisibility {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" refusalReasons: ").append(toIndentedString(refusalReasons)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("status"); + openapiFields.add("refusalReasons"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalMarketplacesVisibility + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalMarketplacesVisibility.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalMarketplacesVisibility is not found in the empty JSON string", AdditionalMarketplacesVisibility.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalMarketplacesVisibility.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalMarketplacesVisibility` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdditionalMarketplacesVisibility.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + if (jsonObj.get("refusalReasons") != null && !jsonObj.get("refusalReasons").isJsonNull()) { + JsonArray jsonArrayrefusalReasons = jsonObj.getAsJsonArray("refusalReasons"); + if (jsonArrayrefusalReasons != null) { + // ensure the json data is an array + if (!jsonObj.get("refusalReasons").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `refusalReasons` to be an array in the JSON string but got `%s`", jsonObj.get("refusalReasons").toString())); + } + + // validate the optional field `refusalReasons` (array) + for (int i = 0; i < jsonArrayrefusalReasons.size(); i++) { + RefusalReason.validateJsonElement(jsonArrayrefusalReasons.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalMarketplacesVisibility.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalMarketplacesVisibility' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalMarketplacesVisibility.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalMarketplacesVisibility value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalMarketplacesVisibility read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalMarketplacesVisibility given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalMarketplacesVisibility + * @throws IOException if the JSON string is invalid with respect to AdditionalMarketplacesVisibility + */ + public static AdditionalMarketplacesVisibility fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalMarketplacesVisibility.class); + } + + /** + * Convert an instance of AdditionalMarketplacesVisibility to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalPropertyDto.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalPropertyDto.java new file mode 100644 index 0000000..cc3e96c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalPropertyDto.java @@ -0,0 +1,332 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalPropertyDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalPropertyDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nonnull + private String description; + + public static final String SERIALIZED_NAME_REQUIRED = "required"; + @SerializedName(SERIALIZED_NAME_REQUIRED) + @javax.annotation.Nonnull + private Boolean required; + + public static final String SERIALIZED_NAME_READ_ONLY = "readOnly"; + @SerializedName(SERIALIZED_NAME_READ_ONLY) + @javax.annotation.Nonnull + private Boolean readOnly; + + public AdditionalPropertyDto() { + } + + public AdditionalPropertyDto id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * ID of the additional property. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public AdditionalPropertyDto name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Translated name of the additional property: 'Sending code' | 'Kod nadania'. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AdditionalPropertyDto description(@javax.annotation.Nonnull String description) { + this.description = description; + return this; + } + + /** + * Translated description of the additional property. + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nonnull String description) { + this.description = description; + } + + + public AdditionalPropertyDto required(@javax.annotation.Nonnull Boolean required) { + this.required = required; + return this; + } + + /** + * Defines if the additional property is mandatory or optional. + * @return required + */ + @javax.annotation.Nonnull + public Boolean getRequired() { + return required; + } + + public void setRequired(@javax.annotation.Nonnull Boolean required) { + this.required = required; + } + + + public AdditionalPropertyDto readOnly(@javax.annotation.Nonnull Boolean readOnly) { + this.readOnly = readOnly; + return this; + } + + /** + * If 'false', the additional property value can be set in request, 'true' means that it is set by carrier and will be available only in /shipment-management/shipments/{shipmentId} response. + * @return readOnly + */ + @javax.annotation.Nonnull + public Boolean getReadOnly() { + return readOnly; + } + + public void setReadOnly(@javax.annotation.Nonnull Boolean readOnly) { + this.readOnly = readOnly; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertyDto additionalPropertyDto = (AdditionalPropertyDto) o; + return Objects.equals(this.id, additionalPropertyDto.id) && + Objects.equals(this.name, additionalPropertyDto.name) && + Objects.equals(this.description, additionalPropertyDto.description) && + Objects.equals(this.required, additionalPropertyDto.required) && + Objects.equals(this.readOnly, additionalPropertyDto.readOnly); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, required, readOnly); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertyDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("required"); + openapiFields.add("readOnly"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("required"); + openapiRequiredFields.add("readOnly"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalPropertyDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalPropertyDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertyDto is not found in the empty JSON string", AdditionalPropertyDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalPropertyDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertyDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdditionalPropertyDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalPropertyDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalPropertyDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalPropertyDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalPropertyDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalPropertyDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalPropertyDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalPropertyDto + * @throws IOException if the JSON string is invalid with respect to AdditionalPropertyDto + */ + public static AdditionalPropertyDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalPropertyDto.class); + } + + /** + * Convert an instance of AdditionalPropertyDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceDefinitionRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceDefinitionRequest.java new file mode 100644 index 0000000..6cd3fff --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceDefinitionRequest.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServiceDefinitionRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServiceDefinitionRequest { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public AdditionalServiceDefinitionRequest() { + } + + public AdditionalServiceDefinitionRequest id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServiceDefinitionRequest additionalServiceDefinitionRequest = (AdditionalServiceDefinitionRequest) o; + return Objects.equals(this.id, additionalServiceDefinitionRequest.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServiceDefinitionRequest {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServiceDefinitionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServiceDefinitionRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServiceDefinitionRequest is not found in the empty JSON string", AdditionalServiceDefinitionRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServiceDefinitionRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServiceDefinitionRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdditionalServiceDefinitionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServiceDefinitionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServiceDefinitionRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServiceDefinitionRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServiceDefinitionRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServiceDefinitionRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServiceDefinitionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServiceDefinitionRequest + * @throws IOException if the JSON string is invalid with respect to AdditionalServiceDefinitionRequest + */ + public static AdditionalServiceDefinitionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServiceDefinitionRequest.class); + } + + /** + * Convert an instance of AdditionalServiceDefinitionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceDto.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceDto.java new file mode 100644 index 0000000..ec4d0c8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceDto.java @@ -0,0 +1,275 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServiceDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServiceDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public AdditionalServiceDto() { + } + + public AdditionalServiceDto id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * ID of additional service. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public AdditionalServiceDto name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Translated name of service: 'Non-standard parcel' | 'Niestandardowa przesyłka'. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AdditionalServiceDto description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Optional description of service. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServiceDto additionalServiceDto = (AdditionalServiceDto) o; + return Objects.equals(this.id, additionalServiceDto.id) && + Objects.equals(this.name, additionalServiceDto.name) && + Objects.equals(this.description, additionalServiceDto.description); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServiceDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServiceDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServiceDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServiceDto is not found in the empty JSON string", AdditionalServiceDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServiceDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServiceDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdditionalServiceDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServiceDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServiceDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServiceDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServiceDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServiceDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServiceDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServiceDto + * @throws IOException if the JSON string is invalid with respect to AdditionalServiceDto + */ + public static AdditionalServiceDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServiceDto.class); + } + + /** + * Convert an instance of AdditionalServiceDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslation.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslation.java new file mode 100644 index 0000000..36e90e5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslation.java @@ -0,0 +1,238 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AdditionalServicesGroupTranslationWrapperWithType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServiceGroupTranslation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServiceGroupTranslation { + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nullable + private String language; + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private AdditionalServicesGroupTranslationWrapperWithType additionalServices; + + public AdditionalServiceGroupTranslation() { + } + + public AdditionalServiceGroupTranslation language(@javax.annotation.Nullable String language) { + this.language = language; + return this; + } + + /** + * IETF language tag. + * @return language + */ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nullable String language) { + this.language = language; + } + + + public AdditionalServiceGroupTranslation additionalServices(@javax.annotation.Nullable AdditionalServicesGroupTranslationWrapperWithType additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nullable + public AdditionalServicesGroupTranslationWrapperWithType getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable AdditionalServicesGroupTranslationWrapperWithType additionalServices) { + this.additionalServices = additionalServices; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServiceGroupTranslation additionalServiceGroupTranslation = (AdditionalServiceGroupTranslation) o; + return Objects.equals(this.language, additionalServiceGroupTranslation.language) && + Objects.equals(this.additionalServices, additionalServiceGroupTranslation.additionalServices); + } + + @Override + public int hashCode() { + return Objects.hash(language, additionalServices); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServiceGroupTranslation {\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("language"); + openapiFields.add("additionalServices"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServiceGroupTranslation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServiceGroupTranslation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServiceGroupTranslation is not found in the empty JSON string", AdditionalServiceGroupTranslation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServiceGroupTranslation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServiceGroupTranslation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + // validate the optional field `additionalServices` + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull()) { + AdditionalServicesGroupTranslationWrapperWithType.validateJsonElement(jsonObj.get("additionalServices")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServiceGroupTranslation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServiceGroupTranslation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServiceGroupTranslation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServiceGroupTranslation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServiceGroupTranslation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServiceGroupTranslation given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServiceGroupTranslation + * @throws IOException if the JSON string is invalid with respect to AdditionalServiceGroupTranslation + */ + public static AdditionalServiceGroupTranslation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServiceGroupTranslation.class); + } + + /** + * Convert an instance of AdditionalServiceGroupTranslation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslationPatchResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslationPatchResponse.java new file mode 100644 index 0000000..b67d493 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslationPatchResponse.java @@ -0,0 +1,238 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AdditionalServicesGroupTranslationWrapperWithType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServiceGroupTranslationPatchResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServiceGroupTranslationPatchResponse { + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nullable + private String language; + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private AdditionalServicesGroupTranslationWrapperWithType additionalServices; + + public AdditionalServiceGroupTranslationPatchResponse() { + } + + public AdditionalServiceGroupTranslationPatchResponse language(@javax.annotation.Nullable String language) { + this.language = language; + return this; + } + + /** + * IETF language tag. + * @return language + */ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nullable String language) { + this.language = language; + } + + + public AdditionalServiceGroupTranslationPatchResponse additionalServices(@javax.annotation.Nullable AdditionalServicesGroupTranslationWrapperWithType additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nullable + public AdditionalServicesGroupTranslationWrapperWithType getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable AdditionalServicesGroupTranslationWrapperWithType additionalServices) { + this.additionalServices = additionalServices; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServiceGroupTranslationPatchResponse additionalServiceGroupTranslationPatchResponse = (AdditionalServiceGroupTranslationPatchResponse) o; + return Objects.equals(this.language, additionalServiceGroupTranslationPatchResponse.language) && + Objects.equals(this.additionalServices, additionalServiceGroupTranslationPatchResponse.additionalServices); + } + + @Override + public int hashCode() { + return Objects.hash(language, additionalServices); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServiceGroupTranslationPatchResponse {\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("language"); + openapiFields.add("additionalServices"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServiceGroupTranslationPatchResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServiceGroupTranslationPatchResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServiceGroupTranslationPatchResponse is not found in the empty JSON string", AdditionalServiceGroupTranslationPatchResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServiceGroupTranslationPatchResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServiceGroupTranslationPatchResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + // validate the optional field `additionalServices` + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull()) { + AdditionalServicesGroupTranslationWrapperWithType.validateJsonElement(jsonObj.get("additionalServices")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServiceGroupTranslationPatchResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServiceGroupTranslationPatchResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServiceGroupTranslationPatchResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServiceGroupTranslationPatchResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServiceGroupTranslationPatchResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServiceGroupTranslationPatchResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServiceGroupTranslationPatchResponse + * @throws IOException if the JSON string is invalid with respect to AdditionalServiceGroupTranslationPatchResponse + */ + public static AdditionalServiceGroupTranslationPatchResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServiceGroupTranslationPatchResponse.class); + } + + /** + * Convert an instance of AdditionalServiceGroupTranslationPatchResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslationResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslationResponse.java new file mode 100644 index 0000000..3acb73b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceGroupTranslationResponse.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalServiceGroupTranslation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServiceGroupTranslationResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServiceGroupTranslationResponse { + public static final String SERIALIZED_NAME_TRANSLATIONS = "translations"; + @SerializedName(SERIALIZED_NAME_TRANSLATIONS) + @javax.annotation.Nullable + private List translations = new ArrayList<>(); + + public AdditionalServiceGroupTranslationResponse() { + } + + public AdditionalServiceGroupTranslationResponse translations(@javax.annotation.Nullable List translations) { + this.translations = translations; + return this; + } + + public AdditionalServiceGroupTranslationResponse addTranslationsItem(AdditionalServiceGroupTranslation translationsItem) { + if (this.translations == null) { + this.translations = new ArrayList<>(); + } + this.translations.add(translationsItem); + return this; + } + + /** + * Get translations + * @return translations + */ + @javax.annotation.Nullable + public List getTranslations() { + return translations; + } + + public void setTranslations(@javax.annotation.Nullable List translations) { + this.translations = translations; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServiceGroupTranslationResponse additionalServiceGroupTranslationResponse = (AdditionalServiceGroupTranslationResponse) o; + return Objects.equals(this.translations, additionalServiceGroupTranslationResponse.translations); + } + + @Override + public int hashCode() { + return Objects.hash(translations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServiceGroupTranslationResponse {\n"); + sb.append(" translations: ").append(toIndentedString(translations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("translations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServiceGroupTranslationResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServiceGroupTranslationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServiceGroupTranslationResponse is not found in the empty JSON string", AdditionalServiceGroupTranslationResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServiceGroupTranslationResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServiceGroupTranslationResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("translations") != null && !jsonObj.get("translations").isJsonNull()) { + JsonArray jsonArraytranslations = jsonObj.getAsJsonArray("translations"); + if (jsonArraytranslations != null) { + // ensure the json data is an array + if (!jsonObj.get("translations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `translations` to be an array in the JSON string but got `%s`", jsonObj.get("translations").toString())); + } + + // validate the optional field `translations` (array) + for (int i = 0; i < jsonArraytranslations.size(); i++) { + AdditionalServiceGroupTranslation.validateJsonElement(jsonArraytranslations.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServiceGroupTranslationResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServiceGroupTranslationResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServiceGroupTranslationResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServiceGroupTranslationResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServiceGroupTranslationResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServiceGroupTranslationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServiceGroupTranslationResponse + * @throws IOException if the JSON string is invalid with respect to AdditionalServiceGroupTranslationResponse + */ + public static AdditionalServiceGroupTranslationResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServiceGroupTranslationResponse.class); + } + + /** + * Convert an instance of AdditionalServiceGroupTranslationResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceRequest.java new file mode 100644 index 0000000..1845880 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceRequest.java @@ -0,0 +1,294 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalServiceDefinitionRequest; +import pl.wtx.allegro.api.client.model.ModelConfiguration; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServiceRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServiceRequest { + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private AdditionalServiceDefinitionRequest definition; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nonnull + private String description; + + public static final String SERIALIZED_NAME_CONFIGURATIONS = "configurations"; + @SerializedName(SERIALIZED_NAME_CONFIGURATIONS) + @javax.annotation.Nonnull + private List configurations = new ArrayList<>(); + + public AdditionalServiceRequest() { + } + + public AdditionalServiceRequest definition(@javax.annotation.Nonnull AdditionalServiceDefinitionRequest definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public AdditionalServiceDefinitionRequest getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull AdditionalServiceDefinitionRequest definition) { + this.definition = definition; + } + + + public AdditionalServiceRequest description(@javax.annotation.Nonnull String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nonnull String description) { + this.description = description; + } + + + public AdditionalServiceRequest configurations(@javax.annotation.Nonnull List configurations) { + this.configurations = configurations; + return this; + } + + public AdditionalServiceRequest addConfigurationsItem(ModelConfiguration configurationsItem) { + if (this.configurations == null) { + this.configurations = new ArrayList<>(); + } + this.configurations.add(configurationsItem); + return this; + } + + /** + * Get configurations + * @return configurations + */ + @javax.annotation.Nonnull + public List getConfigurations() { + return configurations; + } + + public void setConfigurations(@javax.annotation.Nonnull List configurations) { + this.configurations = configurations; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServiceRequest additionalServiceRequest = (AdditionalServiceRequest) o; + return Objects.equals(this.definition, additionalServiceRequest.definition) && + Objects.equals(this.description, additionalServiceRequest.description) && + Objects.equals(this.configurations, additionalServiceRequest.configurations); + } + + @Override + public int hashCode() { + return Objects.hash(definition, description, configurations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServiceRequest {\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" configurations: ").append(toIndentedString(configurations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("definition"); + openapiFields.add("description"); + openapiFields.add("configurations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("definition"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("configurations"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServiceRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServiceRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServiceRequest is not found in the empty JSON string", AdditionalServiceRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServiceRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServiceRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdditionalServiceRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `definition` + AdditionalServiceDefinitionRequest.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("configurations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `configurations` to be an array in the JSON string but got `%s`", jsonObj.get("configurations").toString())); + } + + JsonArray jsonArrayconfigurations = jsonObj.getAsJsonArray("configurations"); + // validate the required field `configurations` (array) + for (int i = 0; i < jsonArrayconfigurations.size(); i++) { + ModelConfiguration.validateJsonElement(jsonArrayconfigurations.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServiceRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServiceRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServiceRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServiceRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServiceRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServiceRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServiceRequest + * @throws IOException if the JSON string is invalid with respect to AdditionalServiceRequest + */ + public static AdditionalServiceRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServiceRequest.class); + } + + /** + * Convert an instance of AdditionalServiceRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceResponse.java new file mode 100644 index 0000000..913c0c3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceResponse.java @@ -0,0 +1,290 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BasicDefinitionResponse; +import pl.wtx.allegro.api.client.model.ModelConfiguration; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServiceResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServiceResponse { + public static final String SERIALIZED_NAME_CONFIGURATIONS = "configurations"; + @SerializedName(SERIALIZED_NAME_CONFIGURATIONS) + @javax.annotation.Nullable + private List configurations = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nullable + private BasicDefinitionResponse definition; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public AdditionalServiceResponse() { + } + + public AdditionalServiceResponse configurations(@javax.annotation.Nullable List configurations) { + this.configurations = configurations; + return this; + } + + public AdditionalServiceResponse addConfigurationsItem(ModelConfiguration configurationsItem) { + if (this.configurations == null) { + this.configurations = new ArrayList<>(); + } + this.configurations.add(configurationsItem); + return this; + } + + /** + * Get configurations + * @return configurations + */ + @javax.annotation.Nullable + public List getConfigurations() { + return configurations; + } + + public void setConfigurations(@javax.annotation.Nullable List configurations) { + this.configurations = configurations; + } + + + public AdditionalServiceResponse definition(@javax.annotation.Nullable BasicDefinitionResponse definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nullable + public BasicDefinitionResponse getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nullable BasicDefinitionResponse definition) { + this.definition = definition; + } + + + public AdditionalServiceResponse description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * This is a description provided by merchant while configuring additional service group. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServiceResponse additionalServiceResponse = (AdditionalServiceResponse) o; + return Objects.equals(this.configurations, additionalServiceResponse.configurations) && + Objects.equals(this.definition, additionalServiceResponse.definition) && + Objects.equals(this.description, additionalServiceResponse.description); + } + + @Override + public int hashCode() { + return Objects.hash(configurations, definition, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServiceResponse {\n"); + sb.append(" configurations: ").append(toIndentedString(configurations)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("configurations"); + openapiFields.add("definition"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServiceResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServiceResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServiceResponse is not found in the empty JSON string", AdditionalServiceResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServiceResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServiceResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("configurations") != null && !jsonObj.get("configurations").isJsonNull()) { + JsonArray jsonArrayconfigurations = jsonObj.getAsJsonArray("configurations"); + if (jsonArrayconfigurations != null) { + // ensure the json data is an array + if (!jsonObj.get("configurations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `configurations` to be an array in the JSON string but got `%s`", jsonObj.get("configurations").toString())); + } + + // validate the optional field `configurations` (array) + for (int i = 0; i < jsonArrayconfigurations.size(); i++) { + ModelConfiguration.validateJsonElement(jsonArrayconfigurations.get(i)); + }; + } + } + // validate the optional field `definition` + if (jsonObj.get("definition") != null && !jsonObj.get("definition").isJsonNull()) { + BasicDefinitionResponse.validateJsonElement(jsonObj.get("definition")); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServiceResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServiceResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServiceResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServiceResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServiceResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServiceResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServiceResponse + * @throws IOException if the JSON string is invalid with respect to AdditionalServiceResponse + */ + public static AdditionalServiceResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServiceResponse.class); + } + + /** + * Convert an instance of AdditionalServiceResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceTranslation.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceTranslation.java new file mode 100644 index 0000000..9d02c6c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServiceTranslation.java @@ -0,0 +1,238 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AdditionalServiceDefinitionRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServiceTranslation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServiceTranslation { + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nullable + private AdditionalServiceDefinitionRequest definition; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public AdditionalServiceTranslation() { + } + + public AdditionalServiceTranslation definition(@javax.annotation.Nullable AdditionalServiceDefinitionRequest definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nullable + public AdditionalServiceDefinitionRequest getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nullable AdditionalServiceDefinitionRequest definition) { + this.definition = definition; + } + + + public AdditionalServiceTranslation description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description of an additional service - provided by merchants and visible by customers. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServiceTranslation additionalServiceTranslation = (AdditionalServiceTranslation) o; + return Objects.equals(this.definition, additionalServiceTranslation.definition) && + Objects.equals(this.description, additionalServiceTranslation.description); + } + + @Override + public int hashCode() { + return Objects.hash(definition, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServiceTranslation {\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("definition"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServiceTranslation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServiceTranslation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServiceTranslation is not found in the empty JSON string", AdditionalServiceTranslation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServiceTranslation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServiceTranslation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `definition` + if (jsonObj.get("definition") != null && !jsonObj.get("definition").isJsonNull()) { + AdditionalServiceDefinitionRequest.validateJsonElement(jsonObj.get("definition")); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServiceTranslation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServiceTranslation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServiceTranslation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServiceTranslation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServiceTranslation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServiceTranslation given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServiceTranslation + * @throws IOException if the JSON string is invalid with respect to AdditionalServiceTranslation + */ + public static AdditionalServiceTranslation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServiceTranslation.class); + } + + /** + * Convert an instance of AdditionalServiceTranslation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroup.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroup.java new file mode 100644 index 0000000..18866f1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroup.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServicesGroup + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServicesGroup { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public AdditionalServicesGroup() { + } + + public AdditionalServicesGroup id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of additional service group + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServicesGroup additionalServicesGroup = (AdditionalServicesGroup) o; + return Objects.equals(this.id, additionalServicesGroup.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServicesGroup {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServicesGroup + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServicesGroup.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServicesGroup is not found in the empty JSON string", AdditionalServicesGroup.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServicesGroup.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServicesGroup` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServicesGroup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServicesGroup' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServicesGroup.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServicesGroup value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServicesGroup read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServicesGroup given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServicesGroup + * @throws IOException if the JSON string is invalid with respect to AdditionalServicesGroup + */ + public static AdditionalServicesGroup fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServicesGroup.class); + } + + /** + * Convert an instance of AdditionalServicesGroup to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupRequest.java new file mode 100644 index 0000000..176558c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupRequest.java @@ -0,0 +1,294 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalServiceRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServicesGroupRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServicesGroupRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nonnull + private String language; + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nonnull + private List additionalServices = new ArrayList<>(); + + public AdditionalServicesGroupRequest() { + } + + public AdditionalServicesGroupRequest name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Name of the group provided by merchant, invisible for buyers. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AdditionalServicesGroupRequest language(@javax.annotation.Nonnull String language) { + this.language = language; + return this; + } + + /** + * IETF language tag. Must be equal to main language for given marketplace: 'pl-PL' on allegro.pl and 'cs-CZ' on allegro.cz while creating new group.<br/> Cannot change the language of already created group while modifying existing group. + * @return language + */ + @javax.annotation.Nonnull + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nonnull String language) { + this.language = language; + } + + + public AdditionalServicesGroupRequest additionalServices(@javax.annotation.Nonnull List additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + public AdditionalServicesGroupRequest addAdditionalServicesItem(AdditionalServiceRequest additionalServicesItem) { + if (this.additionalServices == null) { + this.additionalServices = new ArrayList<>(); + } + this.additionalServices.add(additionalServicesItem); + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nonnull + public List getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nonnull List additionalServices) { + this.additionalServices = additionalServices; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServicesGroupRequest additionalServicesGroupRequest = (AdditionalServicesGroupRequest) o; + return Objects.equals(this.name, additionalServicesGroupRequest.name) && + Objects.equals(this.language, additionalServicesGroupRequest.language) && + Objects.equals(this.additionalServices, additionalServicesGroupRequest.additionalServices); + } + + @Override + public int hashCode() { + return Objects.hash(name, language, additionalServices); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServicesGroupRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("language"); + openapiFields.add("additionalServices"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("language"); + openapiRequiredFields.add("additionalServices"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServicesGroupRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServicesGroupRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServicesGroupRequest is not found in the empty JSON string", AdditionalServicesGroupRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServicesGroupRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServicesGroupRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdditionalServicesGroupRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("additionalServices").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalServices` to be an array in the JSON string but got `%s`", jsonObj.get("additionalServices").toString())); + } + + JsonArray jsonArrayadditionalServices = jsonObj.getAsJsonArray("additionalServices"); + // validate the required field `additionalServices` (array) + for (int i = 0; i < jsonArrayadditionalServices.size(); i++) { + AdditionalServiceRequest.validateJsonElement(jsonArrayadditionalServices.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServicesGroupRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServicesGroupRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServicesGroupRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServicesGroupRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServicesGroupRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServicesGroupRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServicesGroupRequest + * @throws IOException if the JSON string is invalid with respect to AdditionalServicesGroupRequest + */ + public static AdditionalServicesGroupRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServicesGroupRequest.class); + } + + /** + * Convert an instance of AdditionalServicesGroupRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupResponse.java new file mode 100644 index 0000000..423adb4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupResponse.java @@ -0,0 +1,417 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AdditionalServiceResponse; +import pl.wtx.allegro.api.client.model.Reference; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServicesGroupResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServicesGroupResponse { + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private List additionalServices = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_SELLER = "seller"; + @SerializedName(SERIALIZED_NAME_SELLER) + @javax.annotation.Nullable + private Reference seller; + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nullable + private String language; + + public AdditionalServicesGroupResponse() { + } + + public AdditionalServicesGroupResponse additionalServices(@javax.annotation.Nullable List additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + public AdditionalServicesGroupResponse addAdditionalServicesItem(AdditionalServiceResponse additionalServicesItem) { + if (this.additionalServices == null) { + this.additionalServices = new ArrayList<>(); + } + this.additionalServices.add(additionalServicesItem); + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nullable + public List getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable List additionalServices) { + this.additionalServices = additionalServices; + } + + + public AdditionalServicesGroupResponse createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AdditionalServicesGroupResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public AdditionalServicesGroupResponse updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public AdditionalServicesGroupResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the group provided by merchant, invisible for buyers. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public AdditionalServicesGroupResponse seller(@javax.annotation.Nullable Reference seller) { + this.seller = seller; + return this; + } + + /** + * Get seller + * @return seller + */ + @javax.annotation.Nullable + public Reference getSeller() { + return seller; + } + + public void setSeller(@javax.annotation.Nullable Reference seller) { + this.seller = seller; + } + + + public AdditionalServicesGroupResponse language(@javax.annotation.Nullable String language) { + this.language = language; + return this; + } + + /** + * IETF language tag. + * @return language + */ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nullable String language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServicesGroupResponse additionalServicesGroupResponse = (AdditionalServicesGroupResponse) o; + return Objects.equals(this.additionalServices, additionalServicesGroupResponse.additionalServices) && + Objects.equals(this.createdAt, additionalServicesGroupResponse.createdAt) && + Objects.equals(this.id, additionalServicesGroupResponse.id) && + Objects.equals(this.updatedAt, additionalServicesGroupResponse.updatedAt) && + Objects.equals(this.name, additionalServicesGroupResponse.name) && + Objects.equals(this.seller, additionalServicesGroupResponse.seller) && + Objects.equals(this.language, additionalServicesGroupResponse.language); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(additionalServices, createdAt, id, updatedAt, name, seller, language); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServicesGroupResponse {\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" seller: ").append(toIndentedString(seller)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("additionalServices"); + openapiFields.add("createdAt"); + openapiFields.add("id"); + openapiFields.add("updatedAt"); + openapiFields.add("name"); + openapiFields.add("seller"); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServicesGroupResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServicesGroupResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServicesGroupResponse is not found in the empty JSON string", AdditionalServicesGroupResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServicesGroupResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServicesGroupResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull()) { + JsonArray jsonArrayadditionalServices = jsonObj.getAsJsonArray("additionalServices"); + if (jsonArrayadditionalServices != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalServices").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalServices` to be an array in the JSON string but got `%s`", jsonObj.get("additionalServices").toString())); + } + + // validate the optional field `additionalServices` (array) + for (int i = 0; i < jsonArrayadditionalServices.size(); i++) { + AdditionalServiceResponse.validateJsonElement(jsonArrayadditionalServices.get(i)); + }; + } + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `seller` + if (jsonObj.get("seller") != null && !jsonObj.get("seller").isJsonNull()) { + Reference.validateJsonElement(jsonObj.get("seller")); + } + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServicesGroupResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServicesGroupResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServicesGroupResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServicesGroupResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServicesGroupResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServicesGroupResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServicesGroupResponse + * @throws IOException if the JSON string is invalid with respect to AdditionalServicesGroupResponse + */ + public static AdditionalServicesGroupResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServicesGroupResponse.class); + } + + /** + * Convert an instance of AdditionalServicesGroupResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationRequest.java new file mode 100644 index 0000000..a19a105 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationRequest.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AdditionalServicesGroupTranslationWrapper; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServicesGroupTranslationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServicesGroupTranslationRequest { + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private AdditionalServicesGroupTranslationWrapper additionalServices; + + public AdditionalServicesGroupTranslationRequest() { + } + + public AdditionalServicesGroupTranslationRequest additionalServices(@javax.annotation.Nullable AdditionalServicesGroupTranslationWrapper additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nullable + public AdditionalServicesGroupTranslationWrapper getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable AdditionalServicesGroupTranslationWrapper additionalServices) { + this.additionalServices = additionalServices; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServicesGroupTranslationRequest additionalServicesGroupTranslationRequest = (AdditionalServicesGroupTranslationRequest) o; + return Objects.equals(this.additionalServices, additionalServicesGroupTranslationRequest.additionalServices); + } + + @Override + public int hashCode() { + return Objects.hash(additionalServices); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServicesGroupTranslationRequest {\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("additionalServices"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServicesGroupTranslationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServicesGroupTranslationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServicesGroupTranslationRequest is not found in the empty JSON string", AdditionalServicesGroupTranslationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServicesGroupTranslationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServicesGroupTranslationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `additionalServices` + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull()) { + AdditionalServicesGroupTranslationWrapper.validateJsonElement(jsonObj.get("additionalServices")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServicesGroupTranslationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServicesGroupTranslationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServicesGroupTranslationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServicesGroupTranslationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServicesGroupTranslationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServicesGroupTranslationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServicesGroupTranslationRequest + * @throws IOException if the JSON string is invalid with respect to AdditionalServicesGroupTranslationRequest + */ + public static AdditionalServicesGroupTranslationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServicesGroupTranslationRequest.class); + } + + /** + * Convert an instance of AdditionalServicesGroupTranslationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationWrapper.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationWrapper.java new file mode 100644 index 0000000..656e101 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationWrapper.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalServiceTranslation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServicesGroupTranslationWrapper + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServicesGroupTranslationWrapper { + public static final String SERIALIZED_NAME_TRANSLATION = "translation"; + @SerializedName(SERIALIZED_NAME_TRANSLATION) + @javax.annotation.Nullable + private List translation = new ArrayList<>(); + + public AdditionalServicesGroupTranslationWrapper() { + } + + public AdditionalServicesGroupTranslationWrapper translation(@javax.annotation.Nullable List translation) { + this.translation = translation; + return this; + } + + public AdditionalServicesGroupTranslationWrapper addTranslationItem(AdditionalServiceTranslation translationItem) { + if (this.translation == null) { + this.translation = new ArrayList<>(); + } + this.translation.add(translationItem); + return this; + } + + /** + * Get translation + * @return translation + */ + @javax.annotation.Nullable + public List getTranslation() { + return translation; + } + + public void setTranslation(@javax.annotation.Nullable List translation) { + this.translation = translation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServicesGroupTranslationWrapper additionalServicesGroupTranslationWrapper = (AdditionalServicesGroupTranslationWrapper) o; + return Objects.equals(this.translation, additionalServicesGroupTranslationWrapper.translation); + } + + @Override + public int hashCode() { + return Objects.hash(translation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServicesGroupTranslationWrapper {\n"); + sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("translation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServicesGroupTranslationWrapper + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServicesGroupTranslationWrapper.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServicesGroupTranslationWrapper is not found in the empty JSON string", AdditionalServicesGroupTranslationWrapper.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServicesGroupTranslationWrapper.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServicesGroupTranslationWrapper` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("translation") != null && !jsonObj.get("translation").isJsonNull()) { + JsonArray jsonArraytranslation = jsonObj.getAsJsonArray("translation"); + if (jsonArraytranslation != null) { + // ensure the json data is an array + if (!jsonObj.get("translation").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `translation` to be an array in the JSON string but got `%s`", jsonObj.get("translation").toString())); + } + + // validate the optional field `translation` (array) + for (int i = 0; i < jsonArraytranslation.size(); i++) { + AdditionalServiceTranslation.validateJsonElement(jsonArraytranslation.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServicesGroupTranslationWrapper.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServicesGroupTranslationWrapper' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServicesGroupTranslationWrapper.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServicesGroupTranslationWrapper value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServicesGroupTranslationWrapper read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServicesGroupTranslationWrapper given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServicesGroupTranslationWrapper + * @throws IOException if the JSON string is invalid with respect to AdditionalServicesGroupTranslationWrapper + */ + public static AdditionalServicesGroupTranslationWrapper fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServicesGroupTranslationWrapper.class); + } + + /** + * Convert an instance of AdditionalServicesGroupTranslationWrapper to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationWrapperWithType.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationWrapperWithType.java new file mode 100644 index 0000000..f3d4dc7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroupTranslationWrapperWithType.java @@ -0,0 +1,314 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalServiceTranslation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServicesGroupTranslationWrapperWithType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServicesGroupTranslationWrapperWithType { + public static final String SERIALIZED_NAME_TRANSLATION = "translation"; + @SerializedName(SERIALIZED_NAME_TRANSLATION) + @javax.annotation.Nullable + private List translation = new ArrayList<>(); + + /** + * Type of translation. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + MANUAL("MANUAL"), + + AUTO("AUTO"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public AdditionalServicesGroupTranslationWrapperWithType() { + } + + public AdditionalServicesGroupTranslationWrapperWithType translation(@javax.annotation.Nullable List translation) { + this.translation = translation; + return this; + } + + public AdditionalServicesGroupTranslationWrapperWithType addTranslationItem(AdditionalServiceTranslation translationItem) { + if (this.translation == null) { + this.translation = new ArrayList<>(); + } + this.translation.add(translationItem); + return this; + } + + /** + * Get translation + * @return translation + */ + @javax.annotation.Nullable + public List getTranslation() { + return translation; + } + + public void setTranslation(@javax.annotation.Nullable List translation) { + this.translation = translation; + } + + + public AdditionalServicesGroupTranslationWrapperWithType type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of translation. + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServicesGroupTranslationWrapperWithType additionalServicesGroupTranslationWrapperWithType = (AdditionalServicesGroupTranslationWrapperWithType) o; + return Objects.equals(this.translation, additionalServicesGroupTranslationWrapperWithType.translation) && + Objects.equals(this.type, additionalServicesGroupTranslationWrapperWithType.type); + } + + @Override + public int hashCode() { + return Objects.hash(translation, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServicesGroupTranslationWrapperWithType {\n"); + sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("translation"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServicesGroupTranslationWrapperWithType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServicesGroupTranslationWrapperWithType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServicesGroupTranslationWrapperWithType is not found in the empty JSON string", AdditionalServicesGroupTranslationWrapperWithType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServicesGroupTranslationWrapperWithType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServicesGroupTranslationWrapperWithType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("translation") != null && !jsonObj.get("translation").isJsonNull()) { + JsonArray jsonArraytranslation = jsonObj.getAsJsonArray("translation"); + if (jsonArraytranslation != null) { + // ensure the json data is an array + if (!jsonObj.get("translation").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `translation` to be an array in the JSON string but got `%s`", jsonObj.get("translation").toString())); + } + + // validate the optional field `translation` (array) + for (int i = 0; i < jsonArraytranslation.size(); i++) { + AdditionalServiceTranslation.validateJsonElement(jsonArraytranslation.get(i)); + }; + } + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServicesGroupTranslationWrapperWithType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServicesGroupTranslationWrapperWithType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServicesGroupTranslationWrapperWithType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServicesGroupTranslationWrapperWithType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServicesGroupTranslationWrapperWithType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServicesGroupTranslationWrapperWithType given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServicesGroupTranslationWrapperWithType + * @throws IOException if the JSON string is invalid with respect to AdditionalServicesGroupTranslationWrapperWithType + */ + public static AdditionalServicesGroupTranslationWrapperWithType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServicesGroupTranslationWrapperWithType.class); + } + + /** + * Convert an instance of AdditionalServicesGroupTranslationWrapperWithType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroups.java b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroups.java new file mode 100644 index 0000000..16cfe65 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdditionalServicesGroups.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalServicesGroupResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdditionalServicesGroups + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdditionalServicesGroups { + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES_GROUPS = "additionalServicesGroups"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES_GROUPS) + @javax.annotation.Nullable + private List additionalServicesGroups = new ArrayList<>(); + + public AdditionalServicesGroups() { + } + + public AdditionalServicesGroups additionalServicesGroups(@javax.annotation.Nullable List additionalServicesGroups) { + this.additionalServicesGroups = additionalServicesGroups; + return this; + } + + public AdditionalServicesGroups addAdditionalServicesGroupsItem(AdditionalServicesGroupResponse additionalServicesGroupsItem) { + if (this.additionalServicesGroups == null) { + this.additionalServicesGroups = new ArrayList<>(); + } + this.additionalServicesGroups.add(additionalServicesGroupsItem); + return this; + } + + /** + * Get additionalServicesGroups + * @return additionalServicesGroups + */ + @javax.annotation.Nullable + public List getAdditionalServicesGroups() { + return additionalServicesGroups; + } + + public void setAdditionalServicesGroups(@javax.annotation.Nullable List additionalServicesGroups) { + this.additionalServicesGroups = additionalServicesGroups; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalServicesGroups additionalServicesGroups = (AdditionalServicesGroups) o; + return Objects.equals(this.additionalServicesGroups, additionalServicesGroups.additionalServicesGroups); + } + + @Override + public int hashCode() { + return Objects.hash(additionalServicesGroups); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalServicesGroups {\n"); + sb.append(" additionalServicesGroups: ").append(toIndentedString(additionalServicesGroups)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("additionalServicesGroups"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdditionalServicesGroups + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdditionalServicesGroups.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalServicesGroups is not found in the empty JSON string", AdditionalServicesGroups.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdditionalServicesGroups.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalServicesGroups` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("additionalServicesGroups") != null && !jsonObj.get("additionalServicesGroups").isJsonNull()) { + JsonArray jsonArrayadditionalServicesGroups = jsonObj.getAsJsonArray("additionalServicesGroups"); + if (jsonArrayadditionalServicesGroups != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalServicesGroups").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalServicesGroups` to be an array in the JSON string but got `%s`", jsonObj.get("additionalServicesGroups").toString())); + } + + // validate the optional field `additionalServicesGroups` (array) + for (int i = 0; i < jsonArrayadditionalServicesGroups.size(); i++) { + AdditionalServicesGroupResponse.validateJsonElement(jsonArrayadditionalServicesGroups.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdditionalServicesGroups.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdditionalServicesGroups' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdditionalServicesGroups.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdditionalServicesGroups value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdditionalServicesGroups read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdditionalServicesGroups given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdditionalServicesGroups + * @throws IOException if the JSON string is invalid with respect to AdditionalServicesGroups + */ + public static AdditionalServicesGroups fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdditionalServicesGroups.class); + } + + /** + * Convert an instance of AdditionalServicesGroups to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Address.java b/src/main/java/pl/wtx/allegro/api/client/model/Address.java new file mode 100644 index 0000000..6bc0d76 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Address.java @@ -0,0 +1,369 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Coordinates; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Address + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Address { + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nullable + private String street; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_ZIP_CODE = "zipCode"; + @SerializedName(SERIALIZED_NAME_ZIP_CODE) + @javax.annotation.Nonnull + private String zipCode; + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nonnull + private String state; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode; + + public static final String SERIALIZED_NAME_COORDINATES = "coordinates"; + @SerializedName(SERIALIZED_NAME_COORDINATES) + @javax.annotation.Nullable + private Coordinates coordinates; + + public Address() { + } + + public Address street(@javax.annotation.Nullable String street) { + this.street = street; + return this; + } + + /** + * Get street + * @return street + */ + @javax.annotation.Nullable + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nullable String street) { + this.street = street; + } + + + public Address city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * Get city + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public Address zipCode(@javax.annotation.Nonnull String zipCode) { + this.zipCode = zipCode; + return this; + } + + /** + * Get zipCode + * @return zipCode + */ + @javax.annotation.Nonnull + public String getZipCode() { + return zipCode; + } + + public void setZipCode(@javax.annotation.Nonnull String zipCode) { + this.zipCode = zipCode; + } + + + public Address state(@javax.annotation.Nonnull String state) { + this.state = state; + return this; + } + + /** + * Get state + * @return state + */ + @javax.annotation.Nonnull + public String getState() { + return state; + } + + public void setState(@javax.annotation.Nonnull String state) { + this.state = state; + } + + + public Address countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get countryCode + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + public Address coordinates(@javax.annotation.Nullable Coordinates coordinates) { + this.coordinates = coordinates; + return this; + } + + /** + * Get coordinates + * @return coordinates + */ + @javax.annotation.Nullable + public Coordinates getCoordinates() { + return coordinates; + } + + public void setCoordinates(@javax.annotation.Nullable Coordinates coordinates) { + this.coordinates = coordinates; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Address address = (Address) o; + return Objects.equals(this.street, address.street) && + Objects.equals(this.city, address.city) && + Objects.equals(this.zipCode, address.zipCode) && + Objects.equals(this.state, address.state) && + Objects.equals(this.countryCode, address.countryCode) && + Objects.equals(this.coordinates, address.coordinates); + } + + @Override + public int hashCode() { + return Objects.hash(street, city, zipCode, state, countryCode, coordinates); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Address {\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" zipCode: ").append(toIndentedString(zipCode)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" coordinates: ").append(toIndentedString(coordinates)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("street"); + openapiFields.add("city"); + openapiFields.add("zipCode"); + openapiFields.add("state"); + openapiFields.add("countryCode"); + openapiFields.add("coordinates"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("zipCode"); + openapiRequiredFields.add("state"); + openapiRequiredFields.add("countryCode"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Address + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Address.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Address is not found in the empty JSON string", Address.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Address.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Address` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Address.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("street") != null && !jsonObj.get("street").isJsonNull()) && !jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if (!jsonObj.get("zipCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `zipCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("zipCode").toString())); + } + if (!jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + // validate the optional field `coordinates` + if (jsonObj.get("coordinates") != null && !jsonObj.get("coordinates").isJsonNull()) { + Coordinates.validateJsonElement(jsonObj.get("coordinates")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Address.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Address' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter
thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Address.class)); + + return (TypeAdapter) new TypeAdapter
() { + @Override + public void write(JsonWriter out, Address value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Address read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Address given an JSON string + * + * @param jsonString JSON string + * @return An instance of Address + * @throws IOException if the JSON string is invalid with respect to Address + */ + public static Address fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Address.class); + } + + /** + * Convert an instance of Address to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AddressDto.java b/src/main/java/pl/wtx/allegro/api/client/model/AddressDto.java new file mode 100644 index 0000000..3aeec5b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AddressDto.java @@ -0,0 +1,489 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Address object + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AddressDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_COMPANY = "company"; + @SerializedName(SERIALIZED_NAME_COMPANY) + @javax.annotation.Nullable + private String company; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_POSTAL_CODE = "postalCode"; + @SerializedName(SERIALIZED_NAME_POSTAL_CODE) + @javax.annotation.Nonnull + private String postalCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nullable + private String state; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode = "PL"; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nonnull + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nonnull + private String phone; + + public static final String SERIALIZED_NAME_POINT = "point"; + @SerializedName(SERIALIZED_NAME_POINT) + @javax.annotation.Nullable + private String point; + + public AddressDto() { + } + + public AddressDto name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Person name. Name or Company are required. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public AddressDto company(@javax.annotation.Nullable String company) { + this.company = company; + return this; + } + + /** + * Company name. Name or Company are required. + * @return company + */ + @javax.annotation.Nullable + public String getCompany() { + return company; + } + + public void setCompany(@javax.annotation.Nullable String company) { + this.company = company; + } + + + public AddressDto street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Get street + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public AddressDto postalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * Get postalCode + * @return postalCode + */ + @javax.annotation.Nonnull + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + } + + + public AddressDto city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * Get city + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public AddressDto state(@javax.annotation.Nullable String state) { + this.state = state; + return this; + } + + /** + * Required for shipments to Ireland( county name ), United States ( state abbreviation / ISO code ), Canada ( province postal code / ISO code ) + * @return state + */ + @javax.annotation.Nullable + public String getState() { + return state; + } + + public void setState(@javax.annotation.Nullable String state) { + this.state = state; + } + + + public AddressDto countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code in ISO 3166-1 alfa-2 format (two-letter code). + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + public AddressDto email(@javax.annotation.Nonnull String email) { + this.email = email; + return this; + } + + /** + * Email address. For receiver, must be a valid buyer email generated by Allegro (eg. hamu7udk3p+17454c1b6@allegromail.pl). + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nonnull String email) { + this.email = email; + } + + + public AddressDto phone(@javax.annotation.Nonnull String phone) { + this.phone = phone; + return this; + } + + /** + * Cell phone + * @return phone + */ + @javax.annotation.Nonnull + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nonnull String phone) { + this.phone = phone; + } + + + public AddressDto point(@javax.annotation.Nullable String point) { + this.point = point; + return this; + } + + /** + * Pickup point id. You can get it from order or directly from courier service. + * @return point + */ + @javax.annotation.Nullable + public String getPoint() { + return point; + } + + public void setPoint(@javax.annotation.Nullable String point) { + this.point = point; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddressDto addressDto = (AddressDto) o; + return Objects.equals(this.name, addressDto.name) && + Objects.equals(this.company, addressDto.company) && + Objects.equals(this.street, addressDto.street) && + Objects.equals(this.postalCode, addressDto.postalCode) && + Objects.equals(this.city, addressDto.city) && + Objects.equals(this.state, addressDto.state) && + Objects.equals(this.countryCode, addressDto.countryCode) && + Objects.equals(this.email, addressDto.email) && + Objects.equals(this.phone, addressDto.phone) && + Objects.equals(this.point, addressDto.point); + } + + @Override + public int hashCode() { + return Objects.hash(name, company, street, postalCode, city, state, countryCode, email, phone, point); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddressDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" company: ").append(toIndentedString(company)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" point: ").append(toIndentedString(point)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("company"); + openapiFields.add("street"); + openapiFields.add("postalCode"); + openapiFields.add("city"); + openapiFields.add("state"); + openapiFields.add("countryCode"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("point"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("postalCode"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("countryCode"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AddressDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddressDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AddressDto is not found in the empty JSON string", AddressDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddressDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddressDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddressDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("company") != null && !jsonObj.get("company").isJsonNull()) && !jsonObj.get("company").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `company` to be a primitive type in the JSON string but got `%s`", jsonObj.get("company").toString())); + } + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("postalCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postalCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postalCode").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + if ((jsonObj.get("point") != null && !jsonObj.get("point").isJsonNull()) && !jsonObj.get("point").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `point` to be a primitive type in the JSON string but got `%s`", jsonObj.get("point").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddressDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddressDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AddressDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AddressDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddressDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AddressDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddressDto + * @throws IOException if the JSON string is invalid with respect to AddressDto + */ + public static AddressDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddressDto.class); + } + + /** + * Convert an instance of AddressDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNotice.java b/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNotice.java new file mode 100644 index 0000000..5d9d280 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNotice.java @@ -0,0 +1,296 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.HandlingUnit; +import pl.wtx.allegro.api.client.model.ProductItem; +import pl.wtx.allegro.api.client.model.Shipping; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdvanceShipNotice + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdvanceShipNotice { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public static final String SERIALIZED_NAME_HANDLING_UNIT = "handlingUnit"; + @SerializedName(SERIALIZED_NAME_HANDLING_UNIT) + @javax.annotation.Nullable + private HandlingUnit handlingUnit; + + public static final String SERIALIZED_NAME_SHIPPING = "shipping"; + @SerializedName(SERIALIZED_NAME_SHIPPING) + @javax.annotation.Nullable + private Shipping shipping; + + public AdvanceShipNotice() { + } + + public AdvanceShipNotice items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public AdvanceShipNotice addItemsItem(ProductItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of product items. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + + public AdvanceShipNotice handlingUnit(@javax.annotation.Nullable HandlingUnit handlingUnit) { + this.handlingUnit = handlingUnit; + return this; + } + + /** + * Get handlingUnit + * @return handlingUnit + */ + @javax.annotation.Nullable + public HandlingUnit getHandlingUnit() { + return handlingUnit; + } + + public void setHandlingUnit(@javax.annotation.Nullable HandlingUnit handlingUnit) { + this.handlingUnit = handlingUnit; + } + + + public AdvanceShipNotice shipping(@javax.annotation.Nullable Shipping shipping) { + this.shipping = shipping; + return this; + } + + /** + * Get shipping + * @return shipping + */ + @javax.annotation.Nullable + public Shipping getShipping() { + return shipping; + } + + public void setShipping(@javax.annotation.Nullable Shipping shipping) { + this.shipping = shipping; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdvanceShipNotice advanceShipNotice = (AdvanceShipNotice) o; + return Objects.equals(this.items, advanceShipNotice.items) && + Objects.equals(this.handlingUnit, advanceShipNotice.handlingUnit) && + Objects.equals(this.shipping, advanceShipNotice.shipping); + } + + @Override + public int hashCode() { + return Objects.hash(items, handlingUnit, shipping); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdvanceShipNotice {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" handlingUnit: ").append(toIndentedString(handlingUnit)).append("\n"); + sb.append(" shipping: ").append(toIndentedString(shipping)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("items"); + openapiFields.add("handlingUnit"); + openapiFields.add("shipping"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("items"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdvanceShipNotice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdvanceShipNotice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdvanceShipNotice is not found in the empty JSON string", AdvanceShipNotice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdvanceShipNotice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdvanceShipNotice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdvanceShipNotice.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + ProductItem.validateJsonElement(jsonArrayitems.get(i)); + }; + // validate the optional field `handlingUnit` + if (jsonObj.get("handlingUnit") != null && !jsonObj.get("handlingUnit").isJsonNull()) { + HandlingUnit.validateJsonElement(jsonObj.get("handlingUnit")); + } + // validate the optional field `shipping` + if (jsonObj.get("shipping") != null && !jsonObj.get("shipping").isJsonNull()) { + Shipping.validateJsonElement(jsonObj.get("shipping")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdvanceShipNotice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdvanceShipNotice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdvanceShipNotice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdvanceShipNotice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdvanceShipNotice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdvanceShipNotice given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdvanceShipNotice + * @throws IOException if the JSON string is invalid with respect to AdvanceShipNotice + */ + public static AdvanceShipNotice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdvanceShipNotice.class); + } + + /** + * Convert an instance of AdvanceShipNotice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeList.java b/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeList.java new file mode 100644 index 0000000..27255f5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeList.java @@ -0,0 +1,289 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdvanceShipNoticeResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The list of Advance Ship Notices. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdvanceShipNoticeList { + public static final String SERIALIZED_NAME_ADVANCE_SHIP_NOTICES = "advanceShipNotices"; + @SerializedName(SERIALIZED_NAME_ADVANCE_SHIP_NOTICES) + @javax.annotation.Nonnull + private List advanceShipNotices = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nonnull + private BigDecimal count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nonnull + private BigDecimal totalCount; + + public AdvanceShipNoticeList() { + } + + public AdvanceShipNoticeList advanceShipNotices(@javax.annotation.Nonnull List advanceShipNotices) { + this.advanceShipNotices = advanceShipNotices; + return this; + } + + public AdvanceShipNoticeList addAdvanceShipNoticesItem(AdvanceShipNoticeResponse advanceShipNoticesItem) { + if (this.advanceShipNotices == null) { + this.advanceShipNotices = new ArrayList<>(); + } + this.advanceShipNotices.add(advanceShipNoticesItem); + return this; + } + + /** + * Get advanceShipNotices + * @return advanceShipNotices + */ + @javax.annotation.Nonnull + public List getAdvanceShipNotices() { + return advanceShipNotices; + } + + public void setAdvanceShipNotices(@javax.annotation.Nonnull List advanceShipNotices) { + this.advanceShipNotices = advanceShipNotices; + } + + + public AdvanceShipNoticeList count(@javax.annotation.Nonnull BigDecimal count) { + this.count = count; + return this; + } + + /** + * A number of Advance Ship Notices in response. + * @return count + */ + @javax.annotation.Nonnull + public BigDecimal getCount() { + return count; + } + + public void setCount(@javax.annotation.Nonnull BigDecimal count) { + this.count = count; + } + + + public AdvanceShipNoticeList totalCount(@javax.annotation.Nonnull BigDecimal totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * A number of Advance Ship Notices in total. + * @return totalCount + */ + @javax.annotation.Nonnull + public BigDecimal getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nonnull BigDecimal totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdvanceShipNoticeList advanceShipNoticeList = (AdvanceShipNoticeList) o; + return Objects.equals(this.advanceShipNotices, advanceShipNoticeList.advanceShipNotices) && + Objects.equals(this.count, advanceShipNoticeList.count) && + Objects.equals(this.totalCount, advanceShipNoticeList.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(advanceShipNotices, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdvanceShipNoticeList {\n"); + sb.append(" advanceShipNotices: ").append(toIndentedString(advanceShipNotices)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("advanceShipNotices"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("advanceShipNotices"); + openapiRequiredFields.add("count"); + openapiRequiredFields.add("totalCount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdvanceShipNoticeList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdvanceShipNoticeList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdvanceShipNoticeList is not found in the empty JSON string", AdvanceShipNoticeList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdvanceShipNoticeList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdvanceShipNoticeList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdvanceShipNoticeList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("advanceShipNotices").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `advanceShipNotices` to be an array in the JSON string but got `%s`", jsonObj.get("advanceShipNotices").toString())); + } + + JsonArray jsonArrayadvanceShipNotices = jsonObj.getAsJsonArray("advanceShipNotices"); + // validate the required field `advanceShipNotices` (array) + for (int i = 0; i < jsonArrayadvanceShipNotices.size(); i++) { + AdvanceShipNoticeResponse.validateJsonElement(jsonArrayadvanceShipNotices.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdvanceShipNoticeList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdvanceShipNoticeList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdvanceShipNoticeList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdvanceShipNoticeList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdvanceShipNoticeList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdvanceShipNoticeList given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdvanceShipNoticeList + * @throws IOException if the JSON string is invalid with respect to AdvanceShipNoticeList + */ + public static AdvanceShipNoticeList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdvanceShipNoticeList.class); + } + + /** + * Convert an instance of AdvanceShipNoticeList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeResponse.java new file mode 100644 index 0000000..4f72dc0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeResponse.java @@ -0,0 +1,506 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.AdvanceShipNoticeStatus; +import pl.wtx.allegro.api.client.model.HandlingUnit; +import pl.wtx.allegro.api.client.model.Labels; +import pl.wtx.allegro.api.client.model.ProductItem; +import pl.wtx.allegro.api.client.model.ShippingExtended; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AdvanceShipNoticeResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AdvanceShipNoticeResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_DISPLAY_NUMBER = "displayNumber"; + @SerializedName(SERIALIZED_NAME_DISPLAY_NUMBER) + @javax.annotation.Nonnull + private String displayNumber; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private AdvanceShipNoticeStatus status; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public static final String SERIALIZED_NAME_HANDLING_UNIT = "handlingUnit"; + @SerializedName(SERIALIZED_NAME_HANDLING_UNIT) + @javax.annotation.Nullable + private HandlingUnit handlingUnit; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable + private Labels labels; + + public static final String SERIALIZED_NAME_SHIPPING = "shipping"; + @SerializedName(SERIALIZED_NAME_SHIPPING) + @javax.annotation.Nullable + private ShippingExtended shipping; + + public static final String SERIALIZED_NAME_SUBMITTED_AT = "submittedAt"; + @SerializedName(SERIALIZED_NAME_SUBMITTED_AT) + @javax.annotation.Nullable + private OffsetDateTime submittedAt; + + public AdvanceShipNoticeResponse() { + } + + public AdvanceShipNoticeResponse id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * An UUID identifier of ASN. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public AdvanceShipNoticeResponse displayNumber(@javax.annotation.Nonnull String displayNumber) { + this.displayNumber = displayNumber; + return this; + } + + /** + * A human friendly identifier of ASN. + * @return displayNumber + */ + @javax.annotation.Nonnull + public String getDisplayNumber() { + return displayNumber; + } + + public void setDisplayNumber(@javax.annotation.Nonnull String displayNumber) { + this.displayNumber = displayNumber; + } + + + public AdvanceShipNoticeResponse status(@javax.annotation.Nonnull AdvanceShipNoticeStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public AdvanceShipNoticeStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull AdvanceShipNoticeStatus status) { + this.status = status; + } + + + public AdvanceShipNoticeResponse createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The date and time of Advance Ship Notice creation. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601). + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AdvanceShipNoticeResponse updatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The date and time of last Advance Ship Notice update. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601). + * @return updatedAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public AdvanceShipNoticeResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public AdvanceShipNoticeResponse addItemsItem(ProductItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of product items. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + + public AdvanceShipNoticeResponse handlingUnit(@javax.annotation.Nullable HandlingUnit handlingUnit) { + this.handlingUnit = handlingUnit; + return this; + } + + /** + * Get handlingUnit + * @return handlingUnit + */ + @javax.annotation.Nullable + public HandlingUnit getHandlingUnit() { + return handlingUnit; + } + + public void setHandlingUnit(@javax.annotation.Nullable HandlingUnit handlingUnit) { + this.handlingUnit = handlingUnit; + } + + + public AdvanceShipNoticeResponse labels(@javax.annotation.Nullable Labels labels) { + this.labels = labels; + return this; + } + + /** + * Get labels + * @return labels + */ + @javax.annotation.Nullable + public Labels getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Labels labels) { + this.labels = labels; + } + + + public AdvanceShipNoticeResponse shipping(@javax.annotation.Nullable ShippingExtended shipping) { + this.shipping = shipping; + return this; + } + + /** + * Get shipping + * @return shipping + */ + @javax.annotation.Nullable + public ShippingExtended getShipping() { + return shipping; + } + + public void setShipping(@javax.annotation.Nullable ShippingExtended shipping) { + this.shipping = shipping; + } + + + public AdvanceShipNoticeResponse submittedAt(@javax.annotation.Nullable OffsetDateTime submittedAt) { + this.submittedAt = submittedAt; + return this; + } + + /** + * The date and time of Advance Ship Notice submission. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601). + * @return submittedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getSubmittedAt() { + return submittedAt; + } + + public void setSubmittedAt(@javax.annotation.Nullable OffsetDateTime submittedAt) { + this.submittedAt = submittedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdvanceShipNoticeResponse advanceShipNoticeResponse = (AdvanceShipNoticeResponse) o; + return Objects.equals(this.id, advanceShipNoticeResponse.id) && + Objects.equals(this.displayNumber, advanceShipNoticeResponse.displayNumber) && + Objects.equals(this.status, advanceShipNoticeResponse.status) && + Objects.equals(this.createdAt, advanceShipNoticeResponse.createdAt) && + Objects.equals(this.updatedAt, advanceShipNoticeResponse.updatedAt) && + Objects.equals(this.items, advanceShipNoticeResponse.items) && + Objects.equals(this.handlingUnit, advanceShipNoticeResponse.handlingUnit) && + Objects.equals(this.labels, advanceShipNoticeResponse.labels) && + Objects.equals(this.shipping, advanceShipNoticeResponse.shipping) && + Objects.equals(this.submittedAt, advanceShipNoticeResponse.submittedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, displayNumber, status, createdAt, updatedAt, items, handlingUnit, labels, shipping, submittedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdvanceShipNoticeResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" displayNumber: ").append(toIndentedString(displayNumber)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" handlingUnit: ").append(toIndentedString(handlingUnit)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" shipping: ").append(toIndentedString(shipping)).append("\n"); + sb.append(" submittedAt: ").append(toIndentedString(submittedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("displayNumber"); + openapiFields.add("status"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("items"); + openapiFields.add("handlingUnit"); + openapiFields.add("labels"); + openapiFields.add("shipping"); + openapiFields.add("submittedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("displayNumber"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + openapiRequiredFields.add("items"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AdvanceShipNoticeResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AdvanceShipNoticeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdvanceShipNoticeResponse is not found in the empty JSON string", AdvanceShipNoticeResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AdvanceShipNoticeResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdvanceShipNoticeResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdvanceShipNoticeResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("displayNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `displayNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayNumber").toString())); + } + // validate the required field `status` + AdvanceShipNoticeStatus.validateJsonElement(jsonObj.get("status")); + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + ProductItem.validateJsonElement(jsonArrayitems.get(i)); + }; + // validate the optional field `handlingUnit` + if (jsonObj.get("handlingUnit") != null && !jsonObj.get("handlingUnit").isJsonNull()) { + HandlingUnit.validateJsonElement(jsonObj.get("handlingUnit")); + } + // validate the optional field `labels` + if (jsonObj.get("labels") != null && !jsonObj.get("labels").isJsonNull()) { + Labels.validateJsonElement(jsonObj.get("labels")); + } + // validate the optional field `shipping` + if (jsonObj.get("shipping") != null && !jsonObj.get("shipping").isJsonNull()) { + ShippingExtended.validateJsonElement(jsonObj.get("shipping")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdvanceShipNoticeResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdvanceShipNoticeResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdvanceShipNoticeResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdvanceShipNoticeResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AdvanceShipNoticeResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdvanceShipNoticeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdvanceShipNoticeResponse + * @throws IOException if the JSON string is invalid with respect to AdvanceShipNoticeResponse + */ + public static AdvanceShipNoticeResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdvanceShipNoticeResponse.class); + } + + /** + * Convert an instance of AdvanceShipNoticeResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeStatus.java b/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeStatus.java new file mode 100644 index 0000000..951c552 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AdvanceShipNoticeStatus.java @@ -0,0 +1,84 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The Advance Ship Notice Status. + */ +@JsonAdapter(AdvanceShipNoticeStatus.Adapter.class) +public enum AdvanceShipNoticeStatus { + + DRAFT("DRAFT"), + + IN_TRANSIT("IN_TRANSIT"), + + UNPACKING("UNPACKING"), + + COMPLETED("COMPLETED"), + + CANCELLED("CANCELLED"); + + private String value; + + AdvanceShipNoticeStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AdvanceShipNoticeStatus fromValue(String value) { + for (AdvanceShipNoticeStatus b : AdvanceShipNoticeStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AdvanceShipNoticeStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AdvanceShipNoticeStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AdvanceShipNoticeStatus.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AdvanceShipNoticeStatus.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServices.java b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServices.java new file mode 100644 index 0000000..6453d5c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServices.java @@ -0,0 +1,272 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ImpliedWarranty; +import pl.wtx.allegro.api.client.model.ReturnPolicy; +import pl.wtx.allegro.api.client.model.Warranty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The definitions of the different after sales services assigned to the offer. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AfterSalesServices { + public static final String SERIALIZED_NAME_IMPLIED_WARRANTY = "impliedWarranty"; + @SerializedName(SERIALIZED_NAME_IMPLIED_WARRANTY) + @javax.annotation.Nullable + private ImpliedWarranty impliedWarranty; + + public static final String SERIALIZED_NAME_RETURN_POLICY = "returnPolicy"; + @SerializedName(SERIALIZED_NAME_RETURN_POLICY) + @javax.annotation.Nullable + private ReturnPolicy returnPolicy; + + public static final String SERIALIZED_NAME_WARRANTY = "warranty"; + @SerializedName(SERIALIZED_NAME_WARRANTY) + @javax.annotation.Nullable + private Warranty warranty; + + public AfterSalesServices() { + } + + public AfterSalesServices impliedWarranty(@javax.annotation.Nullable ImpliedWarranty impliedWarranty) { + this.impliedWarranty = impliedWarranty; + return this; + } + + /** + * Get impliedWarranty + * @return impliedWarranty + */ + @javax.annotation.Nullable + public ImpliedWarranty getImpliedWarranty() { + return impliedWarranty; + } + + public void setImpliedWarranty(@javax.annotation.Nullable ImpliedWarranty impliedWarranty) { + this.impliedWarranty = impliedWarranty; + } + + + public AfterSalesServices returnPolicy(@javax.annotation.Nullable ReturnPolicy returnPolicy) { + this.returnPolicy = returnPolicy; + return this; + } + + /** + * Get returnPolicy + * @return returnPolicy + */ + @javax.annotation.Nullable + public ReturnPolicy getReturnPolicy() { + return returnPolicy; + } + + public void setReturnPolicy(@javax.annotation.Nullable ReturnPolicy returnPolicy) { + this.returnPolicy = returnPolicy; + } + + + public AfterSalesServices warranty(@javax.annotation.Nullable Warranty warranty) { + this.warranty = warranty; + return this; + } + + /** + * Get warranty + * @return warranty + */ + @javax.annotation.Nullable + public Warranty getWarranty() { + return warranty; + } + + public void setWarranty(@javax.annotation.Nullable Warranty warranty) { + this.warranty = warranty; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AfterSalesServices afterSalesServices = (AfterSalesServices) o; + return Objects.equals(this.impliedWarranty, afterSalesServices.impliedWarranty) && + Objects.equals(this.returnPolicy, afterSalesServices.returnPolicy) && + Objects.equals(this.warranty, afterSalesServices.warranty); + } + + @Override + public int hashCode() { + return Objects.hash(impliedWarranty, returnPolicy, warranty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AfterSalesServices {\n"); + sb.append(" impliedWarranty: ").append(toIndentedString(impliedWarranty)).append("\n"); + sb.append(" returnPolicy: ").append(toIndentedString(returnPolicy)).append("\n"); + sb.append(" warranty: ").append(toIndentedString(warranty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("impliedWarranty"); + openapiFields.add("returnPolicy"); + openapiFields.add("warranty"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AfterSalesServices + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AfterSalesServices.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AfterSalesServices is not found in the empty JSON string", AfterSalesServices.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AfterSalesServices.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AfterSalesServices` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `impliedWarranty` + if (jsonObj.get("impliedWarranty") != null && !jsonObj.get("impliedWarranty").isJsonNull()) { + ImpliedWarranty.validateJsonElement(jsonObj.get("impliedWarranty")); + } + // validate the optional field `returnPolicy` + if (jsonObj.get("returnPolicy") != null && !jsonObj.get("returnPolicy").isJsonNull()) { + ReturnPolicy.validateJsonElement(jsonObj.get("returnPolicy")); + } + // validate the optional field `warranty` + if (jsonObj.get("warranty") != null && !jsonObj.get("warranty").isJsonNull()) { + Warranty.validateJsonElement(jsonObj.get("warranty")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AfterSalesServices.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AfterSalesServices' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AfterSalesServices.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AfterSalesServices value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AfterSalesServices read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AfterSalesServices given an JSON string + * + * @param jsonString JSON string + * @return An instance of AfterSalesServices + * @throws IOException if the JSON string is invalid with respect to AfterSalesServices + */ + public static AfterSalesServices fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AfterSalesServices.class); + } + + /** + * Convert an instance of AfterSalesServices to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesAddress.java new file mode 100644 index 0000000..e934ae2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesAddress.java @@ -0,0 +1,338 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AfterSalesServicesAddress + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AfterSalesServicesAddress { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_POST_CODE = "postCode"; + @SerializedName(SERIALIZED_NAME_POST_CODE) + @javax.annotation.Nonnull + private String postCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode; + + public AfterSalesServicesAddress() { + } + + public AfterSalesServicesAddress name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Company or person name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AfterSalesServicesAddress street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Street name. + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public AfterSalesServicesAddress postCode(@javax.annotation.Nonnull String postCode) { + this.postCode = postCode; + return this; + } + + /** + * Post code. + * @return postCode + */ + @javax.annotation.Nonnull + public String getPostCode() { + return postCode; + } + + public void setPostCode(@javax.annotation.Nonnull String postCode) { + this.postCode = postCode; + } + + + public AfterSalesServicesAddress city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * City name. + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public AfterSalesServicesAddress countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code. + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AfterSalesServicesAddress afterSalesServicesAddress = (AfterSalesServicesAddress) o; + return Objects.equals(this.name, afterSalesServicesAddress.name) && + Objects.equals(this.street, afterSalesServicesAddress.street) && + Objects.equals(this.postCode, afterSalesServicesAddress.postCode) && + Objects.equals(this.city, afterSalesServicesAddress.city) && + Objects.equals(this.countryCode, afterSalesServicesAddress.countryCode); + } + + @Override + public int hashCode() { + return Objects.hash(name, street, postCode, city, countryCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AfterSalesServicesAddress {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postCode: ").append(toIndentedString(postCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("street"); + openapiFields.add("postCode"); + openapiFields.add("city"); + openapiFields.add("countryCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("postCode"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("countryCode"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AfterSalesServicesAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AfterSalesServicesAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AfterSalesServicesAddress is not found in the empty JSON string", AfterSalesServicesAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AfterSalesServicesAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AfterSalesServicesAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AfterSalesServicesAddress.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("postCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postCode").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AfterSalesServicesAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AfterSalesServicesAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AfterSalesServicesAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AfterSalesServicesAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AfterSalesServicesAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AfterSalesServicesAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of AfterSalesServicesAddress + * @throws IOException if the JSON string is invalid with respect to AfterSalesServicesAddress + */ + public static AfterSalesServicesAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AfterSalesServicesAddress.class); + } + + /** + * Convert an instance of AfterSalesServicesAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesAttachment.java b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesAttachment.java new file mode 100644 index 0000000..37d3206 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesAttachment.java @@ -0,0 +1,267 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AfterSalesServicesAttachment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AfterSalesServicesAttachment { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public AfterSalesServicesAttachment() { + } + + public AfterSalesServicesAttachment id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The Id of the attachment. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public AfterSalesServicesAttachment name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Attachment file name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public AfterSalesServicesAttachment url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Direct link to the attachment. + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AfterSalesServicesAttachment afterSalesServicesAttachment = (AfterSalesServicesAttachment) o; + return Objects.equals(this.id, afterSalesServicesAttachment.id) && + Objects.equals(this.name, afterSalesServicesAttachment.name) && + Objects.equals(this.url, afterSalesServicesAttachment.url); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AfterSalesServicesAttachment {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AfterSalesServicesAttachment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AfterSalesServicesAttachment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AfterSalesServicesAttachment is not found in the empty JSON string", AfterSalesServicesAttachment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AfterSalesServicesAttachment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AfterSalesServicesAttachment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AfterSalesServicesAttachment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AfterSalesServicesAttachment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AfterSalesServicesAttachment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AfterSalesServicesAttachment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AfterSalesServicesAttachment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AfterSalesServicesAttachment given an JSON string + * + * @param jsonString JSON string + * @return An instance of AfterSalesServicesAttachment + * @throws IOException if the JSON string is invalid with respect to AfterSalesServicesAttachment + */ + public static AfterSalesServicesAttachment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AfterSalesServicesAttachment.class); + } + + /** + * Convert an instance of AfterSalesServicesAttachment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequest.java new file mode 100644 index 0000000..8c17406 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequest.java @@ -0,0 +1,272 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AfterSalesServicesProductOfferRequestImpliedWarranty; +import pl.wtx.allegro.api.client.model.AfterSalesServicesProductOfferRequestReturnPolicy; +import pl.wtx.allegro.api.client.model.AfterSalesServicesProductOfferRequestWarranty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The definitions of the different after sales services assigned to the offer. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AfterSalesServicesProductOfferRequest { + public static final String SERIALIZED_NAME_IMPLIED_WARRANTY = "impliedWarranty"; + @SerializedName(SERIALIZED_NAME_IMPLIED_WARRANTY) + @javax.annotation.Nullable + private AfterSalesServicesProductOfferRequestImpliedWarranty impliedWarranty; + + public static final String SERIALIZED_NAME_RETURN_POLICY = "returnPolicy"; + @SerializedName(SERIALIZED_NAME_RETURN_POLICY) + @javax.annotation.Nullable + private AfterSalesServicesProductOfferRequestReturnPolicy returnPolicy; + + public static final String SERIALIZED_NAME_WARRANTY = "warranty"; + @SerializedName(SERIALIZED_NAME_WARRANTY) + @javax.annotation.Nullable + private AfterSalesServicesProductOfferRequestWarranty warranty; + + public AfterSalesServicesProductOfferRequest() { + } + + public AfterSalesServicesProductOfferRequest impliedWarranty(@javax.annotation.Nullable AfterSalesServicesProductOfferRequestImpliedWarranty impliedWarranty) { + this.impliedWarranty = impliedWarranty; + return this; + } + + /** + * Get impliedWarranty + * @return impliedWarranty + */ + @javax.annotation.Nullable + public AfterSalesServicesProductOfferRequestImpliedWarranty getImpliedWarranty() { + return impliedWarranty; + } + + public void setImpliedWarranty(@javax.annotation.Nullable AfterSalesServicesProductOfferRequestImpliedWarranty impliedWarranty) { + this.impliedWarranty = impliedWarranty; + } + + + public AfterSalesServicesProductOfferRequest returnPolicy(@javax.annotation.Nullable AfterSalesServicesProductOfferRequestReturnPolicy returnPolicy) { + this.returnPolicy = returnPolicy; + return this; + } + + /** + * Get returnPolicy + * @return returnPolicy + */ + @javax.annotation.Nullable + public AfterSalesServicesProductOfferRequestReturnPolicy getReturnPolicy() { + return returnPolicy; + } + + public void setReturnPolicy(@javax.annotation.Nullable AfterSalesServicesProductOfferRequestReturnPolicy returnPolicy) { + this.returnPolicy = returnPolicy; + } + + + public AfterSalesServicesProductOfferRequest warranty(@javax.annotation.Nullable AfterSalesServicesProductOfferRequestWarranty warranty) { + this.warranty = warranty; + return this; + } + + /** + * Get warranty + * @return warranty + */ + @javax.annotation.Nullable + public AfterSalesServicesProductOfferRequestWarranty getWarranty() { + return warranty; + } + + public void setWarranty(@javax.annotation.Nullable AfterSalesServicesProductOfferRequestWarranty warranty) { + this.warranty = warranty; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AfterSalesServicesProductOfferRequest afterSalesServicesProductOfferRequest = (AfterSalesServicesProductOfferRequest) o; + return Objects.equals(this.impliedWarranty, afterSalesServicesProductOfferRequest.impliedWarranty) && + Objects.equals(this.returnPolicy, afterSalesServicesProductOfferRequest.returnPolicy) && + Objects.equals(this.warranty, afterSalesServicesProductOfferRequest.warranty); + } + + @Override + public int hashCode() { + return Objects.hash(impliedWarranty, returnPolicy, warranty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AfterSalesServicesProductOfferRequest {\n"); + sb.append(" impliedWarranty: ").append(toIndentedString(impliedWarranty)).append("\n"); + sb.append(" returnPolicy: ").append(toIndentedString(returnPolicy)).append("\n"); + sb.append(" warranty: ").append(toIndentedString(warranty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("impliedWarranty"); + openapiFields.add("returnPolicy"); + openapiFields.add("warranty"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AfterSalesServicesProductOfferRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AfterSalesServicesProductOfferRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AfterSalesServicesProductOfferRequest is not found in the empty JSON string", AfterSalesServicesProductOfferRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AfterSalesServicesProductOfferRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AfterSalesServicesProductOfferRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `impliedWarranty` + if (jsonObj.get("impliedWarranty") != null && !jsonObj.get("impliedWarranty").isJsonNull()) { + AfterSalesServicesProductOfferRequestImpliedWarranty.validateJsonElement(jsonObj.get("impliedWarranty")); + } + // validate the optional field `returnPolicy` + if (jsonObj.get("returnPolicy") != null && !jsonObj.get("returnPolicy").isJsonNull()) { + AfterSalesServicesProductOfferRequestReturnPolicy.validateJsonElement(jsonObj.get("returnPolicy")); + } + // validate the optional field `warranty` + if (jsonObj.get("warranty") != null && !jsonObj.get("warranty").isJsonNull()) { + AfterSalesServicesProductOfferRequestWarranty.validateJsonElement(jsonObj.get("warranty")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AfterSalesServicesProductOfferRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AfterSalesServicesProductOfferRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AfterSalesServicesProductOfferRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AfterSalesServicesProductOfferRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AfterSalesServicesProductOfferRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AfterSalesServicesProductOfferRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AfterSalesServicesProductOfferRequest + * @throws IOException if the JSON string is invalid with respect to AfterSalesServicesProductOfferRequest + */ + public static AfterSalesServicesProductOfferRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AfterSalesServicesProductOfferRequest.class); + } + + /** + * Convert an instance of AfterSalesServicesProductOfferRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestImpliedWarranty.java b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestImpliedWarranty.java new file mode 100644 index 0000000..14840dd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestImpliedWarranty.java @@ -0,0 +1,237 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AfterSalesServicesProductOfferRequestImpliedWarranty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AfterSalesServicesProductOfferRequestImpliedWarranty { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AfterSalesServicesProductOfferRequestImpliedWarranty() { + } + + public AfterSalesServicesProductOfferRequestImpliedWarranty id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the implied warranty definition. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public AfterSalesServicesProductOfferRequestImpliedWarranty name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of the implied warranty definition. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AfterSalesServicesProductOfferRequestImpliedWarranty afterSalesServicesProductOfferRequestImpliedWarranty = (AfterSalesServicesProductOfferRequestImpliedWarranty) o; + return Objects.equals(this.id, afterSalesServicesProductOfferRequestImpliedWarranty.id) && + Objects.equals(this.name, afterSalesServicesProductOfferRequestImpliedWarranty.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AfterSalesServicesProductOfferRequestImpliedWarranty {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AfterSalesServicesProductOfferRequestImpliedWarranty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AfterSalesServicesProductOfferRequestImpliedWarranty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AfterSalesServicesProductOfferRequestImpliedWarranty is not found in the empty JSON string", AfterSalesServicesProductOfferRequestImpliedWarranty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AfterSalesServicesProductOfferRequestImpliedWarranty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AfterSalesServicesProductOfferRequestImpliedWarranty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AfterSalesServicesProductOfferRequestImpliedWarranty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AfterSalesServicesProductOfferRequestImpliedWarranty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AfterSalesServicesProductOfferRequestImpliedWarranty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AfterSalesServicesProductOfferRequestImpliedWarranty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AfterSalesServicesProductOfferRequestImpliedWarranty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AfterSalesServicesProductOfferRequestImpliedWarranty given an JSON string + * + * @param jsonString JSON string + * @return An instance of AfterSalesServicesProductOfferRequestImpliedWarranty + * @throws IOException if the JSON string is invalid with respect to AfterSalesServicesProductOfferRequestImpliedWarranty + */ + public static AfterSalesServicesProductOfferRequestImpliedWarranty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AfterSalesServicesProductOfferRequestImpliedWarranty.class); + } + + /** + * Convert an instance of AfterSalesServicesProductOfferRequestImpliedWarranty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestReturnPolicy.java b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestReturnPolicy.java new file mode 100644 index 0000000..9512df7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestReturnPolicy.java @@ -0,0 +1,237 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AfterSalesServicesProductOfferRequestReturnPolicy + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AfterSalesServicesProductOfferRequestReturnPolicy { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AfterSalesServicesProductOfferRequestReturnPolicy() { + } + + public AfterSalesServicesProductOfferRequestReturnPolicy id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the return policy definition. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public AfterSalesServicesProductOfferRequestReturnPolicy name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of the return policy definition. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AfterSalesServicesProductOfferRequestReturnPolicy afterSalesServicesProductOfferRequestReturnPolicy = (AfterSalesServicesProductOfferRequestReturnPolicy) o; + return Objects.equals(this.id, afterSalesServicesProductOfferRequestReturnPolicy.id) && + Objects.equals(this.name, afterSalesServicesProductOfferRequestReturnPolicy.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AfterSalesServicesProductOfferRequestReturnPolicy {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AfterSalesServicesProductOfferRequestReturnPolicy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AfterSalesServicesProductOfferRequestReturnPolicy.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AfterSalesServicesProductOfferRequestReturnPolicy is not found in the empty JSON string", AfterSalesServicesProductOfferRequestReturnPolicy.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AfterSalesServicesProductOfferRequestReturnPolicy.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AfterSalesServicesProductOfferRequestReturnPolicy` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AfterSalesServicesProductOfferRequestReturnPolicy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AfterSalesServicesProductOfferRequestReturnPolicy' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AfterSalesServicesProductOfferRequestReturnPolicy.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AfterSalesServicesProductOfferRequestReturnPolicy value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AfterSalesServicesProductOfferRequestReturnPolicy read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AfterSalesServicesProductOfferRequestReturnPolicy given an JSON string + * + * @param jsonString JSON string + * @return An instance of AfterSalesServicesProductOfferRequestReturnPolicy + * @throws IOException if the JSON string is invalid with respect to AfterSalesServicesProductOfferRequestReturnPolicy + */ + public static AfterSalesServicesProductOfferRequestReturnPolicy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AfterSalesServicesProductOfferRequestReturnPolicy.class); + } + + /** + * Convert an instance of AfterSalesServicesProductOfferRequestReturnPolicy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestWarranty.java b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestWarranty.java new file mode 100644 index 0000000..4e3a118 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AfterSalesServicesProductOfferRequestWarranty.java @@ -0,0 +1,237 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AfterSalesServicesProductOfferRequestWarranty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AfterSalesServicesProductOfferRequestWarranty { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AfterSalesServicesProductOfferRequestWarranty() { + } + + public AfterSalesServicesProductOfferRequestWarranty id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the warranty definition. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public AfterSalesServicesProductOfferRequestWarranty name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of the warranty definition. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AfterSalesServicesProductOfferRequestWarranty afterSalesServicesProductOfferRequestWarranty = (AfterSalesServicesProductOfferRequestWarranty) o; + return Objects.equals(this.id, afterSalesServicesProductOfferRequestWarranty.id) && + Objects.equals(this.name, afterSalesServicesProductOfferRequestWarranty.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AfterSalesServicesProductOfferRequestWarranty {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AfterSalesServicesProductOfferRequestWarranty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AfterSalesServicesProductOfferRequestWarranty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AfterSalesServicesProductOfferRequestWarranty is not found in the empty JSON string", AfterSalesServicesProductOfferRequestWarranty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AfterSalesServicesProductOfferRequestWarranty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AfterSalesServicesProductOfferRequestWarranty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AfterSalesServicesProductOfferRequestWarranty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AfterSalesServicesProductOfferRequestWarranty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AfterSalesServicesProductOfferRequestWarranty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AfterSalesServicesProductOfferRequestWarranty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AfterSalesServicesProductOfferRequestWarranty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AfterSalesServicesProductOfferRequestWarranty given an JSON string + * + * @param jsonString JSON string + * @return An instance of AfterSalesServicesProductOfferRequestWarranty + * @throws IOException if the JSON string is invalid with respect to AfterSalesServicesProductOfferRequestWarranty + */ + public static AfterSalesServicesProductOfferRequestWarranty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AfterSalesServicesProductOfferRequestWarranty.class); + } + + /** + * Convert an instance of AfterSalesServicesProductOfferRequestWarranty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AiCoCreatedContent.java b/src/main/java/pl/wtx/allegro/api/client/model/AiCoCreatedContent.java new file mode 100644 index 0000000..7b910c2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AiCoCreatedContent.java @@ -0,0 +1,227 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Each path will point to a specific field in object which is co-created by AI. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AiCoCreatedContent { + public static final String SERIALIZED_NAME_PATHS = "paths"; + @SerializedName(SERIALIZED_NAME_PATHS) + @javax.annotation.Nonnull + private List paths = new ArrayList<>(); + + public AiCoCreatedContent() { + } + + public AiCoCreatedContent paths(@javax.annotation.Nonnull List paths) { + this.paths = paths; + return this; + } + + public AiCoCreatedContent addPathsItem(String pathsItem) { + if (this.paths == null) { + this.paths = new ArrayList<>(); + } + this.paths.add(pathsItem); + return this; + } + + /** + * Get paths + * @return paths + */ + @javax.annotation.Nonnull + public List getPaths() { + return paths; + } + + public void setPaths(@javax.annotation.Nonnull List paths) { + this.paths = paths; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiCoCreatedContent aiCoCreatedContent = (AiCoCreatedContent) o; + return Objects.equals(this.paths, aiCoCreatedContent.paths); + } + + @Override + public int hashCode() { + return Objects.hash(paths); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AiCoCreatedContent {\n"); + sb.append(" paths: ").append(toIndentedString(paths)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("paths"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("paths"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AiCoCreatedContent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AiCoCreatedContent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AiCoCreatedContent is not found in the empty JSON string", AiCoCreatedContent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AiCoCreatedContent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AiCoCreatedContent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AiCoCreatedContent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("paths") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("paths").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `paths` to be an array in the JSON string but got `%s`", jsonObj.get("paths").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AiCoCreatedContent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AiCoCreatedContent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AiCoCreatedContent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AiCoCreatedContent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AiCoCreatedContent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AiCoCreatedContent given an JSON string + * + * @param jsonString JSON string + * @return An instance of AiCoCreatedContent + * @throws IOException if the JSON string is invalid with respect to AiCoCreatedContent + */ + public static AiCoCreatedContent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AiCoCreatedContent.class); + } + + /** + * Convert an instance of AiCoCreatedContent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDto.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDto.java new file mode 100644 index 0000000..b98feb7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDto.java @@ -0,0 +1,314 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoAlleDiscount; +import pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoBasePrice; +import pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoProduct; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountEligibleOfferDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountEligibleOfferDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + @javax.annotation.Nullable + private AlleDiscountEligibleOfferDtoProduct product; + + public static final String SERIALIZED_NAME_BASE_PRICE = "basePrice"; + @SerializedName(SERIALIZED_NAME_BASE_PRICE) + @javax.annotation.Nullable + private AlleDiscountEligibleOfferDtoBasePrice basePrice; + + public static final String SERIALIZED_NAME_ALLE_DISCOUNT = "alleDiscount"; + @SerializedName(SERIALIZED_NAME_ALLE_DISCOUNT) + @javax.annotation.Nullable + private AlleDiscountEligibleOfferDtoAlleDiscount alleDiscount; + + public AlleDiscountEligibleOfferDto() { + } + + public AlleDiscountEligibleOfferDto id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the offer. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public AlleDiscountEligibleOfferDto product(@javax.annotation.Nullable AlleDiscountEligibleOfferDtoProduct product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public AlleDiscountEligibleOfferDtoProduct getProduct() { + return product; + } + + public void setProduct(@javax.annotation.Nullable AlleDiscountEligibleOfferDtoProduct product) { + this.product = product; + } + + + public AlleDiscountEligibleOfferDto basePrice(@javax.annotation.Nullable AlleDiscountEligibleOfferDtoBasePrice basePrice) { + this.basePrice = basePrice; + return this; + } + + /** + * Get basePrice + * @return basePrice + */ + @javax.annotation.Nullable + public AlleDiscountEligibleOfferDtoBasePrice getBasePrice() { + return basePrice; + } + + public void setBasePrice(@javax.annotation.Nullable AlleDiscountEligibleOfferDtoBasePrice basePrice) { + this.basePrice = basePrice; + } + + + public AlleDiscountEligibleOfferDto alleDiscount(@javax.annotation.Nullable AlleDiscountEligibleOfferDtoAlleDiscount alleDiscount) { + this.alleDiscount = alleDiscount; + return this; + } + + /** + * Get alleDiscount + * @return alleDiscount + */ + @javax.annotation.Nullable + public AlleDiscountEligibleOfferDtoAlleDiscount getAlleDiscount() { + return alleDiscount; + } + + public void setAlleDiscount(@javax.annotation.Nullable AlleDiscountEligibleOfferDtoAlleDiscount alleDiscount) { + this.alleDiscount = alleDiscount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountEligibleOfferDto alleDiscountEligibleOfferDto = (AlleDiscountEligibleOfferDto) o; + return Objects.equals(this.id, alleDiscountEligibleOfferDto.id) && + Objects.equals(this.product, alleDiscountEligibleOfferDto.product) && + Objects.equals(this.basePrice, alleDiscountEligibleOfferDto.basePrice) && + Objects.equals(this.alleDiscount, alleDiscountEligibleOfferDto.alleDiscount); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, product, basePrice, alleDiscount); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountEligibleOfferDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" basePrice: ").append(toIndentedString(basePrice)).append("\n"); + sb.append(" alleDiscount: ").append(toIndentedString(alleDiscount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("product"); + openapiFields.add("basePrice"); + openapiFields.add("alleDiscount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountEligibleOfferDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountEligibleOfferDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountEligibleOfferDto is not found in the empty JSON string", AlleDiscountEligibleOfferDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountEligibleOfferDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountEligibleOfferDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + AlleDiscountEligibleOfferDtoProduct.validateJsonElement(jsonObj.get("product")); + } + // validate the optional field `basePrice` + if (jsonObj.get("basePrice") != null && !jsonObj.get("basePrice").isJsonNull()) { + AlleDiscountEligibleOfferDtoBasePrice.validateJsonElement(jsonObj.get("basePrice")); + } + // validate the optional field `alleDiscount` + if (jsonObj.get("alleDiscount") != null && !jsonObj.get("alleDiscount").isJsonNull()) { + AlleDiscountEligibleOfferDtoAlleDiscount.validateJsonElement(jsonObj.get("alleDiscount")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountEligibleOfferDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountEligibleOfferDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountEligibleOfferDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountEligibleOfferDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountEligibleOfferDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountEligibleOfferDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountEligibleOfferDto + * @throws IOException if the JSON string is invalid with respect to AlleDiscountEligibleOfferDto + */ + public static AlleDiscountEligibleOfferDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountEligibleOfferDto.class); + } + + /** + * Convert an instance of AlleDiscountEligibleOfferDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscount.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscount.java new file mode 100644 index 0000000..36c31fb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscount.java @@ -0,0 +1,272 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions; +import pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount; +import pl.wtx.allegro.api.client.model.AlleDiscountRequiredMerchantPriceDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscount specific data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountEligibleOfferDtoAlleDiscount { + public static final String SERIALIZED_NAME_CAMPAIGN_CONDITIONS = "campaignConditions"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN_CONDITIONS) + @javax.annotation.Nullable + private AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions campaignConditions; + + public static final String SERIALIZED_NAME_REQUIRED_MERCHANT_PRICE = "requiredMerchantPrice"; + @SerializedName(SERIALIZED_NAME_REQUIRED_MERCHANT_PRICE) + @javax.annotation.Nullable + private AlleDiscountRequiredMerchantPriceDto requiredMerchantPrice; + + public static final String SERIALIZED_NAME_MINIMUM_GUARANTEED_DISCOUNT = "minimumGuaranteedDiscount"; + @SerializedName(SERIALIZED_NAME_MINIMUM_GUARANTEED_DISCOUNT) + @javax.annotation.Nullable + private AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount minimumGuaranteedDiscount; + + public AlleDiscountEligibleOfferDtoAlleDiscount() { + } + + public AlleDiscountEligibleOfferDtoAlleDiscount campaignConditions(@javax.annotation.Nullable AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions campaignConditions) { + this.campaignConditions = campaignConditions; + return this; + } + + /** + * Get campaignConditions + * @return campaignConditions + */ + @javax.annotation.Nullable + public AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions getCampaignConditions() { + return campaignConditions; + } + + public void setCampaignConditions(@javax.annotation.Nullable AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions campaignConditions) { + this.campaignConditions = campaignConditions; + } + + + public AlleDiscountEligibleOfferDtoAlleDiscount requiredMerchantPrice(@javax.annotation.Nullable AlleDiscountRequiredMerchantPriceDto requiredMerchantPrice) { + this.requiredMerchantPrice = requiredMerchantPrice; + return this; + } + + /** + * Get requiredMerchantPrice + * @return requiredMerchantPrice + */ + @javax.annotation.Nullable + public AlleDiscountRequiredMerchantPriceDto getRequiredMerchantPrice() { + return requiredMerchantPrice; + } + + public void setRequiredMerchantPrice(@javax.annotation.Nullable AlleDiscountRequiredMerchantPriceDto requiredMerchantPrice) { + this.requiredMerchantPrice = requiredMerchantPrice; + } + + + public AlleDiscountEligibleOfferDtoAlleDiscount minimumGuaranteedDiscount(@javax.annotation.Nullable AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount minimumGuaranteedDiscount) { + this.minimumGuaranteedDiscount = minimumGuaranteedDiscount; + return this; + } + + /** + * Get minimumGuaranteedDiscount + * @return minimumGuaranteedDiscount + */ + @javax.annotation.Nullable + public AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount getMinimumGuaranteedDiscount() { + return minimumGuaranteedDiscount; + } + + public void setMinimumGuaranteedDiscount(@javax.annotation.Nullable AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount minimumGuaranteedDiscount) { + this.minimumGuaranteedDiscount = minimumGuaranteedDiscount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountEligibleOfferDtoAlleDiscount alleDiscountEligibleOfferDtoAlleDiscount = (AlleDiscountEligibleOfferDtoAlleDiscount) o; + return Objects.equals(this.campaignConditions, alleDiscountEligibleOfferDtoAlleDiscount.campaignConditions) && + Objects.equals(this.requiredMerchantPrice, alleDiscountEligibleOfferDtoAlleDiscount.requiredMerchantPrice) && + Objects.equals(this.minimumGuaranteedDiscount, alleDiscountEligibleOfferDtoAlleDiscount.minimumGuaranteedDiscount); + } + + @Override + public int hashCode() { + return Objects.hash(campaignConditions, requiredMerchantPrice, minimumGuaranteedDiscount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountEligibleOfferDtoAlleDiscount {\n"); + sb.append(" campaignConditions: ").append(toIndentedString(campaignConditions)).append("\n"); + sb.append(" requiredMerchantPrice: ").append(toIndentedString(requiredMerchantPrice)).append("\n"); + sb.append(" minimumGuaranteedDiscount: ").append(toIndentedString(minimumGuaranteedDiscount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("campaignConditions"); + openapiFields.add("requiredMerchantPrice"); + openapiFields.add("minimumGuaranteedDiscount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountEligibleOfferDtoAlleDiscount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountEligibleOfferDtoAlleDiscount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountEligibleOfferDtoAlleDiscount is not found in the empty JSON string", AlleDiscountEligibleOfferDtoAlleDiscount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountEligibleOfferDtoAlleDiscount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountEligibleOfferDtoAlleDiscount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `campaignConditions` + if (jsonObj.get("campaignConditions") != null && !jsonObj.get("campaignConditions").isJsonNull()) { + AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.validateJsonElement(jsonObj.get("campaignConditions")); + } + // validate the optional field `requiredMerchantPrice` + if (jsonObj.get("requiredMerchantPrice") != null && !jsonObj.get("requiredMerchantPrice").isJsonNull()) { + AlleDiscountRequiredMerchantPriceDto.validateJsonElement(jsonObj.get("requiredMerchantPrice")); + } + // validate the optional field `minimumGuaranteedDiscount` + if (jsonObj.get("minimumGuaranteedDiscount") != null && !jsonObj.get("minimumGuaranteedDiscount").isJsonNull()) { + AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.validateJsonElement(jsonObj.get("minimumGuaranteedDiscount")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountEligibleOfferDtoAlleDiscount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountEligibleOfferDtoAlleDiscount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountEligibleOfferDtoAlleDiscount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountEligibleOfferDtoAlleDiscount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountEligibleOfferDtoAlleDiscount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountEligibleOfferDtoAlleDiscount given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountEligibleOfferDtoAlleDiscount + * @throws IOException if the JSON string is invalid with respect to AlleDiscountEligibleOfferDtoAlleDiscount + */ + public static AlleDiscountEligibleOfferDtoAlleDiscount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountEligibleOfferDtoAlleDiscount.class); + } + + /** + * Convert an instance of AlleDiscountEligibleOfferDtoAlleDiscount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.java new file mode 100644 index 0000000..322f430 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.java @@ -0,0 +1,255 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Info if offer matches campaign requirements. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions { + public static final String SERIALIZED_NAME_MEETS_CONDITIONS = "meetsConditions"; + @SerializedName(SERIALIZED_NAME_MEETS_CONDITIONS) + @javax.annotation.Nullable + private Boolean meetsConditions; + + public static final String SERIALIZED_NAME_VIOLATIONS = "violations"; + @SerializedName(SERIALIZED_NAME_VIOLATIONS) + @javax.annotation.Nullable + private List violations = new ArrayList<>(); + + public AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions() { + } + + public AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions meetsConditions(@javax.annotation.Nullable Boolean meetsConditions) { + this.meetsConditions = meetsConditions; + return this; + } + + /** + * If true, offer matches campaign requirements and `violations` array will be empty. + * @return meetsConditions + */ + @javax.annotation.Nullable + public Boolean getMeetsConditions() { + return meetsConditions; + } + + public void setMeetsConditions(@javax.annotation.Nullable Boolean meetsConditions) { + this.meetsConditions = meetsConditions; + } + + + public AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions violations(@javax.annotation.Nullable List violations) { + this.violations = violations; + return this; + } + + public AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions addViolationsItem(AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner violationsItem) { + if (this.violations == null) { + this.violations = new ArrayList<>(); + } + this.violations.add(violationsItem); + return this; + } + + /** + * Example violations: - NOT_ENOUGH_STOCK - offer doesn’t meet the stock requirement. - VAT_INVOICE_REQUIRED - offer doesn’t have vat invoice enabled. - NOT_NEW_OFFER - offer’s condition is not new (e.g used). - OFFER_PRICE_VERIFICATION_IN_PROGRESS - we are still gathering the information about the offer price. In this case the “basePrice” field should be set to null. + * @return violations + */ + @javax.annotation.Nullable + public List getViolations() { + return violations; + } + + public void setViolations(@javax.annotation.Nullable List violations) { + this.violations = violations; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions alleDiscountEligibleOfferDtoAlleDiscountCampaignConditions = (AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions) o; + return Objects.equals(this.meetsConditions, alleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.meetsConditions) && + Objects.equals(this.violations, alleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.violations); + } + + @Override + public int hashCode() { + return Objects.hash(meetsConditions, violations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions {\n"); + sb.append(" meetsConditions: ").append(toIndentedString(meetsConditions)).append("\n"); + sb.append(" violations: ").append(toIndentedString(violations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("meetsConditions"); + openapiFields.add("violations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions is not found in the empty JSON string", AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("violations") != null && !jsonObj.get("violations").isJsonNull()) { + JsonArray jsonArrayviolations = jsonObj.getAsJsonArray("violations"); + if (jsonArrayviolations != null) { + // ensure the json data is an array + if (!jsonObj.get("violations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `violations` to be an array in the JSON string but got `%s`", jsonObj.get("violations").toString())); + } + + // validate the optional field `violations` (array) + for (int i = 0; i < jsonArrayviolations.size(); i++) { + AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.validateJsonElement(jsonArrayviolations.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions + * @throws IOException if the JSON string is invalid with respect to AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions + */ + public static AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions.class); + } + + /** + * Convert an instance of AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.java new file mode 100644 index 0000000..d330f28 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner() { + } + + public AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Code of the violation. + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Violation description. + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner alleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner = (AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner) o; + return Objects.equals(this.code, alleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.code) && + Objects.equals(this.message, alleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner is not found in the empty JSON string", AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner + * @throws IOException if the JSON string is invalid with respect to AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner + */ + public static AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner.class); + } + + /** + * Convert an instance of AlleDiscountEligibleOfferDtoAlleDiscountCampaignConditionsViolationsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.java new file mode 100644 index 0000000..6abbcf1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information what will be minimal guaranteed discount if offer is successfully submitted to AlleDiscount campaign. Final discount can be higher and may change for certain campaigns. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount { + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + @javax.annotation.Nullable + private String percentage; + + public AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount() { + } + + public AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount percentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + return this; + } + + /** + * Guaranteed offer discount as a percentage. + * @return percentage + */ + @javax.annotation.Nullable + public String getPercentage() { + return percentage; + } + + public void setPercentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount alleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount = (AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount) o; + return Objects.equals(this.percentage, alleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.percentage); + } + + @Override + public int hashCode() { + return Objects.hash(percentage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount {\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("percentage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount is not found in the empty JSON string", AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("percentage") != null && !jsonObj.get("percentage").isJsonNull()) && !jsonObj.get("percentage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `percentage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("percentage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount + * @throws IOException if the JSON string is invalid with respect to AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount + */ + public static AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount.class); + } + + /** + * Convert an instance of AlleDiscountEligibleOfferDtoAlleDiscountMinimumGuaranteedDiscount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoBasePrice.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoBasePrice.java new file mode 100644 index 0000000..61fc094 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoBasePrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer base price. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountEligibleOfferDtoBasePrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public AlleDiscountEligibleOfferDtoBasePrice() { + } + + public AlleDiscountEligibleOfferDtoBasePrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount of the price. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public AlleDiscountEligibleOfferDtoBasePrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Currency of the price. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountEligibleOfferDtoBasePrice alleDiscountEligibleOfferDtoBasePrice = (AlleDiscountEligibleOfferDtoBasePrice) o; + return Objects.equals(this.amount, alleDiscountEligibleOfferDtoBasePrice.amount) && + Objects.equals(this.currency, alleDiscountEligibleOfferDtoBasePrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountEligibleOfferDtoBasePrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountEligibleOfferDtoBasePrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountEligibleOfferDtoBasePrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountEligibleOfferDtoBasePrice is not found in the empty JSON string", AlleDiscountEligibleOfferDtoBasePrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountEligibleOfferDtoBasePrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountEligibleOfferDtoBasePrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountEligibleOfferDtoBasePrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountEligibleOfferDtoBasePrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountEligibleOfferDtoBasePrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountEligibleOfferDtoBasePrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountEligibleOfferDtoBasePrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountEligibleOfferDtoBasePrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountEligibleOfferDtoBasePrice + * @throws IOException if the JSON string is invalid with respect to AlleDiscountEligibleOfferDtoBasePrice + */ + public static AlleDiscountEligibleOfferDtoBasePrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountEligibleOfferDtoBasePrice.class); + } + + /** + * Convert an instance of AlleDiscountEligibleOfferDtoBasePrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoProduct.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoProduct.java new file mode 100644 index 0000000..b3115dc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountEligibleOfferDtoProduct.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer product data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountEligibleOfferDtoProduct { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public AlleDiscountEligibleOfferDtoProduct() { + } + + public AlleDiscountEligibleOfferDtoProduct id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the product. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountEligibleOfferDtoProduct alleDiscountEligibleOfferDtoProduct = (AlleDiscountEligibleOfferDtoProduct) o; + return Objects.equals(this.id, alleDiscountEligibleOfferDtoProduct.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountEligibleOfferDtoProduct {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountEligibleOfferDtoProduct + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountEligibleOfferDtoProduct.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountEligibleOfferDtoProduct is not found in the empty JSON string", AlleDiscountEligibleOfferDtoProduct.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountEligibleOfferDtoProduct.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountEligibleOfferDtoProduct` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountEligibleOfferDtoProduct.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountEligibleOfferDtoProduct' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountEligibleOfferDtoProduct.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountEligibleOfferDtoProduct value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountEligibleOfferDtoProduct read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountEligibleOfferDtoProduct given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountEligibleOfferDtoProduct + * @throws IOException if the JSON string is invalid with respect to AlleDiscountEligibleOfferDtoProduct + */ + public static AlleDiscountEligibleOfferDtoProduct fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountEligibleOfferDtoProduct.class); + } + + /** + * Convert an instance of AlleDiscountEligibleOfferDtoProduct to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponse.java new file mode 100644 index 0000000..5773ce4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponse.java @@ -0,0 +1,270 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AlleDiscountGetSubmitCommandResponseOutput; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponseInput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountGetSubmitCommandResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountGetSubmitCommandResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nullable + private AlleDiscountSubmitCommandResponseInput input; + + public static final String SERIALIZED_NAME_OUTPUT = "output"; + @SerializedName(SERIALIZED_NAME_OUTPUT) + @javax.annotation.Nullable + private AlleDiscountGetSubmitCommandResponseOutput output; + + public AlleDiscountGetSubmitCommandResponse() { + } + + public AlleDiscountGetSubmitCommandResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the command. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public AlleDiscountGetSubmitCommandResponse input(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseInput input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nullable + public AlleDiscountSubmitCommandResponseInput getInput() { + return input; + } + + public void setInput(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseInput input) { + this.input = input; + } + + + public AlleDiscountGetSubmitCommandResponse output(@javax.annotation.Nullable AlleDiscountGetSubmitCommandResponseOutput output) { + this.output = output; + return this; + } + + /** + * Get output + * @return output + */ + @javax.annotation.Nullable + public AlleDiscountGetSubmitCommandResponseOutput getOutput() { + return output; + } + + public void setOutput(@javax.annotation.Nullable AlleDiscountGetSubmitCommandResponseOutput output) { + this.output = output; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountGetSubmitCommandResponse alleDiscountGetSubmitCommandResponse = (AlleDiscountGetSubmitCommandResponse) o; + return Objects.equals(this.id, alleDiscountGetSubmitCommandResponse.id) && + Objects.equals(this.input, alleDiscountGetSubmitCommandResponse.input) && + Objects.equals(this.output, alleDiscountGetSubmitCommandResponse.output); + } + + @Override + public int hashCode() { + return Objects.hash(id, input, output); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountGetSubmitCommandResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("input"); + openapiFields.add("output"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountGetSubmitCommandResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountGetSubmitCommandResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountGetSubmitCommandResponse is not found in the empty JSON string", AlleDiscountGetSubmitCommandResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountGetSubmitCommandResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountGetSubmitCommandResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `input` + if (jsonObj.get("input") != null && !jsonObj.get("input").isJsonNull()) { + AlleDiscountSubmitCommandResponseInput.validateJsonElement(jsonObj.get("input")); + } + // validate the optional field `output` + if (jsonObj.get("output") != null && !jsonObj.get("output").isJsonNull()) { + AlleDiscountGetSubmitCommandResponseOutput.validateJsonElement(jsonObj.get("output")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountGetSubmitCommandResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountGetSubmitCommandResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountGetSubmitCommandResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountGetSubmitCommandResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountGetSubmitCommandResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountGetSubmitCommandResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountGetSubmitCommandResponse + * @throws IOException if the JSON string is invalid with respect to AlleDiscountGetSubmitCommandResponse + */ + public static AlleDiscountGetSubmitCommandResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountGetSubmitCommandResponse.class); + } + + /** + * Convert an instance of AlleDiscountGetSubmitCommandResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponseOutput.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponseOutput.java new file mode 100644 index 0000000..deb6cc9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponseOutput.java @@ -0,0 +1,417 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation; +import pl.wtx.allegro.api.client.model.ErrorsHolder; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Submit offer command output data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountGetSubmitCommandResponseOutput { + /** + * Status field possible values: - NEW - command processing has not started. - IN_PROGRESS - command is being processed. - FAILED - processing of the command failed. Offer will not participate in AlleDiscount. - SUCCESSFUL - processing of the command was successful. New participation was created but in some cases it still may be denied. To make sure that the offer is participating in AlleDiscount, check the participation status in 'GET /sale/alle-discount/{campaignId}/submitted-offers`. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + NEW("NEW"), + + IN_PROGRESS("IN_PROGRESS"), + + SUCCESSFUL("SUCCESSFUL"), + + FAILED("FAILED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_NEW_OFFER_PARTICIPATION = "newOfferParticipation"; + @SerializedName(SERIALIZED_NAME_NEW_OFFER_PARTICIPATION) + @javax.annotation.Nullable + private AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation newOfferParticipation; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public AlleDiscountGetSubmitCommandResponseOutput() { + } + + public AlleDiscountGetSubmitCommandResponseOutput status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Status field possible values: - NEW - command processing has not started. - IN_PROGRESS - command is being processed. - FAILED - processing of the command failed. Offer will not participate in AlleDiscount. - SUCCESSFUL - processing of the command was successful. New participation was created but in some cases it still may be denied. To make sure that the offer is participating in AlleDiscount, check the participation status in 'GET /sale/alle-discount/{campaignId}/submitted-offers`. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public AlleDiscountGetSubmitCommandResponseOutput createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Command creation date. ISO 8601 format. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AlleDiscountGetSubmitCommandResponseOutput updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Command update date. ISO 8601 format. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public AlleDiscountGetSubmitCommandResponseOutput newOfferParticipation(@javax.annotation.Nullable AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation newOfferParticipation) { + this.newOfferParticipation = newOfferParticipation; + return this; + } + + /** + * Get newOfferParticipation + * @return newOfferParticipation + */ + @javax.annotation.Nullable + public AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation getNewOfferParticipation() { + return newOfferParticipation; + } + + public void setNewOfferParticipation(@javax.annotation.Nullable AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation newOfferParticipation) { + this.newOfferParticipation = newOfferParticipation; + } + + + public AlleDiscountGetSubmitCommandResponseOutput errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public AlleDiscountGetSubmitCommandResponseOutput addErrorsItem(ErrorsHolder errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountGetSubmitCommandResponseOutput alleDiscountGetSubmitCommandResponseOutput = (AlleDiscountGetSubmitCommandResponseOutput) o; + return Objects.equals(this.status, alleDiscountGetSubmitCommandResponseOutput.status) && + Objects.equals(this.createdAt, alleDiscountGetSubmitCommandResponseOutput.createdAt) && + Objects.equals(this.updatedAt, alleDiscountGetSubmitCommandResponseOutput.updatedAt) && + Objects.equals(this.newOfferParticipation, alleDiscountGetSubmitCommandResponseOutput.newOfferParticipation) && + Objects.equals(this.errors, alleDiscountGetSubmitCommandResponseOutput.errors); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, createdAt, updatedAt, newOfferParticipation, errors); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountGetSubmitCommandResponseOutput {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" newOfferParticipation: ").append(toIndentedString(newOfferParticipation)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("newOfferParticipation"); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountGetSubmitCommandResponseOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountGetSubmitCommandResponseOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountGetSubmitCommandResponseOutput is not found in the empty JSON string", AlleDiscountGetSubmitCommandResponseOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountGetSubmitCommandResponseOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountGetSubmitCommandResponseOutput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + // validate the optional field `newOfferParticipation` + if (jsonObj.get("newOfferParticipation") != null && !jsonObj.get("newOfferParticipation").isJsonNull()) { + AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.validateJsonElement(jsonObj.get("newOfferParticipation")); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + ErrorsHolder.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountGetSubmitCommandResponseOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountGetSubmitCommandResponseOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountGetSubmitCommandResponseOutput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountGetSubmitCommandResponseOutput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountGetSubmitCommandResponseOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountGetSubmitCommandResponseOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountGetSubmitCommandResponseOutput + * @throws IOException if the JSON string is invalid with respect to AlleDiscountGetSubmitCommandResponseOutput + */ + public static AlleDiscountGetSubmitCommandResponseOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountGetSubmitCommandResponseOutput.class); + } + + /** + * Convert an instance of AlleDiscountGetSubmitCommandResponseOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.java new file mode 100644 index 0000000..e82444f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Object containing info about created participation in AlleDiscount, contains the id of the created participation. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation { + public static final String SERIALIZED_NAME_PARTICIPATION_ID = "participationId"; + @SerializedName(SERIALIZED_NAME_PARTICIPATION_ID) + @javax.annotation.Nullable + private String participationId; + + public AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation() { + } + + public AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation participationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + return this; + } + + /** + * The id of the participation created by submit offer command. + * @return participationId + */ + @javax.annotation.Nullable + public String getParticipationId() { + return participationId; + } + + public void setParticipationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation alleDiscountGetSubmitCommandResponseOutputNewOfferParticipation = (AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation) o; + return Objects.equals(this.participationId, alleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.participationId); + } + + @Override + public int hashCode() { + return Objects.hash(participationId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation {\n"); + sb.append(" participationId: ").append(toIndentedString(participationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("participationId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation is not found in the empty JSON string", AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("participationId") != null && !jsonObj.get("participationId").isJsonNull()) && !jsonObj.get("participationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `participationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("participationId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation + * @throws IOException if the JSON string is invalid with respect to AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation + */ + public static AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation.class); + } + + /** + * Convert an instance of AlleDiscountGetSubmitCommandResponseOutputNewOfferParticipation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponse.java new file mode 100644 index 0000000..3d822d4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponse.java @@ -0,0 +1,270 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AlleDiscountGetWithdrawCommandResponseInput; +import pl.wtx.allegro.api.client.model.AlleDiscountGetWithdrawCommandResponseOutput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountGetWithdrawCommandResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountGetWithdrawCommandResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nullable + private AlleDiscountGetWithdrawCommandResponseInput input; + + public static final String SERIALIZED_NAME_OUTPUT = "output"; + @SerializedName(SERIALIZED_NAME_OUTPUT) + @javax.annotation.Nullable + private AlleDiscountGetWithdrawCommandResponseOutput output; + + public AlleDiscountGetWithdrawCommandResponse() { + } + + public AlleDiscountGetWithdrawCommandResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the command. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public AlleDiscountGetWithdrawCommandResponse input(@javax.annotation.Nullable AlleDiscountGetWithdrawCommandResponseInput input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nullable + public AlleDiscountGetWithdrawCommandResponseInput getInput() { + return input; + } + + public void setInput(@javax.annotation.Nullable AlleDiscountGetWithdrawCommandResponseInput input) { + this.input = input; + } + + + public AlleDiscountGetWithdrawCommandResponse output(@javax.annotation.Nullable AlleDiscountGetWithdrawCommandResponseOutput output) { + this.output = output; + return this; + } + + /** + * Get output + * @return output + */ + @javax.annotation.Nullable + public AlleDiscountGetWithdrawCommandResponseOutput getOutput() { + return output; + } + + public void setOutput(@javax.annotation.Nullable AlleDiscountGetWithdrawCommandResponseOutput output) { + this.output = output; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountGetWithdrawCommandResponse alleDiscountGetWithdrawCommandResponse = (AlleDiscountGetWithdrawCommandResponse) o; + return Objects.equals(this.id, alleDiscountGetWithdrawCommandResponse.id) && + Objects.equals(this.input, alleDiscountGetWithdrawCommandResponse.input) && + Objects.equals(this.output, alleDiscountGetWithdrawCommandResponse.output); + } + + @Override + public int hashCode() { + return Objects.hash(id, input, output); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountGetWithdrawCommandResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("input"); + openapiFields.add("output"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountGetWithdrawCommandResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountGetWithdrawCommandResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountGetWithdrawCommandResponse is not found in the empty JSON string", AlleDiscountGetWithdrawCommandResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountGetWithdrawCommandResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountGetWithdrawCommandResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `input` + if (jsonObj.get("input") != null && !jsonObj.get("input").isJsonNull()) { + AlleDiscountGetWithdrawCommandResponseInput.validateJsonElement(jsonObj.get("input")); + } + // validate the optional field `output` + if (jsonObj.get("output") != null && !jsonObj.get("output").isJsonNull()) { + AlleDiscountGetWithdrawCommandResponseOutput.validateJsonElement(jsonObj.get("output")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountGetWithdrawCommandResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountGetWithdrawCommandResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountGetWithdrawCommandResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountGetWithdrawCommandResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountGetWithdrawCommandResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountGetWithdrawCommandResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountGetWithdrawCommandResponse + * @throws IOException if the JSON string is invalid with respect to AlleDiscountGetWithdrawCommandResponse + */ + public static AlleDiscountGetWithdrawCommandResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountGetWithdrawCommandResponse.class); + } + + /** + * Convert an instance of AlleDiscountGetWithdrawCommandResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseInput.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseInput.java new file mode 100644 index 0000000..1c16cfc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseInput.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Provided withdraw offer command input data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountGetWithdrawCommandResponseInput { + public static final String SERIALIZED_NAME_PARTICIPATION_ID = "participationId"; + @SerializedName(SERIALIZED_NAME_PARTICIPATION_ID) + @javax.annotation.Nullable + private String participationId; + + public AlleDiscountGetWithdrawCommandResponseInput() { + } + + public AlleDiscountGetWithdrawCommandResponseInput participationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + return this; + } + + /** + * The id of the withdrawn participation. + * @return participationId + */ + @javax.annotation.Nullable + public String getParticipationId() { + return participationId; + } + + public void setParticipationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountGetWithdrawCommandResponseInput alleDiscountGetWithdrawCommandResponseInput = (AlleDiscountGetWithdrawCommandResponseInput) o; + return Objects.equals(this.participationId, alleDiscountGetWithdrawCommandResponseInput.participationId); + } + + @Override + public int hashCode() { + return Objects.hash(participationId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountGetWithdrawCommandResponseInput {\n"); + sb.append(" participationId: ").append(toIndentedString(participationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("participationId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountGetWithdrawCommandResponseInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountGetWithdrawCommandResponseInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountGetWithdrawCommandResponseInput is not found in the empty JSON string", AlleDiscountGetWithdrawCommandResponseInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountGetWithdrawCommandResponseInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountGetWithdrawCommandResponseInput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("participationId") != null && !jsonObj.get("participationId").isJsonNull()) && !jsonObj.get("participationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `participationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("participationId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountGetWithdrawCommandResponseInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountGetWithdrawCommandResponseInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountGetWithdrawCommandResponseInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountGetWithdrawCommandResponseInput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountGetWithdrawCommandResponseInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountGetWithdrawCommandResponseInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountGetWithdrawCommandResponseInput + * @throws IOException if the JSON string is invalid with respect to AlleDiscountGetWithdrawCommandResponseInput + */ + public static AlleDiscountGetWithdrawCommandResponseInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountGetWithdrawCommandResponseInput.class); + } + + /** + * Convert an instance of AlleDiscountGetWithdrawCommandResponseInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseOutput.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseOutput.java new file mode 100644 index 0000000..a9f55c5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseOutput.java @@ -0,0 +1,417 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation; +import pl.wtx.allegro.api.client.model.ErrorsHolder; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Withdraw offer command output data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountGetWithdrawCommandResponseOutput { + /** + * Status field possible values: - NEW - command processing has not started - IN_PROGRESS - command is being processed - FAILED - processing of the command failed. Offer will not participate in AlleDiscount. - SUCCESSFUL - processing of the command was successful. New participation was created. To make sure that the offer is participating in AlleDiscount, request the participation status. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + NEW("NEW"), + + IN_PROGRESS("IN_PROGRESS"), + + SUCCESSFUL("SUCCESSFUL"), + + FAILED("FAILED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_WITHDRAWN_OFFER_PARTICIPATION = "withdrawnOfferParticipation"; + @SerializedName(SERIALIZED_NAME_WITHDRAWN_OFFER_PARTICIPATION) + @javax.annotation.Nullable + private AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation withdrawnOfferParticipation; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public AlleDiscountGetWithdrawCommandResponseOutput() { + } + + public AlleDiscountGetWithdrawCommandResponseOutput status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Status field possible values: - NEW - command processing has not started - IN_PROGRESS - command is being processed - FAILED - processing of the command failed. Offer will not participate in AlleDiscount. - SUCCESSFUL - processing of the command was successful. New participation was created. To make sure that the offer is participating in AlleDiscount, request the participation status. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public AlleDiscountGetWithdrawCommandResponseOutput createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Command creation date. ISO 8601 format. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AlleDiscountGetWithdrawCommandResponseOutput updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Command update date. ISO 8601 format. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public AlleDiscountGetWithdrawCommandResponseOutput withdrawnOfferParticipation(@javax.annotation.Nullable AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation withdrawnOfferParticipation) { + this.withdrawnOfferParticipation = withdrawnOfferParticipation; + return this; + } + + /** + * Get withdrawnOfferParticipation + * @return withdrawnOfferParticipation + */ + @javax.annotation.Nullable + public AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation getWithdrawnOfferParticipation() { + return withdrawnOfferParticipation; + } + + public void setWithdrawnOfferParticipation(@javax.annotation.Nullable AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation withdrawnOfferParticipation) { + this.withdrawnOfferParticipation = withdrawnOfferParticipation; + } + + + public AlleDiscountGetWithdrawCommandResponseOutput errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public AlleDiscountGetWithdrawCommandResponseOutput addErrorsItem(ErrorsHolder errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountGetWithdrawCommandResponseOutput alleDiscountGetWithdrawCommandResponseOutput = (AlleDiscountGetWithdrawCommandResponseOutput) o; + return Objects.equals(this.status, alleDiscountGetWithdrawCommandResponseOutput.status) && + Objects.equals(this.createdAt, alleDiscountGetWithdrawCommandResponseOutput.createdAt) && + Objects.equals(this.updatedAt, alleDiscountGetWithdrawCommandResponseOutput.updatedAt) && + Objects.equals(this.withdrawnOfferParticipation, alleDiscountGetWithdrawCommandResponseOutput.withdrawnOfferParticipation) && + Objects.equals(this.errors, alleDiscountGetWithdrawCommandResponseOutput.errors); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, createdAt, updatedAt, withdrawnOfferParticipation, errors); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountGetWithdrawCommandResponseOutput {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" withdrawnOfferParticipation: ").append(toIndentedString(withdrawnOfferParticipation)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("withdrawnOfferParticipation"); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountGetWithdrawCommandResponseOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountGetWithdrawCommandResponseOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountGetWithdrawCommandResponseOutput is not found in the empty JSON string", AlleDiscountGetWithdrawCommandResponseOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountGetWithdrawCommandResponseOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountGetWithdrawCommandResponseOutput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + // validate the optional field `withdrawnOfferParticipation` + if (jsonObj.get("withdrawnOfferParticipation") != null && !jsonObj.get("withdrawnOfferParticipation").isJsonNull()) { + AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.validateJsonElement(jsonObj.get("withdrawnOfferParticipation")); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + ErrorsHolder.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountGetWithdrawCommandResponseOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountGetWithdrawCommandResponseOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountGetWithdrawCommandResponseOutput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountGetWithdrawCommandResponseOutput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountGetWithdrawCommandResponseOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountGetWithdrawCommandResponseOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountGetWithdrawCommandResponseOutput + * @throws IOException if the JSON string is invalid with respect to AlleDiscountGetWithdrawCommandResponseOutput + */ + public static AlleDiscountGetWithdrawCommandResponseOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountGetWithdrawCommandResponseOutput.class); + } + + /** + * Convert an instance of AlleDiscountGetWithdrawCommandResponseOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.java new file mode 100644 index 0000000..c1a1897 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Withdrawn offer participation data. Non-null when command status is `SUCCESSFUL`. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation { + public static final String SERIALIZED_NAME_PARTICIPATION_ID = "participationId"; + @SerializedName(SERIALIZED_NAME_PARTICIPATION_ID) + @javax.annotation.Nullable + private String participationId; + + public AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation() { + } + + public AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation participationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + return this; + } + + /** + * The id of the withdrawn participation. + * @return participationId + */ + @javax.annotation.Nullable + public String getParticipationId() { + return participationId; + } + + public void setParticipationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation alleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation = (AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation) o; + return Objects.equals(this.participationId, alleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.participationId); + } + + @Override + public int hashCode() { + return Objects.hash(participationId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation {\n"); + sb.append(" participationId: ").append(toIndentedString(participationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("participationId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation is not found in the empty JSON string", AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("participationId") != null && !jsonObj.get("participationId").isJsonNull()) && !jsonObj.get("participationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `participationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("participationId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation + * @throws IOException if the JSON string is invalid with respect to AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation + */ + public static AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation.class); + } + + /** + * Convert an instance of AlleDiscountGetWithdrawCommandResponseOutputWithdrawnOfferParticipation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponse.java new file mode 100644 index 0000000..8180bb7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponse.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountListCampaignsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountListCampaignsResponse { + public static final String SERIALIZED_NAME_ALLE_DISCOUNT_CAMPAIGNS = "alleDiscountCampaigns"; + @SerializedName(SERIALIZED_NAME_ALLE_DISCOUNT_CAMPAIGNS) + @javax.annotation.Nullable + private List alleDiscountCampaigns = new ArrayList<>(); + + public AlleDiscountListCampaignsResponse() { + } + + public AlleDiscountListCampaignsResponse alleDiscountCampaigns(@javax.annotation.Nullable List alleDiscountCampaigns) { + this.alleDiscountCampaigns = alleDiscountCampaigns; + return this; + } + + public AlleDiscountListCampaignsResponse addAlleDiscountCampaignsItem(AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner alleDiscountCampaignsItem) { + if (this.alleDiscountCampaigns == null) { + this.alleDiscountCampaigns = new ArrayList<>(); + } + this.alleDiscountCampaigns.add(alleDiscountCampaignsItem); + return this; + } + + /** + * Array of the available AlleDiscount campaigns. + * @return alleDiscountCampaigns + */ + @javax.annotation.Nullable + public List getAlleDiscountCampaigns() { + return alleDiscountCampaigns; + } + + public void setAlleDiscountCampaigns(@javax.annotation.Nullable List alleDiscountCampaigns) { + this.alleDiscountCampaigns = alleDiscountCampaigns; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountListCampaignsResponse alleDiscountListCampaignsResponse = (AlleDiscountListCampaignsResponse) o; + return Objects.equals(this.alleDiscountCampaigns, alleDiscountListCampaignsResponse.alleDiscountCampaigns); + } + + @Override + public int hashCode() { + return Objects.hash(alleDiscountCampaigns); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountListCampaignsResponse {\n"); + sb.append(" alleDiscountCampaigns: ").append(toIndentedString(alleDiscountCampaigns)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("alleDiscountCampaigns"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountListCampaignsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountListCampaignsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountListCampaignsResponse is not found in the empty JSON string", AlleDiscountListCampaignsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountListCampaignsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountListCampaignsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("alleDiscountCampaigns") != null && !jsonObj.get("alleDiscountCampaigns").isJsonNull()) { + JsonArray jsonArrayalleDiscountCampaigns = jsonObj.getAsJsonArray("alleDiscountCampaigns"); + if (jsonArrayalleDiscountCampaigns != null) { + // ensure the json data is an array + if (!jsonObj.get("alleDiscountCampaigns").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `alleDiscountCampaigns` to be an array in the JSON string but got `%s`", jsonObj.get("alleDiscountCampaigns").toString())); + } + + // validate the optional field `alleDiscountCampaigns` (array) + for (int i = 0; i < jsonArrayalleDiscountCampaigns.size(); i++) { + AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.validateJsonElement(jsonArrayalleDiscountCampaigns.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountListCampaignsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountListCampaignsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountListCampaignsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountListCampaignsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountListCampaignsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountListCampaignsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountListCampaignsResponse + * @throws IOException if the JSON string is invalid with respect to AlleDiscountListCampaignsResponse + */ + public static AlleDiscountListCampaignsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountListCampaignsResponse.class); + } + + /** + * Convert an instance of AlleDiscountListCampaignsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.java new file mode 100644 index 0000000..2671de7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.java @@ -0,0 +1,450 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication; +import pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace; +import pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication; +import pl.wtx.allegro.api.client.model.AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + /** + * Field providing info about the type of the campaign. Two possible values: - SOURCING - no additional requirements. - DISCOUNT - requires price lower than the lowest from 30 days, created badge has crossed out price. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + SOURCING("SOURCING"), + + DISCOUNT("DISCOUNT"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String SERIALIZED_NAME_VISIBILITY = "visibility"; + @SerializedName(SERIALIZED_NAME_VISIBILITY) + @javax.annotation.Nullable + private AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility visibility; + + public static final String SERIALIZED_NAME_APPLICATION = "application"; + @SerializedName(SERIALIZED_NAME_APPLICATION) + @javax.annotation.Nullable + private AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication application; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication publication; + + public static final String SERIALIZED_NAME_MARKETPLACE = "marketplace"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE) + @javax.annotation.Nullable + private AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace marketplace; + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner() { + } + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the campaign. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the campaign. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Field providing info about the type of the campaign. Two possible values: - SOURCING - no additional requirements. - DISCOUNT - requires price lower than the lowest from 30 days, created badge has crossed out price. + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner visibility(@javax.annotation.Nullable AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility visibility) { + this.visibility = visibility; + return this; + } + + /** + * Get visibility + * @return visibility + */ + @javax.annotation.Nullable + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility getVisibility() { + return visibility; + } + + public void setVisibility(@javax.annotation.Nullable AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility visibility) { + this.visibility = visibility; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner application(@javax.annotation.Nullable AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication application) { + this.application = application; + return this; + } + + /** + * Get application + * @return application + */ + @javax.annotation.Nullable + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication getApplication() { + return application; + } + + public void setApplication(@javax.annotation.Nullable AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication application) { + this.application = application; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner publication(@javax.annotation.Nullable AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication publication) { + this.publication = publication; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner marketplace(@javax.annotation.Nullable AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get marketplace + * @return marketplace + */ + @javax.annotation.Nullable + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace getMarketplace() { + return marketplace; + } + + public void setMarketplace(@javax.annotation.Nullable AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace marketplace) { + this.marketplace = marketplace; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner alleDiscountListCampaignsResponseAlleDiscountCampaignsInner = (AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner) o; + return Objects.equals(this.id, alleDiscountListCampaignsResponseAlleDiscountCampaignsInner.id) && + Objects.equals(this.name, alleDiscountListCampaignsResponseAlleDiscountCampaignsInner.name) && + Objects.equals(this.type, alleDiscountListCampaignsResponseAlleDiscountCampaignsInner.type) && + Objects.equals(this.visibility, alleDiscountListCampaignsResponseAlleDiscountCampaignsInner.visibility) && + Objects.equals(this.application, alleDiscountListCampaignsResponseAlleDiscountCampaignsInner.application) && + Objects.equals(this.publication, alleDiscountListCampaignsResponseAlleDiscountCampaignsInner.publication) && + Objects.equals(this.marketplace, alleDiscountListCampaignsResponseAlleDiscountCampaignsInner.marketplace); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, type, visibility, application, publication, marketplace); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" visibility: ").append(toIndentedString(visibility)).append("\n"); + sb.append(" application: ").append(toIndentedString(application)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" marketplace: ").append(toIndentedString(marketplace)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("visibility"); + openapiFields.add("application"); + openapiFields.add("publication"); + openapiFields.add("marketplace"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner is not found in the empty JSON string", AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + // validate the optional field `visibility` + if (jsonObj.get("visibility") != null && !jsonObj.get("visibility").isJsonNull()) { + AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.validateJsonElement(jsonObj.get("visibility")); + } + // validate the optional field `application` + if (jsonObj.get("application") != null && !jsonObj.get("application").isJsonNull()) { + AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.validateJsonElement(jsonObj.get("application")); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `marketplace` + if (jsonObj.get("marketplace") != null && !jsonObj.get("marketplace").isJsonNull()) { + AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.validateJsonElement(jsonObj.get("marketplace")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner + * @throws IOException if the JSON string is invalid with respect to AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner + */ + public static AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner.class); + } + + /** + * Convert an instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.java new file mode 100644 index 0000000..5889dd0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.java @@ -0,0 +1,315 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Time period when the campaign is open for offer submission. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication { + /** + * Type of campaign visibility. One possible value: - WITHIN + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + WITHIN("WITHIN"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private OffsetDateTime from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private OffsetDateTime to; + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication() { + } + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of campaign visibility. One possible value: - WITHIN + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication from(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + return this; + } + + /** + * Provided in ISO 8601 format. + * @return from + */ + @javax.annotation.Nullable + public OffsetDateTime getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication to(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + return this; + } + + /** + * Provided in ISO 8601 format. + * @return to + */ + @javax.annotation.Nullable + public OffsetDateTime getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication = (AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication) o; + return Objects.equals(this.type, alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.type) && + Objects.equals(this.from, alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.from) && + Objects.equals(this.to, alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.to); + } + + @Override + public int hashCode() { + return Objects.hash(type, from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication is not found in the empty JSON string", AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication + * @throws IOException if the JSON string is invalid with respect to AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication + */ + public static AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication.class); + } + + /** + * Convert an instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.java new file mode 100644 index 0000000..570b7a9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Campaign marketplace data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace() { + } + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the marketplace. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace = (AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace) o; + return Objects.equals(this.id, alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace is not found in the empty JSON string", AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace + * @throws IOException if the JSON string is invalid with respect to AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace + */ + public static AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace.class); + } + + /** + * Convert an instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerMarketplace to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.java new file mode 100644 index 0000000..653d53a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.java @@ -0,0 +1,315 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Time period when reduced price (and possible badge if it applies for campaign) is displayed on the list of offers or on the offer page. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication { + /** + * Type of campaign visibility. One possible value: - WITHIN + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + WITHIN("WITHIN"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private OffsetDateTime from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private OffsetDateTime to; + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication() { + } + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of campaign visibility. One possible value: - WITHIN + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication from(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + return this; + } + + /** + * Provided in ISO 8601 format. + * @return from + */ + @javax.annotation.Nullable + public OffsetDateTime getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication to(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + return this; + } + + /** + * Provided in ISO 8601 format. + * @return to + */ + @javax.annotation.Nullable + public OffsetDateTime getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication = (AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication) o; + return Objects.equals(this.type, alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.type) && + Objects.equals(this.from, alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.from) && + Objects.equals(this.to, alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.to); + } + + @Override + public int hashCode() { + return Objects.hash(type, from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication is not found in the empty JSON string", AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication + * @throws IOException if the JSON string is invalid with respect to AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication + */ + public static AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication.class); + } + + /** + * Convert an instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerPublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.java new file mode 100644 index 0000000..4ececa1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.java @@ -0,0 +1,315 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Time period when the campaign is visible in My Allegro. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility { + /** + * Type of campaign visibility. One possible value: - WITHIN + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + WITHIN("WITHIN"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private OffsetDateTime from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private OffsetDateTime to; + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility() { + } + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of campaign visibility. One possible value: - WITHIN + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility from(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + return this; + } + + /** + * Provided in ISO 8601 format. + * @return from + */ + @javax.annotation.Nullable + public OffsetDateTime getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + } + + + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility to(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + return this; + } + + /** + * Provided in ISO 8601 format. + * @return to + */ + @javax.annotation.Nullable + public OffsetDateTime getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility = (AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility) o; + return Objects.equals(this.type, alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.type) && + Objects.equals(this.from, alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.from) && + Objects.equals(this.to, alleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.to); + } + + @Override + public int hashCode() { + return Objects.hash(type, from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility is not found in the empty JSON string", AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility + * @throws IOException if the JSON string is invalid with respect to AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility + */ + public static AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility.class); + } + + /** + * Convert an instance of AlleDiscountListCampaignsResponseAlleDiscountCampaignsInnerVisibility to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListEligibleResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListEligibleResponse.java new file mode 100644 index 0000000..3bbd36a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListEligibleResponse.java @@ -0,0 +1,282 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AlleDiscountEligibleOfferDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountListEligibleResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountListEligibleResponse { + public static final String SERIALIZED_NAME_ELIGIBLE_OFFERS = "eligibleOffers"; + @SerializedName(SERIALIZED_NAME_ELIGIBLE_OFFERS) + @javax.annotation.Nullable + private List eligibleOffers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private Integer totalCount; + + public AlleDiscountListEligibleResponse() { + } + + public AlleDiscountListEligibleResponse eligibleOffers(@javax.annotation.Nullable List eligibleOffers) { + this.eligibleOffers = eligibleOffers; + return this; + } + + public AlleDiscountListEligibleResponse addEligibleOffersItem(AlleDiscountEligibleOfferDto eligibleOffersItem) { + if (this.eligibleOffers == null) { + this.eligibleOffers = new ArrayList<>(); + } + this.eligibleOffers.add(eligibleOffersItem); + return this; + } + + /** + * Array of offers eligible to be submitted to given AlleDiscount campaign. + * @return eligibleOffers + */ + @javax.annotation.Nullable + public List getEligibleOffers() { + return eligibleOffers; + } + + public void setEligibleOffers(@javax.annotation.Nullable List eligibleOffers) { + this.eligibleOffers = eligibleOffers; + } + + + public AlleDiscountListEligibleResponse count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Number of offers returned in page. + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public AlleDiscountListEligibleResponse totalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of eligible offers. + * @return totalCount + */ + @javax.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountListEligibleResponse alleDiscountListEligibleResponse = (AlleDiscountListEligibleResponse) o; + return Objects.equals(this.eligibleOffers, alleDiscountListEligibleResponse.eligibleOffers) && + Objects.equals(this.count, alleDiscountListEligibleResponse.count) && + Objects.equals(this.totalCount, alleDiscountListEligibleResponse.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(eligibleOffers, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountListEligibleResponse {\n"); + sb.append(" eligibleOffers: ").append(toIndentedString(eligibleOffers)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eligibleOffers"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountListEligibleResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountListEligibleResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountListEligibleResponse is not found in the empty JSON string", AlleDiscountListEligibleResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountListEligibleResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountListEligibleResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("eligibleOffers") != null && !jsonObj.get("eligibleOffers").isJsonNull()) { + JsonArray jsonArrayeligibleOffers = jsonObj.getAsJsonArray("eligibleOffers"); + if (jsonArrayeligibleOffers != null) { + // ensure the json data is an array + if (!jsonObj.get("eligibleOffers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `eligibleOffers` to be an array in the JSON string but got `%s`", jsonObj.get("eligibleOffers").toString())); + } + + // validate the optional field `eligibleOffers` (array) + for (int i = 0; i < jsonArrayeligibleOffers.size(); i++) { + AlleDiscountEligibleOfferDto.validateJsonElement(jsonArrayeligibleOffers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountListEligibleResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountListEligibleResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountListEligibleResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountListEligibleResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountListEligibleResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountListEligibleResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountListEligibleResponse + * @throws IOException if the JSON string is invalid with respect to AlleDiscountListEligibleResponse + */ + public static AlleDiscountListEligibleResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountListEligibleResponse.class); + } + + /** + * Convert an instance of AlleDiscountListEligibleResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListSubmittedResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListSubmittedResponse.java new file mode 100644 index 0000000..57d9bc1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountListSubmittedResponse.java @@ -0,0 +1,282 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountListSubmittedResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountListSubmittedResponse { + public static final String SERIALIZED_NAME_SUBMITTED_OFFERS = "submittedOffers"; + @SerializedName(SERIALIZED_NAME_SUBMITTED_OFFERS) + @javax.annotation.Nullable + private List submittedOffers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private Integer totalCount; + + public AlleDiscountListSubmittedResponse() { + } + + public AlleDiscountListSubmittedResponse submittedOffers(@javax.annotation.Nullable List submittedOffers) { + this.submittedOffers = submittedOffers; + return this; + } + + public AlleDiscountListSubmittedResponse addSubmittedOffersItem(AlleDiscountSubmittedOfferDto submittedOffersItem) { + if (this.submittedOffers == null) { + this.submittedOffers = new ArrayList<>(); + } + this.submittedOffers.add(submittedOffersItem); + return this; + } + + /** + * Array of offers submitted to a given AlleDiscount campaign. This list contains all active and non active offer participations. There can be only one submission for offer in one AlleDiscount campaign. + * @return submittedOffers + */ + @javax.annotation.Nullable + public List getSubmittedOffers() { + return submittedOffers; + } + + public void setSubmittedOffers(@javax.annotation.Nullable List submittedOffers) { + this.submittedOffers = submittedOffers; + } + + + public AlleDiscountListSubmittedResponse count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Number of offers returned in page. + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public AlleDiscountListSubmittedResponse totalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of submitted offers. + * @return totalCount + */ + @javax.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountListSubmittedResponse alleDiscountListSubmittedResponse = (AlleDiscountListSubmittedResponse) o; + return Objects.equals(this.submittedOffers, alleDiscountListSubmittedResponse.submittedOffers) && + Objects.equals(this.count, alleDiscountListSubmittedResponse.count) && + Objects.equals(this.totalCount, alleDiscountListSubmittedResponse.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(submittedOffers, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountListSubmittedResponse {\n"); + sb.append(" submittedOffers: ").append(toIndentedString(submittedOffers)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("submittedOffers"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountListSubmittedResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountListSubmittedResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountListSubmittedResponse is not found in the empty JSON string", AlleDiscountListSubmittedResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountListSubmittedResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountListSubmittedResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("submittedOffers") != null && !jsonObj.get("submittedOffers").isJsonNull()) { + JsonArray jsonArraysubmittedOffers = jsonObj.getAsJsonArray("submittedOffers"); + if (jsonArraysubmittedOffers != null) { + // ensure the json data is an array + if (!jsonObj.get("submittedOffers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `submittedOffers` to be an array in the JSON string but got `%s`", jsonObj.get("submittedOffers").toString())); + } + + // validate the optional field `submittedOffers` (array) + for (int i = 0; i < jsonArraysubmittedOffers.size(); i++) { + AlleDiscountSubmittedOfferDto.validateJsonElement(jsonArraysubmittedOffers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountListSubmittedResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountListSubmittedResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountListSubmittedResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountListSubmittedResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountListSubmittedResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountListSubmittedResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountListSubmittedResponse + * @throws IOException if the JSON string is invalid with respect to AlleDiscountListSubmittedResponse + */ + public static AlleDiscountListSubmittedResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountListSubmittedResponse.class); + } + + /** + * Convert an instance of AlleDiscountListSubmittedResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountRequiredMerchantPriceDto.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountRequiredMerchantPriceDto.java new file mode 100644 index 0000000..70fb348 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountRequiredMerchantPriceDto.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Maximum price of offer that will be accepted in this AlleDiscount campaign. If you send submission with higher price, it will be rejected. You can submit your offer with lower price than one indicated here. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountRequiredMerchantPriceDto { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public AlleDiscountRequiredMerchantPriceDto() { + } + + public AlleDiscountRequiredMerchantPriceDto amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount of the price. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public AlleDiscountRequiredMerchantPriceDto currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Currency of the price. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountRequiredMerchantPriceDto alleDiscountRequiredMerchantPriceDto = (AlleDiscountRequiredMerchantPriceDto) o; + return Objects.equals(this.amount, alleDiscountRequiredMerchantPriceDto.amount) && + Objects.equals(this.currency, alleDiscountRequiredMerchantPriceDto.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountRequiredMerchantPriceDto {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountRequiredMerchantPriceDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountRequiredMerchantPriceDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountRequiredMerchantPriceDto is not found in the empty JSON string", AlleDiscountRequiredMerchantPriceDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountRequiredMerchantPriceDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountRequiredMerchantPriceDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountRequiredMerchantPriceDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountRequiredMerchantPriceDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountRequiredMerchantPriceDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountRequiredMerchantPriceDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountRequiredMerchantPriceDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountRequiredMerchantPriceDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountRequiredMerchantPriceDto + * @throws IOException if the JSON string is invalid with respect to AlleDiscountRequiredMerchantPriceDto + */ + public static AlleDiscountRequiredMerchantPriceDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountRequiredMerchantPriceDto.class); + } + + /** + * Convert an instance of AlleDiscountRequiredMerchantPriceDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequest.java new file mode 100644 index 0000000..aa69647 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequest.java @@ -0,0 +1,250 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandRequestInput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountSubmitCommandRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmitCommandRequest { + public static final String SERIALIZED_NAME_COMMAND_ID = "commandId"; + @SerializedName(SERIALIZED_NAME_COMMAND_ID) + @javax.annotation.Nullable + private String commandId; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nullable + private AlleDiscountSubmitCommandRequestInput input; + + public AlleDiscountSubmitCommandRequest() { + } + + public AlleDiscountSubmitCommandRequest commandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + return this; + } + + /** + * The command UUID. If empty, system generates new one. + * @return commandId + */ + @javax.annotation.Nullable + public String getCommandId() { + return commandId; + } + + public void setCommandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + } + + + public AlleDiscountSubmitCommandRequest input(@javax.annotation.Nullable AlleDiscountSubmitCommandRequestInput input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nullable + public AlleDiscountSubmitCommandRequestInput getInput() { + return input; + } + + public void setInput(@javax.annotation.Nullable AlleDiscountSubmitCommandRequestInput input) { + this.input = input; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmitCommandRequest alleDiscountSubmitCommandRequest = (AlleDiscountSubmitCommandRequest) o; + return Objects.equals(this.commandId, alleDiscountSubmitCommandRequest.commandId) && + Objects.equals(this.input, alleDiscountSubmitCommandRequest.input); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(commandId, input); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmitCommandRequest {\n"); + sb.append(" commandId: ").append(toIndentedString(commandId)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("commandId"); + openapiFields.add("input"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmitCommandRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmitCommandRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmitCommandRequest is not found in the empty JSON string", AlleDiscountSubmitCommandRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmitCommandRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmitCommandRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("commandId") != null && !jsonObj.get("commandId").isJsonNull()) && !jsonObj.get("commandId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commandId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commandId").toString())); + } + // validate the optional field `input` + if (jsonObj.get("input") != null && !jsonObj.get("input").isJsonNull()) { + AlleDiscountSubmitCommandRequestInput.validateJsonElement(jsonObj.get("input")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmitCommandRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmitCommandRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmitCommandRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmitCommandRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmitCommandRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmitCommandRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmitCommandRequest + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmitCommandRequest + */ + public static AlleDiscountSubmitCommandRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmitCommandRequest.class); + } + + /** + * Convert an instance of AlleDiscountSubmitCommandRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInput.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInput.java new file mode 100644 index 0000000..4619bde --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInput.java @@ -0,0 +1,272 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandRequestInputCampaign; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandRequestInputOffer; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandRequestInputProposedPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Command input. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmitCommandRequestInput { + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private AlleDiscountSubmitCommandRequestInputOffer offer; + + public static final String SERIALIZED_NAME_CAMPAIGN = "campaign"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN) + @javax.annotation.Nullable + private AlleDiscountSubmitCommandRequestInputCampaign campaign; + + public static final String SERIALIZED_NAME_PROPOSED_PRICE = "proposedPrice"; + @SerializedName(SERIALIZED_NAME_PROPOSED_PRICE) + @javax.annotation.Nullable + private AlleDiscountSubmitCommandRequestInputProposedPrice proposedPrice; + + public AlleDiscountSubmitCommandRequestInput() { + } + + public AlleDiscountSubmitCommandRequestInput offer(@javax.annotation.Nullable AlleDiscountSubmitCommandRequestInputOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public AlleDiscountSubmitCommandRequestInputOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable AlleDiscountSubmitCommandRequestInputOffer offer) { + this.offer = offer; + } + + + public AlleDiscountSubmitCommandRequestInput campaign(@javax.annotation.Nullable AlleDiscountSubmitCommandRequestInputCampaign campaign) { + this.campaign = campaign; + return this; + } + + /** + * Get campaign + * @return campaign + */ + @javax.annotation.Nullable + public AlleDiscountSubmitCommandRequestInputCampaign getCampaign() { + return campaign; + } + + public void setCampaign(@javax.annotation.Nullable AlleDiscountSubmitCommandRequestInputCampaign campaign) { + this.campaign = campaign; + } + + + public AlleDiscountSubmitCommandRequestInput proposedPrice(@javax.annotation.Nullable AlleDiscountSubmitCommandRequestInputProposedPrice proposedPrice) { + this.proposedPrice = proposedPrice; + return this; + } + + /** + * Get proposedPrice + * @return proposedPrice + */ + @javax.annotation.Nullable + public AlleDiscountSubmitCommandRequestInputProposedPrice getProposedPrice() { + return proposedPrice; + } + + public void setProposedPrice(@javax.annotation.Nullable AlleDiscountSubmitCommandRequestInputProposedPrice proposedPrice) { + this.proposedPrice = proposedPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmitCommandRequestInput alleDiscountSubmitCommandRequestInput = (AlleDiscountSubmitCommandRequestInput) o; + return Objects.equals(this.offer, alleDiscountSubmitCommandRequestInput.offer) && + Objects.equals(this.campaign, alleDiscountSubmitCommandRequestInput.campaign) && + Objects.equals(this.proposedPrice, alleDiscountSubmitCommandRequestInput.proposedPrice); + } + + @Override + public int hashCode() { + return Objects.hash(offer, campaign, proposedPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmitCommandRequestInput {\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" campaign: ").append(toIndentedString(campaign)).append("\n"); + sb.append(" proposedPrice: ").append(toIndentedString(proposedPrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offer"); + openapiFields.add("campaign"); + openapiFields.add("proposedPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmitCommandRequestInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmitCommandRequestInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmitCommandRequestInput is not found in the empty JSON string", AlleDiscountSubmitCommandRequestInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmitCommandRequestInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmitCommandRequestInput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + AlleDiscountSubmitCommandRequestInputOffer.validateJsonElement(jsonObj.get("offer")); + } + // validate the optional field `campaign` + if (jsonObj.get("campaign") != null && !jsonObj.get("campaign").isJsonNull()) { + AlleDiscountSubmitCommandRequestInputCampaign.validateJsonElement(jsonObj.get("campaign")); + } + // validate the optional field `proposedPrice` + if (jsonObj.get("proposedPrice") != null && !jsonObj.get("proposedPrice").isJsonNull()) { + AlleDiscountSubmitCommandRequestInputProposedPrice.validateJsonElement(jsonObj.get("proposedPrice")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmitCommandRequestInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmitCommandRequestInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmitCommandRequestInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmitCommandRequestInput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmitCommandRequestInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmitCommandRequestInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmitCommandRequestInput + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmitCommandRequestInput + */ + public static AlleDiscountSubmitCommandRequestInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmitCommandRequestInput.class); + } + + /** + * Convert an instance of AlleDiscountSubmitCommandRequestInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputCampaign.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputCampaign.java new file mode 100644 index 0000000..9f4136b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputCampaign.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Data of AlleDiscount campaign you want to submit your offer to. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmitCommandRequestInputCampaign { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public AlleDiscountSubmitCommandRequestInputCampaign() { + } + + public AlleDiscountSubmitCommandRequestInputCampaign id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the AlleDiscount campaign. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmitCommandRequestInputCampaign alleDiscountSubmitCommandRequestInputCampaign = (AlleDiscountSubmitCommandRequestInputCampaign) o; + return Objects.equals(this.id, alleDiscountSubmitCommandRequestInputCampaign.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmitCommandRequestInputCampaign {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmitCommandRequestInputCampaign + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmitCommandRequestInputCampaign.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmitCommandRequestInputCampaign is not found in the empty JSON string", AlleDiscountSubmitCommandRequestInputCampaign.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmitCommandRequestInputCampaign.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmitCommandRequestInputCampaign` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmitCommandRequestInputCampaign.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmitCommandRequestInputCampaign' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmitCommandRequestInputCampaign.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmitCommandRequestInputCampaign value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmitCommandRequestInputCampaign read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmitCommandRequestInputCampaign given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmitCommandRequestInputCampaign + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmitCommandRequestInputCampaign + */ + public static AlleDiscountSubmitCommandRequestInputCampaign fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmitCommandRequestInputCampaign.class); + } + + /** + * Convert an instance of AlleDiscountSubmitCommandRequestInputCampaign to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputOffer.java new file mode 100644 index 0000000..66293d8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputOffer.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Data of the offer you want to submit to the AlleDiscount campaign. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmitCommandRequestInputOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public AlleDiscountSubmitCommandRequestInputOffer() { + } + + public AlleDiscountSubmitCommandRequestInputOffer id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the offer. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmitCommandRequestInputOffer alleDiscountSubmitCommandRequestInputOffer = (AlleDiscountSubmitCommandRequestInputOffer) o; + return Objects.equals(this.id, alleDiscountSubmitCommandRequestInputOffer.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmitCommandRequestInputOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmitCommandRequestInputOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmitCommandRequestInputOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmitCommandRequestInputOffer is not found in the empty JSON string", AlleDiscountSubmitCommandRequestInputOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmitCommandRequestInputOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmitCommandRequestInputOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmitCommandRequestInputOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmitCommandRequestInputOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmitCommandRequestInputOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmitCommandRequestInputOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmitCommandRequestInputOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmitCommandRequestInputOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmitCommandRequestInputOffer + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmitCommandRequestInputOffer + */ + public static AlleDiscountSubmitCommandRequestInputOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmitCommandRequestInputOffer.class); + } + + /** + * Convert an instance of AlleDiscountSubmitCommandRequestInputOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputProposedPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputProposedPrice.java new file mode 100644 index 0000000..2778304 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandRequestInputProposedPrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The price you agree to lower to for the offer. Must be equal or lower than requiredMerchantPrice returned in `/sale/alle-discount/{campaignId}/eligible-offers` endpoint. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmitCommandRequestInputProposedPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public AlleDiscountSubmitCommandRequestInputProposedPrice() { + } + + public AlleDiscountSubmitCommandRequestInputProposedPrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount of the proposed price. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public AlleDiscountSubmitCommandRequestInputProposedPrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Currency of the proposed price. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmitCommandRequestInputProposedPrice alleDiscountSubmitCommandRequestInputProposedPrice = (AlleDiscountSubmitCommandRequestInputProposedPrice) o; + return Objects.equals(this.amount, alleDiscountSubmitCommandRequestInputProposedPrice.amount) && + Objects.equals(this.currency, alleDiscountSubmitCommandRequestInputProposedPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmitCommandRequestInputProposedPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmitCommandRequestInputProposedPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmitCommandRequestInputProposedPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmitCommandRequestInputProposedPrice is not found in the empty JSON string", AlleDiscountSubmitCommandRequestInputProposedPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmitCommandRequestInputProposedPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmitCommandRequestInputProposedPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmitCommandRequestInputProposedPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmitCommandRequestInputProposedPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmitCommandRequestInputProposedPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmitCommandRequestInputProposedPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmitCommandRequestInputProposedPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmitCommandRequestInputProposedPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmitCommandRequestInputProposedPrice + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmitCommandRequestInputProposedPrice + */ + public static AlleDiscountSubmitCommandRequestInputProposedPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmitCommandRequestInputProposedPrice.class); + } + + /** + * Convert an instance of AlleDiscountSubmitCommandRequestInputProposedPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponse.java new file mode 100644 index 0000000..91bc016 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponse.java @@ -0,0 +1,270 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponseInput; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponseOutput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountSubmitCommandResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmitCommandResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nullable + private AlleDiscountSubmitCommandResponseInput input; + + public static final String SERIALIZED_NAME_OUTPUT = "output"; + @SerializedName(SERIALIZED_NAME_OUTPUT) + @javax.annotation.Nullable + private AlleDiscountSubmitCommandResponseOutput output; + + public AlleDiscountSubmitCommandResponse() { + } + + public AlleDiscountSubmitCommandResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Provided UUID of the submit offer command or generated UUID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public AlleDiscountSubmitCommandResponse input(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseInput input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nullable + public AlleDiscountSubmitCommandResponseInput getInput() { + return input; + } + + public void setInput(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseInput input) { + this.input = input; + } + + + public AlleDiscountSubmitCommandResponse output(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseOutput output) { + this.output = output; + return this; + } + + /** + * Get output + * @return output + */ + @javax.annotation.Nullable + public AlleDiscountSubmitCommandResponseOutput getOutput() { + return output; + } + + public void setOutput(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseOutput output) { + this.output = output; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmitCommandResponse alleDiscountSubmitCommandResponse = (AlleDiscountSubmitCommandResponse) o; + return Objects.equals(this.id, alleDiscountSubmitCommandResponse.id) && + Objects.equals(this.input, alleDiscountSubmitCommandResponse.input) && + Objects.equals(this.output, alleDiscountSubmitCommandResponse.output); + } + + @Override + public int hashCode() { + return Objects.hash(id, input, output); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmitCommandResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("input"); + openapiFields.add("output"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmitCommandResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmitCommandResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmitCommandResponse is not found in the empty JSON string", AlleDiscountSubmitCommandResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmitCommandResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmitCommandResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `input` + if (jsonObj.get("input") != null && !jsonObj.get("input").isJsonNull()) { + AlleDiscountSubmitCommandResponseInput.validateJsonElement(jsonObj.get("input")); + } + // validate the optional field `output` + if (jsonObj.get("output") != null && !jsonObj.get("output").isJsonNull()) { + AlleDiscountSubmitCommandResponseOutput.validateJsonElement(jsonObj.get("output")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmitCommandResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmitCommandResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmitCommandResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmitCommandResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmitCommandResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmitCommandResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmitCommandResponse + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmitCommandResponse + */ + public static AlleDiscountSubmitCommandResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmitCommandResponse.class); + } + + /** + * Convert an instance of AlleDiscountSubmitCommandResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInput.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInput.java new file mode 100644 index 0000000..8027548 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInput.java @@ -0,0 +1,272 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponseInputCampaign; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponseInputOffer; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmitCommandResponseInputProposedPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Provided submit offer command input data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmitCommandResponseInput { + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private AlleDiscountSubmitCommandResponseInputOffer offer; + + public static final String SERIALIZED_NAME_CAMPAIGN = "campaign"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN) + @javax.annotation.Nullable + private AlleDiscountSubmitCommandResponseInputCampaign campaign; + + public static final String SERIALIZED_NAME_PROPOSED_PRICE = "proposedPrice"; + @SerializedName(SERIALIZED_NAME_PROPOSED_PRICE) + @javax.annotation.Nullable + private AlleDiscountSubmitCommandResponseInputProposedPrice proposedPrice; + + public AlleDiscountSubmitCommandResponseInput() { + } + + public AlleDiscountSubmitCommandResponseInput offer(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseInputOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public AlleDiscountSubmitCommandResponseInputOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseInputOffer offer) { + this.offer = offer; + } + + + public AlleDiscountSubmitCommandResponseInput campaign(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseInputCampaign campaign) { + this.campaign = campaign; + return this; + } + + /** + * Get campaign + * @return campaign + */ + @javax.annotation.Nullable + public AlleDiscountSubmitCommandResponseInputCampaign getCampaign() { + return campaign; + } + + public void setCampaign(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseInputCampaign campaign) { + this.campaign = campaign; + } + + + public AlleDiscountSubmitCommandResponseInput proposedPrice(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseInputProposedPrice proposedPrice) { + this.proposedPrice = proposedPrice; + return this; + } + + /** + * Get proposedPrice + * @return proposedPrice + */ + @javax.annotation.Nullable + public AlleDiscountSubmitCommandResponseInputProposedPrice getProposedPrice() { + return proposedPrice; + } + + public void setProposedPrice(@javax.annotation.Nullable AlleDiscountSubmitCommandResponseInputProposedPrice proposedPrice) { + this.proposedPrice = proposedPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmitCommandResponseInput alleDiscountSubmitCommandResponseInput = (AlleDiscountSubmitCommandResponseInput) o; + return Objects.equals(this.offer, alleDiscountSubmitCommandResponseInput.offer) && + Objects.equals(this.campaign, alleDiscountSubmitCommandResponseInput.campaign) && + Objects.equals(this.proposedPrice, alleDiscountSubmitCommandResponseInput.proposedPrice); + } + + @Override + public int hashCode() { + return Objects.hash(offer, campaign, proposedPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmitCommandResponseInput {\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" campaign: ").append(toIndentedString(campaign)).append("\n"); + sb.append(" proposedPrice: ").append(toIndentedString(proposedPrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offer"); + openapiFields.add("campaign"); + openapiFields.add("proposedPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmitCommandResponseInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmitCommandResponseInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmitCommandResponseInput is not found in the empty JSON string", AlleDiscountSubmitCommandResponseInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmitCommandResponseInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmitCommandResponseInput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + AlleDiscountSubmitCommandResponseInputOffer.validateJsonElement(jsonObj.get("offer")); + } + // validate the optional field `campaign` + if (jsonObj.get("campaign") != null && !jsonObj.get("campaign").isJsonNull()) { + AlleDiscountSubmitCommandResponseInputCampaign.validateJsonElement(jsonObj.get("campaign")); + } + // validate the optional field `proposedPrice` + if (jsonObj.get("proposedPrice") != null && !jsonObj.get("proposedPrice").isJsonNull()) { + AlleDiscountSubmitCommandResponseInputProposedPrice.validateJsonElement(jsonObj.get("proposedPrice")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmitCommandResponseInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmitCommandResponseInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmitCommandResponseInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmitCommandResponseInput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmitCommandResponseInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmitCommandResponseInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmitCommandResponseInput + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmitCommandResponseInput + */ + public static AlleDiscountSubmitCommandResponseInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmitCommandResponseInput.class); + } + + /** + * Convert an instance of AlleDiscountSubmitCommandResponseInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputCampaign.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputCampaign.java new file mode 100644 index 0000000..16671db --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputCampaign.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Campaign data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmitCommandResponseInputCampaign { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public AlleDiscountSubmitCommandResponseInputCampaign() { + } + + public AlleDiscountSubmitCommandResponseInputCampaign id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the campaign. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmitCommandResponseInputCampaign alleDiscountSubmitCommandResponseInputCampaign = (AlleDiscountSubmitCommandResponseInputCampaign) o; + return Objects.equals(this.id, alleDiscountSubmitCommandResponseInputCampaign.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmitCommandResponseInputCampaign {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmitCommandResponseInputCampaign + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmitCommandResponseInputCampaign.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmitCommandResponseInputCampaign is not found in the empty JSON string", AlleDiscountSubmitCommandResponseInputCampaign.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmitCommandResponseInputCampaign.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmitCommandResponseInputCampaign` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmitCommandResponseInputCampaign.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmitCommandResponseInputCampaign' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmitCommandResponseInputCampaign.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmitCommandResponseInputCampaign value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmitCommandResponseInputCampaign read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmitCommandResponseInputCampaign given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmitCommandResponseInputCampaign + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmitCommandResponseInputCampaign + */ + public static AlleDiscountSubmitCommandResponseInputCampaign fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmitCommandResponseInputCampaign.class); + } + + /** + * Convert an instance of AlleDiscountSubmitCommandResponseInputCampaign to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputOffer.java new file mode 100644 index 0000000..0964a16 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputOffer.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmitCommandResponseInputOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public AlleDiscountSubmitCommandResponseInputOffer() { + } + + public AlleDiscountSubmitCommandResponseInputOffer id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the offer. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmitCommandResponseInputOffer alleDiscountSubmitCommandResponseInputOffer = (AlleDiscountSubmitCommandResponseInputOffer) o; + return Objects.equals(this.id, alleDiscountSubmitCommandResponseInputOffer.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmitCommandResponseInputOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmitCommandResponseInputOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmitCommandResponseInputOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmitCommandResponseInputOffer is not found in the empty JSON string", AlleDiscountSubmitCommandResponseInputOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmitCommandResponseInputOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmitCommandResponseInputOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmitCommandResponseInputOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmitCommandResponseInputOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmitCommandResponseInputOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmitCommandResponseInputOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmitCommandResponseInputOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmitCommandResponseInputOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmitCommandResponseInputOffer + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmitCommandResponseInputOffer + */ + public static AlleDiscountSubmitCommandResponseInputOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmitCommandResponseInputOffer.class); + } + + /** + * Convert an instance of AlleDiscountSubmitCommandResponseInputOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputProposedPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputProposedPrice.java new file mode 100644 index 0000000..5a699b3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseInputProposedPrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The price you agreed to lower to for the offer. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmitCommandResponseInputProposedPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public AlleDiscountSubmitCommandResponseInputProposedPrice() { + } + + public AlleDiscountSubmitCommandResponseInputProposedPrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount of the price. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public AlleDiscountSubmitCommandResponseInputProposedPrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Currency of the price. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmitCommandResponseInputProposedPrice alleDiscountSubmitCommandResponseInputProposedPrice = (AlleDiscountSubmitCommandResponseInputProposedPrice) o; + return Objects.equals(this.amount, alleDiscountSubmitCommandResponseInputProposedPrice.amount) && + Objects.equals(this.currency, alleDiscountSubmitCommandResponseInputProposedPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmitCommandResponseInputProposedPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmitCommandResponseInputProposedPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmitCommandResponseInputProposedPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmitCommandResponseInputProposedPrice is not found in the empty JSON string", AlleDiscountSubmitCommandResponseInputProposedPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmitCommandResponseInputProposedPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmitCommandResponseInputProposedPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmitCommandResponseInputProposedPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmitCommandResponseInputProposedPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmitCommandResponseInputProposedPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmitCommandResponseInputProposedPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmitCommandResponseInputProposedPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmitCommandResponseInputProposedPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmitCommandResponseInputProposedPrice + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmitCommandResponseInputProposedPrice + */ + public static AlleDiscountSubmitCommandResponseInputProposedPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmitCommandResponseInputProposedPrice.class); + } + + /** + * Convert an instance of AlleDiscountSubmitCommandResponseInputProposedPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseOutput.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseOutput.java new file mode 100644 index 0000000..c1c0ea1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmitCommandResponseOutput.java @@ -0,0 +1,315 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Submit offer command output data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmitCommandResponseOutput { + /** + * Execution status of the command. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + NEW("NEW"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public AlleDiscountSubmitCommandResponseOutput() { + } + + public AlleDiscountSubmitCommandResponseOutput status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Execution status of the command. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public AlleDiscountSubmitCommandResponseOutput createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation date of the command. ISO 8601 format. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AlleDiscountSubmitCommandResponseOutput updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Update date of the command. ISO 8601 format. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmitCommandResponseOutput alleDiscountSubmitCommandResponseOutput = (AlleDiscountSubmitCommandResponseOutput) o; + return Objects.equals(this.status, alleDiscountSubmitCommandResponseOutput.status) && + Objects.equals(this.createdAt, alleDiscountSubmitCommandResponseOutput.createdAt) && + Objects.equals(this.updatedAt, alleDiscountSubmitCommandResponseOutput.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(status, createdAt, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmitCommandResponseOutput {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmitCommandResponseOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmitCommandResponseOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmitCommandResponseOutput is not found in the empty JSON string", AlleDiscountSubmitCommandResponseOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmitCommandResponseOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmitCommandResponseOutput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmitCommandResponseOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmitCommandResponseOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmitCommandResponseOutput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmitCommandResponseOutput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmitCommandResponseOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmitCommandResponseOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmitCommandResponseOutput + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmitCommandResponseOutput + */ + public static AlleDiscountSubmitCommandResponseOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmitCommandResponseOutput.class); + } + + /** + * Convert an instance of AlleDiscountSubmitCommandResponseOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDto.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDto.java new file mode 100644 index 0000000..3a937fc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDto.java @@ -0,0 +1,361 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoCampaign; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoOffer; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoPrices; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoProcess; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountSubmittedOfferDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmittedOfferDto { + public static final String SERIALIZED_NAME_PARTICIPATION_ID = "participationId"; + @SerializedName(SERIALIZED_NAME_PARTICIPATION_ID) + @javax.annotation.Nullable + private String participationId; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private AlleDiscountSubmittedOfferDtoOffer offer; + + public static final String SERIALIZED_NAME_CAMPAIGN = "campaign"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN) + @javax.annotation.Nullable + private AlleDiscountSubmittedOfferDtoCampaign campaign; + + public static final String SERIALIZED_NAME_PRICES = "prices"; + @SerializedName(SERIALIZED_NAME_PRICES) + @javax.annotation.Nullable + private AlleDiscountSubmittedOfferDtoPrices prices; + + public static final String SERIALIZED_NAME_PROCESS = "process"; + @SerializedName(SERIALIZED_NAME_PROCESS) + @javax.annotation.Nullable + private AlleDiscountSubmittedOfferDtoProcess process; + + public static final String SERIALIZED_NAME_PURCHASE_LIMIT = "purchaseLimit"; + @SerializedName(SERIALIZED_NAME_PURCHASE_LIMIT) + @javax.annotation.Nullable + private Integer purchaseLimit; + + public AlleDiscountSubmittedOfferDto() { + } + + public AlleDiscountSubmittedOfferDto participationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + return this; + } + + /** + * The id of the participation. + * @return participationId + */ + @javax.annotation.Nullable + public String getParticipationId() { + return participationId; + } + + public void setParticipationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + } + + + public AlleDiscountSubmittedOfferDto offer(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public AlleDiscountSubmittedOfferDtoOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoOffer offer) { + this.offer = offer; + } + + + public AlleDiscountSubmittedOfferDto campaign(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoCampaign campaign) { + this.campaign = campaign; + return this; + } + + /** + * Get campaign + * @return campaign + */ + @javax.annotation.Nullable + public AlleDiscountSubmittedOfferDtoCampaign getCampaign() { + return campaign; + } + + public void setCampaign(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoCampaign campaign) { + this.campaign = campaign; + } + + + public AlleDiscountSubmittedOfferDto prices(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoPrices prices) { + this.prices = prices; + return this; + } + + /** + * Get prices + * @return prices + */ + @javax.annotation.Nullable + public AlleDiscountSubmittedOfferDtoPrices getPrices() { + return prices; + } + + public void setPrices(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoPrices prices) { + this.prices = prices; + } + + + public AlleDiscountSubmittedOfferDto process(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoProcess process) { + this.process = process; + return this; + } + + /** + * Get process + * @return process + */ + @javax.annotation.Nullable + public AlleDiscountSubmittedOfferDtoProcess getProcess() { + return process; + } + + public void setProcess(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoProcess process) { + this.process = process; + } + + + public AlleDiscountSubmittedOfferDto purchaseLimit(@javax.annotation.Nullable Integer purchaseLimit) { + this.purchaseLimit = purchaseLimit; + return this; + } + + /** + * Limit of purchases on the offer. + * @return purchaseLimit + */ + @javax.annotation.Nullable + public Integer getPurchaseLimit() { + return purchaseLimit; + } + + public void setPurchaseLimit(@javax.annotation.Nullable Integer purchaseLimit) { + this.purchaseLimit = purchaseLimit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmittedOfferDto alleDiscountSubmittedOfferDto = (AlleDiscountSubmittedOfferDto) o; + return Objects.equals(this.participationId, alleDiscountSubmittedOfferDto.participationId) && + Objects.equals(this.offer, alleDiscountSubmittedOfferDto.offer) && + Objects.equals(this.campaign, alleDiscountSubmittedOfferDto.campaign) && + Objects.equals(this.prices, alleDiscountSubmittedOfferDto.prices) && + Objects.equals(this.process, alleDiscountSubmittedOfferDto.process) && + Objects.equals(this.purchaseLimit, alleDiscountSubmittedOfferDto.purchaseLimit); + } + + @Override + public int hashCode() { + return Objects.hash(participationId, offer, campaign, prices, process, purchaseLimit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmittedOfferDto {\n"); + sb.append(" participationId: ").append(toIndentedString(participationId)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" campaign: ").append(toIndentedString(campaign)).append("\n"); + sb.append(" prices: ").append(toIndentedString(prices)).append("\n"); + sb.append(" process: ").append(toIndentedString(process)).append("\n"); + sb.append(" purchaseLimit: ").append(toIndentedString(purchaseLimit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("participationId"); + openapiFields.add("offer"); + openapiFields.add("campaign"); + openapiFields.add("prices"); + openapiFields.add("process"); + openapiFields.add("purchaseLimit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmittedOfferDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmittedOfferDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmittedOfferDto is not found in the empty JSON string", AlleDiscountSubmittedOfferDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmittedOfferDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmittedOfferDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("participationId") != null && !jsonObj.get("participationId").isJsonNull()) && !jsonObj.get("participationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `participationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("participationId").toString())); + } + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + AlleDiscountSubmittedOfferDtoOffer.validateJsonElement(jsonObj.get("offer")); + } + // validate the optional field `campaign` + if (jsonObj.get("campaign") != null && !jsonObj.get("campaign").isJsonNull()) { + AlleDiscountSubmittedOfferDtoCampaign.validateJsonElement(jsonObj.get("campaign")); + } + // validate the optional field `prices` + if (jsonObj.get("prices") != null && !jsonObj.get("prices").isJsonNull()) { + AlleDiscountSubmittedOfferDtoPrices.validateJsonElement(jsonObj.get("prices")); + } + // validate the optional field `process` + if (jsonObj.get("process") != null && !jsonObj.get("process").isJsonNull()) { + AlleDiscountSubmittedOfferDtoProcess.validateJsonElement(jsonObj.get("process")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmittedOfferDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmittedOfferDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmittedOfferDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmittedOfferDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmittedOfferDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmittedOfferDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmittedOfferDto + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmittedOfferDto + */ + public static AlleDiscountSubmittedOfferDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmittedOfferDto.class); + } + + /** + * Convert an instance of AlleDiscountSubmittedOfferDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoCampaign.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoCampaign.java new file mode 100644 index 0000000..188a22e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoCampaign.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscount campaign data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmittedOfferDtoCampaign { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public AlleDiscountSubmittedOfferDtoCampaign() { + } + + public AlleDiscountSubmittedOfferDtoCampaign id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the campaign. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmittedOfferDtoCampaign alleDiscountSubmittedOfferDtoCampaign = (AlleDiscountSubmittedOfferDtoCampaign) o; + return Objects.equals(this.id, alleDiscountSubmittedOfferDtoCampaign.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmittedOfferDtoCampaign {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmittedOfferDtoCampaign + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmittedOfferDtoCampaign.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmittedOfferDtoCampaign is not found in the empty JSON string", AlleDiscountSubmittedOfferDtoCampaign.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmittedOfferDtoCampaign.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmittedOfferDtoCampaign` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmittedOfferDtoCampaign.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmittedOfferDtoCampaign' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmittedOfferDtoCampaign.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmittedOfferDtoCampaign value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmittedOfferDtoCampaign read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmittedOfferDtoCampaign given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmittedOfferDtoCampaign + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmittedOfferDtoCampaign + */ + public static AlleDiscountSubmittedOfferDtoCampaign fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmittedOfferDtoCampaign.class); + } + + /** + * Convert an instance of AlleDiscountSubmittedOfferDtoCampaign to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoOffer.java new file mode 100644 index 0000000..b7f7ecb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoOffer.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Submitted offer data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmittedOfferDtoOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public AlleDiscountSubmittedOfferDtoOffer() { + } + + public AlleDiscountSubmittedOfferDtoOffer id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the offer. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmittedOfferDtoOffer alleDiscountSubmittedOfferDtoOffer = (AlleDiscountSubmittedOfferDtoOffer) o; + return Objects.equals(this.id, alleDiscountSubmittedOfferDtoOffer.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmittedOfferDtoOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmittedOfferDtoOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmittedOfferDtoOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmittedOfferDtoOffer is not found in the empty JSON string", AlleDiscountSubmittedOfferDtoOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmittedOfferDtoOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmittedOfferDtoOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmittedOfferDtoOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmittedOfferDtoOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmittedOfferDtoOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmittedOfferDtoOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmittedOfferDtoOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmittedOfferDtoOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmittedOfferDtoOffer + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmittedOfferDtoOffer + */ + public static AlleDiscountSubmittedOfferDtoOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmittedOfferDtoOffer.class); + } + + /** + * Convert an instance of AlleDiscountSubmittedOfferDtoOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPrices.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPrices.java new file mode 100644 index 0000000..790fd39 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPrices.java @@ -0,0 +1,272 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoPricesProposedPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscount prices data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmittedOfferDtoPrices { + public static final String SERIALIZED_NAME_PROPOSED_PRICE = "proposedPrice"; + @SerializedName(SERIALIZED_NAME_PROPOSED_PRICE) + @javax.annotation.Nullable + private AlleDiscountSubmittedOfferDtoPricesProposedPrice proposedPrice; + + public static final String SERIALIZED_NAME_MINIMAL_PRICE_REDUCTION = "minimalPriceReduction"; + @SerializedName(SERIALIZED_NAME_MINIMAL_PRICE_REDUCTION) + @javax.annotation.Nullable + private AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction minimalPriceReduction; + + public static final String SERIALIZED_NAME_MAXIMUM_SELLING_PRICE = "maximumSellingPrice"; + @SerializedName(SERIALIZED_NAME_MAXIMUM_SELLING_PRICE) + @javax.annotation.Nullable + private AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice maximumSellingPrice; + + public AlleDiscountSubmittedOfferDtoPrices() { + } + + public AlleDiscountSubmittedOfferDtoPrices proposedPrice(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoPricesProposedPrice proposedPrice) { + this.proposedPrice = proposedPrice; + return this; + } + + /** + * Get proposedPrice + * @return proposedPrice + */ + @javax.annotation.Nullable + public AlleDiscountSubmittedOfferDtoPricesProposedPrice getProposedPrice() { + return proposedPrice; + } + + public void setProposedPrice(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoPricesProposedPrice proposedPrice) { + this.proposedPrice = proposedPrice; + } + + + public AlleDiscountSubmittedOfferDtoPrices minimalPriceReduction(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction minimalPriceReduction) { + this.minimalPriceReduction = minimalPriceReduction; + return this; + } + + /** + * Get minimalPriceReduction + * @return minimalPriceReduction + */ + @javax.annotation.Nullable + public AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction getMinimalPriceReduction() { + return minimalPriceReduction; + } + + public void setMinimalPriceReduction(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction minimalPriceReduction) { + this.minimalPriceReduction = minimalPriceReduction; + } + + + public AlleDiscountSubmittedOfferDtoPrices maximumSellingPrice(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice maximumSellingPrice) { + this.maximumSellingPrice = maximumSellingPrice; + return this; + } + + /** + * Get maximumSellingPrice + * @return maximumSellingPrice + */ + @javax.annotation.Nullable + public AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice getMaximumSellingPrice() { + return maximumSellingPrice; + } + + public void setMaximumSellingPrice(@javax.annotation.Nullable AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice maximumSellingPrice) { + this.maximumSellingPrice = maximumSellingPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmittedOfferDtoPrices alleDiscountSubmittedOfferDtoPrices = (AlleDiscountSubmittedOfferDtoPrices) o; + return Objects.equals(this.proposedPrice, alleDiscountSubmittedOfferDtoPrices.proposedPrice) && + Objects.equals(this.minimalPriceReduction, alleDiscountSubmittedOfferDtoPrices.minimalPriceReduction) && + Objects.equals(this.maximumSellingPrice, alleDiscountSubmittedOfferDtoPrices.maximumSellingPrice); + } + + @Override + public int hashCode() { + return Objects.hash(proposedPrice, minimalPriceReduction, maximumSellingPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmittedOfferDtoPrices {\n"); + sb.append(" proposedPrice: ").append(toIndentedString(proposedPrice)).append("\n"); + sb.append(" minimalPriceReduction: ").append(toIndentedString(minimalPriceReduction)).append("\n"); + sb.append(" maximumSellingPrice: ").append(toIndentedString(maximumSellingPrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("proposedPrice"); + openapiFields.add("minimalPriceReduction"); + openapiFields.add("maximumSellingPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmittedOfferDtoPrices + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmittedOfferDtoPrices.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmittedOfferDtoPrices is not found in the empty JSON string", AlleDiscountSubmittedOfferDtoPrices.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmittedOfferDtoPrices.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmittedOfferDtoPrices` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `proposedPrice` + if (jsonObj.get("proposedPrice") != null && !jsonObj.get("proposedPrice").isJsonNull()) { + AlleDiscountSubmittedOfferDtoPricesProposedPrice.validateJsonElement(jsonObj.get("proposedPrice")); + } + // validate the optional field `minimalPriceReduction` + if (jsonObj.get("minimalPriceReduction") != null && !jsonObj.get("minimalPriceReduction").isJsonNull()) { + AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.validateJsonElement(jsonObj.get("minimalPriceReduction")); + } + // validate the optional field `maximumSellingPrice` + if (jsonObj.get("maximumSellingPrice") != null && !jsonObj.get("maximumSellingPrice").isJsonNull()) { + AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.validateJsonElement(jsonObj.get("maximumSellingPrice")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmittedOfferDtoPrices.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmittedOfferDtoPrices' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmittedOfferDtoPrices.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmittedOfferDtoPrices value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmittedOfferDtoPrices read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmittedOfferDtoPrices given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmittedOfferDtoPrices + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmittedOfferDtoPrices + */ + public static AlleDiscountSubmittedOfferDtoPrices fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmittedOfferDtoPrices.class); + } + + /** + * Convert an instance of AlleDiscountSubmittedOfferDtoPrices to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.java new file mode 100644 index 0000000..2046b6d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Maximum price for the offer after discount. Can be lower. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice() { + } + + public AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount of the price. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Currency of the price. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice alleDiscountSubmittedOfferDtoPricesMaximumSellingPrice = (AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice) o; + return Objects.equals(this.amount, alleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.amount) && + Objects.equals(this.currency, alleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice is not found in the empty JSON string", AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice + */ + public static AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice.class); + } + + /** + * Convert an instance of AlleDiscountSubmittedOfferDtoPricesMaximumSellingPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.java new file mode 100644 index 0000000..932b38b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Minimal price reduction on the offer. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction() { + } + + public AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount of the price. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Currency of the price. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction alleDiscountSubmittedOfferDtoPricesMinimalPriceReduction = (AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction) o; + return Objects.equals(this.amount, alleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.amount) && + Objects.equals(this.currency, alleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction is not found in the empty JSON string", AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction + */ + public static AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction.class); + } + + /** + * Convert an instance of AlleDiscountSubmittedOfferDtoPricesMinimalPriceReduction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesProposedPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesProposedPrice.java new file mode 100644 index 0000000..dcbeca7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoPricesProposedPrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The price you agreed to lower to for the offer. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmittedOfferDtoPricesProposedPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public AlleDiscountSubmittedOfferDtoPricesProposedPrice() { + } + + public AlleDiscountSubmittedOfferDtoPricesProposedPrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount of the price. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public AlleDiscountSubmittedOfferDtoPricesProposedPrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Currency of the price. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmittedOfferDtoPricesProposedPrice alleDiscountSubmittedOfferDtoPricesProposedPrice = (AlleDiscountSubmittedOfferDtoPricesProposedPrice) o; + return Objects.equals(this.amount, alleDiscountSubmittedOfferDtoPricesProposedPrice.amount) && + Objects.equals(this.currency, alleDiscountSubmittedOfferDtoPricesProposedPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmittedOfferDtoPricesProposedPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmittedOfferDtoPricesProposedPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmittedOfferDtoPricesProposedPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmittedOfferDtoPricesProposedPrice is not found in the empty JSON string", AlleDiscountSubmittedOfferDtoPricesProposedPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmittedOfferDtoPricesProposedPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmittedOfferDtoPricesProposedPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmittedOfferDtoPricesProposedPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmittedOfferDtoPricesProposedPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmittedOfferDtoPricesProposedPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmittedOfferDtoPricesProposedPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmittedOfferDtoPricesProposedPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmittedOfferDtoPricesProposedPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmittedOfferDtoPricesProposedPrice + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmittedOfferDtoPricesProposedPrice + */ + public static AlleDiscountSubmittedOfferDtoPricesProposedPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmittedOfferDtoPricesProposedPrice.class); + } + + /** + * Convert an instance of AlleDiscountSubmittedOfferDtoPricesProposedPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoProcess.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoProcess.java new file mode 100644 index 0000000..5f2fc26 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoProcess.java @@ -0,0 +1,320 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AlleDiscountSubmittedOfferDtoProcessErrorsInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Participation processing data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmittedOfferDtoProcess { + /** + * - VERIFICATION - participation is being verified. - ACCEPTED - participation in AlleDiscount was created and has passed initial verification. Participation will stay in this status until campaign starts or if additional verification fails. - ACTIVE - participation is active, price on the platform is lowered. Offer is participating in AlleDiscount. - DECLINED - participation didn’t pass verification, check process.errors field for more details. - FINISHED - participation is no longer active. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + VERIFICATION("VERIFICATION"), + + ACCEPTED("ACCEPTED"), + + ACTIVE("ACTIVE"), + + DECLINED("DECLINED"), + + FINISHED("FINISHED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public AlleDiscountSubmittedOfferDtoProcess() { + } + + public AlleDiscountSubmittedOfferDtoProcess status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * - VERIFICATION - participation is being verified. - ACCEPTED - participation in AlleDiscount was created and has passed initial verification. Participation will stay in this status until campaign starts or if additional verification fails. - ACTIVE - participation is active, price on the platform is lowered. Offer is participating in AlleDiscount. - DECLINED - participation didn’t pass verification, check process.errors field for more details. - FINISHED - participation is no longer active. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public AlleDiscountSubmittedOfferDtoProcess errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public AlleDiscountSubmittedOfferDtoProcess addErrorsItem(AlleDiscountSubmittedOfferDtoProcessErrorsInner errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Possible participation errors: - TOO_HIGH_PROPOSED_PRICE - “proposedPrice” field when submitting an offer was set higher than the “requiredMerchantPrice” of this offer. - PRODUCT_CONFIGURATION_CHANGED - configuration of offer’s product has changed in the meantime of processing the request. - PRODUCT_NOT_IN_CAMPAIGN - submitted offer’s product is no longer available in this campaign. - OFFER_NOT_VISIBLE_ON_CAMPAIGN_MARKETPLACE - offer is not visible on the marketplace of the campaign it was submitted to. - CURRENCY_NOT_SUPPORTED - currency in “proposedPrice” does not match the currency of the marketplace offer was submitted to. - ALLE_DISCOUNT_SUSPENDED_ACCOUNT - seller submitting offer is suspended and cannot perform any action. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmittedOfferDtoProcess alleDiscountSubmittedOfferDtoProcess = (AlleDiscountSubmittedOfferDtoProcess) o; + return Objects.equals(this.status, alleDiscountSubmittedOfferDtoProcess.status) && + Objects.equals(this.errors, alleDiscountSubmittedOfferDtoProcess.errors); + } + + @Override + public int hashCode() { + return Objects.hash(status, errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmittedOfferDtoProcess {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmittedOfferDtoProcess + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmittedOfferDtoProcess.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmittedOfferDtoProcess is not found in the empty JSON string", AlleDiscountSubmittedOfferDtoProcess.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmittedOfferDtoProcess.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmittedOfferDtoProcess` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + AlleDiscountSubmittedOfferDtoProcessErrorsInner.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmittedOfferDtoProcess.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmittedOfferDtoProcess' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmittedOfferDtoProcess.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmittedOfferDtoProcess value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmittedOfferDtoProcess read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmittedOfferDtoProcess given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmittedOfferDtoProcess + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmittedOfferDtoProcess + */ + public static AlleDiscountSubmittedOfferDtoProcess fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmittedOfferDtoProcess.class); + } + + /** + * Convert an instance of AlleDiscountSubmittedOfferDtoProcess to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoProcessErrorsInner.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoProcessErrorsInner.java new file mode 100644 index 0000000..731c6a6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountSubmittedOfferDtoProcessErrorsInner.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Error body. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountSubmittedOfferDtoProcessErrorsInner { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public AlleDiscountSubmittedOfferDtoProcessErrorsInner() { + } + + public AlleDiscountSubmittedOfferDtoProcessErrorsInner code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Error code. + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public AlleDiscountSubmittedOfferDtoProcessErrorsInner message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Error message. + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountSubmittedOfferDtoProcessErrorsInner alleDiscountSubmittedOfferDtoProcessErrorsInner = (AlleDiscountSubmittedOfferDtoProcessErrorsInner) o; + return Objects.equals(this.code, alleDiscountSubmittedOfferDtoProcessErrorsInner.code) && + Objects.equals(this.message, alleDiscountSubmittedOfferDtoProcessErrorsInner.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountSubmittedOfferDtoProcessErrorsInner {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountSubmittedOfferDtoProcessErrorsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountSubmittedOfferDtoProcessErrorsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountSubmittedOfferDtoProcessErrorsInner is not found in the empty JSON string", AlleDiscountSubmittedOfferDtoProcessErrorsInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountSubmittedOfferDtoProcessErrorsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountSubmittedOfferDtoProcessErrorsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountSubmittedOfferDtoProcessErrorsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountSubmittedOfferDtoProcessErrorsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountSubmittedOfferDtoProcessErrorsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountSubmittedOfferDtoProcessErrorsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountSubmittedOfferDtoProcessErrorsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountSubmittedOfferDtoProcessErrorsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountSubmittedOfferDtoProcessErrorsInner + * @throws IOException if the JSON string is invalid with respect to AlleDiscountSubmittedOfferDtoProcessErrorsInner + */ + public static AlleDiscountSubmittedOfferDtoProcessErrorsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountSubmittedOfferDtoProcessErrorsInner.class); + } + + /** + * Convert an instance of AlleDiscountSubmittedOfferDtoProcessErrorsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandRequest.java new file mode 100644 index 0000000..b34c2be --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandRequest.java @@ -0,0 +1,250 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AlleDiscountWithdrawCommandRequestInput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountWithdrawCommandRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountWithdrawCommandRequest { + public static final String SERIALIZED_NAME_COMMAND_ID = "commandId"; + @SerializedName(SERIALIZED_NAME_COMMAND_ID) + @javax.annotation.Nullable + private String commandId; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nullable + private AlleDiscountWithdrawCommandRequestInput input; + + public AlleDiscountWithdrawCommandRequest() { + } + + public AlleDiscountWithdrawCommandRequest commandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + return this; + } + + /** + * The Command UUID. If empty, system generates new one. + * @return commandId + */ + @javax.annotation.Nullable + public String getCommandId() { + return commandId; + } + + public void setCommandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + } + + + public AlleDiscountWithdrawCommandRequest input(@javax.annotation.Nullable AlleDiscountWithdrawCommandRequestInput input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nullable + public AlleDiscountWithdrawCommandRequestInput getInput() { + return input; + } + + public void setInput(@javax.annotation.Nullable AlleDiscountWithdrawCommandRequestInput input) { + this.input = input; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountWithdrawCommandRequest alleDiscountWithdrawCommandRequest = (AlleDiscountWithdrawCommandRequest) o; + return Objects.equals(this.commandId, alleDiscountWithdrawCommandRequest.commandId) && + Objects.equals(this.input, alleDiscountWithdrawCommandRequest.input); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(commandId, input); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountWithdrawCommandRequest {\n"); + sb.append(" commandId: ").append(toIndentedString(commandId)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("commandId"); + openapiFields.add("input"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountWithdrawCommandRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountWithdrawCommandRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountWithdrawCommandRequest is not found in the empty JSON string", AlleDiscountWithdrawCommandRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountWithdrawCommandRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountWithdrawCommandRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("commandId") != null && !jsonObj.get("commandId").isJsonNull()) && !jsonObj.get("commandId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commandId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commandId").toString())); + } + // validate the optional field `input` + if (jsonObj.get("input") != null && !jsonObj.get("input").isJsonNull()) { + AlleDiscountWithdrawCommandRequestInput.validateJsonElement(jsonObj.get("input")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountWithdrawCommandRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountWithdrawCommandRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountWithdrawCommandRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountWithdrawCommandRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountWithdrawCommandRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountWithdrawCommandRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountWithdrawCommandRequest + * @throws IOException if the JSON string is invalid with respect to AlleDiscountWithdrawCommandRequest + */ + public static AlleDiscountWithdrawCommandRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountWithdrawCommandRequest.class); + } + + /** + * Convert an instance of AlleDiscountWithdrawCommandRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandRequestInput.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandRequestInput.java new file mode 100644 index 0000000..661d092 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandRequestInput.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Command input. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountWithdrawCommandRequestInput { + public static final String SERIALIZED_NAME_PARTICIPATION_ID = "participationId"; + @SerializedName(SERIALIZED_NAME_PARTICIPATION_ID) + @javax.annotation.Nullable + private String participationId; + + public AlleDiscountWithdrawCommandRequestInput() { + } + + public AlleDiscountWithdrawCommandRequestInput participationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + return this; + } + + /** + * The id of the offer participation you wish to withdraw. Participation id can be found using `GET /sale/alle-discount/{campaignId}/submitted-offers` or `GET /sale/alle-discount/submit-offer-commands` endpoints. + * @return participationId + */ + @javax.annotation.Nullable + public String getParticipationId() { + return participationId; + } + + public void setParticipationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountWithdrawCommandRequestInput alleDiscountWithdrawCommandRequestInput = (AlleDiscountWithdrawCommandRequestInput) o; + return Objects.equals(this.participationId, alleDiscountWithdrawCommandRequestInput.participationId); + } + + @Override + public int hashCode() { + return Objects.hash(participationId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountWithdrawCommandRequestInput {\n"); + sb.append(" participationId: ").append(toIndentedString(participationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("participationId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountWithdrawCommandRequestInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountWithdrawCommandRequestInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountWithdrawCommandRequestInput is not found in the empty JSON string", AlleDiscountWithdrawCommandRequestInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountWithdrawCommandRequestInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountWithdrawCommandRequestInput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("participationId") != null && !jsonObj.get("participationId").isJsonNull()) && !jsonObj.get("participationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `participationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("participationId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountWithdrawCommandRequestInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountWithdrawCommandRequestInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountWithdrawCommandRequestInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountWithdrawCommandRequestInput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountWithdrawCommandRequestInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountWithdrawCommandRequestInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountWithdrawCommandRequestInput + * @throws IOException if the JSON string is invalid with respect to AlleDiscountWithdrawCommandRequestInput + */ + public static AlleDiscountWithdrawCommandRequestInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountWithdrawCommandRequestInput.class); + } + + /** + * Convert an instance of AlleDiscountWithdrawCommandRequestInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponse.java new file mode 100644 index 0000000..76e1a0d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponse.java @@ -0,0 +1,270 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AlleDiscountWithdrawCommandResponseInput; +import pl.wtx.allegro.api.client.model.AlleDiscountWithdrawCommandResponseOutput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlleDiscountWithdrawCommandResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountWithdrawCommandResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nullable + private AlleDiscountWithdrawCommandResponseInput input; + + public static final String SERIALIZED_NAME_OUTPUT = "output"; + @SerializedName(SERIALIZED_NAME_OUTPUT) + @javax.annotation.Nullable + private AlleDiscountWithdrawCommandResponseOutput output; + + public AlleDiscountWithdrawCommandResponse() { + } + + public AlleDiscountWithdrawCommandResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the command. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public AlleDiscountWithdrawCommandResponse input(@javax.annotation.Nullable AlleDiscountWithdrawCommandResponseInput input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nullable + public AlleDiscountWithdrawCommandResponseInput getInput() { + return input; + } + + public void setInput(@javax.annotation.Nullable AlleDiscountWithdrawCommandResponseInput input) { + this.input = input; + } + + + public AlleDiscountWithdrawCommandResponse output(@javax.annotation.Nullable AlleDiscountWithdrawCommandResponseOutput output) { + this.output = output; + return this; + } + + /** + * Get output + * @return output + */ + @javax.annotation.Nullable + public AlleDiscountWithdrawCommandResponseOutput getOutput() { + return output; + } + + public void setOutput(@javax.annotation.Nullable AlleDiscountWithdrawCommandResponseOutput output) { + this.output = output; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountWithdrawCommandResponse alleDiscountWithdrawCommandResponse = (AlleDiscountWithdrawCommandResponse) o; + return Objects.equals(this.id, alleDiscountWithdrawCommandResponse.id) && + Objects.equals(this.input, alleDiscountWithdrawCommandResponse.input) && + Objects.equals(this.output, alleDiscountWithdrawCommandResponse.output); + } + + @Override + public int hashCode() { + return Objects.hash(id, input, output); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountWithdrawCommandResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("input"); + openapiFields.add("output"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountWithdrawCommandResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountWithdrawCommandResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountWithdrawCommandResponse is not found in the empty JSON string", AlleDiscountWithdrawCommandResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountWithdrawCommandResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountWithdrawCommandResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `input` + if (jsonObj.get("input") != null && !jsonObj.get("input").isJsonNull()) { + AlleDiscountWithdrawCommandResponseInput.validateJsonElement(jsonObj.get("input")); + } + // validate the optional field `output` + if (jsonObj.get("output") != null && !jsonObj.get("output").isJsonNull()) { + AlleDiscountWithdrawCommandResponseOutput.validateJsonElement(jsonObj.get("output")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountWithdrawCommandResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountWithdrawCommandResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountWithdrawCommandResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountWithdrawCommandResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountWithdrawCommandResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountWithdrawCommandResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountWithdrawCommandResponse + * @throws IOException if the JSON string is invalid with respect to AlleDiscountWithdrawCommandResponse + */ + public static AlleDiscountWithdrawCommandResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountWithdrawCommandResponse.class); + } + + /** + * Convert an instance of AlleDiscountWithdrawCommandResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponseInput.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponseInput.java new file mode 100644 index 0000000..c98f5f9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponseInput.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Provided withdraw offer command input data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountWithdrawCommandResponseInput { + public static final String SERIALIZED_NAME_PARTICIPATION_ID = "participationId"; + @SerializedName(SERIALIZED_NAME_PARTICIPATION_ID) + @javax.annotation.Nullable + private String participationId; + + public AlleDiscountWithdrawCommandResponseInput() { + } + + public AlleDiscountWithdrawCommandResponseInput participationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + return this; + } + + /** + * The id of the participation which will be withdrawn. + * @return participationId + */ + @javax.annotation.Nullable + public String getParticipationId() { + return participationId; + } + + public void setParticipationId(@javax.annotation.Nullable String participationId) { + this.participationId = participationId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountWithdrawCommandResponseInput alleDiscountWithdrawCommandResponseInput = (AlleDiscountWithdrawCommandResponseInput) o; + return Objects.equals(this.participationId, alleDiscountWithdrawCommandResponseInput.participationId); + } + + @Override + public int hashCode() { + return Objects.hash(participationId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountWithdrawCommandResponseInput {\n"); + sb.append(" participationId: ").append(toIndentedString(participationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("participationId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountWithdrawCommandResponseInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountWithdrawCommandResponseInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountWithdrawCommandResponseInput is not found in the empty JSON string", AlleDiscountWithdrawCommandResponseInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountWithdrawCommandResponseInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountWithdrawCommandResponseInput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("participationId") != null && !jsonObj.get("participationId").isJsonNull()) && !jsonObj.get("participationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `participationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("participationId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountWithdrawCommandResponseInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountWithdrawCommandResponseInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountWithdrawCommandResponseInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountWithdrawCommandResponseInput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountWithdrawCommandResponseInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountWithdrawCommandResponseInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountWithdrawCommandResponseInput + * @throws IOException if the JSON string is invalid with respect to AlleDiscountWithdrawCommandResponseInput + */ + public static AlleDiscountWithdrawCommandResponseInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountWithdrawCommandResponseInput.class); + } + + /** + * Convert an instance of AlleDiscountWithdrawCommandResponseInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponseOutput.java b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponseOutput.java new file mode 100644 index 0000000..963a32c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlleDiscountWithdrawCommandResponseOutput.java @@ -0,0 +1,315 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Withdraw offer command output data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlleDiscountWithdrawCommandResponseOutput { + /** + * Execution status of the command. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + NEW("NEW"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public AlleDiscountWithdrawCommandResponseOutput() { + } + + public AlleDiscountWithdrawCommandResponseOutput status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Execution status of the command. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public AlleDiscountWithdrawCommandResponseOutput createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation date of the command. ISO 8601 format. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AlleDiscountWithdrawCommandResponseOutput updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Update date of the command. ISO 8601 format. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlleDiscountWithdrawCommandResponseOutput alleDiscountWithdrawCommandResponseOutput = (AlleDiscountWithdrawCommandResponseOutput) o; + return Objects.equals(this.status, alleDiscountWithdrawCommandResponseOutput.status) && + Objects.equals(this.createdAt, alleDiscountWithdrawCommandResponseOutput.createdAt) && + Objects.equals(this.updatedAt, alleDiscountWithdrawCommandResponseOutput.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(status, createdAt, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlleDiscountWithdrawCommandResponseOutput {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlleDiscountWithdrawCommandResponseOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlleDiscountWithdrawCommandResponseOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlleDiscountWithdrawCommandResponseOutput is not found in the empty JSON string", AlleDiscountWithdrawCommandResponseOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlleDiscountWithdrawCommandResponseOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlleDiscountWithdrawCommandResponseOutput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlleDiscountWithdrawCommandResponseOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlleDiscountWithdrawCommandResponseOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlleDiscountWithdrawCommandResponseOutput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlleDiscountWithdrawCommandResponseOutput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlleDiscountWithdrawCommandResponseOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlleDiscountWithdrawCommandResponseOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlleDiscountWithdrawCommandResponseOutput + * @throws IOException if the JSON string is invalid with respect to AlleDiscountWithdrawCommandResponseOutput + */ + public static AlleDiscountWithdrawCommandResponseOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlleDiscountWithdrawCommandResponseOutput.class); + } + + /** + * Convert an instance of AlleDiscountWithdrawCommandResponseOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroCarrier.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroCarrier.java new file mode 100644 index 0000000..b799469 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroCarrier.java @@ -0,0 +1,80 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets AllegroCarrier + */ +@JsonAdapter(AllegroCarrier.Adapter.class) +public enum AllegroCarrier { + + UPS("UPS"), + + ALLEGRO_ONE_KURIER("ALLEGRO_ONE_KURIER"), + + DPD("DPD"); + + private String value; + + AllegroCarrier(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AllegroCarrier fromValue(String value) { + for (AllegroCarrier b : AllegroCarrier.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AllegroCarrier enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AllegroCarrier read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AllegroCarrier.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AllegroCarrier.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroMarketplaces.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroMarketplaces.java new file mode 100644 index 0000000..4e0cd76 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroMarketplaces.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.MarketplaceItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroMarketplaces + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroMarketplaces { + public static final String SERIALIZED_NAME_MARKETPLACES = "marketplaces"; + @SerializedName(SERIALIZED_NAME_MARKETPLACES) + @javax.annotation.Nullable + private List marketplaces = new ArrayList<>(); + + public AllegroMarketplaces() { + } + + public AllegroMarketplaces marketplaces(@javax.annotation.Nullable List marketplaces) { + this.marketplaces = marketplaces; + return this; + } + + public AllegroMarketplaces addMarketplacesItem(MarketplaceItem marketplacesItem) { + if (this.marketplaces == null) { + this.marketplaces = new ArrayList<>(); + } + this.marketplaces.add(marketplacesItem); + return this; + } + + /** + * List of marketplaces in allegro + * @return marketplaces + */ + @javax.annotation.Nullable + public List getMarketplaces() { + return marketplaces; + } + + public void setMarketplaces(@javax.annotation.Nullable List marketplaces) { + this.marketplaces = marketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroMarketplaces allegroMarketplaces = (AllegroMarketplaces) o; + return Objects.equals(this.marketplaces, allegroMarketplaces.marketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(marketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroMarketplaces {\n"); + sb.append(" marketplaces: ").append(toIndentedString(marketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroMarketplaces + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroMarketplaces.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroMarketplaces is not found in the empty JSON string", AllegroMarketplaces.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroMarketplaces.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroMarketplaces` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("marketplaces") != null && !jsonObj.get("marketplaces").isJsonNull()) { + JsonArray jsonArraymarketplaces = jsonObj.getAsJsonArray("marketplaces"); + if (jsonArraymarketplaces != null) { + // ensure the json data is an array + if (!jsonObj.get("marketplaces").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaces` to be an array in the JSON string but got `%s`", jsonObj.get("marketplaces").toString())); + } + + // validate the optional field `marketplaces` (array) + for (int i = 0; i < jsonArraymarketplaces.size(); i++) { + MarketplaceItem.validateJsonElement(jsonArraymarketplaces.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroMarketplaces.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroMarketplaces' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroMarketplaces.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroMarketplaces value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroMarketplaces read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroMarketplaces given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroMarketplaces + * @throws IOException if the JSON string is invalid with respect to AllegroMarketplaces + */ + public static AllegroMarketplaces fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroMarketplaces.class); + } + + /** + * Convert an instance of AllegroMarketplaces to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingHistory.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingHistory.java new file mode 100644 index 0000000..15fe8b7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingHistory.java @@ -0,0 +1,246 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AllegroParcelTrackingHistoryTrackingDetails; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroParcelTrackingHistory + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroParcelTrackingHistory { + public static final String SERIALIZED_NAME_WAYBILL = "waybill"; + @SerializedName(SERIALIZED_NAME_WAYBILL) + @javax.annotation.Nonnull + private String waybill; + + public static final String SERIALIZED_NAME_TRACKING_DETAILS = "trackingDetails"; + @SerializedName(SERIALIZED_NAME_TRACKING_DETAILS) + @javax.annotation.Nullable + private AllegroParcelTrackingHistoryTrackingDetails trackingDetails; + + public AllegroParcelTrackingHistory() { + } + + public AllegroParcelTrackingHistory waybill(@javax.annotation.Nonnull String waybill) { + this.waybill = waybill; + return this; + } + + /** + * Waybill number (parcel tracking number). + * @return waybill + */ + @javax.annotation.Nonnull + public String getWaybill() { + return waybill; + } + + public void setWaybill(@javax.annotation.Nonnull String waybill) { + this.waybill = waybill; + } + + + public AllegroParcelTrackingHistory trackingDetails(@javax.annotation.Nullable AllegroParcelTrackingHistoryTrackingDetails trackingDetails) { + this.trackingDetails = trackingDetails; + return this; + } + + /** + * Get trackingDetails + * @return trackingDetails + */ + @javax.annotation.Nullable + public AllegroParcelTrackingHistoryTrackingDetails getTrackingDetails() { + return trackingDetails; + } + + public void setTrackingDetails(@javax.annotation.Nullable AllegroParcelTrackingHistoryTrackingDetails trackingDetails) { + this.trackingDetails = trackingDetails; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroParcelTrackingHistory allegroParcelTrackingHistory = (AllegroParcelTrackingHistory) o; + return Objects.equals(this.waybill, allegroParcelTrackingHistory.waybill) && + Objects.equals(this.trackingDetails, allegroParcelTrackingHistory.trackingDetails); + } + + @Override + public int hashCode() { + return Objects.hash(waybill, trackingDetails); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroParcelTrackingHistory {\n"); + sb.append(" waybill: ").append(toIndentedString(waybill)).append("\n"); + sb.append(" trackingDetails: ").append(toIndentedString(trackingDetails)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("waybill"); + openapiFields.add("trackingDetails"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("waybill"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroParcelTrackingHistory + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroParcelTrackingHistory.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroParcelTrackingHistory is not found in the empty JSON string", AllegroParcelTrackingHistory.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroParcelTrackingHistory.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroParcelTrackingHistory` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllegroParcelTrackingHistory.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("waybill").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `waybill` to be a primitive type in the JSON string but got `%s`", jsonObj.get("waybill").toString())); + } + // validate the optional field `trackingDetails` + if (jsonObj.get("trackingDetails") != null && !jsonObj.get("trackingDetails").isJsonNull()) { + AllegroParcelTrackingHistoryTrackingDetails.validateJsonElement(jsonObj.get("trackingDetails")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroParcelTrackingHistory.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroParcelTrackingHistory' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroParcelTrackingHistory.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroParcelTrackingHistory value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroParcelTrackingHistory read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroParcelTrackingHistory given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroParcelTrackingHistory + * @throws IOException if the JSON string is invalid with respect to AllegroParcelTrackingHistory + */ + public static AllegroParcelTrackingHistory fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroParcelTrackingHistory.class); + } + + /** + * Convert an instance of AllegroParcelTrackingHistory to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingHistoryTrackingDetails.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingHistoryTrackingDetails.java new file mode 100644 index 0000000..7badb25 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingHistoryTrackingDetails.java @@ -0,0 +1,289 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AllegroParcelTrackingStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Parcel tracking history if available. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroParcelTrackingHistoryTrackingDetails { + public static final String SERIALIZED_NAME_STATUSES = "statuses"; + @SerializedName(SERIALIZED_NAME_STATUSES) + @javax.annotation.Nonnull + private List statuses = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime updatedAt; + + public AllegroParcelTrackingHistoryTrackingDetails() { + } + + public AllegroParcelTrackingHistoryTrackingDetails statuses(@javax.annotation.Nonnull List statuses) { + this.statuses = statuses; + return this; + } + + public AllegroParcelTrackingHistoryTrackingDetails addStatusesItem(AllegroParcelTrackingStatus statusesItem) { + if (this.statuses == null) { + this.statuses = new ArrayList<>(); + } + this.statuses.add(statusesItem); + return this; + } + + /** + * List of parcel shipping statuses + * @return statuses + */ + @javax.annotation.Nonnull + public List getStatuses() { + return statuses; + } + + public void setStatuses(@javax.annotation.Nonnull List statuses) { + this.statuses = statuses; + } + + + public AllegroParcelTrackingHistoryTrackingDetails createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The start time parcel tracking recording in ISO 8601 format + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public AllegroParcelTrackingHistoryTrackingDetails updatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Time of registration of the last shipment status change in ISO 8601 format + * @return updatedAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroParcelTrackingHistoryTrackingDetails allegroParcelTrackingHistoryTrackingDetails = (AllegroParcelTrackingHistoryTrackingDetails) o; + return Objects.equals(this.statuses, allegroParcelTrackingHistoryTrackingDetails.statuses) && + Objects.equals(this.createdAt, allegroParcelTrackingHistoryTrackingDetails.createdAt) && + Objects.equals(this.updatedAt, allegroParcelTrackingHistoryTrackingDetails.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(statuses, createdAt, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroParcelTrackingHistoryTrackingDetails {\n"); + sb.append(" statuses: ").append(toIndentedString(statuses)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("statuses"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("statuses"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroParcelTrackingHistoryTrackingDetails + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroParcelTrackingHistoryTrackingDetails.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroParcelTrackingHistoryTrackingDetails is not found in the empty JSON string", AllegroParcelTrackingHistoryTrackingDetails.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroParcelTrackingHistoryTrackingDetails.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroParcelTrackingHistoryTrackingDetails` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllegroParcelTrackingHistoryTrackingDetails.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("statuses").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `statuses` to be an array in the JSON string but got `%s`", jsonObj.get("statuses").toString())); + } + + JsonArray jsonArraystatuses = jsonObj.getAsJsonArray("statuses"); + // validate the required field `statuses` (array) + for (int i = 0; i < jsonArraystatuses.size(); i++) { + AllegroParcelTrackingStatus.validateJsonElement(jsonArraystatuses.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroParcelTrackingHistoryTrackingDetails.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroParcelTrackingHistoryTrackingDetails' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroParcelTrackingHistoryTrackingDetails.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroParcelTrackingHistoryTrackingDetails value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroParcelTrackingHistoryTrackingDetails read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroParcelTrackingHistoryTrackingDetails given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroParcelTrackingHistoryTrackingDetails + * @throws IOException if the JSON string is invalid with respect to AllegroParcelTrackingHistoryTrackingDetails + */ + public static AllegroParcelTrackingHistoryTrackingDetails fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroParcelTrackingHistoryTrackingDetails.class); + } + + /** + * Convert an instance of AllegroParcelTrackingHistoryTrackingDetails to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingStatus.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingStatus.java new file mode 100644 index 0000000..4723562 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroParcelTrackingStatus.java @@ -0,0 +1,366 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroParcelTrackingStatus + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroParcelTrackingStatus { + public static final String SERIALIZED_NAME_OCCURRED_AT = "occurredAt"; + @SerializedName(SERIALIZED_NAME_OCCURRED_AT) + @javax.annotation.Nonnull + private OffsetDateTime occurredAt; + + /** + * Status of the shipment. - `AVAILABLE_FOR_PICKUP` - The parcel is awaiting for pickup. - `DELIVERED` - The parcel was delivered to the receiver / collected by the receiver. - `IN_TRANSIT` - The parcel is on its way to the receiver. The status includes events such as acceptance of the shipment by the carrier, arriving at the hub or redirecting to another address. - `ISSUE` - Problem with shipment. It includes events such as the parcel was refused by the receiver or was lost. - `NOTICE_LEFT` - A notice was left because of an unsuccessful delivery attempt (for example, due to nobody was at the delivery address). - `PENDING` - The shipment has been prepared and it is awaiting to be sent. - `RELEASED_FOR_DELIVERY` - The parcel has been released for delivery to its final destination. - `RETURNED` - The parcel is being or has been returned to the sender. + */ + @JsonAdapter(CodeEnum.Adapter.class) + public enum CodeEnum { + AVAILABLE_FOR_PICKUP("AVAILABLE_FOR_PICKUP"), + + DELIVERED("DELIVERED"), + + IN_TRANSIT("IN_TRANSIT"), + + ISSUE("ISSUE"), + + NOTICE_LEFT("NOTICE_LEFT"), + + PENDING("PENDING"), + + RELEASED_FOR_DELIVERY("RELEASED_FOR_DELIVERY"), + + RETURNED("RETURNED"); + + private String value; + + CodeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CodeEnum fromValue(String value) { + for (CodeEnum b : CodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CodeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CodeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CodeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CodeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private CodeEnum code; + + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable + private String details; + + public static final String SERIALIZED_NAME_TERMINAL = "terminal"; + @SerializedName(SERIALIZED_NAME_TERMINAL) + @javax.annotation.Nullable + private Boolean terminal; + + public AllegroParcelTrackingStatus() { + } + + public AllegroParcelTrackingStatus occurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + /** + * Actual shipment status change time in ISO 8601 format + * @return occurredAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getOccurredAt() { + return occurredAt; + } + + public void setOccurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + } + + + public AllegroParcelTrackingStatus code(@javax.annotation.Nonnull CodeEnum code) { + this.code = code; + return this; + } + + /** + * Status of the shipment. - `AVAILABLE_FOR_PICKUP` - The parcel is awaiting for pickup. - `DELIVERED` - The parcel was delivered to the receiver / collected by the receiver. - `IN_TRANSIT` - The parcel is on its way to the receiver. The status includes events such as acceptance of the shipment by the carrier, arriving at the hub or redirecting to another address. - `ISSUE` - Problem with shipment. It includes events such as the parcel was refused by the receiver or was lost. - `NOTICE_LEFT` - A notice was left because of an unsuccessful delivery attempt (for example, due to nobody was at the delivery address). - `PENDING` - The shipment has been prepared and it is awaiting to be sent. - `RELEASED_FOR_DELIVERY` - The parcel has been released for delivery to its final destination. - `RETURNED` - The parcel is being or has been returned to the sender. + * @return code + */ + @javax.annotation.Nonnull + public CodeEnum getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull CodeEnum code) { + this.code = code; + } + + + public AllegroParcelTrackingStatus details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * Optional description for a given status, mainly intended to describe the problem with the shipment + * @return details + */ + @javax.annotation.Nullable + public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + + public AllegroParcelTrackingStatus terminal(@javax.annotation.Nullable Boolean terminal) { + this.terminal = terminal; + return this; + } + + /** + * Indicates the final status, after which there should be no more status changes + * @return terminal + */ + @javax.annotation.Nullable + public Boolean getTerminal() { + return terminal; + } + + public void setTerminal(@javax.annotation.Nullable Boolean terminal) { + this.terminal = terminal; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroParcelTrackingStatus allegroParcelTrackingStatus = (AllegroParcelTrackingStatus) o; + return Objects.equals(this.occurredAt, allegroParcelTrackingStatus.occurredAt) && + Objects.equals(this.code, allegroParcelTrackingStatus.code) && + Objects.equals(this.details, allegroParcelTrackingStatus.details) && + Objects.equals(this.terminal, allegroParcelTrackingStatus.terminal); + } + + @Override + public int hashCode() { + return Objects.hash(occurredAt, code, details, terminal); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroParcelTrackingStatus {\n"); + sb.append(" occurredAt: ").append(toIndentedString(occurredAt)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" terminal: ").append(toIndentedString(terminal)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("occurredAt"); + openapiFields.add("code"); + openapiFields.add("details"); + openapiFields.add("terminal"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("occurredAt"); + openapiRequiredFields.add("code"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroParcelTrackingStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroParcelTrackingStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroParcelTrackingStatus is not found in the empty JSON string", AllegroParcelTrackingStatus.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroParcelTrackingStatus.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroParcelTrackingStatus` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllegroParcelTrackingStatus.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + // validate the required field `code` + CodeEnum.validateJsonElement(jsonObj.get("code")); + if ((jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be a primitive type in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroParcelTrackingStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroParcelTrackingStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroParcelTrackingStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroParcelTrackingStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroParcelTrackingStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroParcelTrackingStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroParcelTrackingStatus + * @throws IOException if the JSON string is invalid with respect to AllegroParcelTrackingStatus + */ + public static AllegroParcelTrackingStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroParcelTrackingStatus.class); + } + + /** + * Convert an instance of AllegroParcelTrackingStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPoint.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPoint.java new file mode 100644 index 0000000..74fa99b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPoint.java @@ -0,0 +1,624 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AllegroCarrier; +import pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointAddress; +import pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointOpeningInner; +import pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointPaymentsInner; +import pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointRestrictionsInner; +import pl.wtx.allegro.api.client.model.AllegroPickupDropOffPointServicesInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Allegro pickup drop off point. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPickupDropOffPoint { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + /** + * Point type. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + PUDO("PUDO"), + + APM("APM"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_SERVICES = "services"; + @SerializedName(SERIALIZED_NAME_SERVICES) + @javax.annotation.Nonnull + private List services = new ArrayList<>(); + + public static final String SERIALIZED_NAME_RESTRICTIONS = "restrictions"; + @SerializedName(SERIALIZED_NAME_RESTRICTIONS) + @javax.annotation.Nonnull + private List restrictions = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_PAYMENTS = "payments"; + @SerializedName(SERIALIZED_NAME_PAYMENTS) + @javax.annotation.Nonnull + private List payments = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nonnull + private AllegroPickupDropOffPointAddress address; + + public static final String SERIALIZED_NAME_OPENING = "opening"; + @SerializedName(SERIALIZED_NAME_OPENING) + @javax.annotation.Nonnull + private List opening = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CARRIERS = "carriers"; + @SerializedName(SERIALIZED_NAME_CARRIERS) + @javax.annotation.Nonnull + private List carriers = new ArrayList<>(); + + public AllegroPickupDropOffPoint() { + } + + public AllegroPickupDropOffPoint id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Point id. You can use it in Ship with Allegro. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public AllegroPickupDropOffPoint name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Point name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AllegroPickupDropOffPoint type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Point type. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public AllegroPickupDropOffPoint services(@javax.annotation.Nonnull List services) { + this.services = services; + return this; + } + + public AllegroPickupDropOffPoint addServicesItem(AllegroPickupDropOffPointServicesInner servicesItem) { + if (this.services == null) { + this.services = new ArrayList<>(); + } + this.services.add(servicesItem); + return this; + } + + /** + * Point services. + * @return services + */ + @javax.annotation.Nonnull + public List getServices() { + return services; + } + + public void setServices(@javax.annotation.Nonnull List services) { + this.services = services; + } + + + public AllegroPickupDropOffPoint restrictions(@javax.annotation.Nonnull List restrictions) { + this.restrictions = restrictions; + return this; + } + + public AllegroPickupDropOffPoint addRestrictionsItem(AllegroPickupDropOffPointRestrictionsInner restrictionsItem) { + if (this.restrictions == null) { + this.restrictions = new ArrayList<>(); + } + this.restrictions.add(restrictionsItem); + return this; + } + + /** + * Point restrictions. + * @return restrictions + */ + @javax.annotation.Nonnull + public List getRestrictions() { + return restrictions; + } + + public void setRestrictions(@javax.annotation.Nonnull List restrictions) { + this.restrictions = restrictions; + } + + + public AllegroPickupDropOffPoint description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Point description + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + public AllegroPickupDropOffPoint payments(@javax.annotation.Nonnull List payments) { + this.payments = payments; + return this; + } + + public AllegroPickupDropOffPoint addPaymentsItem(AllegroPickupDropOffPointPaymentsInner paymentsItem) { + if (this.payments == null) { + this.payments = new ArrayList<>(); + } + this.payments.add(paymentsItem); + return this; + } + + /** + * Point payment type. + * @return payments + */ + @javax.annotation.Nonnull + public List getPayments() { + return payments; + } + + public void setPayments(@javax.annotation.Nonnull List payments) { + this.payments = payments; + } + + + public AllegroPickupDropOffPoint address(@javax.annotation.Nonnull AllegroPickupDropOffPointAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nonnull + public AllegroPickupDropOffPointAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nonnull AllegroPickupDropOffPointAddress address) { + this.address = address; + } + + + public AllegroPickupDropOffPoint opening(@javax.annotation.Nonnull List opening) { + this.opening = opening; + return this; + } + + public AllegroPickupDropOffPoint addOpeningItem(AllegroPickupDropOffPointOpeningInner openingItem) { + if (this.opening == null) { + this.opening = new ArrayList<>(); + } + this.opening.add(openingItem); + return this; + } + + /** + * Point working hours information. + * @return opening + */ + @javax.annotation.Nonnull + public List getOpening() { + return opening; + } + + public void setOpening(@javax.annotation.Nonnull List opening) { + this.opening = opening; + } + + + public AllegroPickupDropOffPoint carriers(@javax.annotation.Nonnull List carriers) { + this.carriers = carriers; + return this; + } + + public AllegroPickupDropOffPoint addCarriersItem(AllegroCarrier carriersItem) { + if (this.carriers == null) { + this.carriers = new ArrayList<>(); + } + this.carriers.add(carriersItem); + return this; + } + + /** + * List of carriers that can drop off/pick up packages from point. + * @return carriers + */ + @javax.annotation.Nonnull + public List getCarriers() { + return carriers; + } + + public void setCarriers(@javax.annotation.Nonnull List carriers) { + this.carriers = carriers; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPickupDropOffPoint allegroPickupDropOffPoint = (AllegroPickupDropOffPoint) o; + return Objects.equals(this.id, allegroPickupDropOffPoint.id) && + Objects.equals(this.name, allegroPickupDropOffPoint.name) && + Objects.equals(this.type, allegroPickupDropOffPoint.type) && + Objects.equals(this.services, allegroPickupDropOffPoint.services) && + Objects.equals(this.restrictions, allegroPickupDropOffPoint.restrictions) && + Objects.equals(this.description, allegroPickupDropOffPoint.description) && + Objects.equals(this.payments, allegroPickupDropOffPoint.payments) && + Objects.equals(this.address, allegroPickupDropOffPoint.address) && + Objects.equals(this.opening, allegroPickupDropOffPoint.opening) && + Objects.equals(this.carriers, allegroPickupDropOffPoint.carriers); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, type, services, restrictions, description, payments, address, opening, carriers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPickupDropOffPoint {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" services: ").append(toIndentedString(services)).append("\n"); + sb.append(" restrictions: ").append(toIndentedString(restrictions)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" payments: ").append(toIndentedString(payments)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" opening: ").append(toIndentedString(opening)).append("\n"); + sb.append(" carriers: ").append(toIndentedString(carriers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("services"); + openapiFields.add("restrictions"); + openapiFields.add("description"); + openapiFields.add("payments"); + openapiFields.add("address"); + openapiFields.add("opening"); + openapiFields.add("carriers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("services"); + openapiRequiredFields.add("restrictions"); + openapiRequiredFields.add("payments"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("opening"); + openapiRequiredFields.add("carriers"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPickupDropOffPoint + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPickupDropOffPoint.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPickupDropOffPoint is not found in the empty JSON string", AllegroPickupDropOffPoint.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPickupDropOffPoint.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPickupDropOffPoint` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllegroPickupDropOffPoint.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + // ensure the json data is an array + if (!jsonObj.get("services").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `services` to be an array in the JSON string but got `%s`", jsonObj.get("services").toString())); + } + + JsonArray jsonArrayservices = jsonObj.getAsJsonArray("services"); + // validate the required field `services` (array) + for (int i = 0; i < jsonArrayservices.size(); i++) { + AllegroPickupDropOffPointServicesInner.validateJsonElement(jsonArrayservices.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("restrictions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `restrictions` to be an array in the JSON string but got `%s`", jsonObj.get("restrictions").toString())); + } + + JsonArray jsonArrayrestrictions = jsonObj.getAsJsonArray("restrictions"); + // validate the required field `restrictions` (array) + for (int i = 0; i < jsonArrayrestrictions.size(); i++) { + AllegroPickupDropOffPointRestrictionsInner.validateJsonElement(jsonArrayrestrictions.get(i)); + }; + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("payments").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `payments` to be an array in the JSON string but got `%s`", jsonObj.get("payments").toString())); + } + + JsonArray jsonArraypayments = jsonObj.getAsJsonArray("payments"); + // validate the required field `payments` (array) + for (int i = 0; i < jsonArraypayments.size(); i++) { + AllegroPickupDropOffPointPaymentsInner.validateJsonElement(jsonArraypayments.get(i)); + }; + // validate the required field `address` + AllegroPickupDropOffPointAddress.validateJsonElement(jsonObj.get("address")); + // ensure the json data is an array + if (!jsonObj.get("opening").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `opening` to be an array in the JSON string but got `%s`", jsonObj.get("opening").toString())); + } + + JsonArray jsonArrayopening = jsonObj.getAsJsonArray("opening"); + // validate the required field `opening` (array) + for (int i = 0; i < jsonArrayopening.size(); i++) { + AllegroPickupDropOffPointOpeningInner.validateJsonElement(jsonArrayopening.get(i)); + }; + // ensure the required json array is present + if (jsonObj.get("carriers") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("carriers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `carriers` to be an array in the JSON string but got `%s`", jsonObj.get("carriers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPickupDropOffPoint.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPickupDropOffPoint' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPickupDropOffPoint.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPickupDropOffPoint value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPickupDropOffPoint read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPickupDropOffPoint given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPickupDropOffPoint + * @throws IOException if the JSON string is invalid with respect to AllegroPickupDropOffPoint + */ + public static AllegroPickupDropOffPoint fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPickupDropOffPoint.class); + } + + /** + * Convert an instance of AllegroPickupDropOffPoint to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointAddress.java new file mode 100644 index 0000000..534dfc7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointAddress.java @@ -0,0 +1,338 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Coordinates; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPickupDropOffPointAddress + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPickupDropOffPointAddress { + public static final String SERIALIZED_NAME_POST_CODE = "postCode"; + @SerializedName(SERIALIZED_NAME_POST_CODE) + @javax.annotation.Nonnull + private String postCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode; + + public static final String SERIALIZED_NAME_COORDINATES = "coordinates"; + @SerializedName(SERIALIZED_NAME_COORDINATES) + @javax.annotation.Nonnull + private Coordinates coordinates; + + public AllegroPickupDropOffPointAddress() { + } + + public AllegroPickupDropOffPointAddress postCode(@javax.annotation.Nonnull String postCode) { + this.postCode = postCode; + return this; + } + + /** + * Postal code + * @return postCode + */ + @javax.annotation.Nonnull + public String getPostCode() { + return postCode; + } + + public void setPostCode(@javax.annotation.Nonnull String postCode) { + this.postCode = postCode; + } + + + public AllegroPickupDropOffPointAddress city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * City name + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public AllegroPickupDropOffPointAddress street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Street + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public AllegroPickupDropOffPointAddress countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + public AllegroPickupDropOffPointAddress coordinates(@javax.annotation.Nonnull Coordinates coordinates) { + this.coordinates = coordinates; + return this; + } + + /** + * Get coordinates + * @return coordinates + */ + @javax.annotation.Nonnull + public Coordinates getCoordinates() { + return coordinates; + } + + public void setCoordinates(@javax.annotation.Nonnull Coordinates coordinates) { + this.coordinates = coordinates; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPickupDropOffPointAddress allegroPickupDropOffPointAddress = (AllegroPickupDropOffPointAddress) o; + return Objects.equals(this.postCode, allegroPickupDropOffPointAddress.postCode) && + Objects.equals(this.city, allegroPickupDropOffPointAddress.city) && + Objects.equals(this.street, allegroPickupDropOffPointAddress.street) && + Objects.equals(this.countryCode, allegroPickupDropOffPointAddress.countryCode) && + Objects.equals(this.coordinates, allegroPickupDropOffPointAddress.coordinates); + } + + @Override + public int hashCode() { + return Objects.hash(postCode, city, street, countryCode, coordinates); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPickupDropOffPointAddress {\n"); + sb.append(" postCode: ").append(toIndentedString(postCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" coordinates: ").append(toIndentedString(coordinates)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("postCode"); + openapiFields.add("city"); + openapiFields.add("street"); + openapiFields.add("countryCode"); + openapiFields.add("coordinates"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("postCode"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("countryCode"); + openapiRequiredFields.add("coordinates"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPickupDropOffPointAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPickupDropOffPointAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPickupDropOffPointAddress is not found in the empty JSON string", AllegroPickupDropOffPointAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPickupDropOffPointAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPickupDropOffPointAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllegroPickupDropOffPointAddress.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("postCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postCode").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + // validate the required field `coordinates` + Coordinates.validateJsonElement(jsonObj.get("coordinates")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPickupDropOffPointAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPickupDropOffPointAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPickupDropOffPointAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPickupDropOffPointAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPickupDropOffPointAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPickupDropOffPointAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPickupDropOffPointAddress + * @throws IOException if the JSON string is invalid with respect to AllegroPickupDropOffPointAddress + */ + public static AllegroPickupDropOffPointAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPickupDropOffPointAddress.class); + } + + /** + * Convert an instance of AllegroPickupDropOffPointAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointOpeningInner.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointOpeningInner.java new file mode 100644 index 0000000..f8cc66f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointOpeningInner.java @@ -0,0 +1,276 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPickupDropOffPointOpeningInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPickupDropOffPointOpeningInner { + public static final String SERIALIZED_NAME_DAY_OF_WEEK = "dayOfWeek"; + @SerializedName(SERIALIZED_NAME_DAY_OF_WEEK) + @javax.annotation.Nonnull + private String dayOfWeek; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nonnull + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nonnull + private String to; + + public AllegroPickupDropOffPointOpeningInner() { + } + + public AllegroPickupDropOffPointOpeningInner dayOfWeek(@javax.annotation.Nonnull String dayOfWeek) { + this.dayOfWeek = dayOfWeek; + return this; + } + + /** + * Day of week (ISO 8601). + * @return dayOfWeek + */ + @javax.annotation.Nonnull + public String getDayOfWeek() { + return dayOfWeek; + } + + public void setDayOfWeek(@javax.annotation.Nonnull String dayOfWeek) { + this.dayOfWeek = dayOfWeek; + } + + + public AllegroPickupDropOffPointOpeningInner from(@javax.annotation.Nonnull String from) { + this.from = from; + return this; + } + + /** + * Start hour. + * @return from + */ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nonnull String from) { + this.from = from; + } + + + public AllegroPickupDropOffPointOpeningInner to(@javax.annotation.Nonnull String to) { + this.to = to; + return this; + } + + /** + * End hour. + * @return to + */ + @javax.annotation.Nonnull + public String getTo() { + return to; + } + + public void setTo(@javax.annotation.Nonnull String to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPickupDropOffPointOpeningInner allegroPickupDropOffPointOpeningInner = (AllegroPickupDropOffPointOpeningInner) o; + return Objects.equals(this.dayOfWeek, allegroPickupDropOffPointOpeningInner.dayOfWeek) && + Objects.equals(this.from, allegroPickupDropOffPointOpeningInner.from) && + Objects.equals(this.to, allegroPickupDropOffPointOpeningInner.to); + } + + @Override + public int hashCode() { + return Objects.hash(dayOfWeek, from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPickupDropOffPointOpeningInner {\n"); + sb.append(" dayOfWeek: ").append(toIndentedString(dayOfWeek)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dayOfWeek"); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("dayOfWeek"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("to"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPickupDropOffPointOpeningInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPickupDropOffPointOpeningInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPickupDropOffPointOpeningInner is not found in the empty JSON string", AllegroPickupDropOffPointOpeningInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPickupDropOffPointOpeningInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPickupDropOffPointOpeningInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllegroPickupDropOffPointOpeningInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("dayOfWeek").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dayOfWeek` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dayOfWeek").toString())); + } + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPickupDropOffPointOpeningInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPickupDropOffPointOpeningInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPickupDropOffPointOpeningInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPickupDropOffPointOpeningInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPickupDropOffPointOpeningInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPickupDropOffPointOpeningInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPickupDropOffPointOpeningInner + * @throws IOException if the JSON string is invalid with respect to AllegroPickupDropOffPointOpeningInner + */ + public static AllegroPickupDropOffPointOpeningInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPickupDropOffPointOpeningInner.class); + } + + /** + * Convert an instance of AllegroPickupDropOffPointOpeningInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointPaymentsInner.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointPaymentsInner.java new file mode 100644 index 0000000..f935c49 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointPaymentsInner.java @@ -0,0 +1,268 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPickupDropOffPointPaymentsInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPickupDropOffPointPaymentsInner { + /** + * Gets or Sets method + */ + @JsonAdapter(MethodEnum.Adapter.class) + public enum MethodEnum { + CASH("CASH"), + + CARD("CARD"); + + private String value; + + MethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MethodEnum fromValue(String value) { + for (MethodEnum b : MethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MethodEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MethodEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + MethodEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + @javax.annotation.Nonnull + private MethodEnum method; + + public AllegroPickupDropOffPointPaymentsInner() { + } + + public AllegroPickupDropOffPointPaymentsInner method(@javax.annotation.Nonnull MethodEnum method) { + this.method = method; + return this; + } + + /** + * Get method + * @return method + */ + @javax.annotation.Nonnull + public MethodEnum getMethod() { + return method; + } + + public void setMethod(@javax.annotation.Nonnull MethodEnum method) { + this.method = method; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPickupDropOffPointPaymentsInner allegroPickupDropOffPointPaymentsInner = (AllegroPickupDropOffPointPaymentsInner) o; + return Objects.equals(this.method, allegroPickupDropOffPointPaymentsInner.method); + } + + @Override + public int hashCode() { + return Objects.hash(method); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPickupDropOffPointPaymentsInner {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("method"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("method"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPickupDropOffPointPaymentsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPickupDropOffPointPaymentsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPickupDropOffPointPaymentsInner is not found in the empty JSON string", AllegroPickupDropOffPointPaymentsInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPickupDropOffPointPaymentsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPickupDropOffPointPaymentsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllegroPickupDropOffPointPaymentsInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("method").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `method` to be a primitive type in the JSON string but got `%s`", jsonObj.get("method").toString())); + } + // validate the required field `method` + MethodEnum.validateJsonElement(jsonObj.get("method")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPickupDropOffPointPaymentsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPickupDropOffPointPaymentsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPickupDropOffPointPaymentsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPickupDropOffPointPaymentsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPickupDropOffPointPaymentsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPickupDropOffPointPaymentsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPickupDropOffPointPaymentsInner + * @throws IOException if the JSON string is invalid with respect to AllegroPickupDropOffPointPaymentsInner + */ + public static AllegroPickupDropOffPointPaymentsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPickupDropOffPointPaymentsInner.class); + } + + /** + * Convert an instance of AllegroPickupDropOffPointPaymentsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointRestrictionsInner.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointRestrictionsInner.java new file mode 100644 index 0000000..6303fdc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointRestrictionsInner.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPickupDropOffPointRestrictionsInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPickupDropOffPointRestrictionsInner { + /** + * Set of values can be extended. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + OVERLOADED("OVERLOADED"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public AllegroPickupDropOffPointRestrictionsInner() { + } + + public AllegroPickupDropOffPointRestrictionsInner type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Set of values can be extended. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPickupDropOffPointRestrictionsInner allegroPickupDropOffPointRestrictionsInner = (AllegroPickupDropOffPointRestrictionsInner) o; + return Objects.equals(this.type, allegroPickupDropOffPointRestrictionsInner.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPickupDropOffPointRestrictionsInner {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPickupDropOffPointRestrictionsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPickupDropOffPointRestrictionsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPickupDropOffPointRestrictionsInner is not found in the empty JSON string", AllegroPickupDropOffPointRestrictionsInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPickupDropOffPointRestrictionsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPickupDropOffPointRestrictionsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllegroPickupDropOffPointRestrictionsInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPickupDropOffPointRestrictionsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPickupDropOffPointRestrictionsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPickupDropOffPointRestrictionsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPickupDropOffPointRestrictionsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPickupDropOffPointRestrictionsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPickupDropOffPointRestrictionsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPickupDropOffPointRestrictionsInner + * @throws IOException if the JSON string is invalid with respect to AllegroPickupDropOffPointRestrictionsInner + */ + public static AllegroPickupDropOffPointRestrictionsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPickupDropOffPointRestrictionsInner.class); + } + + /** + * Convert an instance of AllegroPickupDropOffPointRestrictionsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointServicesInner.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointServicesInner.java new file mode 100644 index 0000000..279c0bc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointServicesInner.java @@ -0,0 +1,268 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPickupDropOffPointServicesInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPickupDropOffPointServicesInner { + /** + * Set of values can be extended. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + PICKUP("PICKUP"), + + DROPOFF("DROPOFF"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public AllegroPickupDropOffPointServicesInner() { + } + + public AllegroPickupDropOffPointServicesInner type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Set of values can be extended. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPickupDropOffPointServicesInner allegroPickupDropOffPointServicesInner = (AllegroPickupDropOffPointServicesInner) o; + return Objects.equals(this.type, allegroPickupDropOffPointServicesInner.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPickupDropOffPointServicesInner {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPickupDropOffPointServicesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPickupDropOffPointServicesInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPickupDropOffPointServicesInner is not found in the empty JSON string", AllegroPickupDropOffPointServicesInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPickupDropOffPointServicesInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPickupDropOffPointServicesInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AllegroPickupDropOffPointServicesInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPickupDropOffPointServicesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPickupDropOffPointServicesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPickupDropOffPointServicesInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPickupDropOffPointServicesInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPickupDropOffPointServicesInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPickupDropOffPointServicesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPickupDropOffPointServicesInner + * @throws IOException if the JSON string is invalid with respect to AllegroPickupDropOffPointServicesInner + */ + public static AllegroPickupDropOffPointServicesInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPickupDropOffPointServicesInner.class); + } + + /** + * Convert an instance of AllegroPickupDropOffPointServicesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointsResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointsResponse.java new file mode 100644 index 0000000..ac37389 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPickupDropOffPointsResponse.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AllegroPickupDropOffPoint; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPickupDropOffPointsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPickupDropOffPointsResponse { + public static final String SERIALIZED_NAME_POINTS = "points"; + @SerializedName(SERIALIZED_NAME_POINTS) + @javax.annotation.Nullable + private List points = new ArrayList<>(); + + public AllegroPickupDropOffPointsResponse() { + } + + public AllegroPickupDropOffPointsResponse points(@javax.annotation.Nullable List points) { + this.points = points; + return this; + } + + public AllegroPickupDropOffPointsResponse addPointsItem(AllegroPickupDropOffPoint pointsItem) { + if (this.points == null) { + this.points = new ArrayList<>(); + } + this.points.add(pointsItem); + return this; + } + + /** + * List of Allegro pickup drop off points. + * @return points + */ + @javax.annotation.Nullable + public List getPoints() { + return points; + } + + public void setPoints(@javax.annotation.Nullable List points) { + this.points = points; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPickupDropOffPointsResponse allegroPickupDropOffPointsResponse = (AllegroPickupDropOffPointsResponse) o; + return Objects.equals(this.points, allegroPickupDropOffPointsResponse.points); + } + + @Override + public int hashCode() { + return Objects.hash(points); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPickupDropOffPointsResponse {\n"); + sb.append(" points: ").append(toIndentedString(points)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("points"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPickupDropOffPointsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPickupDropOffPointsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPickupDropOffPointsResponse is not found in the empty JSON string", AllegroPickupDropOffPointsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPickupDropOffPointsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPickupDropOffPointsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("points") != null && !jsonObj.get("points").isJsonNull()) { + JsonArray jsonArraypoints = jsonObj.getAsJsonArray("points"); + if (jsonArraypoints != null) { + // ensure the json data is an array + if (!jsonObj.get("points").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `points` to be an array in the JSON string but got `%s`", jsonObj.get("points").toString())); + } + + // validate the optional field `points` (array) + for (int i = 0; i < jsonArraypoints.size(); i++) { + AllegroPickupDropOffPoint.validateJsonElement(jsonArraypoints.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPickupDropOffPointsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPickupDropOffPointsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPickupDropOffPointsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPickupDropOffPointsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPickupDropOffPointsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPickupDropOffPointsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPickupDropOffPointsResponse + * @throws IOException if the JSON string is invalid with respect to AllegroPickupDropOffPointsResponse + */ + public static AllegroPickupDropOffPointsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPickupDropOffPointsResponse.class); + } + + /** + * Convert an instance of AllegroPickupDropOffPointsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountChangeRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountChangeRequest.java new file mode 100644 index 0000000..49e33c2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountChangeRequest.java @@ -0,0 +1,300 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import pl.wtx.allegro.api.client.model.AllegroPricesAccountChangeRequestAdditionalMarketplacesValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPricesAccountChangeRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPricesAccountChangeRequest { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ALLOWED("ALLOWED"), + + DENIED("DENIED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private Map additionalMarketplaces = new HashMap<>(); + + public AllegroPricesAccountChangeRequest() { + } + + public AllegroPricesAccountChangeRequest status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public AllegroPricesAccountChangeRequest additionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public AllegroPricesAccountChangeRequest putAdditionalMarketplacesItem(String key, AllegroPricesAccountChangeRequestAdditionalMarketplacesValue additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new HashMap<>(); + } + this.additionalMarketplaces.put(key, additionalMarketplacesItem); + return this; + } + + /** + * Consent statuses on marketplaces other than the base marketplace of the account. + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public Map getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPricesAccountChangeRequest allegroPricesAccountChangeRequest = (AllegroPricesAccountChangeRequest) o; + return Objects.equals(this.status, allegroPricesAccountChangeRequest.status) && + Objects.equals(this.additionalMarketplaces, allegroPricesAccountChangeRequest.additionalMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(status, additionalMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPricesAccountChangeRequest {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPricesAccountChangeRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPricesAccountChangeRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPricesAccountChangeRequest is not found in the empty JSON string", AllegroPricesAccountChangeRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPricesAccountChangeRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPricesAccountChangeRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPricesAccountChangeRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPricesAccountChangeRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPricesAccountChangeRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPricesAccountChangeRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPricesAccountChangeRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPricesAccountChangeRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPricesAccountChangeRequest + * @throws IOException if the JSON string is invalid with respect to AllegroPricesAccountChangeRequest + */ + public static AllegroPricesAccountChangeRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPricesAccountChangeRequest.class); + } + + /** + * Convert an instance of AllegroPricesAccountChangeRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountChangeRequestAdditionalMarketplacesValue.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountChangeRequestAdditionalMarketplacesValue.java new file mode 100644 index 0000000..8080300 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountChangeRequestAdditionalMarketplacesValue.java @@ -0,0 +1,262 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPricesAccountChangeRequestAdditionalMarketplacesValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPricesAccountChangeRequestAdditionalMarketplacesValue { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ALLOWED("ALLOWED"), + + DENIED("DENIED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public AllegroPricesAccountChangeRequestAdditionalMarketplacesValue() { + } + + public AllegroPricesAccountChangeRequestAdditionalMarketplacesValue status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPricesAccountChangeRequestAdditionalMarketplacesValue allegroPricesAccountChangeRequestAdditionalMarketplacesValue = (AllegroPricesAccountChangeRequestAdditionalMarketplacesValue) o; + return Objects.equals(this.status, allegroPricesAccountChangeRequestAdditionalMarketplacesValue.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPricesAccountChangeRequestAdditionalMarketplacesValue {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPricesAccountChangeRequestAdditionalMarketplacesValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPricesAccountChangeRequestAdditionalMarketplacesValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPricesAccountChangeRequestAdditionalMarketplacesValue is not found in the empty JSON string", AllegroPricesAccountChangeRequestAdditionalMarketplacesValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPricesAccountChangeRequestAdditionalMarketplacesValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPricesAccountChangeRequestAdditionalMarketplacesValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPricesAccountChangeRequestAdditionalMarketplacesValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPricesAccountChangeRequestAdditionalMarketplacesValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPricesAccountChangeRequestAdditionalMarketplacesValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPricesAccountChangeRequestAdditionalMarketplacesValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPricesAccountChangeRequestAdditionalMarketplacesValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPricesAccountChangeRequestAdditionalMarketplacesValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPricesAccountChangeRequestAdditionalMarketplacesValue + * @throws IOException if the JSON string is invalid with respect to AllegroPricesAccountChangeRequestAdditionalMarketplacesValue + */ + public static AllegroPricesAccountChangeRequestAdditionalMarketplacesValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPricesAccountChangeRequestAdditionalMarketplacesValue.class); + } + + /** + * Convert an instance of AllegroPricesAccountChangeRequestAdditionalMarketplacesValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountConsentChangeResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountConsentChangeResponse.java new file mode 100644 index 0000000..db1b39d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesAccountConsentChangeResponse.java @@ -0,0 +1,300 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import pl.wtx.allegro.api.client.model.AllegroPricesAccountChangeRequestAdditionalMarketplacesValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPricesAccountConsentChangeResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPricesAccountConsentChangeResponse { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ALLOWED("ALLOWED"), + + DENIED("DENIED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private Map additionalMarketplaces = new HashMap<>(); + + public AllegroPricesAccountConsentChangeResponse() { + } + + public AllegroPricesAccountConsentChangeResponse status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public AllegroPricesAccountConsentChangeResponse additionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public AllegroPricesAccountConsentChangeResponse putAdditionalMarketplacesItem(String key, AllegroPricesAccountChangeRequestAdditionalMarketplacesValue additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new HashMap<>(); + } + this.additionalMarketplaces.put(key, additionalMarketplacesItem); + return this; + } + + /** + * Consent statuses on marketplaces other than the base marketplace of the account. + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public Map getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPricesAccountConsentChangeResponse allegroPricesAccountConsentChangeResponse = (AllegroPricesAccountConsentChangeResponse) o; + return Objects.equals(this.status, allegroPricesAccountConsentChangeResponse.status) && + Objects.equals(this.additionalMarketplaces, allegroPricesAccountConsentChangeResponse.additionalMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(status, additionalMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPricesAccountConsentChangeResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPricesAccountConsentChangeResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPricesAccountConsentChangeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPricesAccountConsentChangeResponse is not found in the empty JSON string", AllegroPricesAccountConsentChangeResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPricesAccountConsentChangeResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPricesAccountConsentChangeResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPricesAccountConsentChangeResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPricesAccountConsentChangeResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPricesAccountConsentChangeResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPricesAccountConsentChangeResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPricesAccountConsentChangeResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPricesAccountConsentChangeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPricesAccountConsentChangeResponse + * @throws IOException if the JSON string is invalid with respect to AllegroPricesAccountConsentChangeResponse + */ + public static AllegroPricesAccountConsentChangeResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPricesAccountConsentChangeResponse.class); + } + + /** + * Convert an instance of AllegroPricesAccountConsentChangeResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesEligibilityResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesEligibilityResponse.java new file mode 100644 index 0000000..70e7a88 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesEligibilityResponse.java @@ -0,0 +1,332 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import pl.wtx.allegro.api.client.model.AllegroPricesEligibilityResponseAdditionalMarketplacesValue; +import pl.wtx.allegro.api.client.model.AllegroPricesQualificationResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPricesEligibilityResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPricesEligibilityResponse { + /** + * Gets or Sets consent + */ + @JsonAdapter(ConsentEnum.Adapter.class) + public enum ConsentEnum { + ALLOWED("ALLOWED"), + + DENIED("DENIED"); + + private String value; + + ConsentEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ConsentEnum fromValue(String value) { + for (ConsentEnum b : ConsentEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ConsentEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ConsentEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ConsentEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ConsentEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CONSENT = "consent"; + @SerializedName(SERIALIZED_NAME_CONSENT) + @javax.annotation.Nullable + private ConsentEnum consent; + + public static final String SERIALIZED_NAME_QUALIFICATION = "qualification"; + @SerializedName(SERIALIZED_NAME_QUALIFICATION) + @javax.annotation.Nullable + private AllegroPricesQualificationResponse qualification; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private Map additionalMarketplaces = new HashMap<>(); + + public AllegroPricesEligibilityResponse() { + } + + public AllegroPricesEligibilityResponse consent(@javax.annotation.Nullable ConsentEnum consent) { + this.consent = consent; + return this; + } + + /** + * Get consent + * @return consent + */ + @javax.annotation.Nullable + public ConsentEnum getConsent() { + return consent; + } + + public void setConsent(@javax.annotation.Nullable ConsentEnum consent) { + this.consent = consent; + } + + + public AllegroPricesEligibilityResponse qualification(@javax.annotation.Nullable AllegroPricesQualificationResponse qualification) { + this.qualification = qualification; + return this; + } + + /** + * Get qualification + * @return qualification + */ + @javax.annotation.Nullable + public AllegroPricesQualificationResponse getQualification() { + return qualification; + } + + public void setQualification(@javax.annotation.Nullable AllegroPricesQualificationResponse qualification) { + this.qualification = qualification; + } + + + public AllegroPricesEligibilityResponse additionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public AllegroPricesEligibilityResponse putAdditionalMarketplacesItem(String key, AllegroPricesEligibilityResponseAdditionalMarketplacesValue additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new HashMap<>(); + } + this.additionalMarketplaces.put(key, additionalMarketplacesItem); + return this; + } + + /** + * Eligibility state on marketplces other than the base marketplace of the account. + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public Map getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPricesEligibilityResponse allegroPricesEligibilityResponse = (AllegroPricesEligibilityResponse) o; + return Objects.equals(this.consent, allegroPricesEligibilityResponse.consent) && + Objects.equals(this.qualification, allegroPricesEligibilityResponse.qualification) && + Objects.equals(this.additionalMarketplaces, allegroPricesEligibilityResponse.additionalMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(consent, qualification, additionalMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPricesEligibilityResponse {\n"); + sb.append(" consent: ").append(toIndentedString(consent)).append("\n"); + sb.append(" qualification: ").append(toIndentedString(qualification)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("consent"); + openapiFields.add("qualification"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPricesEligibilityResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPricesEligibilityResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPricesEligibilityResponse is not found in the empty JSON string", AllegroPricesEligibilityResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPricesEligibilityResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPricesEligibilityResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("consent") != null && !jsonObj.get("consent").isJsonNull()) && !jsonObj.get("consent").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `consent` to be a primitive type in the JSON string but got `%s`", jsonObj.get("consent").toString())); + } + // validate the optional field `consent` + if (jsonObj.get("consent") != null && !jsonObj.get("consent").isJsonNull()) { + ConsentEnum.validateJsonElement(jsonObj.get("consent")); + } + // validate the optional field `qualification` + if (jsonObj.get("qualification") != null && !jsonObj.get("qualification").isJsonNull()) { + AllegroPricesQualificationResponse.validateJsonElement(jsonObj.get("qualification")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPricesEligibilityResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPricesEligibilityResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPricesEligibilityResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPricesEligibilityResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPricesEligibilityResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPricesEligibilityResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPricesEligibilityResponse + * @throws IOException if the JSON string is invalid with respect to AllegroPricesEligibilityResponse + */ + public static AllegroPricesEligibilityResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPricesEligibilityResponse.class); + } + + /** + * Convert an instance of AllegroPricesEligibilityResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesEligibilityResponseAdditionalMarketplacesValue.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesEligibilityResponseAdditionalMarketplacesValue.java new file mode 100644 index 0000000..6b8c947 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesEligibilityResponseAdditionalMarketplacesValue.java @@ -0,0 +1,294 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AllegroPricesQualificationResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPricesEligibilityResponseAdditionalMarketplacesValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPricesEligibilityResponseAdditionalMarketplacesValue { + /** + * Gets or Sets consent + */ + @JsonAdapter(ConsentEnum.Adapter.class) + public enum ConsentEnum { + ALLOWED("ALLOWED"), + + DENIED("DENIED"); + + private String value; + + ConsentEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ConsentEnum fromValue(String value) { + for (ConsentEnum b : ConsentEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ConsentEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ConsentEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ConsentEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ConsentEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CONSENT = "consent"; + @SerializedName(SERIALIZED_NAME_CONSENT) + @javax.annotation.Nullable + private ConsentEnum consent; + + public static final String SERIALIZED_NAME_QUALIFICATION = "qualification"; + @SerializedName(SERIALIZED_NAME_QUALIFICATION) + @javax.annotation.Nullable + private AllegroPricesQualificationResponse qualification; + + public AllegroPricesEligibilityResponseAdditionalMarketplacesValue() { + } + + public AllegroPricesEligibilityResponseAdditionalMarketplacesValue consent(@javax.annotation.Nullable ConsentEnum consent) { + this.consent = consent; + return this; + } + + /** + * Get consent + * @return consent + */ + @javax.annotation.Nullable + public ConsentEnum getConsent() { + return consent; + } + + public void setConsent(@javax.annotation.Nullable ConsentEnum consent) { + this.consent = consent; + } + + + public AllegroPricesEligibilityResponseAdditionalMarketplacesValue qualification(@javax.annotation.Nullable AllegroPricesQualificationResponse qualification) { + this.qualification = qualification; + return this; + } + + /** + * Get qualification + * @return qualification + */ + @javax.annotation.Nullable + public AllegroPricesQualificationResponse getQualification() { + return qualification; + } + + public void setQualification(@javax.annotation.Nullable AllegroPricesQualificationResponse qualification) { + this.qualification = qualification; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPricesEligibilityResponseAdditionalMarketplacesValue allegroPricesEligibilityResponseAdditionalMarketplacesValue = (AllegroPricesEligibilityResponseAdditionalMarketplacesValue) o; + return Objects.equals(this.consent, allegroPricesEligibilityResponseAdditionalMarketplacesValue.consent) && + Objects.equals(this.qualification, allegroPricesEligibilityResponseAdditionalMarketplacesValue.qualification); + } + + @Override + public int hashCode() { + return Objects.hash(consent, qualification); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPricesEligibilityResponseAdditionalMarketplacesValue {\n"); + sb.append(" consent: ").append(toIndentedString(consent)).append("\n"); + sb.append(" qualification: ").append(toIndentedString(qualification)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("consent"); + openapiFields.add("qualification"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPricesEligibilityResponseAdditionalMarketplacesValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPricesEligibilityResponseAdditionalMarketplacesValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPricesEligibilityResponseAdditionalMarketplacesValue is not found in the empty JSON string", AllegroPricesEligibilityResponseAdditionalMarketplacesValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPricesEligibilityResponseAdditionalMarketplacesValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPricesEligibilityResponseAdditionalMarketplacesValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("consent") != null && !jsonObj.get("consent").isJsonNull()) && !jsonObj.get("consent").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `consent` to be a primitive type in the JSON string but got `%s`", jsonObj.get("consent").toString())); + } + // validate the optional field `consent` + if (jsonObj.get("consent") != null && !jsonObj.get("consent").isJsonNull()) { + ConsentEnum.validateJsonElement(jsonObj.get("consent")); + } + // validate the optional field `qualification` + if (jsonObj.get("qualification") != null && !jsonObj.get("qualification").isJsonNull()) { + AllegroPricesQualificationResponse.validateJsonElement(jsonObj.get("qualification")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPricesEligibilityResponseAdditionalMarketplacesValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPricesEligibilityResponseAdditionalMarketplacesValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPricesEligibilityResponseAdditionalMarketplacesValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPricesEligibilityResponseAdditionalMarketplacesValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPricesEligibilityResponseAdditionalMarketplacesValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPricesEligibilityResponseAdditionalMarketplacesValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPricesEligibilityResponseAdditionalMarketplacesValue + * @throws IOException if the JSON string is invalid with respect to AllegroPricesEligibilityResponseAdditionalMarketplacesValue + */ + public static AllegroPricesEligibilityResponseAdditionalMarketplacesValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPricesEligibilityResponseAdditionalMarketplacesValue.class); + } + + /** + * Convert an instance of AllegroPricesEligibilityResponseAdditionalMarketplacesValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesOfferChangeRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesOfferChangeRequest.java new file mode 100644 index 0000000..e54a1ce --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesOfferChangeRequest.java @@ -0,0 +1,300 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import pl.wtx.allegro.api.client.model.AllegroPricesAccountChangeRequestAdditionalMarketplacesValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPricesOfferChangeRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPricesOfferChangeRequest { + /** + * Use it to update the consent on the base marketplace of the offer. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ALLOWED("ALLOWED"), + + DENIED("DENIED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private Map additionalMarketplaces = new HashMap<>(); + + public AllegroPricesOfferChangeRequest() { + } + + public AllegroPricesOfferChangeRequest status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Use it to update the consent on the base marketplace of the offer. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public AllegroPricesOfferChangeRequest additionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public AllegroPricesOfferChangeRequest putAdditionalMarketplacesItem(String key, AllegroPricesAccountChangeRequestAdditionalMarketplacesValue additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new HashMap<>(); + } + this.additionalMarketplaces.put(key, additionalMarketplacesItem); + return this; + } + + /** + * Use it to update the consent on marketplaces other than the base marketplace of the offer. + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public Map getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPricesOfferChangeRequest allegroPricesOfferChangeRequest = (AllegroPricesOfferChangeRequest) o; + return Objects.equals(this.status, allegroPricesOfferChangeRequest.status) && + Objects.equals(this.additionalMarketplaces, allegroPricesOfferChangeRequest.additionalMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(status, additionalMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPricesOfferChangeRequest {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPricesOfferChangeRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPricesOfferChangeRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPricesOfferChangeRequest is not found in the empty JSON string", AllegroPricesOfferChangeRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPricesOfferChangeRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPricesOfferChangeRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPricesOfferChangeRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPricesOfferChangeRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPricesOfferChangeRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPricesOfferChangeRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPricesOfferChangeRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPricesOfferChangeRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPricesOfferChangeRequest + * @throws IOException if the JSON string is invalid with respect to AllegroPricesOfferChangeRequest + */ + public static AllegroPricesOfferChangeRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPricesOfferChangeRequest.class); + } + + /** + * Convert an instance of AllegroPricesOfferChangeRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesOfferConsentChangeResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesOfferConsentChangeResponse.java new file mode 100644 index 0000000..953d87b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesOfferConsentChangeResponse.java @@ -0,0 +1,300 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import pl.wtx.allegro.api.client.model.AllegroPricesAccountChangeRequestAdditionalMarketplacesValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPricesOfferConsentChangeResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPricesOfferConsentChangeResponse { + /** + * Consent status on the base marketplace of the offer. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ALLOWED("ALLOWED"), + + DENIED("DENIED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private Map additionalMarketplaces = new HashMap<>(); + + public AllegroPricesOfferConsentChangeResponse() { + } + + public AllegroPricesOfferConsentChangeResponse status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Consent status on the base marketplace of the offer. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public AllegroPricesOfferConsentChangeResponse additionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public AllegroPricesOfferConsentChangeResponse putAdditionalMarketplacesItem(String key, AllegroPricesAccountChangeRequestAdditionalMarketplacesValue additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new HashMap<>(); + } + this.additionalMarketplaces.put(key, additionalMarketplacesItem); + return this; + } + + /** + * Consent statuses on marketplaces other than the base marketplace of the offer. + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public Map getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPricesOfferConsentChangeResponse allegroPricesOfferConsentChangeResponse = (AllegroPricesOfferConsentChangeResponse) o; + return Objects.equals(this.status, allegroPricesOfferConsentChangeResponse.status) && + Objects.equals(this.additionalMarketplaces, allegroPricesOfferConsentChangeResponse.additionalMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(status, additionalMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPricesOfferConsentChangeResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPricesOfferConsentChangeResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPricesOfferConsentChangeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPricesOfferConsentChangeResponse is not found in the empty JSON string", AllegroPricesOfferConsentChangeResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPricesOfferConsentChangeResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPricesOfferConsentChangeResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPricesOfferConsentChangeResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPricesOfferConsentChangeResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPricesOfferConsentChangeResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPricesOfferConsentChangeResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPricesOfferConsentChangeResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPricesOfferConsentChangeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPricesOfferConsentChangeResponse + * @throws IOException if the JSON string is invalid with respect to AllegroPricesOfferConsentChangeResponse + */ + public static AllegroPricesOfferConsentChangeResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPricesOfferConsentChangeResponse.class); + } + + /** + * Convert an instance of AllegroPricesOfferConsentChangeResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesQualificationResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesQualificationResponse.java new file mode 100644 index 0000000..535a6e0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AllegroPricesQualificationResponse.java @@ -0,0 +1,262 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AllegroPricesQualificationResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AllegroPricesQualificationResponse { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + QUALIFIED("QUALIFIED"), + + DISQUALIFIED("DISQUALIFIED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public AllegroPricesQualificationResponse() { + } + + public AllegroPricesQualificationResponse status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllegroPricesQualificationResponse allegroPricesQualificationResponse = (AllegroPricesQualificationResponse) o; + return Objects.equals(this.status, allegroPricesQualificationResponse.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllegroPricesQualificationResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AllegroPricesQualificationResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllegroPricesQualificationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllegroPricesQualificationResponse is not found in the empty JSON string", AllegroPricesQualificationResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllegroPricesQualificationResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllegroPricesQualificationResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllegroPricesQualificationResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllegroPricesQualificationResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllegroPricesQualificationResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllegroPricesQualificationResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllegroPricesQualificationResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllegroPricesQualificationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllegroPricesQualificationResponse + * @throws IOException if the JSON string is invalid with respect to AllegroPricesQualificationResponse + */ + public static AllegroPricesQualificationResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllegroPricesQualificationResponse.class); + } + + /** + * Convert an instance of AllegroPricesQualificationResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AlreadyInWarehouseShipping.java b/src/main/java/pl/wtx/allegro/api/client/model/AlreadyInWarehouseShipping.java new file mode 100644 index 0000000..143b13f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AlreadyInWarehouseShipping.java @@ -0,0 +1,261 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ShippingExtended; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AlreadyInWarehouseShipping + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AlreadyInWarehouseShipping extends ShippingExtended { + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + @javax.annotation.Nullable + protected String method = "ALREADY_IN_WAREHOUSE"; + + public static final String SERIALIZED_NAME_ESTIMATED_TIME_OF_ARRIVAL = "estimatedTimeOfArrival"; + @SerializedName(SERIALIZED_NAME_ESTIMATED_TIME_OF_ARRIVAL) + @javax.annotation.Nullable + private OffsetDateTime estimatedTimeOfArrival; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode; + + public AlreadyInWarehouseShipping() { + this.method = this.getClass().getSimpleName(); + } + + public AlreadyInWarehouseShipping method(@javax.annotation.Nullable String method) { + this.method = method; + return this; + } + + /** + * Get method + * @return method + */ + @javax.annotation.Nullable + public String getMethod() { + return method; + } + + public void setMethod(@javax.annotation.Nullable String method) { + this.method = method; + } + + + public AlreadyInWarehouseShipping estimatedTimeOfArrival(@javax.annotation.Nullable OffsetDateTime estimatedTimeOfArrival) { + this.estimatedTimeOfArrival = estimatedTimeOfArrival; + return this; + } + + /** + * The estimated date and time of Advance Ship Notice arrival in the warehouse. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601). + * @return estimatedTimeOfArrival + */ + @javax.annotation.Nullable + public OffsetDateTime getEstimatedTimeOfArrival() { + return estimatedTimeOfArrival; + } + + public void setEstimatedTimeOfArrival(@javax.annotation.Nullable OffsetDateTime estimatedTimeOfArrival) { + this.estimatedTimeOfArrival = estimatedTimeOfArrival; + } + + + public AlreadyInWarehouseShipping countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code in ISO 3166-1 alpha-2 format (two-letter code), which means the country from which Advance Ship Notice is sent. + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlreadyInWarehouseShipping alreadyInWarehouseShipping = (AlreadyInWarehouseShipping) o; + return Objects.equals(this.method, alreadyInWarehouseShipping.method) && + Objects.equals(this.estimatedTimeOfArrival, alreadyInWarehouseShipping.estimatedTimeOfArrival) && + Objects.equals(this.countryCode, alreadyInWarehouseShipping.countryCode) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(method, estimatedTimeOfArrival, countryCode, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlreadyInWarehouseShipping {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" estimatedTimeOfArrival: ").append(toIndentedString(estimatedTimeOfArrival)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("method"); + openapiFields.add("estimatedTimeOfArrival"); + openapiFields.add("countryCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlreadyInWarehouseShipping + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlreadyInWarehouseShipping.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlreadyInWarehouseShipping is not found in the empty JSON string", AlreadyInWarehouseShipping.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlreadyInWarehouseShipping.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlreadyInWarehouseShipping` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlreadyInWarehouseShipping.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlreadyInWarehouseShipping' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlreadyInWarehouseShipping.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlreadyInWarehouseShipping value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlreadyInWarehouseShipping read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AlreadyInWarehouseShipping given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlreadyInWarehouseShipping + * @throws IOException if the JSON string is invalid with respect to AlreadyInWarehouseShipping + */ + public static AlreadyInWarehouseShipping fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlreadyInWarehouseShipping.class); + } + + /** + * Convert an instance of AlreadyInWarehouseShipping to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Answer.java b/src/main/java/pl/wtx/allegro/api/client/model/Answer.java new file mode 100644 index 0000000..32ed015 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Answer.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Seller's answer, if null seller did not publish answer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Answer { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private String createdAt; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nonnull + private String message; + + public Answer() { + } + + public Answer createdAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Answer creation datetime in ISO 8601 format + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + } + + + public Answer message(@javax.annotation.Nonnull String message) { + this.message = message; + return this; + } + + /** + * Answer message + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nonnull String message) { + this.message = message; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Answer answer = (Answer) o; + return Objects.equals(this.createdAt, answer.createdAt) && + Objects.equals(this.message, answer.message); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Answer {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("message"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Answer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Answer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Answer is not found in the empty JSON string", Answer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Answer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Answer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Answer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); + } + if (!jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Answer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Answer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Answer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Answer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Answer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Answer given an JSON string + * + * @param jsonString JSON string + * @return An instance of Answer + * @throws IOException if the JSON string is invalid with respect to Answer + */ + public static Answer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Answer.class); + } + + /** + * Convert an instance of Answer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AnswerVBeta1.java b/src/main/java/pl/wtx/allegro/api/client/model/AnswerVBeta1.java new file mode 100644 index 0000000..ef9c263 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AnswerVBeta1.java @@ -0,0 +1,276 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Seller's answer, if null seller did not publish answer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AnswerVBeta1 { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private String createdAt; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nonnull + private String text; + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nonnull + private String language; + + public AnswerVBeta1() { + } + + public AnswerVBeta1 createdAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Answer creation datetime in ISO 8601 format + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + } + + + public AnswerVBeta1 text(@javax.annotation.Nonnull String text) { + this.text = text; + return this; + } + + /** + * Answer message + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nonnull String text) { + this.text = text; + } + + + public AnswerVBeta1 language(@javax.annotation.Nonnull String language) { + this.language = language; + return this; + } + + /** + * Language of the user comment. + * @return language + */ + @javax.annotation.Nonnull + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nonnull String language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnswerVBeta1 answerVBeta1 = (AnswerVBeta1) o; + return Objects.equals(this.createdAt, answerVBeta1.createdAt) && + Objects.equals(this.text, answerVBeta1.text) && + Objects.equals(this.language, answerVBeta1.language); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, text, language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnswerVBeta1 {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("text"); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("language"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AnswerVBeta1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnswerVBeta1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AnswerVBeta1 is not found in the empty JSON string", AnswerVBeta1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AnswerVBeta1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AnswerVBeta1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AnswerVBeta1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); + } + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if (!jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnswerVBeta1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnswerVBeta1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnswerVBeta1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnswerVBeta1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AnswerVBeta1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnswerVBeta1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnswerVBeta1 + * @throws IOException if the JSON string is invalid with respect to AnswerVBeta1 + */ + public static AnswerVBeta1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnswerVBeta1.class); + } + + /** + * Convert an instance of AnswerVBeta1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ApplicationTimePolicy.java b/src/main/java/pl/wtx/allegro/api/client/model/ApplicationTimePolicy.java new file mode 100644 index 0000000..18d54a7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ApplicationTimePolicy.java @@ -0,0 +1,334 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Time period when the campaign is open for applying for badge. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ApplicationTimePolicy { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ALWAYS("ALWAYS"), + + SINCE("SINCE"), + + WITHIN("WITHIN"), + + UNTIL("UNTIL"), + + NEVER("NEVER"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private String to; + + public ApplicationTimePolicy() { + } + + public ApplicationTimePolicy type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public ApplicationTimePolicy from(@javax.annotation.Nullable String from) { + this.from = from; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return from + */ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable String from) { + this.from = from; + } + + + public ApplicationTimePolicy to(@javax.annotation.Nullable String to) { + this.to = to; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return to + */ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable String to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApplicationTimePolicy applicationTimePolicy = (ApplicationTimePolicy) o; + return Objects.equals(this.type, applicationTimePolicy.type) && + Objects.equals(this.from, applicationTimePolicy.from) && + Objects.equals(this.to, applicationTimePolicy.to); + } + + @Override + public int hashCode() { + return Objects.hash(type, from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApplicationTimePolicy {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ApplicationTimePolicy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApplicationTimePolicy.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ApplicationTimePolicy is not found in the empty JSON string", ApplicationTimePolicy.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ApplicationTimePolicy.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ApplicationTimePolicy` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ApplicationTimePolicy.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApplicationTimePolicy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApplicationTimePolicy' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApplicationTimePolicy.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApplicationTimePolicy value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ApplicationTimePolicy read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ApplicationTimePolicy given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApplicationTimePolicy + * @throws IOException if the JSON string is invalid with respect to ApplicationTimePolicy + */ + public static ApplicationTimePolicy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApplicationTimePolicy.class); + } + + /** + * Convert an instance of ApplicationTimePolicy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Attachment.java b/src/main/java/pl/wtx/allegro/api/client/model/Attachment.java new file mode 100644 index 0000000..7ea5db1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Attachment.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Attachment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Attachment { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public Attachment() { + } + + public Attachment id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of an attachment received in a response from *POST /sale/offer-attachments* + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Attachment attachment = (Attachment) o; + return Objects.equals(this.id, attachment.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Attachment {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Attachment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Attachment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Attachment is not found in the empty JSON string", Attachment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Attachment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Attachment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Attachment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Attachment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Attachment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Attachment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Attachment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Attachment given an JSON string + * + * @param jsonString JSON string + * @return An instance of Attachment + * @throws IOException if the JSON string is invalid with respect to Attachment + */ + public static Attachment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Attachment.class); + } + + /** + * Convert an instance of Attachment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AttachmentDeclaration.java b/src/main/java/pl/wtx/allegro/api/client/model/AttachmentDeclaration.java new file mode 100644 index 0000000..b6829bf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AttachmentDeclaration.java @@ -0,0 +1,243 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AttachmentDeclaration + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AttachmentDeclaration { + public static final String SERIALIZED_NAME_FILE_NAME = "fileName"; + @SerializedName(SERIALIZED_NAME_FILE_NAME) + @javax.annotation.Nonnull + private String fileName; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nonnull + private Integer size; + + public AttachmentDeclaration() { + } + + public AttachmentDeclaration fileName(@javax.annotation.Nonnull String fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get fileName + * @return fileName + */ + @javax.annotation.Nonnull + public String getFileName() { + return fileName; + } + + public void setFileName(@javax.annotation.Nonnull String fileName) { + this.fileName = fileName; + } + + + public AttachmentDeclaration size(@javax.annotation.Nonnull Integer size) { + this.size = size; + return this; + } + + /** + * Get size + * minimum: 1 + * @return size + */ + @javax.annotation.Nonnull + public Integer getSize() { + return size; + } + + public void setSize(@javax.annotation.Nonnull Integer size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AttachmentDeclaration attachmentDeclaration = (AttachmentDeclaration) o; + return Objects.equals(this.fileName, attachmentDeclaration.fileName) && + Objects.equals(this.size, attachmentDeclaration.size); + } + + @Override + public int hashCode() { + return Objects.hash(fileName, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentDeclaration {\n"); + sb.append(" fileName: ").append(toIndentedString(fileName)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fileName"); + openapiFields.add("size"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fileName"); + openapiRequiredFields.add("size"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AttachmentDeclaration + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AttachmentDeclaration.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AttachmentDeclaration is not found in the empty JSON string", AttachmentDeclaration.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AttachmentDeclaration.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AttachmentDeclaration` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AttachmentDeclaration.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("fileName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fileName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fileName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AttachmentDeclaration.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AttachmentDeclaration' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AttachmentDeclaration.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AttachmentDeclaration value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AttachmentDeclaration read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AttachmentDeclaration given an JSON string + * + * @param jsonString JSON string + * @return An instance of AttachmentDeclaration + * @throws IOException if the JSON string is invalid with respect to AttachmentDeclaration + */ + public static AttachmentDeclaration fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AttachmentDeclaration.class); + } + + /** + * Convert an instance of AttachmentDeclaration to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AttachmentFile.java b/src/main/java/pl/wtx/allegro/api/client/model/AttachmentFile.java new file mode 100644 index 0000000..04c91f9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AttachmentFile.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AttachmentFile + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AttachmentFile { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public AttachmentFile() { + } + + public AttachmentFile name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public AttachmentFile url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AttachmentFile attachmentFile = (AttachmentFile) o; + return Objects.equals(this.name, attachmentFile.name) && + Objects.equals(this.url, attachmentFile.url); + } + + @Override + public int hashCode() { + return Objects.hash(name, url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentFile {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AttachmentFile + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AttachmentFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AttachmentFile is not found in the empty JSON string", AttachmentFile.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AttachmentFile.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AttachmentFile` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AttachmentFile.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AttachmentFile' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AttachmentFile.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AttachmentFile value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AttachmentFile read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AttachmentFile given an JSON string + * + * @param jsonString JSON string + * @return An instance of AttachmentFile + * @throws IOException if the JSON string is invalid with respect to AttachmentFile + */ + public static AttachmentFile fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AttachmentFile.class); + } + + /** + * Convert an instance of AttachmentFile to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AttachmentFileRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AttachmentFileRequest.java new file mode 100644 index 0000000..2dcbe9d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AttachmentFileRequest.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AttachmentFileRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AttachmentFileRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public AttachmentFileRequest() { + } + + public AttachmentFileRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AttachmentFileRequest attachmentFileRequest = (AttachmentFileRequest) o; + return Objects.equals(this.name, attachmentFileRequest.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentFileRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AttachmentFileRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AttachmentFileRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AttachmentFileRequest is not found in the empty JSON string", AttachmentFileRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AttachmentFileRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AttachmentFileRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AttachmentFileRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AttachmentFileRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AttachmentFileRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AttachmentFileRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AttachmentFileRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AttachmentFileRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AttachmentFileRequest + * @throws IOException if the JSON string is invalid with respect to AttachmentFileRequest + */ + public static AttachmentFileRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AttachmentFileRequest.class); + } + + /** + * Convert an instance of AttachmentFileRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AttachmentType.java b/src/main/java/pl/wtx/allegro/api/client/model/AttachmentType.java new file mode 100644 index 0000000..596e419 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AttachmentType.java @@ -0,0 +1,96 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * offer attachment type + */ +@JsonAdapter(AttachmentType.Adapter.class) +public enum AttachmentType { + + MANUAL("MANUAL"), + + SPECIAL_OFFER_RULES("SPECIAL_OFFER_RULES"), + + COMPETITION_RULES("COMPETITION_RULES"), + + BOOK_EXCERPT("BOOK_EXCERPT"), + + USER_MANUAL("USER_MANUAL"), + + INSTALLATION_INSTRUCTIONS("INSTALLATION_INSTRUCTIONS"), + + GAME_INSTRUCTIONS("GAME_INSTRUCTIONS"), + + ENERGY_LABEL("ENERGY_LABEL"), + + PRODUCT_INFORMATION_SHEET("PRODUCT_INFORMATION_SHEET"), + + TIRE_LABEL("TIRE_LABEL"), + + SAFETY_INFORMATION_MANUAL("SAFETY_INFORMATION_MANUAL"); + + private String value; + + AttachmentType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AttachmentType fromValue(String value) { + for (AttachmentType b : AttachmentType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AttachmentType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AttachmentType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AttachmentType.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AttachmentType.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AuctionDetails.java b/src/main/java/pl/wtx/allegro/api/client/model/AuctionDetails.java new file mode 100644 index 0000000..4b6fd13 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AuctionDetails.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CurrentPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Auction details. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AuctionDetails { + public static final String SERIALIZED_NAME_CURRENT_PRICE = "currentPrice"; + @SerializedName(SERIALIZED_NAME_CURRENT_PRICE) + @javax.annotation.Nonnull + private CurrentPrice currentPrice; + + public AuctionDetails() { + } + + public AuctionDetails currentPrice(@javax.annotation.Nonnull CurrentPrice currentPrice) { + this.currentPrice = currentPrice; + return this; + } + + /** + * Get currentPrice + * @return currentPrice + */ + @javax.annotation.Nonnull + public CurrentPrice getCurrentPrice() { + return currentPrice; + } + + public void setCurrentPrice(@javax.annotation.Nonnull CurrentPrice currentPrice) { + this.currentPrice = currentPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuctionDetails auctionDetails = (AuctionDetails) o; + return Objects.equals(this.currentPrice, auctionDetails.currentPrice); + } + + @Override + public int hashCode() { + return Objects.hash(currentPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuctionDetails {\n"); + sb.append(" currentPrice: ").append(toIndentedString(currentPrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("currentPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("currentPrice"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuctionDetails + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuctionDetails.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuctionDetails is not found in the empty JSON string", AuctionDetails.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuctionDetails.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuctionDetails` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuctionDetails.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `currentPrice` + CurrentPrice.validateJsonElement(jsonObj.get("currentPrice")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuctionDetails.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuctionDetails' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuctionDetails.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuctionDetails value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuctionDetails read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuctionDetails given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuctionDetails + * @throws IOException if the JSON string is invalid with respect to AuctionDetails + */ + public static AuctionDetails fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuctionDetails.class); + } + + /** + * Convert an instance of AuctionDetails to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AuthError.java b/src/main/java/pl/wtx/allegro/api/client/model/AuthError.java new file mode 100644 index 0000000..a9608ba --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AuthError.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AuthError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AuthError { + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + @javax.annotation.Nonnull + private String error; + + public static final String SERIALIZED_NAME_ERROR_DESCRIPTION = "error_description"; + @SerializedName(SERIALIZED_NAME_ERROR_DESCRIPTION) + @javax.annotation.Nullable + private String errorDescription; + + public AuthError() { + } + + public AuthError error(@javax.annotation.Nonnull String error) { + this.error = error; + return this; + } + + /** + * Authorization error code + * @return error + */ + @javax.annotation.Nonnull + public String getError() { + return error; + } + + public void setError(@javax.annotation.Nonnull String error) { + this.error = error; + } + + + public AuthError errorDescription(@javax.annotation.Nullable String errorDescription) { + this.errorDescription = errorDescription; + return this; + } + + /** + * Authorization error message + * @return errorDescription + */ + @javax.annotation.Nullable + public String getErrorDescription() { + return errorDescription; + } + + public void setErrorDescription(@javax.annotation.Nullable String errorDescription) { + this.errorDescription = errorDescription; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthError authError = (AuthError) o; + return Objects.equals(this.error, authError.error) && + Objects.equals(this.errorDescription, authError.errorDescription); + } + + @Override + public int hashCode() { + return Objects.hash(error, errorDescription); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthError {\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" errorDescription: ").append(toIndentedString(errorDescription)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("error"); + openapiFields.add("error_description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("error"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthError is not found in the empty JSON string", AuthError.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthError.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthError` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthError.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("error").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `error` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error").toString())); + } + if ((jsonObj.get("error_description") != null && !jsonObj.get("error_description").isJsonNull()) && !jsonObj.get("error_description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `error_description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error_description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthError given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthError + * @throws IOException if the JSON string is invalid with respect to AuthError + */ + public static AuthError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthError.class); + } + + /** + * Convert an instance of AuthError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingOfferRuleConfiguration.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingOfferRuleConfiguration.java new file mode 100644 index 0000000..2ffe6ff --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingOfferRuleConfiguration.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AutomaticPricingOfferRuleConfigurationPriceRange; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer Rule configuration. For \"EXCHANGE_RATE\" the field is not allowed. For \"FOLLOW_BY_ALLEGRO_MIN_PRICE\", \"FOLLOW_BY_MARKET_MIN_PRICE\" and \"FOLLOW_BY_TOP_OFFER_PRICE\" it is necessary for the rule to work. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingOfferRuleConfiguration { + public static final String SERIALIZED_NAME_PRICE_RANGE = "priceRange"; + @SerializedName(SERIALIZED_NAME_PRICE_RANGE) + @javax.annotation.Nullable + private AutomaticPricingOfferRuleConfigurationPriceRange priceRange; + + public AutomaticPricingOfferRuleConfiguration() { + } + + public AutomaticPricingOfferRuleConfiguration priceRange(@javax.annotation.Nullable AutomaticPricingOfferRuleConfigurationPriceRange priceRange) { + this.priceRange = priceRange; + return this; + } + + /** + * Get priceRange + * @return priceRange + */ + @javax.annotation.Nullable + public AutomaticPricingOfferRuleConfigurationPriceRange getPriceRange() { + return priceRange; + } + + public void setPriceRange(@javax.annotation.Nullable AutomaticPricingOfferRuleConfigurationPriceRange priceRange) { + this.priceRange = priceRange; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomaticPricingOfferRuleConfiguration automaticPricingOfferRuleConfiguration = (AutomaticPricingOfferRuleConfiguration) o; + return Objects.equals(this.priceRange, automaticPricingOfferRuleConfiguration.priceRange); + } + + @Override + public int hashCode() { + return Objects.hash(priceRange); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutomaticPricingOfferRuleConfiguration {\n"); + sb.append(" priceRange: ").append(toIndentedString(priceRange)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("priceRange"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingOfferRuleConfiguration + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutomaticPricingOfferRuleConfiguration.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AutomaticPricingOfferRuleConfiguration is not found in the empty JSON string", AutomaticPricingOfferRuleConfiguration.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutomaticPricingOfferRuleConfiguration.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AutomaticPricingOfferRuleConfiguration` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `priceRange` + if (jsonObj.get("priceRange") != null && !jsonObj.get("priceRange").isJsonNull()) { + AutomaticPricingOfferRuleConfigurationPriceRange.validateJsonElement(jsonObj.get("priceRange")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingOfferRuleConfiguration.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingOfferRuleConfiguration' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingOfferRuleConfiguration.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingOfferRuleConfiguration value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutomaticPricingOfferRuleConfiguration read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutomaticPricingOfferRuleConfiguration given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingOfferRuleConfiguration + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingOfferRuleConfiguration + */ + public static AutomaticPricingOfferRuleConfiguration fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingOfferRuleConfiguration.class); + } + + /** + * Convert an instance of AutomaticPricingOfferRuleConfiguration to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingOfferRuleConfigurationPriceRange.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingOfferRuleConfigurationPriceRange.java new file mode 100644 index 0000000..8e35c53 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingOfferRuleConfigurationPriceRange.java @@ -0,0 +1,329 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Price range. This field is optional. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingOfferRuleConfigurationPriceRange { + /** + * Price range currency type. * `BASE_MARKETPLACE_CURRENCY` - The price must be defined in the same currency as offer base marketplace currency. * `MARKETPLACE_CURRENCY` - The price must be defined in the same currency as marketplace currency. For a base marketplace this is the only accepted value. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BASE_MARKETPLACE_CURRENCY("BASE_MARKETPLACE_CURRENCY"), + + MARKETPLACE_CURRENCY("MARKETPLACE_CURRENCY"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_MIN_PRICE = "minPrice"; + @SerializedName(SERIALIZED_NAME_MIN_PRICE) + @javax.annotation.Nonnull + private Price minPrice; + + public static final String SERIALIZED_NAME_MAX_PRICE = "maxPrice"; + @SerializedName(SERIALIZED_NAME_MAX_PRICE) + @javax.annotation.Nonnull + private Price maxPrice; + + public AutomaticPricingOfferRuleConfigurationPriceRange() { + } + + public AutomaticPricingOfferRuleConfigurationPriceRange type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Price range currency type. * `BASE_MARKETPLACE_CURRENCY` - The price must be defined in the same currency as offer base marketplace currency. * `MARKETPLACE_CURRENCY` - The price must be defined in the same currency as marketplace currency. For a base marketplace this is the only accepted value. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public AutomaticPricingOfferRuleConfigurationPriceRange minPrice(@javax.annotation.Nonnull Price minPrice) { + this.minPrice = minPrice; + return this; + } + + /** + * The minimum price that can be set. + * @return minPrice + */ + @javax.annotation.Nonnull + public Price getMinPrice() { + return minPrice; + } + + public void setMinPrice(@javax.annotation.Nonnull Price minPrice) { + this.minPrice = minPrice; + } + + + public AutomaticPricingOfferRuleConfigurationPriceRange maxPrice(@javax.annotation.Nonnull Price maxPrice) { + this.maxPrice = maxPrice; + return this; + } + + /** + * The maximum price that can be set. + * @return maxPrice + */ + @javax.annotation.Nonnull + public Price getMaxPrice() { + return maxPrice; + } + + public void setMaxPrice(@javax.annotation.Nonnull Price maxPrice) { + this.maxPrice = maxPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomaticPricingOfferRuleConfigurationPriceRange automaticPricingOfferRuleConfigurationPriceRange = (AutomaticPricingOfferRuleConfigurationPriceRange) o; + return Objects.equals(this.type, automaticPricingOfferRuleConfigurationPriceRange.type) && + Objects.equals(this.minPrice, automaticPricingOfferRuleConfigurationPriceRange.minPrice) && + Objects.equals(this.maxPrice, automaticPricingOfferRuleConfigurationPriceRange.maxPrice); + } + + @Override + public int hashCode() { + return Objects.hash(type, minPrice, maxPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutomaticPricingOfferRuleConfigurationPriceRange {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" minPrice: ").append(toIndentedString(minPrice)).append("\n"); + sb.append(" maxPrice: ").append(toIndentedString(maxPrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("minPrice"); + openapiFields.add("maxPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("minPrice"); + openapiRequiredFields.add("maxPrice"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingOfferRuleConfigurationPriceRange + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutomaticPricingOfferRuleConfigurationPriceRange.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AutomaticPricingOfferRuleConfigurationPriceRange is not found in the empty JSON string", AutomaticPricingOfferRuleConfigurationPriceRange.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutomaticPricingOfferRuleConfigurationPriceRange.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AutomaticPricingOfferRuleConfigurationPriceRange` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AutomaticPricingOfferRuleConfigurationPriceRange.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `minPrice` + Price.validateJsonElement(jsonObj.get("minPrice")); + // validate the required field `maxPrice` + Price.validateJsonElement(jsonObj.get("maxPrice")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingOfferRuleConfigurationPriceRange.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingOfferRuleConfigurationPriceRange' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingOfferRuleConfigurationPriceRange.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingOfferRuleConfigurationPriceRange value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutomaticPricingOfferRuleConfigurationPriceRange read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutomaticPricingOfferRuleConfigurationPriceRange given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingOfferRuleConfigurationPriceRange + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingOfferRuleConfigurationPriceRange + */ + public static AutomaticPricingOfferRuleConfigurationPriceRange fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingOfferRuleConfigurationPriceRange.class); + } + + /** + * Convert an instance of AutomaticPricingOfferRuleConfigurationPriceRange to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfiguration.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfiguration.java new file mode 100644 index 0000000..e012c58 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfiguration.java @@ -0,0 +1,282 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByAmount; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByPercentage; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import pl.wtx.allegro.api.client.invoker.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingRuleConfiguration extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AutomaticPricingRuleConfiguration.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingRuleConfiguration.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingRuleConfiguration' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterAutomaticPricingRuleConfigurationChangeByAmount = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingRuleConfigurationChangeByAmount.class)); + final TypeAdapter adapterAutomaticPricingRuleConfigurationChangeByPercentage = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingRuleConfigurationChangeByPercentage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingRuleConfiguration value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `AutomaticPricingRuleConfigurationChangeByAmount` + if (value.getActualInstance() instanceof AutomaticPricingRuleConfigurationChangeByAmount) { + JsonElement element = adapterAutomaticPricingRuleConfigurationChangeByAmount.toJsonTree((AutomaticPricingRuleConfigurationChangeByAmount)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `AutomaticPricingRuleConfigurationChangeByPercentage` + if (value.getActualInstance() instanceof AutomaticPricingRuleConfigurationChangeByPercentage) { + JsonElement element = adapterAutomaticPricingRuleConfigurationChangeByPercentage.toJsonTree((AutomaticPricingRuleConfigurationChangeByPercentage)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: AutomaticPricingRuleConfigurationChangeByAmount, AutomaticPricingRuleConfigurationChangeByPercentage"); + } + + @Override + public AutomaticPricingRuleConfiguration read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize AutomaticPricingRuleConfigurationChangeByAmount + try { + // validate the JSON object to see if any exception is thrown + AutomaticPricingRuleConfigurationChangeByAmount.validateJsonElement(jsonElement); + actualAdapter = adapterAutomaticPricingRuleConfigurationChangeByAmount; + match++; + log.log(Level.FINER, "Input data matches schema 'AutomaticPricingRuleConfigurationChangeByAmount'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for AutomaticPricingRuleConfigurationChangeByAmount failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'AutomaticPricingRuleConfigurationChangeByAmount'", e); + } + // deserialize AutomaticPricingRuleConfigurationChangeByPercentage + try { + // validate the JSON object to see if any exception is thrown + AutomaticPricingRuleConfigurationChangeByPercentage.validateJsonElement(jsonElement); + actualAdapter = adapterAutomaticPricingRuleConfigurationChangeByPercentage; + match++; + log.log(Level.FINER, "Input data matches schema 'AutomaticPricingRuleConfigurationChangeByPercentage'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for AutomaticPricingRuleConfigurationChangeByPercentage failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'AutomaticPricingRuleConfigurationChangeByPercentage'", e); + } + + if (match == 1) { + AutomaticPricingRuleConfiguration ret = new AutomaticPricingRuleConfiguration(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for AutomaticPricingRuleConfiguration: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public AutomaticPricingRuleConfiguration() { + super("oneOf", Boolean.TRUE); + } + + public AutomaticPricingRuleConfiguration(Object o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("AutomaticPricingRuleConfigurationChangeByAmount", AutomaticPricingRuleConfigurationChangeByAmount.class); + schemas.put("AutomaticPricingRuleConfigurationChangeByPercentage", AutomaticPricingRuleConfigurationChangeByPercentage.class); + } + + @Override + public Map> getSchemas() { + return AutomaticPricingRuleConfiguration.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * AutomaticPricingRuleConfigurationChangeByAmount, AutomaticPricingRuleConfigurationChangeByPercentage + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance == null) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof AutomaticPricingRuleConfigurationChangeByAmount) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof AutomaticPricingRuleConfigurationChangeByPercentage) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be AutomaticPricingRuleConfigurationChangeByAmount, AutomaticPricingRuleConfigurationChangeByPercentage"); + } + + /** + * Get the actual instance, which can be the following: + * AutomaticPricingRuleConfigurationChangeByAmount, AutomaticPricingRuleConfigurationChangeByPercentage + * + * @return The actual instance (AutomaticPricingRuleConfigurationChangeByAmount, AutomaticPricingRuleConfigurationChangeByPercentage) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AutomaticPricingRuleConfigurationChangeByAmount`. If the actual instance is not `AutomaticPricingRuleConfigurationChangeByAmount`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `AutomaticPricingRuleConfigurationChangeByAmount` + * @throws ClassCastException if the instance is not `AutomaticPricingRuleConfigurationChangeByAmount` + */ + public AutomaticPricingRuleConfigurationChangeByAmount getAutomaticPricingRuleConfigurationChangeByAmount() throws ClassCastException { + return (AutomaticPricingRuleConfigurationChangeByAmount)super.getActualInstance(); + } + + /** + * Get the actual instance of `AutomaticPricingRuleConfigurationChangeByPercentage`. If the actual instance is not `AutomaticPricingRuleConfigurationChangeByPercentage`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `AutomaticPricingRuleConfigurationChangeByPercentage` + * @throws ClassCastException if the instance is not `AutomaticPricingRuleConfigurationChangeByPercentage` + */ + public AutomaticPricingRuleConfigurationChangeByPercentage getAutomaticPricingRuleConfigurationChangeByPercentage() throws ClassCastException { + return (AutomaticPricingRuleConfigurationChangeByPercentage)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingRuleConfiguration + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with AutomaticPricingRuleConfigurationChangeByAmount + try { + AutomaticPricingRuleConfigurationChangeByAmount.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for AutomaticPricingRuleConfigurationChangeByAmount failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with AutomaticPricingRuleConfigurationChangeByPercentage + try { + AutomaticPricingRuleConfigurationChangeByPercentage.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for AutomaticPricingRuleConfigurationChangeByPercentage failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for AutomaticPricingRuleConfiguration with oneOf schemas: AutomaticPricingRuleConfigurationChangeByAmount, AutomaticPricingRuleConfigurationChangeByPercentage. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of AutomaticPricingRuleConfiguration given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingRuleConfiguration + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingRuleConfiguration + */ + public static AutomaticPricingRuleConfiguration fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingRuleConfiguration.class); + } + + /** + * Convert an instance of AutomaticPricingRuleConfiguration to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmount.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmount.java new file mode 100644 index 0000000..2aa8852 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmount.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AutomaticPricingRuleConfigurationChangeByAmount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingRuleConfigurationChangeByAmount { + public static final String SERIALIZED_NAME_CHANGE_BY_AMOUNT = "changeByAmount"; + @SerializedName(SERIALIZED_NAME_CHANGE_BY_AMOUNT) + @javax.annotation.Nonnull + private AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount changeByAmount; + + public AutomaticPricingRuleConfigurationChangeByAmount() { + } + + public AutomaticPricingRuleConfigurationChangeByAmount changeByAmount(@javax.annotation.Nonnull AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount changeByAmount) { + this.changeByAmount = changeByAmount; + return this; + } + + /** + * Get changeByAmount + * @return changeByAmount + */ + @javax.annotation.Nonnull + public AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount getChangeByAmount() { + return changeByAmount; + } + + public void setChangeByAmount(@javax.annotation.Nonnull AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount changeByAmount) { + this.changeByAmount = changeByAmount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomaticPricingRuleConfigurationChangeByAmount automaticPricingRuleConfigurationChangeByAmount = (AutomaticPricingRuleConfigurationChangeByAmount) o; + return Objects.equals(this.changeByAmount, automaticPricingRuleConfigurationChangeByAmount.changeByAmount); + } + + @Override + public int hashCode() { + return Objects.hash(changeByAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutomaticPricingRuleConfigurationChangeByAmount {\n"); + sb.append(" changeByAmount: ").append(toIndentedString(changeByAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("changeByAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("changeByAmount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingRuleConfigurationChangeByAmount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutomaticPricingRuleConfigurationChangeByAmount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AutomaticPricingRuleConfigurationChangeByAmount is not found in the empty JSON string", AutomaticPricingRuleConfigurationChangeByAmount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutomaticPricingRuleConfigurationChangeByAmount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AutomaticPricingRuleConfigurationChangeByAmount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AutomaticPricingRuleConfigurationChangeByAmount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `changeByAmount` + AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.validateJsonElement(jsonObj.get("changeByAmount")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingRuleConfigurationChangeByAmount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingRuleConfigurationChangeByAmount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingRuleConfigurationChangeByAmount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingRuleConfigurationChangeByAmount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutomaticPricingRuleConfigurationChangeByAmount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutomaticPricingRuleConfigurationChangeByAmount given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingRuleConfigurationChangeByAmount + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingRuleConfigurationChangeByAmount + */ + public static AutomaticPricingRuleConfigurationChangeByAmount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingRuleConfigurationChangeByAmount.class); + } + + /** + * Convert an instance of AutomaticPricingRuleConfigurationChangeByAmount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.java new file mode 100644 index 0000000..a20f228 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.java @@ -0,0 +1,317 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount { + /** + * Gets or Sets operation + */ + @JsonAdapter(OperationEnum.Adapter.class) + public enum OperationEnum { + SUBTRACT("SUBTRACT"), + + ADD("ADD"); + + private String value; + + OperationEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OperationEnum fromValue(String value) { + for (OperationEnum b : OperationEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OperationEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OperationEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OperationEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OperationEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_OPERATION = "operation"; + @SerializedName(SERIALIZED_NAME_OPERATION) + @javax.annotation.Nonnull + private OperationEnum operation; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nonnull + private List values = new ArrayList<>(); + + public AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount() { + } + + public AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount operation(@javax.annotation.Nonnull OperationEnum operation) { + this.operation = operation; + return this; + } + + /** + * Get operation + * @return operation + */ + @javax.annotation.Nonnull + public OperationEnum getOperation() { + return operation; + } + + public void setOperation(@javax.annotation.Nonnull OperationEnum operation) { + this.operation = operation; + } + + + public AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount values(@javax.annotation.Nonnull List values) { + this.values = values; + return this; + } + + public AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount addValuesItem(AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Get values + * @return values + */ + @javax.annotation.Nonnull + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nonnull List values) { + this.values = values; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount automaticPricingRuleConfigurationChangeByAmountChangeByAmount = (AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount) o; + return Objects.equals(this.operation, automaticPricingRuleConfigurationChangeByAmountChangeByAmount.operation) && + Objects.equals(this.values, automaticPricingRuleConfigurationChangeByAmountChangeByAmount.values); + } + + @Override + public int hashCode() { + return Objects.hash(operation, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount {\n"); + sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("operation"); + openapiFields.add("values"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("operation"); + openapiRequiredFields.add("values"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount is not found in the empty JSON string", AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("operation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `operation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("operation").toString())); + } + // validate the required field `operation` + OperationEnum.validateJsonElement(jsonObj.get("operation")); + // ensure the json data is an array + if (!jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + + JsonArray jsonArrayvalues = jsonObj.getAsJsonArray("values"); + // validate the required field `values` (array) + for (int i = 0; i < jsonArrayvalues.size(); i++) { + AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.validateJsonElement(jsonArrayvalues.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount + */ + public static AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount.class); + } + + /** + * Convert an instance of AutomaticPricingRuleConfigurationChangeByAmountChangeByAmount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.java new file mode 100644 index 0000000..3d73082 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.java @@ -0,0 +1,246 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private BigDecimal amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner() { + } + + public AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner amount(@javax.annotation.Nonnull BigDecimal amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + */ + @javax.annotation.Nonnull + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull BigDecimal amount) { + this.amount = amount; + } + + + public AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner automaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner = (AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner) o; + return Objects.equals(this.amount, automaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.amount) && + Objects.equals(this.currency, automaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner is not found in the empty JSON string", AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner + */ + public static AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner.class); + } + + /** + * Convert an instance of AutomaticPricingRuleConfigurationChangeByAmountChangeByAmountValuesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByPercentage.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByPercentage.java new file mode 100644 index 0000000..a3f4c3d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByPercentage.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AutomaticPricingRuleConfigurationChangeByPercentage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingRuleConfigurationChangeByPercentage { + public static final String SERIALIZED_NAME_CHANGE_BY_PERCENTAGE = "changeByPercentage"; + @SerializedName(SERIALIZED_NAME_CHANGE_BY_PERCENTAGE) + @javax.annotation.Nonnull + private AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage changeByPercentage; + + public AutomaticPricingRuleConfigurationChangeByPercentage() { + } + + public AutomaticPricingRuleConfigurationChangeByPercentage changeByPercentage(@javax.annotation.Nonnull AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage changeByPercentage) { + this.changeByPercentage = changeByPercentage; + return this; + } + + /** + * Get changeByPercentage + * @return changeByPercentage + */ + @javax.annotation.Nonnull + public AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage getChangeByPercentage() { + return changeByPercentage; + } + + public void setChangeByPercentage(@javax.annotation.Nonnull AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage changeByPercentage) { + this.changeByPercentage = changeByPercentage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomaticPricingRuleConfigurationChangeByPercentage automaticPricingRuleConfigurationChangeByPercentage = (AutomaticPricingRuleConfigurationChangeByPercentage) o; + return Objects.equals(this.changeByPercentage, automaticPricingRuleConfigurationChangeByPercentage.changeByPercentage); + } + + @Override + public int hashCode() { + return Objects.hash(changeByPercentage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutomaticPricingRuleConfigurationChangeByPercentage {\n"); + sb.append(" changeByPercentage: ").append(toIndentedString(changeByPercentage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("changeByPercentage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("changeByPercentage"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingRuleConfigurationChangeByPercentage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutomaticPricingRuleConfigurationChangeByPercentage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AutomaticPricingRuleConfigurationChangeByPercentage is not found in the empty JSON string", AutomaticPricingRuleConfigurationChangeByPercentage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutomaticPricingRuleConfigurationChangeByPercentage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AutomaticPricingRuleConfigurationChangeByPercentage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AutomaticPricingRuleConfigurationChangeByPercentage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `changeByPercentage` + AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.validateJsonElement(jsonObj.get("changeByPercentage")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingRuleConfigurationChangeByPercentage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingRuleConfigurationChangeByPercentage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingRuleConfigurationChangeByPercentage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingRuleConfigurationChangeByPercentage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutomaticPricingRuleConfigurationChangeByPercentage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutomaticPricingRuleConfigurationChangeByPercentage given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingRuleConfigurationChangeByPercentage + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingRuleConfigurationChangeByPercentage + */ + public static AutomaticPricingRuleConfigurationChangeByPercentage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingRuleConfigurationChangeByPercentage.class); + } + + /** + * Convert an instance of AutomaticPricingRuleConfigurationChangeByPercentage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.java new file mode 100644 index 0000000..2172a90 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.java @@ -0,0 +1,299 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage { + /** + * Gets or Sets operation + */ + @JsonAdapter(OperationEnum.Adapter.class) + public enum OperationEnum { + SUBTRACT("SUBTRACT"), + + ADD("ADD"); + + private String value; + + OperationEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OperationEnum fromValue(String value) { + for (OperationEnum b : OperationEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OperationEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OperationEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OperationEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OperationEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_OPERATION = "operation"; + @SerializedName(SERIALIZED_NAME_OPERATION) + @javax.annotation.Nonnull + private OperationEnum operation; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage() { + } + + public AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage operation(@javax.annotation.Nonnull OperationEnum operation) { + this.operation = operation; + return this; + } + + /** + * Get operation + * @return operation + */ + @javax.annotation.Nonnull + public OperationEnum getOperation() { + return operation; + } + + public void setOperation(@javax.annotation.Nonnull OperationEnum operation) { + this.operation = operation; + } + + + public AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage automaticPricingRuleConfigurationChangeByPercentageChangeByPercentage = (AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage) o; + return Objects.equals(this.operation, automaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.operation) && + Objects.equals(this.value, automaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.value); + } + + @Override + public int hashCode() { + return Objects.hash(operation, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage {\n"); + sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("operation"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("operation"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage is not found in the empty JSON string", AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("operation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `operation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("operation").toString())); + } + // validate the required field `operation` + OperationEnum.validateJsonElement(jsonObj.get("operation")); + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage + */ + public static AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage.class); + } + + /** + * Convert an instance of AutomaticPricingRuleConfigurationChangeByPercentageChangeByPercentage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulePostRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulePostRequest.java new file mode 100644 index 0000000..e94f2be --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulePostRequest.java @@ -0,0 +1,289 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfiguration; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AutomaticPricingRulePostRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingRulePostRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private AutomaticPricingRuleType type; + + public static final String SERIALIZED_NAME_CONFIGURATION = "configuration"; + @SerializedName(SERIALIZED_NAME_CONFIGURATION) + @javax.annotation.Nullable + private AutomaticPricingRuleConfiguration _configuration; + + public AutomaticPricingRulePostRequest() { + } + + public AutomaticPricingRulePostRequest name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The rule name. Default rule names are automatically translated based on the value provided in the the \"Accept-Language\" header. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AutomaticPricingRulePostRequest type(@javax.annotation.Nonnull AutomaticPricingRuleType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public AutomaticPricingRuleType getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull AutomaticPricingRuleType type) { + this.type = type; + } + + + public AutomaticPricingRulePostRequest _configuration(@javax.annotation.Nullable AutomaticPricingRuleConfiguration _configuration) { + this._configuration = _configuration; + return this; + } + + /** + * Get _configuration + * @return _configuration + */ + @javax.annotation.Nullable + public AutomaticPricingRuleConfiguration getConfiguration() { + return _configuration; + } + + public void setConfiguration(@javax.annotation.Nullable AutomaticPricingRuleConfiguration _configuration) { + this._configuration = _configuration; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomaticPricingRulePostRequest automaticPricingRulePostRequest = (AutomaticPricingRulePostRequest) o; + return Objects.equals(this.name, automaticPricingRulePostRequest.name) && + Objects.equals(this.type, automaticPricingRulePostRequest.type) && + Objects.equals(this._configuration, automaticPricingRulePostRequest._configuration); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, _configuration); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutomaticPricingRulePostRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("configuration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingRulePostRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutomaticPricingRulePostRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AutomaticPricingRulePostRequest is not found in the empty JSON string", AutomaticPricingRulePostRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutomaticPricingRulePostRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AutomaticPricingRulePostRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AutomaticPricingRulePostRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the required field `type` + AutomaticPricingRuleType.validateJsonElement(jsonObj.get("type")); + // validate the optional field `configuration` + if (jsonObj.get("configuration") != null && !jsonObj.get("configuration").isJsonNull()) { + AutomaticPricingRuleConfiguration.validateJsonElement(jsonObj.get("configuration")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingRulePostRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingRulePostRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingRulePostRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingRulePostRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutomaticPricingRulePostRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutomaticPricingRulePostRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingRulePostRequest + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingRulePostRequest + */ + public static AutomaticPricingRulePostRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingRulePostRequest.class); + } + + /** + * Convert an instance of AutomaticPricingRulePostRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulePutRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulePutRequest.java new file mode 100644 index 0000000..51ce3a7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulePutRequest.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfiguration; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AutomaticPricingRulePutRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingRulePutRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_CONFIGURATION = "configuration"; + @SerializedName(SERIALIZED_NAME_CONFIGURATION) + @javax.annotation.Nullable + private AutomaticPricingRuleConfiguration _configuration; + + public AutomaticPricingRulePutRequest() { + } + + public AutomaticPricingRulePutRequest name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The rule name. Default rule names are automatically translated based on the value provided in the the \"Accept-Language\" header. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AutomaticPricingRulePutRequest _configuration(@javax.annotation.Nullable AutomaticPricingRuleConfiguration _configuration) { + this._configuration = _configuration; + return this; + } + + /** + * Get _configuration + * @return _configuration + */ + @javax.annotation.Nullable + public AutomaticPricingRuleConfiguration getConfiguration() { + return _configuration; + } + + public void setConfiguration(@javax.annotation.Nullable AutomaticPricingRuleConfiguration _configuration) { + this._configuration = _configuration; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomaticPricingRulePutRequest automaticPricingRulePutRequest = (AutomaticPricingRulePutRequest) o; + return Objects.equals(this.name, automaticPricingRulePutRequest.name) && + Objects.equals(this._configuration, automaticPricingRulePutRequest._configuration); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, _configuration); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutomaticPricingRulePutRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("configuration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingRulePutRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutomaticPricingRulePutRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AutomaticPricingRulePutRequest is not found in the empty JSON string", AutomaticPricingRulePutRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutomaticPricingRulePutRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AutomaticPricingRulePutRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AutomaticPricingRulePutRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `configuration` + if (jsonObj.get("configuration") != null && !jsonObj.get("configuration").isJsonNull()) { + AutomaticPricingRuleConfiguration.validateJsonElement(jsonObj.get("configuration")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingRulePutRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingRulePutRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingRulePutRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingRulePutRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutomaticPricingRulePutRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutomaticPricingRulePutRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingRulePutRequest + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingRulePutRequest + */ + public static AutomaticPricingRulePutRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingRulePutRequest.class); + } + + /** + * Convert an instance of AutomaticPricingRulePutRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleResponse.java new file mode 100644 index 0000000..19b33f1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleResponse.java @@ -0,0 +1,377 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleConfiguration; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AutomaticPricingRuleResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingRuleResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private AutomaticPricingRuleType type; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_DEFAULT = "default"; + @SerializedName(SERIALIZED_NAME_DEFAULT) + @javax.annotation.Nonnull + private Boolean _default; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_CONFIGURATION = "configuration"; + @SerializedName(SERIALIZED_NAME_CONFIGURATION) + @javax.annotation.Nullable + private AutomaticPricingRuleConfiguration _configuration; + + public AutomaticPricingRuleResponse() { + } + + public AutomaticPricingRuleResponse id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Identifier of a automatic pricing rule. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public AutomaticPricingRuleResponse type(@javax.annotation.Nonnull AutomaticPricingRuleType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public AutomaticPricingRuleType getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull AutomaticPricingRuleType type) { + this.type = type; + } + + + public AutomaticPricingRuleResponse name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The rule name. Default rule names are automatically translated based on the value provided in the the \"Accept-Language\" header. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public AutomaticPricingRuleResponse _default(@javax.annotation.Nonnull Boolean _default) { + this._default = _default; + return this; + } + + /** + * Indicates whether a rule is default (true) or created by merchant (false). + * @return _default + */ + @javax.annotation.Nonnull + public Boolean getDefault() { + return _default; + } + + public void setDefault(@javax.annotation.Nonnull Boolean _default) { + this._default = _default; + } + + + public AutomaticPricingRuleResponse updatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The date the rule was last modified in ISO 8601 format. + * @return updatedAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public AutomaticPricingRuleResponse _configuration(@javax.annotation.Nullable AutomaticPricingRuleConfiguration _configuration) { + this._configuration = _configuration; + return this; + } + + /** + * Get _configuration + * @return _configuration + */ + @javax.annotation.Nullable + public AutomaticPricingRuleConfiguration getConfiguration() { + return _configuration; + } + + public void setConfiguration(@javax.annotation.Nullable AutomaticPricingRuleConfiguration _configuration) { + this._configuration = _configuration; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomaticPricingRuleResponse automaticPricingRuleResponse = (AutomaticPricingRuleResponse) o; + return Objects.equals(this.id, automaticPricingRuleResponse.id) && + Objects.equals(this.type, automaticPricingRuleResponse.type) && + Objects.equals(this.name, automaticPricingRuleResponse.name) && + Objects.equals(this._default, automaticPricingRuleResponse._default) && + Objects.equals(this.updatedAt, automaticPricingRuleResponse.updatedAt) && + Objects.equals(this._configuration, automaticPricingRuleResponse._configuration); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, name, _default, updatedAt, _configuration); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutomaticPricingRuleResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("name"); + openapiFields.add("default"); + openapiFields.add("updatedAt"); + openapiFields.add("configuration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("default"); + openapiRequiredFields.add("updatedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingRuleResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutomaticPricingRuleResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AutomaticPricingRuleResponse is not found in the empty JSON string", AutomaticPricingRuleResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutomaticPricingRuleResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AutomaticPricingRuleResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AutomaticPricingRuleResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `type` + AutomaticPricingRuleType.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `configuration` + if (jsonObj.get("configuration") != null && !jsonObj.get("configuration").isJsonNull()) { + AutomaticPricingRuleConfiguration.validateJsonElement(jsonObj.get("configuration")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingRuleResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingRuleResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingRuleResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingRuleResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutomaticPricingRuleResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutomaticPricingRuleResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingRuleResponse + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingRuleResponse + */ + public static AutomaticPricingRuleResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingRuleResponse.class); + } + + /** + * Convert an instance of AutomaticPricingRuleResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleType.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleType.java new file mode 100644 index 0000000..0139fe2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRuleType.java @@ -0,0 +1,82 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The rule type. * `EXCHANGE_RATE` - Calculates prices on additional marketplaces using the latest exchange rates and price from the offer base marketplace. <br />Is not available on base marketplace and business marketplaces. <br /><a href=\"https://help.allegro.com/pl/sell/a/jak-dzialaja-reguly-cenowe-typu-przelicznik-cen-LR8WwMKyBf9\" target=\"_blank\">More information about EXCHANGE_RATE type</a>. * `FOLLOW_BY_ALLEGRO_MIN_PRICE` - Calculates prices by following the lowest product price on Allegro for a given marketplace. <br />Is not available on business marketplaces. <br /><a href=\"https://help.allegro.com/pl/sell/a/jak-dzialaja-reguly-cenowe-typu-najnizsza-cena-na-allegro-i-top-oferta-8drjrabe3hE\" target=\"_blank\">More information about FOLLOW_BY_ALLEGRO_MIN_PRICE type</a>. * `FOLLOW_BY_MARKET_MIN_PRICE` - Calculates prices by following the lowest product price on market for a given marketplace. <br />Is not available on business marketplaces. <br /><a href=\"https://help.allegro.com/pl/sell/a/jak-dzialaja-reguly-cenowe-typu-najnizsza-cena-na-allegro-i-top-oferta-8drjrabe3hE\" target=\"_blank\">More information about FOLLOW_BY_MARKET_MIN_PRICE type</a>. * `FOLLOW_BY_TOP_OFFER_PRICE` - Calculates prices by following the top offer price on market for a given marketplace. <br />Is not available on business marketplaces. <br /><a href=\"https://help.allegro.com/pl/sell/a/jak-dzialaja-reguly-cenowe-typu-najnizsza-cena-na-allegro-i-top-oferta-8drjrabe3hE\" target=\"_blank\">More information about FOLLOW_BY_TOP_OFFER_PRICE type</a>. + */ +@JsonAdapter(AutomaticPricingRuleType.Adapter.class) +public enum AutomaticPricingRuleType { + + EXCHANGE_RATE("EXCHANGE_RATE"), + + FOLLOW_BY_ALLEGRO_MIN_PRICE("FOLLOW_BY_ALLEGRO_MIN_PRICE"), + + FOLLOW_BY_MARKET_MIN_PRICE("FOLLOW_BY_MARKET_MIN_PRICE"), + + FOLLOW_BY_TOP_OFFER_PRICE("FOLLOW_BY_TOP_OFFER_PRICE"); + + private String value; + + AutomaticPricingRuleType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AutomaticPricingRuleType fromValue(String value) { + for (AutomaticPricingRuleType b : AutomaticPricingRuleType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AutomaticPricingRuleType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AutomaticPricingRuleType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AutomaticPricingRuleType.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AutomaticPricingRuleType.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulesResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulesResponse.java new file mode 100644 index 0000000..d489c73 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AutomaticPricingRulesResponse.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AutomaticPricingRulesResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AutomaticPricingRulesResponse { + public static final String SERIALIZED_NAME_RULES = "rules"; + @SerializedName(SERIALIZED_NAME_RULES) + @javax.annotation.Nonnull + private List rules = new ArrayList<>(); + + public AutomaticPricingRulesResponse() { + } + + public AutomaticPricingRulesResponse rules(@javax.annotation.Nonnull List rules) { + this.rules = rules; + return this; + } + + public AutomaticPricingRulesResponse addRulesItem(AutomaticPricingRuleResponse rulesItem) { + if (this.rules == null) { + this.rules = new ArrayList<>(); + } + this.rules.add(rulesItem); + return this; + } + + /** + * List of rules. + * @return rules + */ + @javax.annotation.Nonnull + public List getRules() { + return rules; + } + + public void setRules(@javax.annotation.Nonnull List rules) { + this.rules = rules; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AutomaticPricingRulesResponse automaticPricingRulesResponse = (AutomaticPricingRulesResponse) o; + return Objects.equals(this.rules, automaticPricingRulesResponse.rules); + } + + @Override + public int hashCode() { + return Objects.hash(rules); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AutomaticPricingRulesResponse {\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rules"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("rules"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AutomaticPricingRulesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AutomaticPricingRulesResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AutomaticPricingRulesResponse is not found in the empty JSON string", AutomaticPricingRulesResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AutomaticPricingRulesResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AutomaticPricingRulesResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AutomaticPricingRulesResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("rules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rules` to be an array in the JSON string but got `%s`", jsonObj.get("rules").toString())); + } + + JsonArray jsonArrayrules = jsonObj.getAsJsonArray("rules"); + // validate the required field `rules` (array) + for (int i = 0; i < jsonArrayrules.size(); i++) { + AutomaticPricingRuleResponse.validateJsonElement(jsonArrayrules.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AutomaticPricingRulesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AutomaticPricingRulesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AutomaticPricingRulesResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AutomaticPricingRulesResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AutomaticPricingRulesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AutomaticPricingRulesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AutomaticPricingRulesResponse + * @throws IOException if the JSON string is invalid with respect to AutomaticPricingRulesResponse + */ + public static AutomaticPricingRulesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AutomaticPricingRulesResponse.class); + } + + /** + * Convert an instance of AutomaticPricingRulesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AvailableConstraint.java b/src/main/java/pl/wtx/allegro/api/client/model/AvailableConstraint.java new file mode 100644 index 0000000..fd09186 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AvailableConstraint.java @@ -0,0 +1,259 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AvailableConstraint + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AvailableConstraint { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_AVAILABLE_DELIVERY_METHODS = "availableDeliveryMethods"; + @SerializedName(SERIALIZED_NAME_AVAILABLE_DELIVERY_METHODS) + @javax.annotation.Nullable + private List availableDeliveryMethods; + + public AvailableConstraint() { + } + + public AvailableConstraint type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * One of the type COUNTRY_SAME_QUANTITY or COUNTRY_DELIVERY_SAME_QUANTITY + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public AvailableConstraint availableDeliveryMethods(@javax.annotation.Nullable List availableDeliveryMethods) { + this.availableDeliveryMethods = availableDeliveryMethods; + return this; + } + + public AvailableConstraint addAvailableDeliveryMethodsItem(String availableDeliveryMethodsItem) { + if (this.availableDeliveryMethods == null) { + this.availableDeliveryMethods = new ArrayList<>(); + } + this.availableDeliveryMethods.add(availableDeliveryMethodsItem); + return this; + } + + /** + * All delivery methods ids, which are available for given additional service. + * @return availableDeliveryMethods + */ + @javax.annotation.Nullable + public List getAvailableDeliveryMethods() { + return availableDeliveryMethods; + } + + public void setAvailableDeliveryMethods(@javax.annotation.Nullable List availableDeliveryMethods) { + this.availableDeliveryMethods = availableDeliveryMethods; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AvailableConstraint availableConstraint = (AvailableConstraint) o; + return Objects.equals(this.type, availableConstraint.type) && + Objects.equals(this.availableDeliveryMethods, availableConstraint.availableDeliveryMethods); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, availableDeliveryMethods); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AvailableConstraint {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" availableDeliveryMethods: ").append(toIndentedString(availableDeliveryMethods)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("availableDeliveryMethods"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AvailableConstraint + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AvailableConstraint.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AvailableConstraint is not found in the empty JSON string", AvailableConstraint.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AvailableConstraint.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AvailableConstraint` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("availableDeliveryMethods") != null && !jsonObj.get("availableDeliveryMethods").isJsonNull() && !jsonObj.get("availableDeliveryMethods").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `availableDeliveryMethods` to be an array in the JSON string but got `%s`", jsonObj.get("availableDeliveryMethods").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AvailableConstraint.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AvailableConstraint' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AvailableConstraint.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AvailableConstraint value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AvailableConstraint read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AvailableConstraint given an JSON string + * + * @param jsonString JSON string + * @return An instance of AvailableConstraint + * @throws IOException if the JSON string is invalid with respect to AvailableConstraint + */ + public static AvailableConstraint fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AvailableConstraint.class); + } + + /** + * Convert an instance of AvailableConstraint to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AvailableProductResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/AvailableProductResponse.java new file mode 100644 index 0000000..9db0e13 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AvailableProductResponse.java @@ -0,0 +1,308 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The product. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AvailableProductResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_GTINS = "gtins"; + @SerializedName(SERIALIZED_NAME_GTINS) + @javax.annotation.Nullable + private List gtins = new ArrayList<>(); + + public static final String SERIALIZED_NAME_IMAGE = "image"; + @SerializedName(SERIALIZED_NAME_IMAGE) + @javax.annotation.Nullable + private String image; + + public AvailableProductResponse() { + } + + public AvailableProductResponse id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The product identifier. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public AvailableProductResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The product name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public AvailableProductResponse gtins(@javax.annotation.Nullable List gtins) { + this.gtins = gtins; + return this; + } + + public AvailableProductResponse addGtinsItem(String gtinsItem) { + if (this.gtins == null) { + this.gtins = new ArrayList<>(); + } + this.gtins.add(gtinsItem); + return this; + } + + /** + * List of product's GTIN numbers. + * @return gtins + */ + @javax.annotation.Nullable + public List getGtins() { + return gtins; + } + + public void setGtins(@javax.annotation.Nullable List gtins) { + this.gtins = gtins; + } + + + public AvailableProductResponse image(@javax.annotation.Nullable String image) { + this.image = image; + return this; + } + + /** + * The product image. + * @return image + */ + @javax.annotation.Nullable + public String getImage() { + return image; + } + + public void setImage(@javax.annotation.Nullable String image) { + this.image = image; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AvailableProductResponse availableProductResponse = (AvailableProductResponse) o; + return Objects.equals(this.id, availableProductResponse.id) && + Objects.equals(this.name, availableProductResponse.name) && + Objects.equals(this.gtins, availableProductResponse.gtins) && + Objects.equals(this.image, availableProductResponse.image); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, gtins, image); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AvailableProductResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" gtins: ").append(toIndentedString(gtins)).append("\n"); + sb.append(" image: ").append(toIndentedString(image)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("gtins"); + openapiFields.add("image"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AvailableProductResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AvailableProductResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AvailableProductResponse is not found in the empty JSON string", AvailableProductResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AvailableProductResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AvailableProductResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("gtins") != null && !jsonObj.get("gtins").isJsonNull() && !jsonObj.get("gtins").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `gtins` to be an array in the JSON string but got `%s`", jsonObj.get("gtins").toString())); + } + if ((jsonObj.get("image") != null && !jsonObj.get("image").isJsonNull()) && !jsonObj.get("image").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `image` to be a primitive type in the JSON string but got `%s`", jsonObj.get("image").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AvailableProductResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AvailableProductResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AvailableProductResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AvailableProductResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AvailableProductResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AvailableProductResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AvailableProductResponse + * @throws IOException if the JSON string is invalid with respect to AvailableProductResponse + */ + public static AvailableProductResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AvailableProductResponse.class); + } + + /** + * Convert an instance of AvailableProductResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AvailableProductsList.java b/src/main/java/pl/wtx/allegro/api/client/model/AvailableProductsList.java new file mode 100644 index 0000000..1764913 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AvailableProductsList.java @@ -0,0 +1,283 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AvailableProductResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The list of available seller's products. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AvailableProductsList { + public static final String SERIALIZED_NAME_PRODUCTS = "products"; + @SerializedName(SERIALIZED_NAME_PRODUCTS) + @javax.annotation.Nullable + private List products = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private BigDecimal count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private BigDecimal totalCount; + + public AvailableProductsList() { + } + + public AvailableProductsList products(@javax.annotation.Nullable List products) { + this.products = products; + return this; + } + + public AvailableProductsList addProductsItem(AvailableProductResponse productsItem) { + if (this.products == null) { + this.products = new ArrayList<>(); + } + this.products.add(productsItem); + return this; + } + + /** + * List of products. + * @return products + */ + @javax.annotation.Nullable + public List getProducts() { + return products; + } + + public void setProducts(@javax.annotation.Nullable List products) { + this.products = products; + } + + + public AvailableProductsList count(@javax.annotation.Nullable BigDecimal count) { + this.count = count; + return this; + } + + /** + * Number of returned products. + * @return count + */ + @javax.annotation.Nullable + public BigDecimal getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable BigDecimal count) { + this.count = count; + } + + + public AvailableProductsList totalCount(@javax.annotation.Nullable BigDecimal totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of available products. + * @return totalCount + */ + @javax.annotation.Nullable + public BigDecimal getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable BigDecimal totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AvailableProductsList availableProductsList = (AvailableProductsList) o; + return Objects.equals(this.products, availableProductsList.products) && + Objects.equals(this.count, availableProductsList.count) && + Objects.equals(this.totalCount, availableProductsList.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(products, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AvailableProductsList {\n"); + sb.append(" products: ").append(toIndentedString(products)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("products"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AvailableProductsList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AvailableProductsList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AvailableProductsList is not found in the empty JSON string", AvailableProductsList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AvailableProductsList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AvailableProductsList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("products") != null && !jsonObj.get("products").isJsonNull()) { + JsonArray jsonArrayproducts = jsonObj.getAsJsonArray("products"); + if (jsonArrayproducts != null) { + // ensure the json data is an array + if (!jsonObj.get("products").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `products` to be an array in the JSON string but got `%s`", jsonObj.get("products").toString())); + } + + // validate the optional field `products` (array) + for (int i = 0; i < jsonArrayproducts.size(); i++) { + AvailableProductResponse.validateJsonElement(jsonArrayproducts.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AvailableProductsList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AvailableProductsList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AvailableProductsList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AvailableProductsList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AvailableProductsList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AvailableProductsList given an JSON string + * + * @param jsonString JSON string + * @return An instance of AvailableProductsList + * @throws IOException if the JSON string is invalid with respect to AvailableProductsList + */ + public static AvailableProductsList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AvailableProductsList.class); + } + + /** + * Convert an instance of AvailableProductsList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AvailablePromotionPackage.java b/src/main/java/pl/wtx/allegro/api/client/model/AvailablePromotionPackage.java new file mode 100644 index 0000000..2086a83 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AvailablePromotionPackage.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AvailablePromotionPackage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AvailablePromotionPackage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_CYCLE_DURATION = "cycleDuration"; + @SerializedName(SERIALIZED_NAME_CYCLE_DURATION) + @javax.annotation.Nullable + private String cycleDuration; + + public AvailablePromotionPackage() { + } + + public AvailablePromotionPackage id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Promotion package identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public AvailablePromotionPackage name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Promotion package name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public AvailablePromotionPackage cycleDuration(@javax.annotation.Nullable String cycleDuration) { + this.cycleDuration = cycleDuration; + return this; + } + + /** + * Promo package cycle duration. + * @return cycleDuration + */ + @javax.annotation.Nullable + public String getCycleDuration() { + return cycleDuration; + } + + public void setCycleDuration(@javax.annotation.Nullable String cycleDuration) { + this.cycleDuration = cycleDuration; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AvailablePromotionPackage availablePromotionPackage = (AvailablePromotionPackage) o; + return Objects.equals(this.id, availablePromotionPackage.id) && + Objects.equals(this.name, availablePromotionPackage.name) && + Objects.equals(this.cycleDuration, availablePromotionPackage.cycleDuration); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, cycleDuration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AvailablePromotionPackage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" cycleDuration: ").append(toIndentedString(cycleDuration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("cycleDuration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AvailablePromotionPackage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AvailablePromotionPackage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AvailablePromotionPackage is not found in the empty JSON string", AvailablePromotionPackage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AvailablePromotionPackage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AvailablePromotionPackage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("cycleDuration") != null && !jsonObj.get("cycleDuration").isJsonNull()) && !jsonObj.get("cycleDuration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cycleDuration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cycleDuration").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AvailablePromotionPackage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AvailablePromotionPackage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AvailablePromotionPackage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AvailablePromotionPackage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AvailablePromotionPackage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AvailablePromotionPackage given an JSON string + * + * @param jsonString JSON string + * @return An instance of AvailablePromotionPackage + * @throws IOException if the JSON string is invalid with respect to AvailablePromotionPackage + */ + public static AvailablePromotionPackage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AvailablePromotionPackage.class); + } + + /** + * Convert an instance of AvailablePromotionPackage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AvailablePromotionPackages.java b/src/main/java/pl/wtx/allegro/api/client/model/AvailablePromotionPackages.java new file mode 100644 index 0000000..e4cef05 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AvailablePromotionPackages.java @@ -0,0 +1,357 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AvailablePromotionPackage; +import pl.wtx.allegro.api.client.model.MarketplaceAvailablePromotionPackages; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * AvailablePromotionPackages + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AvailablePromotionPackages { + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + public static final String SERIALIZED_NAME_BASE_PACKAGES = "basePackages"; + @SerializedName(SERIALIZED_NAME_BASE_PACKAGES) + @javax.annotation.Nullable + private List basePackages = new ArrayList<>(); + + public static final String SERIALIZED_NAME_EXTRA_PACKAGES = "extraPackages"; + @SerializedName(SERIALIZED_NAME_EXTRA_PACKAGES) + @javax.annotation.Nullable + private List extraPackages = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private List additionalMarketplaces = new ArrayList<>(); + + public AvailablePromotionPackages() { + } + + public AvailablePromotionPackages marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * Get marketplaceId + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + public AvailablePromotionPackages basePackages(@javax.annotation.Nullable List basePackages) { + this.basePackages = basePackages; + return this; + } + + public AvailablePromotionPackages addBasePackagesItem(AvailablePromotionPackage basePackagesItem) { + if (this.basePackages == null) { + this.basePackages = new ArrayList<>(); + } + this.basePackages.add(basePackagesItem); + return this; + } + + /** + * Available base promotion packages. Only one base package can be set on an offer. + * @return basePackages + */ + @javax.annotation.Nullable + public List getBasePackages() { + return basePackages; + } + + public void setBasePackages(@javax.annotation.Nullable List basePackages) { + this.basePackages = basePackages; + } + + + public AvailablePromotionPackages extraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + return this; + } + + public AvailablePromotionPackages addExtraPackagesItem(AvailablePromotionPackage extraPackagesItem) { + if (this.extraPackages == null) { + this.extraPackages = new ArrayList<>(); + } + this.extraPackages.add(extraPackagesItem); + return this; + } + + /** + * Available extra promotion packages. Multiple different extra packages can be set on an offer. + * @return extraPackages + */ + @javax.annotation.Nullable + public List getExtraPackages() { + return extraPackages; + } + + public void setExtraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + } + + + public AvailablePromotionPackages additionalMarketplaces(@javax.annotation.Nullable List additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public AvailablePromotionPackages addAdditionalMarketplacesItem(MarketplaceAvailablePromotionPackages additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new ArrayList<>(); + } + this.additionalMarketplaces.add(additionalMarketplacesItem); + return this; + } + + /** + * Available promotion packages on additional marketplaces. + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public List getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable List additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AvailablePromotionPackages availablePromotionPackages = (AvailablePromotionPackages) o; + return Objects.equals(this.marketplaceId, availablePromotionPackages.marketplaceId) && + Objects.equals(this.basePackages, availablePromotionPackages.basePackages) && + Objects.equals(this.extraPackages, availablePromotionPackages.extraPackages) && + Objects.equals(this.additionalMarketplaces, availablePromotionPackages.additionalMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(marketplaceId, basePackages, extraPackages, additionalMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AvailablePromotionPackages {\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append(" basePackages: ").append(toIndentedString(basePackages)).append("\n"); + sb.append(" extraPackages: ").append(toIndentedString(extraPackages)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplaceId"); + openapiFields.add("basePackages"); + openapiFields.add("extraPackages"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AvailablePromotionPackages + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AvailablePromotionPackages.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AvailablePromotionPackages is not found in the empty JSON string", AvailablePromotionPackages.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AvailablePromotionPackages.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AvailablePromotionPackages` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("marketplaceId") != null && !jsonObj.get("marketplaceId").isJsonNull()) && !jsonObj.get("marketplaceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("marketplaceId").toString())); + } + if (jsonObj.get("basePackages") != null && !jsonObj.get("basePackages").isJsonNull()) { + JsonArray jsonArraybasePackages = jsonObj.getAsJsonArray("basePackages"); + if (jsonArraybasePackages != null) { + // ensure the json data is an array + if (!jsonObj.get("basePackages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `basePackages` to be an array in the JSON string but got `%s`", jsonObj.get("basePackages").toString())); + } + + // validate the optional field `basePackages` (array) + for (int i = 0; i < jsonArraybasePackages.size(); i++) { + AvailablePromotionPackage.validateJsonElement(jsonArraybasePackages.get(i)); + }; + } + } + if (jsonObj.get("extraPackages") != null && !jsonObj.get("extraPackages").isJsonNull()) { + JsonArray jsonArrayextraPackages = jsonObj.getAsJsonArray("extraPackages"); + if (jsonArrayextraPackages != null) { + // ensure the json data is an array + if (!jsonObj.get("extraPackages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `extraPackages` to be an array in the JSON string but got `%s`", jsonObj.get("extraPackages").toString())); + } + + // validate the optional field `extraPackages` (array) + for (int i = 0; i < jsonArrayextraPackages.size(); i++) { + AvailablePromotionPackage.validateJsonElement(jsonArrayextraPackages.get(i)); + }; + } + } + if (jsonObj.get("additionalMarketplaces") != null && !jsonObj.get("additionalMarketplaces").isJsonNull()) { + JsonArray jsonArrayadditionalMarketplaces = jsonObj.getAsJsonArray("additionalMarketplaces"); + if (jsonArrayadditionalMarketplaces != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalMarketplaces").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalMarketplaces` to be an array in the JSON string but got `%s`", jsonObj.get("additionalMarketplaces").toString())); + } + + // validate the optional field `additionalMarketplaces` (array) + for (int i = 0; i < jsonArrayadditionalMarketplaces.size(); i++) { + MarketplaceAvailablePromotionPackages.validateJsonElement(jsonArrayadditionalMarketplaces.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AvailablePromotionPackages.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AvailablePromotionPackages' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AvailablePromotionPackages.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AvailablePromotionPackages value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AvailablePromotionPackages read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AvailablePromotionPackages given an JSON string + * + * @param jsonString JSON string + * @return An instance of AvailablePromotionPackages + * @throws IOException if the JSON string is invalid with respect to AvailablePromotionPackages + */ + public static AvailablePromotionPackages fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AvailablePromotionPackages.class); + } + + /** + * Convert an instance of AvailablePromotionPackages to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/AverageRates.java b/src/main/java/pl/wtx/allegro/api/client/model/AverageRates.java new file mode 100644 index 0000000..ca7efa9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/AverageRates.java @@ -0,0 +1,292 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The rates broken down into detailed categories. Note that this information is only available if the seller has received enough detailed ratings. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class AverageRates { + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private Double delivery; + + public static final String SERIALIZED_NAME_DELIVERY_COST = "deliveryCost"; + @SerializedName(SERIALIZED_NAME_DELIVERY_COST) + @javax.annotation.Nullable + private Double deliveryCost; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private Double description; + + public static final String SERIALIZED_NAME_SERVICE = "service"; + @SerializedName(SERIALIZED_NAME_SERVICE) + @javax.annotation.Nullable + private Double service; + + public AverageRates() { + } + + public AverageRates delivery(@javax.annotation.Nullable Double delivery) { + this.delivery = delivery; + return this; + } + + /** + * The average value of delivery rate. + * minimum: 0 + * maximum: 5 + * @return delivery + */ + @javax.annotation.Nullable + public Double getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable Double delivery) { + this.delivery = delivery; + } + + + public AverageRates deliveryCost(@javax.annotation.Nullable Double deliveryCost) { + this.deliveryCost = deliveryCost; + return this; + } + + /** + * The average value of delivery cost rate. + * minimum: 0 + * maximum: 5 + * @return deliveryCost + */ + @javax.annotation.Nullable + public Double getDeliveryCost() { + return deliveryCost; + } + + public void setDeliveryCost(@javax.annotation.Nullable Double deliveryCost) { + this.deliveryCost = deliveryCost; + } + + + public AverageRates description(@javax.annotation.Nullable Double description) { + this.description = description; + return this; + } + + /** + * The average value of description rate. + * minimum: 0 + * maximum: 5 + * @return description + */ + @javax.annotation.Nullable + public Double getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable Double description) { + this.description = description; + } + + + public AverageRates service(@javax.annotation.Nullable Double service) { + this.service = service; + return this; + } + + /** + * The average value of service rate. + * minimum: 0 + * maximum: 5 + * @return service + */ + @javax.annotation.Nullable + public Double getService() { + return service; + } + + public void setService(@javax.annotation.Nullable Double service) { + this.service = service; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AverageRates averageRates = (AverageRates) o; + return Objects.equals(this.delivery, averageRates.delivery) && + Objects.equals(this.deliveryCost, averageRates.deliveryCost) && + Objects.equals(this.description, averageRates.description) && + Objects.equals(this.service, averageRates.service); + } + + @Override + public int hashCode() { + return Objects.hash(delivery, deliveryCost, description, service); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AverageRates {\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" deliveryCost: ").append(toIndentedString(deliveryCost)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("delivery"); + openapiFields.add("deliveryCost"); + openapiFields.add("description"); + openapiFields.add("service"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AverageRates + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AverageRates.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AverageRates is not found in the empty JSON string", AverageRates.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AverageRates.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AverageRates` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AverageRates.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AverageRates' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AverageRates.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AverageRates value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AverageRates read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AverageRates given an JSON string + * + * @param jsonString JSON string + * @return An instance of AverageRates + * @throws IOException if the JSON string is invalid with respect to AverageRates + */ + public static AverageRates fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AverageRates.class); + } + + /** + * Convert an instance of AverageRates to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/B2b.java b/src/main/java/pl/wtx/allegro/api/client/model/B2b.java new file mode 100644 index 0000000..c43f0c1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/B2b.java @@ -0,0 +1,203 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Defines offer properties for buyers with company account (Allegro Biznes). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class B2b { + public static final String SERIALIZED_NAME_BUYABLE_ONLY_BY_BUSINESS = "buyableOnlyByBusiness"; + @SerializedName(SERIALIZED_NAME_BUYABLE_ONLY_BY_BUSINESS) + @javax.annotation.Nullable + private Boolean buyableOnlyByBusiness; + + public B2b() { + } + + public B2b buyableOnlyByBusiness(@javax.annotation.Nullable Boolean buyableOnlyByBusiness) { + this.buyableOnlyByBusiness = buyableOnlyByBusiness; + return this; + } + + /** + * If true, then only users with company account are eligible to buy given offer. Offers buyable only by business are allowed only in selected categories. False by default. + * @return buyableOnlyByBusiness + */ + @javax.annotation.Nullable + public Boolean getBuyableOnlyByBusiness() { + return buyableOnlyByBusiness; + } + + public void setBuyableOnlyByBusiness(@javax.annotation.Nullable Boolean buyableOnlyByBusiness) { + this.buyableOnlyByBusiness = buyableOnlyByBusiness; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + B2b b2b = (B2b) o; + return Objects.equals(this.buyableOnlyByBusiness, b2b.buyableOnlyByBusiness); + } + + @Override + public int hashCode() { + return Objects.hash(buyableOnlyByBusiness); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class B2b {\n"); + sb.append(" buyableOnlyByBusiness: ").append(toIndentedString(buyableOnlyByBusiness)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("buyableOnlyByBusiness"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to B2b + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!B2b.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in B2b is not found in the empty JSON string", B2b.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!B2b.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `B2b` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!B2b.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'B2b' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(B2b.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, B2b value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public B2b read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of B2b given an JSON string + * + * @param jsonString JSON string + * @return An instance of B2b + * @throws IOException if the JSON string is invalid with respect to B2b + */ + public static B2b fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, B2b.class); + } + + /** + * Convert an instance of B2b to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Badge.java b/src/main/java/pl/wtx/allegro/api/client/model/Badge.java new file mode 100644 index 0000000..7fd15af --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Badge.java @@ -0,0 +1,352 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.BadgeApplicationOffer; +import pl.wtx.allegro.api.client.model.BadgePrices; +import pl.wtx.allegro.api.client.model.BadgeProcess; +import pl.wtx.allegro.api.client.model.BadgePublicationTimePolicy; +import pl.wtx.allegro.api.client.model.OfferBadgeCampaign; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Badge + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Badge { + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private BadgeApplicationOffer offer; + + public static final String SERIALIZED_NAME_CAMPAIGN = "campaign"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN) + @javax.annotation.Nonnull + private OfferBadgeCampaign campaign; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private BadgePublicationTimePolicy publication; + + public static final String SERIALIZED_NAME_PRICES = "prices"; + @SerializedName(SERIALIZED_NAME_PRICES) + @javax.annotation.Nullable + private BadgePrices prices; + + public static final String SERIALIZED_NAME_PROCESS = "process"; + @SerializedName(SERIALIZED_NAME_PROCESS) + @javax.annotation.Nonnull + private BadgeProcess process; + + public Badge() { + } + + public Badge offer(@javax.annotation.Nonnull BadgeApplicationOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public BadgeApplicationOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull BadgeApplicationOffer offer) { + this.offer = offer; + } + + + public Badge campaign(@javax.annotation.Nonnull OfferBadgeCampaign campaign) { + this.campaign = campaign; + return this; + } + + /** + * Get campaign + * @return campaign + */ + @javax.annotation.Nonnull + public OfferBadgeCampaign getCampaign() { + return campaign; + } + + public void setCampaign(@javax.annotation.Nonnull OfferBadgeCampaign campaign) { + this.campaign = campaign; + } + + + public Badge publication(@javax.annotation.Nullable BadgePublicationTimePolicy publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public BadgePublicationTimePolicy getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable BadgePublicationTimePolicy publication) { + this.publication = publication; + } + + + public Badge prices(@javax.annotation.Nullable BadgePrices prices) { + this.prices = prices; + return this; + } + + /** + * Get prices + * @return prices + */ + @javax.annotation.Nullable + public BadgePrices getPrices() { + return prices; + } + + public void setPrices(@javax.annotation.Nullable BadgePrices prices) { + this.prices = prices; + } + + + public Badge process(@javax.annotation.Nonnull BadgeProcess process) { + this.process = process; + return this; + } + + /** + * Get process + * @return process + */ + @javax.annotation.Nonnull + public BadgeProcess getProcess() { + return process; + } + + public void setProcess(@javax.annotation.Nonnull BadgeProcess process) { + this.process = process; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Badge badge = (Badge) o; + return Objects.equals(this.offer, badge.offer) && + Objects.equals(this.campaign, badge.campaign) && + Objects.equals(this.publication, badge.publication) && + Objects.equals(this.prices, badge.prices) && + Objects.equals(this.process, badge.process); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(offer, campaign, publication, prices, process); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Badge {\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" campaign: ").append(toIndentedString(campaign)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" prices: ").append(toIndentedString(prices)).append("\n"); + sb.append(" process: ").append(toIndentedString(process)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offer"); + openapiFields.add("campaign"); + openapiFields.add("publication"); + openapiFields.add("prices"); + openapiFields.add("process"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("campaign"); + openapiRequiredFields.add("process"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Badge + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Badge.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Badge is not found in the empty JSON string", Badge.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Badge.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Badge` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Badge.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `offer` + BadgeApplicationOffer.validateJsonElement(jsonObj.get("offer")); + // validate the required field `campaign` + OfferBadgeCampaign.validateJsonElement(jsonObj.get("campaign")); + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + BadgePublicationTimePolicy.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `prices` + if (jsonObj.get("prices") != null && !jsonObj.get("prices").isJsonNull()) { + BadgePrices.validateJsonElement(jsonObj.get("prices")); + } + // validate the required field `process` + BadgeProcess.validateJsonElement(jsonObj.get("process")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Badge.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Badge' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Badge.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Badge value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Badge read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Badge given an JSON string + * + * @param jsonString JSON string + * @return An instance of Badge + * @throws IOException if the JSON string is invalid with respect to Badge + */ + public static Badge fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Badge.class); + } + + /** + * Convert an instance of Badge to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplication.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplication.java new file mode 100644 index 0000000..0ae0d54 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplication.java @@ -0,0 +1,445 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.BadgeApplicationCampaign; +import pl.wtx.allegro.api.client.model.BadgeApplicationOffer; +import pl.wtx.allegro.api.client.model.BadgeApplicationPrices; +import pl.wtx.allegro.api.client.model.BadgeApplicationProcess; +import pl.wtx.allegro.api.client.model.BadgeApplicationPurchaseConstraints; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgeApplication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplication { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private String createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nonnull + private String updatedAt; + + public static final String SERIALIZED_NAME_CAMPAIGN = "campaign"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN) + @javax.annotation.Nonnull + private BadgeApplicationCampaign campaign; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private BadgeApplicationOffer offer; + + public static final String SERIALIZED_NAME_PRICES = "prices"; + @SerializedName(SERIALIZED_NAME_PRICES) + @javax.annotation.Nullable + private BadgeApplicationPrices prices; + + public static final String SERIALIZED_NAME_PROCESS = "process"; + @SerializedName(SERIALIZED_NAME_PROCESS) + @javax.annotation.Nonnull + private BadgeApplicationProcess process; + + public static final String SERIALIZED_NAME_PURCHASE_CONSTRAINTS = "purchaseConstraints"; + @SerializedName(SERIALIZED_NAME_PURCHASE_CONSTRAINTS) + @javax.annotation.Nullable + private BadgeApplicationPurchaseConstraints purchaseConstraints; + + public BadgeApplication() { + } + + public BadgeApplication id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Badge application ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public BadgeApplication createdAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + } + + + public BadgeApplication updatedAt(@javax.annotation.Nonnull String updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return updatedAt + */ + @javax.annotation.Nonnull + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nonnull String updatedAt) { + this.updatedAt = updatedAt; + } + + + public BadgeApplication campaign(@javax.annotation.Nonnull BadgeApplicationCampaign campaign) { + this.campaign = campaign; + return this; + } + + /** + * Get campaign + * @return campaign + */ + @javax.annotation.Nonnull + public BadgeApplicationCampaign getCampaign() { + return campaign; + } + + public void setCampaign(@javax.annotation.Nonnull BadgeApplicationCampaign campaign) { + this.campaign = campaign; + } + + + public BadgeApplication offer(@javax.annotation.Nonnull BadgeApplicationOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public BadgeApplicationOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull BadgeApplicationOffer offer) { + this.offer = offer; + } + + + public BadgeApplication prices(@javax.annotation.Nullable BadgeApplicationPrices prices) { + this.prices = prices; + return this; + } + + /** + * Get prices + * @return prices + */ + @javax.annotation.Nullable + public BadgeApplicationPrices getPrices() { + return prices; + } + + public void setPrices(@javax.annotation.Nullable BadgeApplicationPrices prices) { + this.prices = prices; + } + + + public BadgeApplication process(@javax.annotation.Nonnull BadgeApplicationProcess process) { + this.process = process; + return this; + } + + /** + * Get process + * @return process + */ + @javax.annotation.Nonnull + public BadgeApplicationProcess getProcess() { + return process; + } + + public void setProcess(@javax.annotation.Nonnull BadgeApplicationProcess process) { + this.process = process; + } + + + public BadgeApplication purchaseConstraints(@javax.annotation.Nullable BadgeApplicationPurchaseConstraints purchaseConstraints) { + this.purchaseConstraints = purchaseConstraints; + return this; + } + + /** + * Get purchaseConstraints + * @return purchaseConstraints + */ + @javax.annotation.Nullable + public BadgeApplicationPurchaseConstraints getPurchaseConstraints() { + return purchaseConstraints; + } + + public void setPurchaseConstraints(@javax.annotation.Nullable BadgeApplicationPurchaseConstraints purchaseConstraints) { + this.purchaseConstraints = purchaseConstraints; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplication badgeApplication = (BadgeApplication) o; + return Objects.equals(this.id, badgeApplication.id) && + Objects.equals(this.createdAt, badgeApplication.createdAt) && + Objects.equals(this.updatedAt, badgeApplication.updatedAt) && + Objects.equals(this.campaign, badgeApplication.campaign) && + Objects.equals(this.offer, badgeApplication.offer) && + Objects.equals(this.prices, badgeApplication.prices) && + Objects.equals(this.process, badgeApplication.process) && + Objects.equals(this.purchaseConstraints, badgeApplication.purchaseConstraints); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, createdAt, updatedAt, campaign, offer, prices, process, purchaseConstraints); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplication {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" campaign: ").append(toIndentedString(campaign)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" prices: ").append(toIndentedString(prices)).append("\n"); + sb.append(" process: ").append(toIndentedString(process)).append("\n"); + sb.append(" purchaseConstraints: ").append(toIndentedString(purchaseConstraints)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("campaign"); + openapiFields.add("offer"); + openapiFields.add("prices"); + openapiFields.add("process"); + openapiFields.add("purchaseConstraints"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + openapiRequiredFields.add("campaign"); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("process"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplication is not found in the empty JSON string", BadgeApplication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeApplication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); + } + if (!jsonObj.get("updatedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `updatedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedAt").toString())); + } + // validate the required field `campaign` + BadgeApplicationCampaign.validateJsonElement(jsonObj.get("campaign")); + // validate the required field `offer` + BadgeApplicationOffer.validateJsonElement(jsonObj.get("offer")); + // validate the optional field `prices` + if (jsonObj.get("prices") != null && !jsonObj.get("prices").isJsonNull()) { + BadgeApplicationPrices.validateJsonElement(jsonObj.get("prices")); + } + // validate the required field `process` + BadgeApplicationProcess.validateJsonElement(jsonObj.get("process")); + // validate the optional field `purchaseConstraints` + if (jsonObj.get("purchaseConstraints") != null && !jsonObj.get("purchaseConstraints").isJsonNull()) { + BadgeApplicationPurchaseConstraints.validateJsonElement(jsonObj.get("purchaseConstraints")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplication given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplication + * @throws IOException if the JSON string is invalid with respect to BadgeApplication + */ + public static BadgeApplication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplication.class); + } + + /** + * Convert an instance of BadgeApplication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationBargainPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationBargainPrice.java new file mode 100644 index 0000000..c223191 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationBargainPrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Bargain price. Required by DISCOUNT and SOURCING campaign. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationBargainPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public BadgeApplicationBargainPrice() { + } + + public BadgeApplicationBargainPrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Value must be greater than minimal, decimal places aligned with market rules. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public BadgeApplicationBargainPrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). Only base currency for a given marketplace is supported, example: PLN for allegro-pl, CZK for allegro-cz, EUR for allegro-sk. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationBargainPrice badgeApplicationBargainPrice = (BadgeApplicationBargainPrice) o; + return Objects.equals(this.amount, badgeApplicationBargainPrice.amount) && + Objects.equals(this.currency, badgeApplicationBargainPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationBargainPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationBargainPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationBargainPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationBargainPrice is not found in the empty JSON string", BadgeApplicationBargainPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationBargainPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationBargainPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationBargainPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationBargainPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationBargainPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationBargainPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationBargainPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationBargainPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationBargainPrice + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationBargainPrice + */ + public static BadgeApplicationBargainPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationBargainPrice.class); + } + + /** + * Convert an instance of BadgeApplicationBargainPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationCampaign.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationCampaign.java new file mode 100644 index 0000000..2981b6a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationCampaign.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgeApplicationCampaign + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationCampaign { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public BadgeApplicationCampaign() { + } + + public BadgeApplicationCampaign id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Badge campaign ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationCampaign badgeApplicationCampaign = (BadgeApplicationCampaign) o; + return Objects.equals(this.id, badgeApplicationCampaign.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationCampaign {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationCampaign + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationCampaign.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationCampaign is not found in the empty JSON string", BadgeApplicationCampaign.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationCampaign.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationCampaign` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeApplicationCampaign.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationCampaign.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationCampaign' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationCampaign.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationCampaign value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationCampaign read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationCampaign given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationCampaign + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationCampaign + */ + public static BadgeApplicationCampaign fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationCampaign.class); + } + + /** + * Convert an instance of BadgeApplicationCampaign to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationOffer.java new file mode 100644 index 0000000..75e24ca --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationOffer.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgeApplicationOffer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public BadgeApplicationOffer() { + } + + public BadgeApplicationOffer id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Offer ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationOffer badgeApplicationOffer = (BadgeApplicationOffer) o; + return Objects.equals(this.id, badgeApplicationOffer.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationOffer is not found in the empty JSON string", BadgeApplicationOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeApplicationOffer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationOffer + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationOffer + */ + public static BadgeApplicationOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationOffer.class); + } + + /** + * Convert an instance of BadgeApplicationOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPrices.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPrices.java new file mode 100644 index 0000000..e334de0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPrices.java @@ -0,0 +1,220 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.BadgeApplicationBargainPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Required by DISCOUNT and SOURCING campaign. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationPrices { + public static final String SERIALIZED_NAME_BARGAIN = "bargain"; + @SerializedName(SERIALIZED_NAME_BARGAIN) + @javax.annotation.Nullable + private BadgeApplicationBargainPrice bargain; + + public BadgeApplicationPrices() { + } + + public BadgeApplicationPrices bargain(@javax.annotation.Nullable BadgeApplicationBargainPrice bargain) { + this.bargain = bargain; + return this; + } + + /** + * Get bargain + * @return bargain + */ + @javax.annotation.Nullable + public BadgeApplicationBargainPrice getBargain() { + return bargain; + } + + public void setBargain(@javax.annotation.Nullable BadgeApplicationBargainPrice bargain) { + this.bargain = bargain; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationPrices badgeApplicationPrices = (BadgeApplicationPrices) o; + return Objects.equals(this.bargain, badgeApplicationPrices.bargain); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(bargain); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationPrices {\n"); + sb.append(" bargain: ").append(toIndentedString(bargain)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("bargain"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationPrices + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationPrices.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationPrices is not found in the empty JSON string", BadgeApplicationPrices.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationPrices.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationPrices` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `bargain` + if (jsonObj.get("bargain") != null && !jsonObj.get("bargain").isJsonNull()) { + BadgeApplicationBargainPrice.validateJsonElement(jsonObj.get("bargain")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationPrices.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationPrices' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationPrices.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationPrices value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationPrices read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationPrices given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationPrices + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationPrices + */ + public static BadgeApplicationPrices fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationPrices.class); + } + + /** + * Convert an instance of BadgeApplicationPrices to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationProcess.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationProcess.java new file mode 100644 index 0000000..d34f8c3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationProcess.java @@ -0,0 +1,319 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BadgeApplicationRejectionReason; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about processing of the application. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationProcess { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + REQUESTED("REQUESTED"), + + PROCESSED("PROCESSED"), + + DECLINED("DECLINED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public static final String SERIALIZED_NAME_REJECTION_REASONS = "rejectionReasons"; + @SerializedName(SERIALIZED_NAME_REJECTION_REASONS) + @javax.annotation.Nonnull + private List rejectionReasons = new ArrayList<>(); + + public BadgeApplicationProcess() { + } + + public BadgeApplicationProcess status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + public BadgeApplicationProcess rejectionReasons(@javax.annotation.Nonnull List rejectionReasons) { + this.rejectionReasons = rejectionReasons; + return this; + } + + public BadgeApplicationProcess addRejectionReasonsItem(BadgeApplicationRejectionReason rejectionReasonsItem) { + if (this.rejectionReasons == null) { + this.rejectionReasons = new ArrayList<>(); + } + this.rejectionReasons.add(rejectionReasonsItem); + return this; + } + + /** + * A list of rejection reasons for the badge application. Returned for process.status = DECLINED only. + * @return rejectionReasons + */ + @javax.annotation.Nonnull + public List getRejectionReasons() { + return rejectionReasons; + } + + public void setRejectionReasons(@javax.annotation.Nonnull List rejectionReasons) { + this.rejectionReasons = rejectionReasons; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationProcess badgeApplicationProcess = (BadgeApplicationProcess) o; + return Objects.equals(this.status, badgeApplicationProcess.status) && + Objects.equals(this.rejectionReasons, badgeApplicationProcess.rejectionReasons); + } + + @Override + public int hashCode() { + return Objects.hash(status, rejectionReasons); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationProcess {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" rejectionReasons: ").append(toIndentedString(rejectionReasons)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("rejectionReasons"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("rejectionReasons"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationProcess + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationProcess.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationProcess is not found in the empty JSON string", BadgeApplicationProcess.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationProcess.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationProcess` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeApplicationProcess.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + // ensure the json data is an array + if (!jsonObj.get("rejectionReasons").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rejectionReasons` to be an array in the JSON string but got `%s`", jsonObj.get("rejectionReasons").toString())); + } + + JsonArray jsonArrayrejectionReasons = jsonObj.getAsJsonArray("rejectionReasons"); + // validate the required field `rejectionReasons` (array) + for (int i = 0; i < jsonArrayrejectionReasons.size(); i++) { + BadgeApplicationRejectionReason.validateJsonElement(jsonArrayrejectionReasons.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationProcess.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationProcess' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationProcess.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationProcess value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationProcess read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationProcess given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationProcess + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationProcess + */ + public static BadgeApplicationProcess fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationProcess.class); + } + + /** + * Convert an instance of BadgeApplicationProcess to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraints.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraints.java new file mode 100644 index 0000000..cc8f542 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraints.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BadgeApplicationPurchaseConstraintsLimit; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Constraints of purchase of this offer while it participates in the campaign. Optional for all campaigns types. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationPurchaseConstraints { + public static final String SERIALIZED_NAME_LIMIT = "limit"; + @SerializedName(SERIALIZED_NAME_LIMIT) + @javax.annotation.Nullable + private BadgeApplicationPurchaseConstraintsLimit limit; + + public BadgeApplicationPurchaseConstraints() { + } + + public BadgeApplicationPurchaseConstraints limit(@javax.annotation.Nullable BadgeApplicationPurchaseConstraintsLimit limit) { + this.limit = limit; + return this; + } + + /** + * Get limit + * @return limit + */ + @javax.annotation.Nullable + public BadgeApplicationPurchaseConstraintsLimit getLimit() { + return limit; + } + + public void setLimit(@javax.annotation.Nullable BadgeApplicationPurchaseConstraintsLimit limit) { + this.limit = limit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationPurchaseConstraints badgeApplicationPurchaseConstraints = (BadgeApplicationPurchaseConstraints) o; + return Objects.equals(this.limit, badgeApplicationPurchaseConstraints.limit); + } + + @Override + public int hashCode() { + return Objects.hash(limit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationPurchaseConstraints {\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("limit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationPurchaseConstraints + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationPurchaseConstraints.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationPurchaseConstraints is not found in the empty JSON string", BadgeApplicationPurchaseConstraints.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationPurchaseConstraints.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationPurchaseConstraints` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `limit` + if (jsonObj.get("limit") != null && !jsonObj.get("limit").isJsonNull()) { + BadgeApplicationPurchaseConstraintsLimit.validateJsonElement(jsonObj.get("limit")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationPurchaseConstraints.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationPurchaseConstraints' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationPurchaseConstraints.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationPurchaseConstraints value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationPurchaseConstraints read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationPurchaseConstraints given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationPurchaseConstraints + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationPurchaseConstraints + */ + public static BadgeApplicationPurchaseConstraints fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationPurchaseConstraints.class); + } + + /** + * Convert an instance of BadgeApplicationPurchaseConstraints to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraintsLimit.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraintsLimit.java new file mode 100644 index 0000000..a7650ee --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraintsLimit.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BadgeApplicationPurchaseConstraintsLimitPerUser; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Limits of purchase of this offer while it participates in the campaign. Only DISCOUNT and SOURCING campaigns. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationPurchaseConstraintsLimit { + public static final String SERIALIZED_NAME_PER_USER = "perUser"; + @SerializedName(SERIALIZED_NAME_PER_USER) + @javax.annotation.Nullable + private BadgeApplicationPurchaseConstraintsLimitPerUser perUser; + + public BadgeApplicationPurchaseConstraintsLimit() { + } + + public BadgeApplicationPurchaseConstraintsLimit perUser(@javax.annotation.Nullable BadgeApplicationPurchaseConstraintsLimitPerUser perUser) { + this.perUser = perUser; + return this; + } + + /** + * Get perUser + * @return perUser + */ + @javax.annotation.Nullable + public BadgeApplicationPurchaseConstraintsLimitPerUser getPerUser() { + return perUser; + } + + public void setPerUser(@javax.annotation.Nullable BadgeApplicationPurchaseConstraintsLimitPerUser perUser) { + this.perUser = perUser; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationPurchaseConstraintsLimit badgeApplicationPurchaseConstraintsLimit = (BadgeApplicationPurchaseConstraintsLimit) o; + return Objects.equals(this.perUser, badgeApplicationPurchaseConstraintsLimit.perUser); + } + + @Override + public int hashCode() { + return Objects.hash(perUser); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationPurchaseConstraintsLimit {\n"); + sb.append(" perUser: ").append(toIndentedString(perUser)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("perUser"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationPurchaseConstraintsLimit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationPurchaseConstraintsLimit.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationPurchaseConstraintsLimit is not found in the empty JSON string", BadgeApplicationPurchaseConstraintsLimit.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationPurchaseConstraintsLimit.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationPurchaseConstraintsLimit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `perUser` + if (jsonObj.get("perUser") != null && !jsonObj.get("perUser").isJsonNull()) { + BadgeApplicationPurchaseConstraintsLimitPerUser.validateJsonElement(jsonObj.get("perUser")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationPurchaseConstraintsLimit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationPurchaseConstraintsLimit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationPurchaseConstraintsLimit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationPurchaseConstraintsLimit value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationPurchaseConstraintsLimit read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationPurchaseConstraintsLimit given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationPurchaseConstraintsLimit + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationPurchaseConstraintsLimit + */ + public static BadgeApplicationPurchaseConstraintsLimit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationPurchaseConstraintsLimit.class); + } + + /** + * Convert an instance of BadgeApplicationPurchaseConstraintsLimit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraintsLimitPerUser.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraintsLimitPerUser.java new file mode 100644 index 0000000..ce91bdc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationPurchaseConstraintsLimitPerUser.java @@ -0,0 +1,204 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Limits of purchase of this offer per user while it participates in the campaign. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationPurchaseConstraintsLimitPerUser { + public static final String SERIALIZED_NAME_MAX_ITEMS = "maxItems"; + @SerializedName(SERIALIZED_NAME_MAX_ITEMS) + @javax.annotation.Nullable + private Integer maxItems; + + public BadgeApplicationPurchaseConstraintsLimitPerUser() { + } + + public BadgeApplicationPurchaseConstraintsLimitPerUser maxItems(@javax.annotation.Nullable Integer maxItems) { + this.maxItems = maxItems; + return this; + } + + /** + * Maximum number of items that one user can buy of this offer, while it participates in the campaign. + * minimum: 1 + * @return maxItems + */ + @javax.annotation.Nullable + public Integer getMaxItems() { + return maxItems; + } + + public void setMaxItems(@javax.annotation.Nullable Integer maxItems) { + this.maxItems = maxItems; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationPurchaseConstraintsLimitPerUser badgeApplicationPurchaseConstraintsLimitPerUser = (BadgeApplicationPurchaseConstraintsLimitPerUser) o; + return Objects.equals(this.maxItems, badgeApplicationPurchaseConstraintsLimitPerUser.maxItems); + } + + @Override + public int hashCode() { + return Objects.hash(maxItems); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationPurchaseConstraintsLimitPerUser {\n"); + sb.append(" maxItems: ").append(toIndentedString(maxItems)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("maxItems"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationPurchaseConstraintsLimitPerUser + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationPurchaseConstraintsLimitPerUser.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationPurchaseConstraintsLimitPerUser is not found in the empty JSON string", BadgeApplicationPurchaseConstraintsLimitPerUser.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationPurchaseConstraintsLimitPerUser.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationPurchaseConstraintsLimitPerUser` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationPurchaseConstraintsLimitPerUser.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationPurchaseConstraintsLimitPerUser' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationPurchaseConstraintsLimitPerUser.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationPurchaseConstraintsLimitPerUser value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationPurchaseConstraintsLimitPerUser read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationPurchaseConstraintsLimitPerUser given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationPurchaseConstraintsLimitPerUser + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationPurchaseConstraintsLimitPerUser + */ + public static BadgeApplicationPurchaseConstraintsLimitPerUser fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationPurchaseConstraintsLimitPerUser.class); + } + + /** + * Convert an instance of BadgeApplicationPurchaseConstraintsLimitPerUser to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRejectionReason.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRejectionReason.java new file mode 100644 index 0000000..50ce7e6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRejectionReason.java @@ -0,0 +1,263 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BadgeApplicationRejectionReasonMessage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgeApplicationRejectionReason + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationRejectionReason { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private String code; + + public static final String SERIALIZED_NAME_MESSAGES = "messages"; + @SerializedName(SERIALIZED_NAME_MESSAGES) + @javax.annotation.Nonnull + private List messages = new ArrayList<>(); + + public BadgeApplicationRejectionReason() { + } + + public BadgeApplicationRejectionReason code(@javax.annotation.Nonnull String code) { + this.code = code; + return this; + } + + /** + * Code corresponding to the message. For more information visit <a href=\"/badge/#6\" target=\"_blank\">the list of available codes</a>. + * @return code + */ + @javax.annotation.Nonnull + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull String code) { + this.code = code; + } + + + public BadgeApplicationRejectionReason messages(@javax.annotation.Nonnull List messages) { + this.messages = messages; + return this; + } + + public BadgeApplicationRejectionReason addMessagesItem(BadgeApplicationRejectionReasonMessage messagesItem) { + if (this.messages == null) { + this.messages = new ArrayList<>(); + } + this.messages.add(messagesItem); + return this; + } + + /** + * List of messages with rejection reasons. + * @return messages + */ + @javax.annotation.Nonnull + public List getMessages() { + return messages; + } + + public void setMessages(@javax.annotation.Nonnull List messages) { + this.messages = messages; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationRejectionReason badgeApplicationRejectionReason = (BadgeApplicationRejectionReason) o; + return Objects.equals(this.code, badgeApplicationRejectionReason.code) && + Objects.equals(this.messages, badgeApplicationRejectionReason.messages); + } + + @Override + public int hashCode() { + return Objects.hash(code, messages); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationRejectionReason {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" messages: ").append(toIndentedString(messages)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("messages"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("code"); + openapiRequiredFields.add("messages"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationRejectionReason + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationRejectionReason.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationRejectionReason is not found in the empty JSON string", BadgeApplicationRejectionReason.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationRejectionReason.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationRejectionReason` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeApplicationRejectionReason.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("messages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `messages` to be an array in the JSON string but got `%s`", jsonObj.get("messages").toString())); + } + + JsonArray jsonArraymessages = jsonObj.getAsJsonArray("messages"); + // validate the required field `messages` (array) + for (int i = 0; i < jsonArraymessages.size(); i++) { + BadgeApplicationRejectionReasonMessage.validateJsonElement(jsonArraymessages.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationRejectionReason.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationRejectionReason' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationRejectionReason.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationRejectionReason value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationRejectionReason read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationRejectionReason given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationRejectionReason + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationRejectionReason + */ + public static BadgeApplicationRejectionReason fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationRejectionReason.class); + } + + /** + * Convert an instance of BadgeApplicationRejectionReason to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRejectionReasonMessage.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRejectionReasonMessage.java new file mode 100644 index 0000000..7d35e00 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRejectionReasonMessage.java @@ -0,0 +1,256 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgeApplicationRejectionReasonMessage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationRejectionReasonMessage { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nonnull + private String text; + + public static final String SERIALIZED_NAME_LINK = "link"; + @SerializedName(SERIALIZED_NAME_LINK) + @javax.annotation.Nullable + private String link; + + public BadgeApplicationRejectionReasonMessage() { + } + + public BadgeApplicationRejectionReasonMessage text(@javax.annotation.Nonnull String text) { + this.text = text; + return this; + } + + /** + * Detailed message. + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nonnull String text) { + this.text = text; + } + + + public BadgeApplicationRejectionReasonMessage link(@javax.annotation.Nullable String link) { + this.link = link; + return this; + } + + /** + * Optional link that redirects to page associated with rejection reason. + * @return link + */ + @javax.annotation.Nullable + public String getLink() { + return link; + } + + public void setLink(@javax.annotation.Nullable String link) { + this.link = link; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationRejectionReasonMessage badgeApplicationRejectionReasonMessage = (BadgeApplicationRejectionReasonMessage) o; + return Objects.equals(this.text, badgeApplicationRejectionReasonMessage.text) && + Objects.equals(this.link, badgeApplicationRejectionReasonMessage.link); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(text, link); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationRejectionReasonMessage {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" link: ").append(toIndentedString(link)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("text"); + openapiFields.add("link"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("text"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationRejectionReasonMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationRejectionReasonMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationRejectionReasonMessage is not found in the empty JSON string", BadgeApplicationRejectionReasonMessage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationRejectionReasonMessage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationRejectionReasonMessage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeApplicationRejectionReasonMessage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if ((jsonObj.get("link") != null && !jsonObj.get("link").isJsonNull()) && !jsonObj.get("link").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `link` to be a primitive type in the JSON string but got `%s`", jsonObj.get("link").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationRejectionReasonMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationRejectionReasonMessage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationRejectionReasonMessage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationRejectionReasonMessage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationRejectionReasonMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationRejectionReasonMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationRejectionReasonMessage + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationRejectionReasonMessage + */ + public static BadgeApplicationRejectionReasonMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationRejectionReasonMessage.class); + } + + /** + * Convert an instance of BadgeApplicationRejectionReasonMessage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRequest.java new file mode 100644 index 0000000..a02306f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationRequest.java @@ -0,0 +1,321 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.BadgeApplicationCampaign; +import pl.wtx.allegro.api.client.model.BadgeApplicationOffer; +import pl.wtx.allegro.api.client.model.BadgeApplicationPrices; +import pl.wtx.allegro.api.client.model.BadgeApplicationPurchaseConstraints; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgeApplicationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationRequest { + public static final String SERIALIZED_NAME_CAMPAIGN = "campaign"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN) + @javax.annotation.Nonnull + private BadgeApplicationCampaign campaign; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private BadgeApplicationOffer offer; + + public static final String SERIALIZED_NAME_PRICES = "prices"; + @SerializedName(SERIALIZED_NAME_PRICES) + @javax.annotation.Nullable + private BadgeApplicationPrices prices; + + public static final String SERIALIZED_NAME_PURCHASE_CONSTRAINTS = "purchaseConstraints"; + @SerializedName(SERIALIZED_NAME_PURCHASE_CONSTRAINTS) + @javax.annotation.Nullable + private BadgeApplicationPurchaseConstraints purchaseConstraints; + + public BadgeApplicationRequest() { + } + + public BadgeApplicationRequest campaign(@javax.annotation.Nonnull BadgeApplicationCampaign campaign) { + this.campaign = campaign; + return this; + } + + /** + * Get campaign + * @return campaign + */ + @javax.annotation.Nonnull + public BadgeApplicationCampaign getCampaign() { + return campaign; + } + + public void setCampaign(@javax.annotation.Nonnull BadgeApplicationCampaign campaign) { + this.campaign = campaign; + } + + + public BadgeApplicationRequest offer(@javax.annotation.Nonnull BadgeApplicationOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public BadgeApplicationOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull BadgeApplicationOffer offer) { + this.offer = offer; + } + + + public BadgeApplicationRequest prices(@javax.annotation.Nullable BadgeApplicationPrices prices) { + this.prices = prices; + return this; + } + + /** + * Get prices + * @return prices + */ + @javax.annotation.Nullable + public BadgeApplicationPrices getPrices() { + return prices; + } + + public void setPrices(@javax.annotation.Nullable BadgeApplicationPrices prices) { + this.prices = prices; + } + + + public BadgeApplicationRequest purchaseConstraints(@javax.annotation.Nullable BadgeApplicationPurchaseConstraints purchaseConstraints) { + this.purchaseConstraints = purchaseConstraints; + return this; + } + + /** + * Get purchaseConstraints + * @return purchaseConstraints + */ + @javax.annotation.Nullable + public BadgeApplicationPurchaseConstraints getPurchaseConstraints() { + return purchaseConstraints; + } + + public void setPurchaseConstraints(@javax.annotation.Nullable BadgeApplicationPurchaseConstraints purchaseConstraints) { + this.purchaseConstraints = purchaseConstraints; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationRequest badgeApplicationRequest = (BadgeApplicationRequest) o; + return Objects.equals(this.campaign, badgeApplicationRequest.campaign) && + Objects.equals(this.offer, badgeApplicationRequest.offer) && + Objects.equals(this.prices, badgeApplicationRequest.prices) && + Objects.equals(this.purchaseConstraints, badgeApplicationRequest.purchaseConstraints); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(campaign, offer, prices, purchaseConstraints); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationRequest {\n"); + sb.append(" campaign: ").append(toIndentedString(campaign)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" prices: ").append(toIndentedString(prices)).append("\n"); + sb.append(" purchaseConstraints: ").append(toIndentedString(purchaseConstraints)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("campaign"); + openapiFields.add("offer"); + openapiFields.add("prices"); + openapiFields.add("purchaseConstraints"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("campaign"); + openapiRequiredFields.add("offer"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationRequest is not found in the empty JSON string", BadgeApplicationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeApplicationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `campaign` + BadgeApplicationCampaign.validateJsonElement(jsonObj.get("campaign")); + // validate the required field `offer` + BadgeApplicationOffer.validateJsonElement(jsonObj.get("offer")); + // validate the optional field `prices` + if (jsonObj.get("prices") != null && !jsonObj.get("prices").isJsonNull()) { + BadgeApplicationPrices.validateJsonElement(jsonObj.get("prices")); + } + // validate the optional field `purchaseConstraints` + if (jsonObj.get("purchaseConstraints") != null && !jsonObj.get("purchaseConstraints").isJsonNull()) { + BadgeApplicationPurchaseConstraints.validateJsonElement(jsonObj.get("purchaseConstraints")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationRequest + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationRequest + */ + public static BadgeApplicationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationRequest.class); + } + + /** + * Convert an instance of BadgeApplicationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationSubsidySellerPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationSubsidySellerPrice.java new file mode 100644 index 0000000..69be108 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationSubsidySellerPrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The price requested by partner. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationSubsidySellerPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public BadgeApplicationSubsidySellerPrice() { + } + + public BadgeApplicationSubsidySellerPrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Value must be greater than minimal, decimal places aligned with market rules. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public BadgeApplicationSubsidySellerPrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). Only base currency for a given marketplace is supported, example: PLN for allegro-pl, CZK for allegro-cz, EUR for allegro-sk. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationSubsidySellerPrice badgeApplicationSubsidySellerPrice = (BadgeApplicationSubsidySellerPrice) o; + return Objects.equals(this.amount, badgeApplicationSubsidySellerPrice.amount) && + Objects.equals(this.currency, badgeApplicationSubsidySellerPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationSubsidySellerPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationSubsidySellerPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationSubsidySellerPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationSubsidySellerPrice is not found in the empty JSON string", BadgeApplicationSubsidySellerPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationSubsidySellerPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationSubsidySellerPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationSubsidySellerPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationSubsidySellerPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationSubsidySellerPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationSubsidySellerPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationSubsidySellerPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationSubsidySellerPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationSubsidySellerPrice + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationSubsidySellerPrice + */ + public static BadgeApplicationSubsidySellerPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationSubsidySellerPrice.class); + } + + /** + * Convert an instance of BadgeApplicationSubsidySellerPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationSubsidyTargetPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationSubsidyTargetPrice.java new file mode 100644 index 0000000..2c45c62 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplicationSubsidyTargetPrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The price visible as the Buy Now price. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplicationSubsidyTargetPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public BadgeApplicationSubsidyTargetPrice() { + } + + public BadgeApplicationSubsidyTargetPrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Value must be greater than minimal, decimal places aligned with market rules. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public BadgeApplicationSubsidyTargetPrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). Only base currency for a given marketplace is supported, example: PLN for allegro-pl, CZK for allegro-cz, EUR for allegro-sk. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplicationSubsidyTargetPrice badgeApplicationSubsidyTargetPrice = (BadgeApplicationSubsidyTargetPrice) o; + return Objects.equals(this.amount, badgeApplicationSubsidyTargetPrice.amount) && + Objects.equals(this.currency, badgeApplicationSubsidyTargetPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplicationSubsidyTargetPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplicationSubsidyTargetPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplicationSubsidyTargetPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplicationSubsidyTargetPrice is not found in the empty JSON string", BadgeApplicationSubsidyTargetPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplicationSubsidyTargetPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplicationSubsidyTargetPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplicationSubsidyTargetPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplicationSubsidyTargetPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplicationSubsidyTargetPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplicationSubsidyTargetPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplicationSubsidyTargetPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplicationSubsidyTargetPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplicationSubsidyTargetPrice + * @throws IOException if the JSON string is invalid with respect to BadgeApplicationSubsidyTargetPrice + */ + public static BadgeApplicationSubsidyTargetPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplicationSubsidyTargetPrice.class); + } + + /** + * Convert an instance of BadgeApplicationSubsidyTargetPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplications.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplications.java new file mode 100644 index 0000000..0efdde1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeApplications.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BadgeApplication; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgeApplications + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeApplications { + public static final String SERIALIZED_NAME_BADGE_APPLICATIONS = "badgeApplications"; + @SerializedName(SERIALIZED_NAME_BADGE_APPLICATIONS) + @javax.annotation.Nonnull + private List badgeApplications = new ArrayList<>(); + + public BadgeApplications() { + } + + public BadgeApplications badgeApplications(@javax.annotation.Nonnull List badgeApplications) { + this.badgeApplications = badgeApplications; + return this; + } + + public BadgeApplications addBadgeApplicationsItem(BadgeApplication badgeApplicationsItem) { + if (this.badgeApplications == null) { + this.badgeApplications = new ArrayList<>(); + } + this.badgeApplications.add(badgeApplicationsItem); + return this; + } + + /** + * Get badgeApplications + * @return badgeApplications + */ + @javax.annotation.Nonnull + public List getBadgeApplications() { + return badgeApplications; + } + + public void setBadgeApplications(@javax.annotation.Nonnull List badgeApplications) { + this.badgeApplications = badgeApplications; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeApplications badgeApplications = (BadgeApplications) o; + return Objects.equals(this.badgeApplications, badgeApplications.badgeApplications); + } + + @Override + public int hashCode() { + return Objects.hash(badgeApplications); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeApplications {\n"); + sb.append(" badgeApplications: ").append(toIndentedString(badgeApplications)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("badgeApplications"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("badgeApplications"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeApplications + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeApplications.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeApplications is not found in the empty JSON string", BadgeApplications.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeApplications.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeApplications` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeApplications.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("badgeApplications").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `badgeApplications` to be an array in the JSON string but got `%s`", jsonObj.get("badgeApplications").toString())); + } + + JsonArray jsonArraybadgeApplications = jsonObj.getAsJsonArray("badgeApplications"); + // validate the required field `badgeApplications` (array) + for (int i = 0; i < jsonArraybadgeApplications.size(); i++) { + BadgeApplication.validateJsonElement(jsonArraybadgeApplications.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeApplications.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeApplications' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeApplications.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeApplications value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeApplications read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeApplications given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeApplications + * @throws IOException if the JSON string is invalid with respect to BadgeApplications + */ + public static BadgeApplications fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeApplications.class); + } + + /** + * Convert an instance of BadgeApplications to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeCampaign.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeCampaign.java new file mode 100644 index 0000000..19e71a8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeCampaign.java @@ -0,0 +1,518 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ApplicationTimePolicy; +import pl.wtx.allegro.api.client.model.MarketplaceReference; +import pl.wtx.allegro.api.client.model.PublicationTimePolicy; +import pl.wtx.allegro.api.client.model.UserCampaignEligibility; +import pl.wtx.allegro.api.client.model.VisibilityTimePolicy; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgeCampaign + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeCampaign { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_MARKETPLACE = "marketplace"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE) + @javax.annotation.Nonnull + private MarketplaceReference marketplace; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + DISCOUNT("DISCOUNT"), + + STANDARD("STANDARD"), + + SOURCING("SOURCING"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_ELIGIBILITY = "eligibility"; + @SerializedName(SERIALIZED_NAME_ELIGIBILITY) + @javax.annotation.Nonnull + private UserCampaignEligibility eligibility; + + public static final String SERIALIZED_NAME_APPLICATION = "application"; + @SerializedName(SERIALIZED_NAME_APPLICATION) + @javax.annotation.Nonnull + private ApplicationTimePolicy application; + + public static final String SERIALIZED_NAME_VISIBILITY = "visibility"; + @SerializedName(SERIALIZED_NAME_VISIBILITY) + @javax.annotation.Nonnull + private VisibilityTimePolicy visibility; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nonnull + private PublicationTimePolicy publication; + + public static final String SERIALIZED_NAME_REGULATIONS_LINK = "regulationsLink"; + @SerializedName(SERIALIZED_NAME_REGULATIONS_LINK) + @javax.annotation.Nonnull + private String regulationsLink; + + public BadgeCampaign() { + } + + public BadgeCampaign id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Badge campaign ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public BadgeCampaign name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Badge campaign name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public BadgeCampaign marketplace(@javax.annotation.Nonnull MarketplaceReference marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get marketplace + * @return marketplace + */ + @javax.annotation.Nonnull + public MarketplaceReference getMarketplace() { + return marketplace; + } + + public void setMarketplace(@javax.annotation.Nonnull MarketplaceReference marketplace) { + this.marketplace = marketplace; + } + + + public BadgeCampaign type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public BadgeCampaign eligibility(@javax.annotation.Nonnull UserCampaignEligibility eligibility) { + this.eligibility = eligibility; + return this; + } + + /** + * Get eligibility + * @return eligibility + */ + @javax.annotation.Nonnull + public UserCampaignEligibility getEligibility() { + return eligibility; + } + + public void setEligibility(@javax.annotation.Nonnull UserCampaignEligibility eligibility) { + this.eligibility = eligibility; + } + + + public BadgeCampaign application(@javax.annotation.Nonnull ApplicationTimePolicy application) { + this.application = application; + return this; + } + + /** + * Get application + * @return application + */ + @javax.annotation.Nonnull + public ApplicationTimePolicy getApplication() { + return application; + } + + public void setApplication(@javax.annotation.Nonnull ApplicationTimePolicy application) { + this.application = application; + } + + + public BadgeCampaign visibility(@javax.annotation.Nonnull VisibilityTimePolicy visibility) { + this.visibility = visibility; + return this; + } + + /** + * Get visibility + * @return visibility + */ + @javax.annotation.Nonnull + public VisibilityTimePolicy getVisibility() { + return visibility; + } + + public void setVisibility(@javax.annotation.Nonnull VisibilityTimePolicy visibility) { + this.visibility = visibility; + } + + + public BadgeCampaign publication(@javax.annotation.Nonnull PublicationTimePolicy publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nonnull + public PublicationTimePolicy getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nonnull PublicationTimePolicy publication) { + this.publication = publication; + } + + + public BadgeCampaign regulationsLink(@javax.annotation.Nonnull String regulationsLink) { + this.regulationsLink = regulationsLink; + return this; + } + + /** + * Link to campaign Terms & Conditions + * @return regulationsLink + */ + @javax.annotation.Nonnull + public String getRegulationsLink() { + return regulationsLink; + } + + public void setRegulationsLink(@javax.annotation.Nonnull String regulationsLink) { + this.regulationsLink = regulationsLink; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeCampaign badgeCampaign = (BadgeCampaign) o; + return Objects.equals(this.id, badgeCampaign.id) && + Objects.equals(this.name, badgeCampaign.name) && + Objects.equals(this.marketplace, badgeCampaign.marketplace) && + Objects.equals(this.type, badgeCampaign.type) && + Objects.equals(this.eligibility, badgeCampaign.eligibility) && + Objects.equals(this.application, badgeCampaign.application) && + Objects.equals(this.visibility, badgeCampaign.visibility) && + Objects.equals(this.publication, badgeCampaign.publication) && + Objects.equals(this.regulationsLink, badgeCampaign.regulationsLink); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, marketplace, type, eligibility, application, visibility, publication, regulationsLink); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeCampaign {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" marketplace: ").append(toIndentedString(marketplace)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" eligibility: ").append(toIndentedString(eligibility)).append("\n"); + sb.append(" application: ").append(toIndentedString(application)).append("\n"); + sb.append(" visibility: ").append(toIndentedString(visibility)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" regulationsLink: ").append(toIndentedString(regulationsLink)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("marketplace"); + openapiFields.add("type"); + openapiFields.add("eligibility"); + openapiFields.add("application"); + openapiFields.add("visibility"); + openapiFields.add("publication"); + openapiFields.add("regulationsLink"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("marketplace"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("eligibility"); + openapiRequiredFields.add("application"); + openapiRequiredFields.add("visibility"); + openapiRequiredFields.add("publication"); + openapiRequiredFields.add("regulationsLink"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeCampaign + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeCampaign.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeCampaign is not found in the empty JSON string", BadgeCampaign.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeCampaign.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeCampaign` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeCampaign.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the required field `marketplace` + MarketplaceReference.validateJsonElement(jsonObj.get("marketplace")); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `eligibility` + UserCampaignEligibility.validateJsonElement(jsonObj.get("eligibility")); + // validate the required field `application` + ApplicationTimePolicy.validateJsonElement(jsonObj.get("application")); + // validate the required field `visibility` + VisibilityTimePolicy.validateJsonElement(jsonObj.get("visibility")); + // validate the required field `publication` + PublicationTimePolicy.validateJsonElement(jsonObj.get("publication")); + if (!jsonObj.get("regulationsLink").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `regulationsLink` to be a primitive type in the JSON string but got `%s`", jsonObj.get("regulationsLink").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeCampaign.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeCampaign' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeCampaign.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeCampaign value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeCampaign read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeCampaign given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeCampaign + * @throws IOException if the JSON string is invalid with respect to BadgeCampaign + */ + public static BadgeCampaign fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeCampaign.class); + } + + /** + * Convert an instance of BadgeCampaign to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeMarketPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeMarketPrice.java new file mode 100644 index 0000000..4e0f4f3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeMarketPrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Suggested market price. Calculated automatically based on the offer's price history. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeMarketPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public BadgeMarketPrice() { + } + + public BadgeMarketPrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Value must be greater than minimal, decimal places aligned with market rules. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public BadgeMarketPrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). Only base currency for a given marketplace is supported, example: PLN for allegro-pl, CZK for allegro-cz, EUR for allegro-sk. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeMarketPrice badgeMarketPrice = (BadgeMarketPrice) o; + return Objects.equals(this.amount, badgeMarketPrice.amount) && + Objects.equals(this.currency, badgeMarketPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeMarketPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeMarketPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeMarketPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeMarketPrice is not found in the empty JSON string", BadgeMarketPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeMarketPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeMarketPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeMarketPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeMarketPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeMarketPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeMarketPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeMarketPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeMarketPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeMarketPrice + * @throws IOException if the JSON string is invalid with respect to BadgeMarketPrice + */ + public static BadgeMarketPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeMarketPrice.class); + } + + /** + * Convert an instance of BadgeMarketPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeOperation.java new file mode 100644 index 0000000..4556652 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeOperation.java @@ -0,0 +1,454 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BadgeApplicationCampaign; +import pl.wtx.allegro.api.client.model.BadgeApplicationOffer; +import pl.wtx.allegro.api.client.model.BadgeOperationProcess; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgeOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeOperation { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + /** + * Badge operation type. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + UPDATE("UPDATE"), + + FINISH("FINISH"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private String createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nonnull + private String updatedAt; + + public static final String SERIALIZED_NAME_CAMPAIGN = "campaign"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN) + @javax.annotation.Nonnull + private BadgeApplicationCampaign campaign; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private BadgeApplicationOffer offer; + + public static final String SERIALIZED_NAME_PROCESS = "process"; + @SerializedName(SERIALIZED_NAME_PROCESS) + @javax.annotation.Nonnull + private BadgeOperationProcess process; + + public BadgeOperation() { + } + + public BadgeOperation id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Badge operation ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public BadgeOperation type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Badge operation type. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public BadgeOperation createdAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + } + + + public BadgeOperation updatedAt(@javax.annotation.Nonnull String updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return updatedAt + */ + @javax.annotation.Nonnull + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nonnull String updatedAt) { + this.updatedAt = updatedAt; + } + + + public BadgeOperation campaign(@javax.annotation.Nonnull BadgeApplicationCampaign campaign) { + this.campaign = campaign; + return this; + } + + /** + * Get campaign + * @return campaign + */ + @javax.annotation.Nonnull + public BadgeApplicationCampaign getCampaign() { + return campaign; + } + + public void setCampaign(@javax.annotation.Nonnull BadgeApplicationCampaign campaign) { + this.campaign = campaign; + } + + + public BadgeOperation offer(@javax.annotation.Nonnull BadgeApplicationOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public BadgeApplicationOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull BadgeApplicationOffer offer) { + this.offer = offer; + } + + + public BadgeOperation process(@javax.annotation.Nonnull BadgeOperationProcess process) { + this.process = process; + return this; + } + + /** + * Get process + * @return process + */ + @javax.annotation.Nonnull + public BadgeOperationProcess getProcess() { + return process; + } + + public void setProcess(@javax.annotation.Nonnull BadgeOperationProcess process) { + this.process = process; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeOperation badgeOperation = (BadgeOperation) o; + return Objects.equals(this.id, badgeOperation.id) && + Objects.equals(this.type, badgeOperation.type) && + Objects.equals(this.createdAt, badgeOperation.createdAt) && + Objects.equals(this.updatedAt, badgeOperation.updatedAt) && + Objects.equals(this.campaign, badgeOperation.campaign) && + Objects.equals(this.offer, badgeOperation.offer) && + Objects.equals(this.process, badgeOperation.process); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, updatedAt, campaign, offer, process); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeOperation {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" campaign: ").append(toIndentedString(campaign)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" process: ").append(toIndentedString(process)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("campaign"); + openapiFields.add("offer"); + openapiFields.add("process"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + openapiRequiredFields.add("campaign"); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("process"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeOperation is not found in the empty JSON string", BadgeOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); + } + if (!jsonObj.get("updatedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `updatedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedAt").toString())); + } + // validate the required field `campaign` + BadgeApplicationCampaign.validateJsonElement(jsonObj.get("campaign")); + // validate the required field `offer` + BadgeApplicationOffer.validateJsonElement(jsonObj.get("offer")); + // validate the required field `process` + BadgeOperationProcess.validateJsonElement(jsonObj.get("process")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeOperation + * @throws IOException if the JSON string is invalid with respect to BadgeOperation + */ + public static BadgeOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeOperation.class); + } + + /** + * Convert an instance of BadgeOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeOperationProcess.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeOperationProcess.java new file mode 100644 index 0000000..d698673 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeOperationProcess.java @@ -0,0 +1,319 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BadgeApplicationRejectionReason; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about processing of the request/operation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeOperationProcess { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + REQUESTED("REQUESTED"), + + PROCESSED("PROCESSED"), + + DECLINED("DECLINED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public static final String SERIALIZED_NAME_REJECTION_REASONS = "rejectionReasons"; + @SerializedName(SERIALIZED_NAME_REJECTION_REASONS) + @javax.annotation.Nonnull + private List rejectionReasons = new ArrayList<>(); + + public BadgeOperationProcess() { + } + + public BadgeOperationProcess status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + public BadgeOperationProcess rejectionReasons(@javax.annotation.Nonnull List rejectionReasons) { + this.rejectionReasons = rejectionReasons; + return this; + } + + public BadgeOperationProcess addRejectionReasonsItem(BadgeApplicationRejectionReason rejectionReasonsItem) { + if (this.rejectionReasons == null) { + this.rejectionReasons = new ArrayList<>(); + } + this.rejectionReasons.add(rejectionReasonsItem); + return this; + } + + /** + * A list of rejection reasons for the badge operation. Returned for process.status = DECLINED only. + * @return rejectionReasons + */ + @javax.annotation.Nonnull + public List getRejectionReasons() { + return rejectionReasons; + } + + public void setRejectionReasons(@javax.annotation.Nonnull List rejectionReasons) { + this.rejectionReasons = rejectionReasons; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeOperationProcess badgeOperationProcess = (BadgeOperationProcess) o; + return Objects.equals(this.status, badgeOperationProcess.status) && + Objects.equals(this.rejectionReasons, badgeOperationProcess.rejectionReasons); + } + + @Override + public int hashCode() { + return Objects.hash(status, rejectionReasons); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeOperationProcess {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" rejectionReasons: ").append(toIndentedString(rejectionReasons)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("rejectionReasons"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("rejectionReasons"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeOperationProcess + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeOperationProcess.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeOperationProcess is not found in the empty JSON string", BadgeOperationProcess.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeOperationProcess.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeOperationProcess` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeOperationProcess.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + // ensure the json data is an array + if (!jsonObj.get("rejectionReasons").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rejectionReasons` to be an array in the JSON string but got `%s`", jsonObj.get("rejectionReasons").toString())); + } + + JsonArray jsonArrayrejectionReasons = jsonObj.getAsJsonArray("rejectionReasons"); + // validate the required field `rejectionReasons` (array) + for (int i = 0; i < jsonArrayrejectionReasons.size(); i++) { + BadgeApplicationRejectionReason.validateJsonElement(jsonArrayrejectionReasons.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeOperationProcess.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeOperationProcess' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeOperationProcess.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeOperationProcess value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeOperationProcess read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeOperationProcess given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeOperationProcess + * @throws IOException if the JSON string is invalid with respect to BadgeOperationProcess + */ + public static BadgeOperationProcess fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeOperationProcess.class); + } + + /** + * Convert an instance of BadgeOperationProcess to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPrices.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPrices.java new file mode 100644 index 0000000..5cf4966 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPrices.java @@ -0,0 +1,220 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.BadgePatchPricesPrices; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Required by DISCOUNT and SOURCING campaign. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgePatchPrices { + public static final String SERIALIZED_NAME_PRICES = "prices"; + @SerializedName(SERIALIZED_NAME_PRICES) + @javax.annotation.Nullable + private BadgePatchPricesPrices prices; + + public BadgePatchPrices() { + } + + public BadgePatchPrices prices(@javax.annotation.Nullable BadgePatchPricesPrices prices) { + this.prices = prices; + return this; + } + + /** + * Get prices + * @return prices + */ + @javax.annotation.Nullable + public BadgePatchPricesPrices getPrices() { + return prices; + } + + public void setPrices(@javax.annotation.Nullable BadgePatchPricesPrices prices) { + this.prices = prices; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgePatchPrices badgePatchPrices = (BadgePatchPrices) o; + return Objects.equals(this.prices, badgePatchPrices.prices); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(prices); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgePatchPrices {\n"); + sb.append(" prices: ").append(toIndentedString(prices)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("prices"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgePatchPrices + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgePatchPrices.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgePatchPrices is not found in the empty JSON string", BadgePatchPrices.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgePatchPrices.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgePatchPrices` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `prices` + if (jsonObj.get("prices") != null && !jsonObj.get("prices").isJsonNull()) { + BadgePatchPricesPrices.validateJsonElement(jsonObj.get("prices")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgePatchPrices.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgePatchPrices' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgePatchPrices.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgePatchPrices value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgePatchPrices read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgePatchPrices given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgePatchPrices + * @throws IOException if the JSON string is invalid with respect to BadgePatchPrices + */ + public static BadgePatchPrices fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgePatchPrices.class); + } + + /** + * Convert an instance of BadgePatchPrices to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPricesPrices.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPricesPrices.java new file mode 100644 index 0000000..9517722 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPricesPrices.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BadgePatchPricesPricesBargain; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgePatchPricesPrices + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgePatchPricesPrices { + public static final String SERIALIZED_NAME_BARGAIN = "bargain"; + @SerializedName(SERIALIZED_NAME_BARGAIN) + @javax.annotation.Nullable + private BadgePatchPricesPricesBargain bargain; + + public BadgePatchPricesPrices() { + } + + public BadgePatchPricesPrices bargain(@javax.annotation.Nullable BadgePatchPricesPricesBargain bargain) { + this.bargain = bargain; + return this; + } + + /** + * Get bargain + * @return bargain + */ + @javax.annotation.Nullable + public BadgePatchPricesPricesBargain getBargain() { + return bargain; + } + + public void setBargain(@javax.annotation.Nullable BadgePatchPricesPricesBargain bargain) { + this.bargain = bargain; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgePatchPricesPrices badgePatchPricesPrices = (BadgePatchPricesPrices) o; + return Objects.equals(this.bargain, badgePatchPricesPrices.bargain); + } + + @Override + public int hashCode() { + return Objects.hash(bargain); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgePatchPricesPrices {\n"); + sb.append(" bargain: ").append(toIndentedString(bargain)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("bargain"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgePatchPricesPrices + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgePatchPricesPrices.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgePatchPricesPrices is not found in the empty JSON string", BadgePatchPricesPrices.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgePatchPricesPrices.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgePatchPricesPrices` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `bargain` + if (jsonObj.get("bargain") != null && !jsonObj.get("bargain").isJsonNull()) { + BadgePatchPricesPricesBargain.validateJsonElement(jsonObj.get("bargain")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgePatchPricesPrices.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgePatchPricesPrices' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgePatchPricesPrices.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgePatchPricesPrices value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgePatchPricesPrices read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgePatchPricesPrices given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgePatchPricesPrices + * @throws IOException if the JSON string is invalid with respect to BadgePatchPricesPrices + */ + public static BadgePatchPricesPrices fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgePatchPricesPrices.class); + } + + /** + * Convert an instance of BadgePatchPricesPrices to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPricesPricesBargain.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPricesPricesBargain.java new file mode 100644 index 0000000..dc12f99 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchPricesPricesBargain.java @@ -0,0 +1,220 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.BadgeApplicationBargainPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgePatchPricesPricesBargain + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgePatchPricesPricesBargain { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private BadgeApplicationBargainPrice value; + + public BadgePatchPricesPricesBargain() { + } + + public BadgePatchPricesPricesBargain value(@javax.annotation.Nullable BadgeApplicationBargainPrice value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public BadgeApplicationBargainPrice getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable BadgeApplicationBargainPrice value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgePatchPricesPricesBargain badgePatchPricesPricesBargain = (BadgePatchPricesPricesBargain) o; + return Objects.equals(this.value, badgePatchPricesPricesBargain.value); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgePatchPricesPricesBargain {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgePatchPricesPricesBargain + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgePatchPricesPricesBargain.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgePatchPricesPricesBargain is not found in the empty JSON string", BadgePatchPricesPricesBargain.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgePatchPricesPricesBargain.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgePatchPricesPricesBargain` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `value` + if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { + BadgeApplicationBargainPrice.validateJsonElement(jsonObj.get("value")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgePatchPricesPricesBargain.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgePatchPricesPricesBargain' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgePatchPricesPricesBargain.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgePatchPricesPricesBargain value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgePatchPricesPricesBargain read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgePatchPricesPricesBargain given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgePatchPricesPricesBargain + * @throws IOException if the JSON string is invalid with respect to BadgePatchPricesPricesBargain + */ + public static BadgePatchPricesPricesBargain fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgePatchPricesPricesBargain.class); + } + + /** + * Convert an instance of BadgePatchPricesPricesBargain to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchProcess.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchProcess.java new file mode 100644 index 0000000..9a83083 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchProcess.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BadgePatchProcessProcess; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgePatchProcess + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgePatchProcess { + public static final String SERIALIZED_NAME_PROCESS = "process"; + @SerializedName(SERIALIZED_NAME_PROCESS) + @javax.annotation.Nullable + private BadgePatchProcessProcess process; + + public BadgePatchProcess() { + } + + public BadgePatchProcess process(@javax.annotation.Nullable BadgePatchProcessProcess process) { + this.process = process; + return this; + } + + /** + * Get process + * @return process + */ + @javax.annotation.Nullable + public BadgePatchProcessProcess getProcess() { + return process; + } + + public void setProcess(@javax.annotation.Nullable BadgePatchProcessProcess process) { + this.process = process; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgePatchProcess badgePatchProcess = (BadgePatchProcess) o; + return Objects.equals(this.process, badgePatchProcess.process); + } + + @Override + public int hashCode() { + return Objects.hash(process); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgePatchProcess {\n"); + sb.append(" process: ").append(toIndentedString(process)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("process"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgePatchProcess + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgePatchProcess.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgePatchProcess is not found in the empty JSON string", BadgePatchProcess.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgePatchProcess.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgePatchProcess` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `process` + if (jsonObj.get("process") != null && !jsonObj.get("process").isJsonNull()) { + BadgePatchProcessProcess.validateJsonElement(jsonObj.get("process")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgePatchProcess.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgePatchProcess' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgePatchProcess.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgePatchProcess value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgePatchProcess read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgePatchProcess given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgePatchProcess + * @throws IOException if the JSON string is invalid with respect to BadgePatchProcess + */ + public static BadgePatchProcess fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgePatchProcess.class); + } + + /** + * Convert an instance of BadgePatchProcess to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchProcessProcess.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchProcessProcess.java new file mode 100644 index 0000000..74fdeb7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchProcessProcess.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BadgePatchProcessProcess + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgePatchProcessProcess { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + FINISHED("FINISHED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public BadgePatchProcessProcess() { + } + + public BadgePatchProcessProcess status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgePatchProcessProcess badgePatchProcessProcess = (BadgePatchProcessProcess) o; + return Objects.equals(this.status, badgePatchProcessProcess.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgePatchProcessProcess {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgePatchProcessProcess + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgePatchProcessProcess.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgePatchProcessProcess is not found in the empty JSON string", BadgePatchProcessProcess.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgePatchProcessProcess.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgePatchProcessProcess` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgePatchProcessProcess.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgePatchProcessProcess' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgePatchProcessProcess.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgePatchProcessProcess value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgePatchProcessProcess read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgePatchProcessProcess given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgePatchProcessProcess + * @throws IOException if the JSON string is invalid with respect to BadgePatchProcessProcess + */ + public static BadgePatchProcessProcess fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgePatchProcessProcess.class); + } + + /** + * Convert an instance of BadgePatchProcessProcess to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchRequest.java new file mode 100644 index 0000000..dda4640 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgePatchRequest.java @@ -0,0 +1,270 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.BadgePatchPrices; +import pl.wtx.allegro.api.client.model.BadgePatchPricesPrices; +import pl.wtx.allegro.api.client.model.BadgePatchProcess; +import pl.wtx.allegro.api.client.model.BadgePatchProcessProcess; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import pl.wtx.allegro.api.client.invoker.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgePatchRequest extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(BadgePatchRequest.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgePatchRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgePatchRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterBadgePatchProcess = gson.getDelegateAdapter(this, TypeToken.get(BadgePatchProcess.class)); + final TypeAdapter adapterBadgePatchPrices = gson.getDelegateAdapter(this, TypeToken.get(BadgePatchPrices.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgePatchRequest value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `BadgePatchProcess` + if (value.getActualInstance() instanceof BadgePatchProcess) { + JsonElement element = adapterBadgePatchProcess.toJsonTree((BadgePatchProcess)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `BadgePatchPrices` + if (value.getActualInstance() instanceof BadgePatchPrices) { + JsonElement element = adapterBadgePatchPrices.toJsonTree((BadgePatchPrices)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: BadgePatchPrices, BadgePatchProcess"); + } + + @Override + public BadgePatchRequest read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize BadgePatchProcess + try { + // validate the JSON object to see if any exception is thrown + BadgePatchProcess.validateJsonElement(jsonElement); + actualAdapter = adapterBadgePatchProcess; + BadgePatchRequest ret = new BadgePatchRequest(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for BadgePatchProcess failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'BadgePatchProcess'", e); + } + // deserialize BadgePatchPrices + try { + // validate the JSON object to see if any exception is thrown + BadgePatchPrices.validateJsonElement(jsonElement); + actualAdapter = adapterBadgePatchPrices; + BadgePatchRequest ret = new BadgePatchRequest(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for BadgePatchPrices failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'BadgePatchPrices'", e); + } + + throw new IOException(String.format("Failed deserialization for BadgePatchRequest: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public BadgePatchRequest() { + super("anyOf", Boolean.FALSE); + } + + public BadgePatchRequest(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BadgePatchProcess", BadgePatchProcess.class); + schemas.put("BadgePatchPrices", BadgePatchPrices.class); + } + + @Override + public Map> getSchemas() { + return BadgePatchRequest.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * BadgePatchPrices, BadgePatchProcess + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof BadgePatchProcess) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof BadgePatchPrices) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BadgePatchPrices, BadgePatchProcess"); + } + + /** + * Get the actual instance, which can be the following: + * BadgePatchPrices, BadgePatchProcess + * + * @return The actual instance (BadgePatchPrices, BadgePatchProcess) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `BadgePatchProcess`. If the actual instance is not `BadgePatchProcess`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BadgePatchProcess` + * @throws ClassCastException if the instance is not `BadgePatchProcess` + */ + public BadgePatchProcess getBadgePatchProcess() throws ClassCastException { + return (BadgePatchProcess)super.getActualInstance(); + } + + /** + * Get the actual instance of `BadgePatchPrices`. If the actual instance is not `BadgePatchPrices`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BadgePatchPrices` + * @throws ClassCastException if the instance is not `BadgePatchPrices` + */ + public BadgePatchPrices getBadgePatchPrices() throws ClassCastException { + return (BadgePatchPrices)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgePatchRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with BadgePatchProcess + try { + BadgePatchProcess.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for BadgePatchProcess failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with BadgePatchPrices + try { + BadgePatchPrices.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for BadgePatchPrices failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for BadgePatchRequest with anyOf schemas: BadgePatchPrices, BadgePatchProcess. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of BadgePatchRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgePatchRequest + * @throws IOException if the JSON string is invalid with respect to BadgePatchRequest + */ + public static BadgePatchRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgePatchRequest.class); + } + + /** + * Convert an instance of BadgePatchRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgePrices.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgePrices.java new file mode 100644 index 0000000..815740d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgePrices.java @@ -0,0 +1,284 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.BadgeApplicationBargainPrice; +import pl.wtx.allegro.api.client.model.BadgeMarketPrice; +import pl.wtx.allegro.api.client.model.BadgeSubsidyPrices; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Provided for DISCOUNT and SOURCING campaigns. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgePrices { + public static final String SERIALIZED_NAME_MARKET = "market"; + @SerializedName(SERIALIZED_NAME_MARKET) + @javax.annotation.Nullable + private BadgeMarketPrice market; + + public static final String SERIALIZED_NAME_BARGAIN = "bargain"; + @SerializedName(SERIALIZED_NAME_BARGAIN) + @javax.annotation.Nullable + private BadgeApplicationBargainPrice bargain; + + public static final String SERIALIZED_NAME_SUBSIDY = "subsidy"; + @SerializedName(SERIALIZED_NAME_SUBSIDY) + @javax.annotation.Nullable + private BadgeSubsidyPrices subsidy; + + public BadgePrices() { + } + + public BadgePrices market(@javax.annotation.Nullable BadgeMarketPrice market) { + this.market = market; + return this; + } + + /** + * Get market + * @return market + */ + @javax.annotation.Nullable + public BadgeMarketPrice getMarket() { + return market; + } + + public void setMarket(@javax.annotation.Nullable BadgeMarketPrice market) { + this.market = market; + } + + + public BadgePrices bargain(@javax.annotation.Nullable BadgeApplicationBargainPrice bargain) { + this.bargain = bargain; + return this; + } + + /** + * Get bargain + * @return bargain + */ + @javax.annotation.Nullable + public BadgeApplicationBargainPrice getBargain() { + return bargain; + } + + public void setBargain(@javax.annotation.Nullable BadgeApplicationBargainPrice bargain) { + this.bargain = bargain; + } + + + public BadgePrices subsidy(@javax.annotation.Nullable BadgeSubsidyPrices subsidy) { + this.subsidy = subsidy; + return this; + } + + /** + * Get subsidy + * @return subsidy + */ + @javax.annotation.Nullable + public BadgeSubsidyPrices getSubsidy() { + return subsidy; + } + + public void setSubsidy(@javax.annotation.Nullable BadgeSubsidyPrices subsidy) { + this.subsidy = subsidy; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgePrices badgePrices = (BadgePrices) o; + return Objects.equals(this.market, badgePrices.market) && + Objects.equals(this.bargain, badgePrices.bargain) && + Objects.equals(this.subsidy, badgePrices.subsidy); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(market, bargain, subsidy); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgePrices {\n"); + sb.append(" market: ").append(toIndentedString(market)).append("\n"); + sb.append(" bargain: ").append(toIndentedString(bargain)).append("\n"); + sb.append(" subsidy: ").append(toIndentedString(subsidy)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("market"); + openapiFields.add("bargain"); + openapiFields.add("subsidy"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgePrices + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgePrices.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgePrices is not found in the empty JSON string", BadgePrices.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgePrices.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgePrices` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `market` + if (jsonObj.get("market") != null && !jsonObj.get("market").isJsonNull()) { + BadgeMarketPrice.validateJsonElement(jsonObj.get("market")); + } + // validate the optional field `bargain` + if (jsonObj.get("bargain") != null && !jsonObj.get("bargain").isJsonNull()) { + BadgeApplicationBargainPrice.validateJsonElement(jsonObj.get("bargain")); + } + // validate the optional field `subsidy` + if (jsonObj.get("subsidy") != null && !jsonObj.get("subsidy").isJsonNull()) { + BadgeSubsidyPrices.validateJsonElement(jsonObj.get("subsidy")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgePrices.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgePrices' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgePrices.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgePrices value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgePrices read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgePrices given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgePrices + * @throws IOException if the JSON string is invalid with respect to BadgePrices + */ + public static BadgePrices fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgePrices.class); + } + + /** + * Convert an instance of BadgePrices to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeProcess.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeProcess.java new file mode 100644 index 0000000..6868dd1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeProcess.java @@ -0,0 +1,323 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BadgeApplicationRejectionReason; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about badge processing. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeProcess { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + IN_VERIFICATION("IN_VERIFICATION"), + + WAITING_FOR_PUBLICATION("WAITING_FOR_PUBLICATION"), + + ACTIVE("ACTIVE"), + + FINISHED("FINISHED"), + + DECLINED("DECLINED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public static final String SERIALIZED_NAME_REJECTION_REASONS = "rejectionReasons"; + @SerializedName(SERIALIZED_NAME_REJECTION_REASONS) + @javax.annotation.Nonnull + private List rejectionReasons = new ArrayList<>(); + + public BadgeProcess() { + } + + public BadgeProcess status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + public BadgeProcess rejectionReasons(@javax.annotation.Nonnull List rejectionReasons) { + this.rejectionReasons = rejectionReasons; + return this; + } + + public BadgeProcess addRejectionReasonsItem(BadgeApplicationRejectionReason rejectionReasonsItem) { + if (this.rejectionReasons == null) { + this.rejectionReasons = new ArrayList<>(); + } + this.rejectionReasons.add(rejectionReasonsItem); + return this; + } + + /** + * A list of messages with rejection reasons. Returned for process.status = DECLINED only. + * @return rejectionReasons + */ + @javax.annotation.Nonnull + public List getRejectionReasons() { + return rejectionReasons; + } + + public void setRejectionReasons(@javax.annotation.Nonnull List rejectionReasons) { + this.rejectionReasons = rejectionReasons; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeProcess badgeProcess = (BadgeProcess) o; + return Objects.equals(this.status, badgeProcess.status) && + Objects.equals(this.rejectionReasons, badgeProcess.rejectionReasons); + } + + @Override + public int hashCode() { + return Objects.hash(status, rejectionReasons); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeProcess {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" rejectionReasons: ").append(toIndentedString(rejectionReasons)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("rejectionReasons"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("rejectionReasons"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeProcess + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeProcess.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeProcess is not found in the empty JSON string", BadgeProcess.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeProcess.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeProcess` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgeProcess.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + // ensure the json data is an array + if (!jsonObj.get("rejectionReasons").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rejectionReasons` to be an array in the JSON string but got `%s`", jsonObj.get("rejectionReasons").toString())); + } + + JsonArray jsonArrayrejectionReasons = jsonObj.getAsJsonArray("rejectionReasons"); + // validate the required field `rejectionReasons` (array) + for (int i = 0; i < jsonArrayrejectionReasons.size(); i++) { + BadgeApplicationRejectionReason.validateJsonElement(jsonArrayrejectionReasons.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeProcess.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeProcess' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeProcess.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeProcess value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeProcess read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeProcess given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeProcess + * @throws IOException if the JSON string is invalid with respect to BadgeProcess + */ + public static BadgeProcess fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeProcess.class); + } + + /** + * Convert an instance of BadgeProcess to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgePublicationTimePolicy.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgePublicationTimePolicy.java new file mode 100644 index 0000000..92906b6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgePublicationTimePolicy.java @@ -0,0 +1,346 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Time period when the badge is displayed on the list of offers or on the offer page. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgePublicationTimePolicy { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ALWAYS("ALWAYS"), + + SINCE("SINCE"), + + WITHIN("WITHIN"), + + UNTIL("UNTIL"), + + NEVER("NEVER"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private String to; + + public BadgePublicationTimePolicy() { + } + + public BadgePublicationTimePolicy type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public BadgePublicationTimePolicy from(@javax.annotation.Nullable String from) { + this.from = from; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return from + */ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable String from) { + this.from = from; + } + + + public BadgePublicationTimePolicy to(@javax.annotation.Nullable String to) { + this.to = to; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return to + */ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable String to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgePublicationTimePolicy badgePublicationTimePolicy = (BadgePublicationTimePolicy) o; + return Objects.equals(this.type, badgePublicationTimePolicy.type) && + Objects.equals(this.from, badgePublicationTimePolicy.from) && + Objects.equals(this.to, badgePublicationTimePolicy.to); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, from, to); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgePublicationTimePolicy {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgePublicationTimePolicy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgePublicationTimePolicy.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgePublicationTimePolicy is not found in the empty JSON string", BadgePublicationTimePolicy.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgePublicationTimePolicy.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgePublicationTimePolicy` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgePublicationTimePolicy.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgePublicationTimePolicy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgePublicationTimePolicy' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgePublicationTimePolicy.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgePublicationTimePolicy value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgePublicationTimePolicy read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgePublicationTimePolicy given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgePublicationTimePolicy + * @throws IOException if the JSON string is invalid with respect to BadgePublicationTimePolicy + */ + public static BadgePublicationTimePolicy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgePublicationTimePolicy.class); + } + + /** + * Convert an instance of BadgePublicationTimePolicy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgeSubsidyPrices.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgeSubsidyPrices.java new file mode 100644 index 0000000..9270558 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgeSubsidyPrices.java @@ -0,0 +1,240 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BadgeApplicationSubsidySellerPrice; +import pl.wtx.allegro.api.client.model.BadgeApplicationSubsidyTargetPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Prices that relate to the price reconciliation. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgeSubsidyPrices { + public static final String SERIALIZED_NAME_TARGET_PRICE = "targetPrice"; + @SerializedName(SERIALIZED_NAME_TARGET_PRICE) + @javax.annotation.Nullable + private BadgeApplicationSubsidyTargetPrice targetPrice; + + public static final String SERIALIZED_NAME_SELLER_PRICE = "sellerPrice"; + @SerializedName(SERIALIZED_NAME_SELLER_PRICE) + @javax.annotation.Nullable + private BadgeApplicationSubsidySellerPrice sellerPrice; + + public BadgeSubsidyPrices() { + } + + public BadgeSubsidyPrices targetPrice(@javax.annotation.Nullable BadgeApplicationSubsidyTargetPrice targetPrice) { + this.targetPrice = targetPrice; + return this; + } + + /** + * Get targetPrice + * @return targetPrice + */ + @javax.annotation.Nullable + public BadgeApplicationSubsidyTargetPrice getTargetPrice() { + return targetPrice; + } + + public void setTargetPrice(@javax.annotation.Nullable BadgeApplicationSubsidyTargetPrice targetPrice) { + this.targetPrice = targetPrice; + } + + + public BadgeSubsidyPrices sellerPrice(@javax.annotation.Nullable BadgeApplicationSubsidySellerPrice sellerPrice) { + this.sellerPrice = sellerPrice; + return this; + } + + /** + * Get sellerPrice + * @return sellerPrice + */ + @javax.annotation.Nullable + public BadgeApplicationSubsidySellerPrice getSellerPrice() { + return sellerPrice; + } + + public void setSellerPrice(@javax.annotation.Nullable BadgeApplicationSubsidySellerPrice sellerPrice) { + this.sellerPrice = sellerPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgeSubsidyPrices badgeSubsidyPrices = (BadgeSubsidyPrices) o; + return Objects.equals(this.targetPrice, badgeSubsidyPrices.targetPrice) && + Objects.equals(this.sellerPrice, badgeSubsidyPrices.sellerPrice); + } + + @Override + public int hashCode() { + return Objects.hash(targetPrice, sellerPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgeSubsidyPrices {\n"); + sb.append(" targetPrice: ").append(toIndentedString(targetPrice)).append("\n"); + sb.append(" sellerPrice: ").append(toIndentedString(sellerPrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("targetPrice"); + openapiFields.add("sellerPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgeSubsidyPrices + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgeSubsidyPrices.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgeSubsidyPrices is not found in the empty JSON string", BadgeSubsidyPrices.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgeSubsidyPrices.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgeSubsidyPrices` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `targetPrice` + if (jsonObj.get("targetPrice") != null && !jsonObj.get("targetPrice").isJsonNull()) { + BadgeApplicationSubsidyTargetPrice.validateJsonElement(jsonObj.get("targetPrice")); + } + // validate the optional field `sellerPrice` + if (jsonObj.get("sellerPrice") != null && !jsonObj.get("sellerPrice").isJsonNull()) { + BadgeApplicationSubsidySellerPrice.validateJsonElement(jsonObj.get("sellerPrice")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgeSubsidyPrices.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgeSubsidyPrices' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgeSubsidyPrices.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgeSubsidyPrices value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgeSubsidyPrices read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgeSubsidyPrices given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgeSubsidyPrices + * @throws IOException if the JSON string is invalid with respect to BadgeSubsidyPrices + */ + public static BadgeSubsidyPrices fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgeSubsidyPrices.class); + } + + /** + * Convert an instance of BadgeSubsidyPrices to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BadgesList.java b/src/main/java/pl/wtx/allegro/api/client/model/BadgesList.java new file mode 100644 index 0000000..e5cdb0a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BadgesList.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Badge; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * List of badges + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BadgesList { + public static final String SERIALIZED_NAME_BADGES = "badges"; + @SerializedName(SERIALIZED_NAME_BADGES) + @javax.annotation.Nonnull + private List badges = new ArrayList<>(); + + public BadgesList() { + } + + public BadgesList badges(@javax.annotation.Nonnull List badges) { + this.badges = badges; + return this; + } + + public BadgesList addBadgesItem(Badge badgesItem) { + if (this.badges == null) { + this.badges = new ArrayList<>(); + } + this.badges.add(badgesItem); + return this; + } + + /** + * Get badges + * @return badges + */ + @javax.annotation.Nonnull + public List getBadges() { + return badges; + } + + public void setBadges(@javax.annotation.Nonnull List badges) { + this.badges = badges; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BadgesList badgesList = (BadgesList) o; + return Objects.equals(this.badges, badgesList.badges); + } + + @Override + public int hashCode() { + return Objects.hash(badges); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BadgesList {\n"); + sb.append(" badges: ").append(toIndentedString(badges)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("badges"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("badges"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BadgesList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BadgesList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BadgesList is not found in the empty JSON string", BadgesList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BadgesList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BadgesList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BadgesList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("badges").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `badges` to be an array in the JSON string but got `%s`", jsonObj.get("badges").toString())); + } + + JsonArray jsonArraybadges = jsonObj.getAsJsonArray("badges"); + // validate the required field `badges` (array) + for (int i = 0; i < jsonArraybadges.size(); i++) { + Badge.validateJsonElement(jsonArraybadges.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BadgesList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BadgesList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BadgesList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BadgesList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BadgesList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BadgesList given an JSON string + * + * @param jsonString JSON string + * @return An instance of BadgesList + * @throws IOException if the JSON string is invalid with respect to BadgesList + */ + public static BadgesList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BadgesList.class); + } + + /** + * Convert an instance of BadgesList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BaseOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/BaseOperation.java new file mode 100644 index 0000000..a4fb8df --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BaseOperation.java @@ -0,0 +1,417 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BaseOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + /** + * The group to which the given operation type belongs. + */ + @JsonAdapter(GroupEnum.Adapter.class) + public enum GroupEnum { + INCOME("INCOME"), + + OUTCOME("OUTCOME"), + + REFUND("REFUND"), + + BLOCKADES("BLOCKADES"); + + private String value; + + GroupEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static GroupEnum fromValue(String value) { + for (GroupEnum b : GroupEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final GroupEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public GroupEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return GroupEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + GroupEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_GROUP = "group"; + @SerializedName(SERIALIZED_NAME_GROUP) + @javax.annotation.Nonnull + private GroupEnum group; + + public static final String SERIALIZED_NAME_WALLET = "wallet"; + @SerializedName(SERIALIZED_NAME_WALLET) + @javax.annotation.Nonnull + private Wallet wallet; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private OperationValue value; + + public static final String SERIALIZED_NAME_OCCURRED_AT = "occurredAt"; + @SerializedName(SERIALIZED_NAME_OCCURRED_AT) + @javax.annotation.Nonnull + private OffsetDateTime occurredAt; + + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + public BaseOperation() { + this.type = this.getClass().getSimpleName(); + } + + public BaseOperation type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Type of the operation. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public BaseOperation group(@javax.annotation.Nonnull GroupEnum group) { + this.group = group; + return this; + } + + /** + * The group to which the given operation type belongs. + * @return group + */ + @javax.annotation.Nonnull + public GroupEnum getGroup() { + return group; + } + + public void setGroup(@javax.annotation.Nonnull GroupEnum group) { + this.group = group; + } + + + public BaseOperation wallet(@javax.annotation.Nonnull Wallet wallet) { + this.wallet = wallet; + return this; + } + + /** + * Get wallet + * @return wallet + */ + @javax.annotation.Nonnull + public Wallet getWallet() { + return wallet; + } + + public void setWallet(@javax.annotation.Nonnull Wallet wallet) { + this.wallet = wallet; + } + + + public BaseOperation value(@javax.annotation.Nonnull OperationValue value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + public OperationValue getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull OperationValue value) { + this.value = value; + } + + + public BaseOperation occurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + /** + * Date and time of the operation in ISO 8601 format. + * @return occurredAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getOccurredAt() { + return occurredAt; + } + + public void setOccurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + } + + + public BaseOperation marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * The marketplace ID where operation was made. Value may be `null` for operations not assigned to any marketplace. + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BaseOperation baseOperation = (BaseOperation) o; + return Objects.equals(this.type, baseOperation.type) && + Objects.equals(this.group, baseOperation.group) && + Objects.equals(this.wallet, baseOperation.wallet) && + Objects.equals(this.value, baseOperation.value) && + Objects.equals(this.occurredAt, baseOperation.occurredAt) && + Objects.equals(this.marketplaceId, baseOperation.marketplaceId); + } + + @Override + public int hashCode() { + return Objects.hash(type, group, wallet, value, occurredAt, marketplaceId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseOperation {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" group: ").append(toIndentedString(group)).append("\n"); + sb.append(" wallet: ").append(toIndentedString(wallet)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" occurredAt: ").append(toIndentedString(occurredAt)).append("\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BaseOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BaseOperation is not found in the empty JSON string", BaseOperation.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "BLOCKADE": + BlockadeOperation.validateJsonElement(jsonElement); + break; + case "BLOCKADE_RELEASE": + BlockadeReleaseOperation.validateJsonElement(jsonElement); + break; + case "COMPENSATION": + CompensationOperation.validateJsonElement(jsonElement); + break; + case "CONTRIBUTION": + ContributionOperation.validateJsonElement(jsonElement); + break; + case "CORRECTION": + CorrectionOperation.validateJsonElement(jsonElement); + break; + case "DEDUCTION_CHARGE": + DeductionChargeOperation.validateJsonElement(jsonElement); + break; + case "DEDUCTION_INCREASE": + DeductionIncreaseOperation.validateJsonElement(jsonElement); + break; + case "PAYOUT": + PayoutOperation.validateJsonElement(jsonElement); + break; + case "PAYOUT_CANCEL": + PayoutOperationCancel.validateJsonElement(jsonElement); + break; + case "PROVIDER_REFUND_TRANSFER_CHARGE": + ProviderRefundTransferChargeOperation.validateJsonElement(jsonElement); + break; + case "PROVIDER_REFUND_TRANSFER_INCREASE": + ProviderRefundTransferIncreaseOperation.validateJsonElement(jsonElement); + break; + case "REFUND_CANCEL": + RefundCancelOperation.validateJsonElement(jsonElement); + break; + case "REFUND_CHARGE": + RefundChargeOperation.validateJsonElement(jsonElement); + break; + case "REFUND_INCREASE": + RefundIncreaseOperation.validateJsonElement(jsonElement); + break; + case "SURCHARGE": + SurchargeOperation.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of BaseOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseOperation + * @throws IOException if the JSON string is invalid with respect to BaseOperation + */ + public static BaseOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseOperation.class); + } + + /** + * Convert an instance of BaseOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BaseSaleProductResponseDto.java b/src/main/java/pl/wtx/allegro/api/client/model/BaseSaleProductResponseDto.java new file mode 100644 index 0000000..4d843bd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BaseSaleProductResponseDto.java @@ -0,0 +1,604 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AiCoCreatedContent; +import pl.wtx.allegro.api.client.model.ImageUrl; +import pl.wtx.allegro.api.client.model.ProductCategoryWithPath; +import pl.wtx.allegro.api.client.model.ProductParameterDto; +import pl.wtx.allegro.api.client.model.ProductSafetyDto; +import pl.wtx.allegro.api.client.model.SaleProductDtoPublication; +import pl.wtx.allegro.api.client.model.StandardizedDescription; +import pl.wtx.allegro.api.client.model.TrustedContent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BaseSaleProductResponseDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BaseSaleProductResponseDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private StandardizedDescription description; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nonnull + private ProductCategoryWithPath category; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_IS_DRAFT = "isDraft"; + @SerializedName(SERIALIZED_NAME_IS_DRAFT) + @javax.annotation.Nullable + private Boolean isDraft; + + public static final String SERIALIZED_NAME_AI_CO_CREATED_CONTENT = "aiCoCreatedContent"; + @SerializedName(SERIALIZED_NAME_AI_CO_CREATED_CONTENT) + @javax.annotation.Nullable + private AiCoCreatedContent aiCoCreatedContent; + + public static final String SERIALIZED_NAME_TRUSTED_CONTENT = "trustedContent"; + @SerializedName(SERIALIZED_NAME_TRUSTED_CONTENT) + @javax.annotation.Nullable + private TrustedContent trustedContent; + + public static final String SERIALIZED_NAME_HAS_PROTECTED_BRAND = "hasProtectedBrand"; + @SerializedName(SERIALIZED_NAME_HAS_PROTECTED_BRAND) + @javax.annotation.Nullable + private Boolean hasProtectedBrand; + + public static final String SERIALIZED_NAME_PRODUCT_SAFETY = "productSafety"; + @SerializedName(SERIALIZED_NAME_PRODUCT_SAFETY) + @javax.annotation.Nullable + private ProductSafetyDto productSafety; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private SaleProductDtoPublication publication; + + public BaseSaleProductResponseDto() { + } + + public BaseSaleProductResponseDto id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public BaseSaleProductResponseDto name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Name of the product. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public BaseSaleProductResponseDto description(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public StandardizedDescription getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + } + + + public BaseSaleProductResponseDto category(@javax.annotation.Nonnull ProductCategoryWithPath category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nonnull + public ProductCategoryWithPath getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nonnull ProductCategoryWithPath category) { + this.category = category; + } + + + public BaseSaleProductResponseDto images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public BaseSaleProductResponseDto addImagesItem(ImageUrl imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * Get images + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public BaseSaleProductResponseDto parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public BaseSaleProductResponseDto addParametersItem(ProductParameterDto parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Get parameters + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public BaseSaleProductResponseDto isDraft(@javax.annotation.Nullable Boolean isDraft) { + this.isDraft = isDraft; + return this; + } + + /** + * Flag that informs if product is waiting for resolution of basic parameters change proposal. + * @return isDraft + */ + @javax.annotation.Nullable + public Boolean getIsDraft() { + return isDraft; + } + + public void setIsDraft(@javax.annotation.Nullable Boolean isDraft) { + this.isDraft = isDraft; + } + + + public BaseSaleProductResponseDto aiCoCreatedContent(@javax.annotation.Nullable AiCoCreatedContent aiCoCreatedContent) { + this.aiCoCreatedContent = aiCoCreatedContent; + return this; + } + + /** + * Get aiCoCreatedContent + * @return aiCoCreatedContent + */ + @javax.annotation.Nullable + public AiCoCreatedContent getAiCoCreatedContent() { + return aiCoCreatedContent; + } + + public void setAiCoCreatedContent(@javax.annotation.Nullable AiCoCreatedContent aiCoCreatedContent) { + this.aiCoCreatedContent = aiCoCreatedContent; + } + + + public BaseSaleProductResponseDto trustedContent(@javax.annotation.Nullable TrustedContent trustedContent) { + this.trustedContent = trustedContent; + return this; + } + + /** + * Get trustedContent + * @return trustedContent + */ + @javax.annotation.Nullable + public TrustedContent getTrustedContent() { + return trustedContent; + } + + public void setTrustedContent(@javax.annotation.Nullable TrustedContent trustedContent) { + this.trustedContent = trustedContent; + } + + + public BaseSaleProductResponseDto hasProtectedBrand(@javax.annotation.Nullable Boolean hasProtectedBrand) { + this.hasProtectedBrand = hasProtectedBrand; + return this; + } + + /** + * Flag that informs if product is a part of a protected brand's assortment and its use may be restricted. + * @return hasProtectedBrand + */ + @javax.annotation.Nullable + public Boolean getHasProtectedBrand() { + return hasProtectedBrand; + } + + public void setHasProtectedBrand(@javax.annotation.Nullable Boolean hasProtectedBrand) { + this.hasProtectedBrand = hasProtectedBrand; + } + + + public BaseSaleProductResponseDto productSafety(@javax.annotation.Nullable ProductSafetyDto productSafety) { + this.productSafety = productSafety; + return this; + } + + /** + * Get productSafety + * @return productSafety + */ + @javax.annotation.Nullable + public ProductSafetyDto getProductSafety() { + return productSafety; + } + + public void setProductSafety(@javax.annotation.Nullable ProductSafetyDto productSafety) { + this.productSafety = productSafety; + } + + + public BaseSaleProductResponseDto publication(@javax.annotation.Nullable SaleProductDtoPublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public SaleProductDtoPublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable SaleProductDtoPublication publication) { + this.publication = publication; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BaseSaleProductResponseDto baseSaleProductResponseDto = (BaseSaleProductResponseDto) o; + return Objects.equals(this.id, baseSaleProductResponseDto.id) && + Objects.equals(this.name, baseSaleProductResponseDto.name) && + Objects.equals(this.description, baseSaleProductResponseDto.description) && + Objects.equals(this.category, baseSaleProductResponseDto.category) && + Objects.equals(this.images, baseSaleProductResponseDto.images) && + Objects.equals(this.parameters, baseSaleProductResponseDto.parameters) && + Objects.equals(this.isDraft, baseSaleProductResponseDto.isDraft) && + Objects.equals(this.aiCoCreatedContent, baseSaleProductResponseDto.aiCoCreatedContent) && + Objects.equals(this.trustedContent, baseSaleProductResponseDto.trustedContent) && + Objects.equals(this.hasProtectedBrand, baseSaleProductResponseDto.hasProtectedBrand) && + Objects.equals(this.productSafety, baseSaleProductResponseDto.productSafety) && + Objects.equals(this.publication, baseSaleProductResponseDto.publication); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, category, images, parameters, isDraft, aiCoCreatedContent, trustedContent, hasProtectedBrand, productSafety, publication); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseSaleProductResponseDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" isDraft: ").append(toIndentedString(isDraft)).append("\n"); + sb.append(" aiCoCreatedContent: ").append(toIndentedString(aiCoCreatedContent)).append("\n"); + sb.append(" trustedContent: ").append(toIndentedString(trustedContent)).append("\n"); + sb.append(" hasProtectedBrand: ").append(toIndentedString(hasProtectedBrand)).append("\n"); + sb.append(" productSafety: ").append(toIndentedString(productSafety)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("category"); + openapiFields.add("images"); + openapiFields.add("parameters"); + openapiFields.add("isDraft"); + openapiFields.add("aiCoCreatedContent"); + openapiFields.add("trustedContent"); + openapiFields.add("hasProtectedBrand"); + openapiFields.add("productSafety"); + openapiFields.add("publication"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("category"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BaseSaleProductResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseSaleProductResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BaseSaleProductResponseDto is not found in the empty JSON string", BaseSaleProductResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BaseSaleProductResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BaseSaleProductResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BaseSaleProductResponseDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + StandardizedDescription.validateJsonElement(jsonObj.get("description")); + } + // validate the required field `category` + ProductCategoryWithPath.validateJsonElement(jsonObj.get("category")); + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull()) { + JsonArray jsonArrayimages = jsonObj.getAsJsonArray("images"); + if (jsonArrayimages != null) { + // ensure the json data is an array + if (!jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + + // validate the optional field `images` (array) + for (int i = 0; i < jsonArrayimages.size(); i++) { + ImageUrl.validateJsonElement(jsonArrayimages.get(i)); + }; + } + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ProductParameterDto.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + // validate the optional field `aiCoCreatedContent` + if (jsonObj.get("aiCoCreatedContent") != null && !jsonObj.get("aiCoCreatedContent").isJsonNull()) { + AiCoCreatedContent.validateJsonElement(jsonObj.get("aiCoCreatedContent")); + } + // validate the optional field `trustedContent` + if (jsonObj.get("trustedContent") != null && !jsonObj.get("trustedContent").isJsonNull()) { + TrustedContent.validateJsonElement(jsonObj.get("trustedContent")); + } + // validate the optional field `productSafety` + if (jsonObj.get("productSafety") != null && !jsonObj.get("productSafety").isJsonNull()) { + ProductSafetyDto.validateJsonElement(jsonObj.get("productSafety")); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + SaleProductDtoPublication.validateJsonElement(jsonObj.get("publication")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BaseSaleProductResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseSaleProductResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseSaleProductResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseSaleProductResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BaseSaleProductResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BaseSaleProductResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseSaleProductResponseDto + * @throws IOException if the JSON string is invalid with respect to BaseSaleProductResponseDto + */ + public static BaseSaleProductResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseSaleProductResponseDto.class); + } + + /** + * Convert an instance of BaseSaleProductResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BasicDefinitionResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/BasicDefinitionResponse.java new file mode 100644 index 0000000..c638bd0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BasicDefinitionResponse.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BasicDefinitionResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BasicDefinitionResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public BasicDefinitionResponse() { + } + + public BasicDefinitionResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of an additional service definition. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BasicDefinitionResponse basicDefinitionResponse = (BasicDefinitionResponse) o; + return Objects.equals(this.id, basicDefinitionResponse.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BasicDefinitionResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BasicDefinitionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BasicDefinitionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BasicDefinitionResponse is not found in the empty JSON string", BasicDefinitionResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BasicDefinitionResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BasicDefinitionResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BasicDefinitionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BasicDefinitionResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BasicDefinitionResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BasicDefinitionResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BasicDefinitionResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BasicDefinitionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BasicDefinitionResponse + * @throws IOException if the JSON string is invalid with respect to BasicDefinitionResponse + */ + public static BasicDefinitionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BasicDefinitionResponse.class); + } + + /** + * Convert an instance of BasicDefinitionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Benefit.java b/src/main/java/pl/wtx/allegro/api/client/model/Benefit.java new file mode 100644 index 0000000..e96d062 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Benefit.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BenefitSpecification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Benefit + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Benefit { + public static final String SERIALIZED_NAME_SPECIFICATION = "specification"; + @SerializedName(SERIALIZED_NAME_SPECIFICATION) + @javax.annotation.Nonnull + private BenefitSpecification specification; + + public Benefit() { + } + + public Benefit specification(@javax.annotation.Nonnull BenefitSpecification specification) { + this.specification = specification; + return this; + } + + /** + * Get specification + * @return specification + */ + @javax.annotation.Nonnull + public BenefitSpecification getSpecification() { + return specification; + } + + public void setSpecification(@javax.annotation.Nonnull BenefitSpecification specification) { + this.specification = specification; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Benefit benefit = (Benefit) o; + return Objects.equals(this.specification, benefit.specification); + } + + @Override + public int hashCode() { + return Objects.hash(specification); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Benefit {\n"); + sb.append(" specification: ").append(toIndentedString(specification)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("specification"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("specification"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Benefit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Benefit.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Benefit is not found in the empty JSON string", Benefit.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Benefit.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Benefit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Benefit.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `specification` + BenefitSpecification.validateJsonElement(jsonObj.get("specification")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Benefit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Benefit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Benefit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Benefit value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Benefit read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Benefit given an JSON string + * + * @param jsonString JSON string + * @return An instance of Benefit + * @throws IOException if the JSON string is invalid with respect to Benefit + */ + public static Benefit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Benefit.class); + } + + /** + * Convert an instance of Benefit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BenefitSpecification.java b/src/main/java/pl/wtx/allegro/api/client/model/BenefitSpecification.java new file mode 100644 index 0000000..a60b24f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BenefitSpecification.java @@ -0,0 +1,183 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * One of: LargeOrderDiscountBenefitSpecification, WholesalePriceListBenefitSpecification, MultiPackBenefitSpecification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BenefitSpecification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + public BenefitSpecification() { + this.type = this.getClass().getSimpleName(); + } + + public BenefitSpecification type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Type of benefit. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BenefitSpecification benefitSpecification = (BenefitSpecification) o; + return Objects.equals(this.type, benefitSpecification.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BenefitSpecification {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BenefitSpecification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BenefitSpecification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BenefitSpecification is not found in the empty JSON string", BenefitSpecification.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "LARGE_ORDER_DISCOUNT": + LargeOrderDiscountBenefitSpecification.validateJsonElement(jsonElement); + break; + case "UNIT_PERCENTAGE_DISCOUNT": + MultiPackBenefitSpecification.validateJsonElement(jsonElement); + break; + case "WHOLESALE_PRICE_LIST": + WholesalePriceListBenefitSpecification.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of BenefitSpecification given an JSON string + * + * @param jsonString JSON string + * @return An instance of BenefitSpecification + * @throws IOException if the JSON string is invalid with respect to BenefitSpecification + */ + public static BenefitSpecification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BenefitSpecification.class); + } + + /** + * Convert an instance of BenefitSpecification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BidRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/BidRequest.java new file mode 100644 index 0000000..58e35c4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BidRequest.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.MaxPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The bid request. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BidRequest { + public static final String SERIALIZED_NAME_MAX_AMOUNT = "maxAmount"; + @SerializedName(SERIALIZED_NAME_MAX_AMOUNT) + @javax.annotation.Nonnull + private MaxPrice maxAmount; + + public BidRequest() { + } + + public BidRequest maxAmount(@javax.annotation.Nonnull MaxPrice maxAmount) { + this.maxAmount = maxAmount; + return this; + } + + /** + * Get maxAmount + * @return maxAmount + */ + @javax.annotation.Nonnull + public MaxPrice getMaxAmount() { + return maxAmount; + } + + public void setMaxAmount(@javax.annotation.Nonnull MaxPrice maxAmount) { + this.maxAmount = maxAmount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BidRequest bidRequest = (BidRequest) o; + return Objects.equals(this.maxAmount, bidRequest.maxAmount); + } + + @Override + public int hashCode() { + return Objects.hash(maxAmount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BidRequest {\n"); + sb.append(" maxAmount: ").append(toIndentedString(maxAmount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("maxAmount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("maxAmount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BidRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BidRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BidRequest is not found in the empty JSON string", BidRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BidRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BidRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BidRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `maxAmount` + MaxPrice.validateJsonElement(jsonObj.get("maxAmount")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BidRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BidRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BidRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BidRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BidRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BidRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of BidRequest + * @throws IOException if the JSON string is invalid with respect to BidRequest + */ + public static BidRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BidRequest.class); + } + + /** + * Convert an instance of BidRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BillingEntries.java b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntries.java new file mode 100644 index 0000000..dbddede --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntries.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BillingEntry; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BillingEntries + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BillingEntries { + public static final String SERIALIZED_NAME_BILLING_ENTRIES = "billingEntries"; + @SerializedName(SERIALIZED_NAME_BILLING_ENTRIES) + @javax.annotation.Nullable + private List billingEntries = new ArrayList<>(); + + public BillingEntries() { + } + + public BillingEntries billingEntries(@javax.annotation.Nullable List billingEntries) { + this.billingEntries = billingEntries; + return this; + } + + public BillingEntries addBillingEntriesItem(BillingEntry billingEntriesItem) { + if (this.billingEntries == null) { + this.billingEntries = new ArrayList<>(); + } + this.billingEntries.add(billingEntriesItem); + return this; + } + + /** + * List of billing types. + * @return billingEntries + */ + @javax.annotation.Nullable + public List getBillingEntries() { + return billingEntries; + } + + public void setBillingEntries(@javax.annotation.Nullable List billingEntries) { + this.billingEntries = billingEntries; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillingEntries billingEntries = (BillingEntries) o; + return Objects.equals(this.billingEntries, billingEntries.billingEntries); + } + + @Override + public int hashCode() { + return Objects.hash(billingEntries); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillingEntries {\n"); + sb.append(" billingEntries: ").append(toIndentedString(billingEntries)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("billingEntries"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillingEntries + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillingEntries.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillingEntries is not found in the empty JSON string", BillingEntries.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillingEntries.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingEntries` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("billingEntries") != null && !jsonObj.get("billingEntries").isJsonNull()) { + JsonArray jsonArraybillingEntries = jsonObj.getAsJsonArray("billingEntries"); + if (jsonArraybillingEntries != null) { + // ensure the json data is an array + if (!jsonObj.get("billingEntries").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `billingEntries` to be an array in the JSON string but got `%s`", jsonObj.get("billingEntries").toString())); + } + + // validate the optional field `billingEntries` (array) + for (int i = 0; i < jsonArraybillingEntries.size(); i++) { + BillingEntry.validateJsonElement(jsonArraybillingEntries.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillingEntries.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillingEntries' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillingEntries.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillingEntries value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillingEntries read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillingEntries given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillingEntries + * @throws IOException if the JSON string is invalid with respect to BillingEntries + */ + public static BillingEntries fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillingEntries.class); + } + + /** + * Convert an instance of BillingEntries to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BillingEntry.java b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntry.java new file mode 100644 index 0000000..4e0c267 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntry.java @@ -0,0 +1,479 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.BillingEntryAdditionalInfoInner; +import pl.wtx.allegro.api.client.model.BillingEntryBalance; +import pl.wtx.allegro.api.client.model.BillingEntryOffer; +import pl.wtx.allegro.api.client.model.BillingEntryOrder; +import pl.wtx.allegro.api.client.model.BillingEntryTax; +import pl.wtx.allegro.api.client.model.BillingEntryType; +import pl.wtx.allegro.api.client.model.BillingEntryValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BillingEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BillingEntry { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_OCCURRED_AT = "occurredAt"; + @SerializedName(SERIALIZED_NAME_OCCURRED_AT) + @javax.annotation.Nullable + private OffsetDateTime occurredAt; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private BillingEntryType type; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private BillingEntryOffer offer; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private BillingEntryValue value; + + public static final String SERIALIZED_NAME_TAX = "tax"; + @SerializedName(SERIALIZED_NAME_TAX) + @javax.annotation.Nullable + private BillingEntryTax tax; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + @javax.annotation.Nullable + private BillingEntryBalance balance; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + @javax.annotation.Nullable + private BillingEntryOrder order; + + public static final String SERIALIZED_NAME_ADDITIONAL_INFO = "additionalInfo"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFO) + @javax.annotation.Nullable + private List additionalInfo = new ArrayList<>(); + + public BillingEntry() { + } + + public BillingEntry id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * ID of the returned billing entry. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public BillingEntry occurredAt(@javax.annotation.Nullable OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + /** + * Date of billing entry. + * @return occurredAt + */ + @javax.annotation.Nullable + public OffsetDateTime getOccurredAt() { + return occurredAt; + } + + public void setOccurredAt(@javax.annotation.Nullable OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + } + + + public BillingEntry type(@javax.annotation.Nullable BillingEntryType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public BillingEntryType getType() { + return type; + } + + public void setType(@javax.annotation.Nullable BillingEntryType type) { + this.type = type; + } + + + public BillingEntry offer(@javax.annotation.Nullable BillingEntryOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public BillingEntryOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable BillingEntryOffer offer) { + this.offer = offer; + } + + + public BillingEntry value(@javax.annotation.Nullable BillingEntryValue value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public BillingEntryValue getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable BillingEntryValue value) { + this.value = value; + } + + + public BillingEntry tax(@javax.annotation.Nullable BillingEntryTax tax) { + this.tax = tax; + return this; + } + + /** + * Get tax + * @return tax + */ + @javax.annotation.Nullable + public BillingEntryTax getTax() { + return tax; + } + + public void setTax(@javax.annotation.Nullable BillingEntryTax tax) { + this.tax = tax; + } + + + public BillingEntry balance(@javax.annotation.Nullable BillingEntryBalance balance) { + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + */ + @javax.annotation.Nullable + public BillingEntryBalance getBalance() { + return balance; + } + + public void setBalance(@javax.annotation.Nullable BillingEntryBalance balance) { + this.balance = balance; + } + + + public BillingEntry order(@javax.annotation.Nullable BillingEntryOrder order) { + this.order = order; + return this; + } + + /** + * Get order + * @return order + */ + @javax.annotation.Nullable + public BillingEntryOrder getOrder() { + return order; + } + + public void setOrder(@javax.annotation.Nullable BillingEntryOrder order) { + this.order = order; + } + + + public BillingEntry additionalInfo(@javax.annotation.Nullable List additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + public BillingEntry addAdditionalInfoItem(BillingEntryAdditionalInfoInner additionalInfoItem) { + if (this.additionalInfo == null) { + this.additionalInfo = new ArrayList<>(); + } + this.additionalInfo.add(additionalInfoItem); + return this; + } + + /** + * Additional information associated with the returned billing entry. + * @return additionalInfo + */ + @javax.annotation.Nullable + public List getAdditionalInfo() { + return additionalInfo; + } + + public void setAdditionalInfo(@javax.annotation.Nullable List additionalInfo) { + this.additionalInfo = additionalInfo; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillingEntry billingEntry = (BillingEntry) o; + return Objects.equals(this.id, billingEntry.id) && + Objects.equals(this.occurredAt, billingEntry.occurredAt) && + Objects.equals(this.type, billingEntry.type) && + Objects.equals(this.offer, billingEntry.offer) && + Objects.equals(this.value, billingEntry.value) && + Objects.equals(this.tax, billingEntry.tax) && + Objects.equals(this.balance, billingEntry.balance) && + Objects.equals(this.order, billingEntry.order) && + Objects.equals(this.additionalInfo, billingEntry.additionalInfo); + } + + @Override + public int hashCode() { + return Objects.hash(id, occurredAt, type, offer, value, tax, balance, order, additionalInfo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillingEntry {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" occurredAt: ").append(toIndentedString(occurredAt)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" tax: ").append(toIndentedString(tax)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("offer"); + openapiFields.add("value"); + openapiFields.add("tax"); + openapiFields.add("balance"); + openapiFields.add("order"); + openapiFields.add("additionalInfo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillingEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillingEntry.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillingEntry is not found in the empty JSON string", BillingEntry.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillingEntry.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + BillingEntryType.validateJsonElement(jsonObj.get("type")); + } + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + BillingEntryOffer.validateJsonElement(jsonObj.get("offer")); + } + // validate the optional field `value` + if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { + BillingEntryValue.validateJsonElement(jsonObj.get("value")); + } + // validate the optional field `tax` + if (jsonObj.get("tax") != null && !jsonObj.get("tax").isJsonNull()) { + BillingEntryTax.validateJsonElement(jsonObj.get("tax")); + } + // validate the optional field `balance` + if (jsonObj.get("balance") != null && !jsonObj.get("balance").isJsonNull()) { + BillingEntryBalance.validateJsonElement(jsonObj.get("balance")); + } + // validate the optional field `order` + if (jsonObj.get("order") != null && !jsonObj.get("order").isJsonNull()) { + BillingEntryOrder.validateJsonElement(jsonObj.get("order")); + } + if (jsonObj.get("additionalInfo") != null && !jsonObj.get("additionalInfo").isJsonNull()) { + JsonArray jsonArrayadditionalInfo = jsonObj.getAsJsonArray("additionalInfo"); + if (jsonArrayadditionalInfo != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalInfo").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInfo` to be an array in the JSON string but got `%s`", jsonObj.get("additionalInfo").toString())); + } + + // validate the optional field `additionalInfo` (array) + for (int i = 0; i < jsonArrayadditionalInfo.size(); i++) { + BillingEntryAdditionalInfoInner.validateJsonElement(jsonArrayadditionalInfo.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillingEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillingEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillingEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillingEntry value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillingEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillingEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillingEntry + * @throws IOException if the JSON string is invalid with respect to BillingEntry + */ + public static BillingEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillingEntry.class); + } + + /** + * Convert an instance of BillingEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryAdditionalInfoInner.java b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryAdditionalInfoInner.java new file mode 100644 index 0000000..e8504bd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryAdditionalInfoInner.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BillingEntryAdditionalInfoInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BillingEntryAdditionalInfoInner { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public BillingEntryAdditionalInfoInner() { + } + + public BillingEntryAdditionalInfoInner type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * The technical key identifying the type of additional information. + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public BillingEntryAdditionalInfoInner name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The display name for the additional information type. This value is translated based on the \"Accept-Language\" header. By default a message in English is returned. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public BillingEntryAdditionalInfoInner value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * The actual value associated with the given additional information type. + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillingEntryAdditionalInfoInner billingEntryAdditionalInfoInner = (BillingEntryAdditionalInfoInner) o; + return Objects.equals(this.type, billingEntryAdditionalInfoInner.type) && + Objects.equals(this.name, billingEntryAdditionalInfoInner.name) && + Objects.equals(this.value, billingEntryAdditionalInfoInner.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillingEntryAdditionalInfoInner {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("name"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillingEntryAdditionalInfoInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillingEntryAdditionalInfoInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillingEntryAdditionalInfoInner is not found in the empty JSON string", BillingEntryAdditionalInfoInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillingEntryAdditionalInfoInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingEntryAdditionalInfoInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillingEntryAdditionalInfoInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillingEntryAdditionalInfoInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillingEntryAdditionalInfoInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillingEntryAdditionalInfoInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillingEntryAdditionalInfoInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillingEntryAdditionalInfoInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillingEntryAdditionalInfoInner + * @throws IOException if the JSON string is invalid with respect to BillingEntryAdditionalInfoInner + */ + public static BillingEntryAdditionalInfoInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillingEntryAdditionalInfoInner.class); + } + + /** + * Convert an instance of BillingEntryAdditionalInfoInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryBalance.java b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryBalance.java new file mode 100644 index 0000000..8c73306 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryBalance.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * User account balance calculated on billing date. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BillingEntryBalance { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public BillingEntryBalance() { + } + + public BillingEntryBalance amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Monetary amount of the balance calculated for the returned billing entry. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public BillingEntryBalance currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Three-letter currency code (ISO-4217) of the balance of the returned billing entry. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillingEntryBalance billingEntryBalance = (BillingEntryBalance) o; + return Objects.equals(this.amount, billingEntryBalance.amount) && + Objects.equals(this.currency, billingEntryBalance.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillingEntryBalance {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillingEntryBalance + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillingEntryBalance.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillingEntryBalance is not found in the empty JSON string", BillingEntryBalance.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillingEntryBalance.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingEntryBalance` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillingEntryBalance.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillingEntryBalance' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillingEntryBalance.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillingEntryBalance value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillingEntryBalance read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillingEntryBalance given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillingEntryBalance + * @throws IOException if the JSON string is invalid with respect to BillingEntryBalance + */ + public static BillingEntryBalance fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillingEntryBalance.class); + } + + /** + * Convert an instance of BillingEntryBalance to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryOffer.java new file mode 100644 index 0000000..b49134c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryOffer.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer associated with the returned billing entry. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BillingEntryOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public BillingEntryOffer() { + } + + public BillingEntryOffer id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of the offer associated with the billing entry. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public BillingEntryOffer name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the offer associated with the billing entry. This field is populated asynchronously, which means the value may appear with a delay. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillingEntryOffer billingEntryOffer = (BillingEntryOffer) o; + return Objects.equals(this.id, billingEntryOffer.id) && + Objects.equals(this.name, billingEntryOffer.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillingEntryOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillingEntryOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillingEntryOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillingEntryOffer is not found in the empty JSON string", BillingEntryOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillingEntryOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingEntryOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillingEntryOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillingEntryOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillingEntryOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillingEntryOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillingEntryOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillingEntryOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillingEntryOffer + * @throws IOException if the JSON string is invalid with respect to BillingEntryOffer + */ + public static BillingEntryOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillingEntryOffer.class); + } + + /** + * Convert an instance of BillingEntryOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryOrder.java b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryOrder.java new file mode 100644 index 0000000..45a11dd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryOrder.java @@ -0,0 +1,207 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Order associated with the returned billing entry. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BillingEntryOrder { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public BillingEntryOrder() { + } + + public BillingEntryOrder id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * Order id + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillingEntryOrder billingEntryOrder = (BillingEntryOrder) o; + return Objects.equals(this.id, billingEntryOrder.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillingEntryOrder {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillingEntryOrder + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillingEntryOrder.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillingEntryOrder is not found in the empty JSON string", BillingEntryOrder.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillingEntryOrder.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingEntryOrder` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillingEntryOrder.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillingEntryOrder' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillingEntryOrder.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillingEntryOrder value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillingEntryOrder read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillingEntryOrder given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillingEntryOrder + * @throws IOException if the JSON string is invalid with respect to BillingEntryOrder + */ + public static BillingEntryOrder fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillingEntryOrder.class); + } + + /** + * Convert an instance of BillingEntryOrder to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryTax.java b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryTax.java new file mode 100644 index 0000000..9cd2950 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryTax.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Tax rate applied to the returned billing entry. Optional field percentage is present if the returned billing entry is subject to tax. In this case, annotation is not returned. Optional field annotation is present if the returned billing entry is exempt from tax or tax is not applicable; the possible value is \"OUT_OF_SCOPE\". In this case, percentage is not returned. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BillingEntryTax { + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + @javax.annotation.Nullable + private String percentage; + + public static final String SERIALIZED_NAME_ANNOTATION = "annotation"; + @SerializedName(SERIALIZED_NAME_ANNOTATION) + @javax.annotation.Nullable + private String annotation; + + public BillingEntryTax() { + } + + public BillingEntryTax percentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + return this; + } + + /** + * Optional tax rate shown as a number in the range 0-100. + * @return percentage + */ + @javax.annotation.Nullable + public String getPercentage() { + return percentage; + } + + public void setPercentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + } + + + public BillingEntryTax annotation(@javax.annotation.Nullable String annotation) { + this.annotation = annotation; + return this; + } + + /** + * Optional annotation explaining the tax rate. + * @return annotation + */ + @javax.annotation.Nullable + public String getAnnotation() { + return annotation; + } + + public void setAnnotation(@javax.annotation.Nullable String annotation) { + this.annotation = annotation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillingEntryTax billingEntryTax = (BillingEntryTax) o; + return Objects.equals(this.percentage, billingEntryTax.percentage) && + Objects.equals(this.annotation, billingEntryTax.annotation); + } + + @Override + public int hashCode() { + return Objects.hash(percentage, annotation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillingEntryTax {\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append(" annotation: ").append(toIndentedString(annotation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("percentage"); + openapiFields.add("annotation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillingEntryTax + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillingEntryTax.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillingEntryTax is not found in the empty JSON string", BillingEntryTax.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillingEntryTax.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingEntryTax` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("percentage") != null && !jsonObj.get("percentage").isJsonNull()) && !jsonObj.get("percentage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `percentage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("percentage").toString())); + } + if ((jsonObj.get("annotation") != null && !jsonObj.get("annotation").isJsonNull()) && !jsonObj.get("annotation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `annotation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("annotation").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillingEntryTax.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillingEntryTax' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillingEntryTax.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillingEntryTax value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillingEntryTax read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillingEntryTax given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillingEntryTax + * @throws IOException if the JSON string is invalid with respect to BillingEntryTax + */ + public static BillingEntryTax fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillingEntryTax.class); + } + + /** + * Convert an instance of BillingEntryTax to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryType.java b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryType.java new file mode 100644 index 0000000..fd00de2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryType.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BillingEntryType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BillingEntryType { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public BillingEntryType() { + } + + public BillingEntryType id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Three-letter code of the billing type of the returned billing entry. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public BillingEntryType name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Billing type of the returned billing entry. This type is translated based on the value of the \"Accept-Language\" header. By default a message in English is returned. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillingEntryType billingEntryType = (BillingEntryType) o; + return Objects.equals(this.id, billingEntryType.id) && + Objects.equals(this.name, billingEntryType.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillingEntryType {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillingEntryType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillingEntryType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillingEntryType is not found in the empty JSON string", BillingEntryType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillingEntryType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingEntryType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillingEntryType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillingEntryType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillingEntryType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillingEntryType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillingEntryType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillingEntryType given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillingEntryType + * @throws IOException if the JSON string is invalid with respect to BillingEntryType + */ + public static BillingEntryType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillingEntryType.class); + } + + /** + * Convert an instance of BillingEntryType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryValue.java b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryValue.java new file mode 100644 index 0000000..6bc01d6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BillingEntryValue.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Money value of the returned billing entry. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BillingEntryValue { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public BillingEntryValue() { + } + + public BillingEntryValue amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Monetary amount of the returned billing entry. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public BillingEntryValue currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Three-letter currency code (ISO-4217) of the returned billing entry. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillingEntryValue billingEntryValue = (BillingEntryValue) o; + return Objects.equals(this.amount, billingEntryValue.amount) && + Objects.equals(this.currency, billingEntryValue.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillingEntryValue {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillingEntryValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillingEntryValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillingEntryValue is not found in the empty JSON string", BillingEntryValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillingEntryValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingEntryValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillingEntryValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillingEntryValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillingEntryValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillingEntryValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillingEntryValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillingEntryValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillingEntryValue + * @throws IOException if the JSON string is invalid with respect to BillingEntryValue + */ + public static BillingEntryValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillingEntryValue.class); + } + + /** + * Convert an instance of BillingEntryValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BillingType.java b/src/main/java/pl/wtx/allegro/api/client/model/BillingType.java new file mode 100644 index 0000000..6c86c48 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BillingType.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BillingType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BillingType { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public BillingType() { + } + + public BillingType id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of the billing type. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public BillingType description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Localized type name. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BillingType billingType = (BillingType) o; + return Objects.equals(this.id, billingType.id) && + Objects.equals(this.description, billingType.description); + } + + @Override + public int hashCode() { + return Objects.hash(id, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BillingType {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BillingType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BillingType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BillingType is not found in the empty JSON string", BillingType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BillingType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BillingType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BillingType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BillingType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BillingType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BillingType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BillingType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BillingType given an JSON string + * + * @param jsonString JSON string + * @return An instance of BillingType + * @throws IOException if the JSON string is invalid with respect to BillingType + */ + public static BillingType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BillingType.class); + } + + /** + * Convert an instance of BillingType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BlockadeOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/BlockadeOperation.java new file mode 100644 index 0000000..20401b1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BlockadeOperation.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.OperationPayment; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BlockadeOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BlockadeOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "BLOCKADE"; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nonnull + private OperationPayment payment; + + public BlockadeOperation() { + this.type = this.getClass().getSimpleName(); + } + + public BlockadeOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public BlockadeOperation payment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nonnull + public OperationPayment getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BlockadeOperation blockadeOperation = (BlockadeOperation) o; + return Objects.equals(this.type, blockadeOperation.type) && + Objects.equals(this.payment, blockadeOperation.payment) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, payment, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BlockadeOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("payment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payment"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BlockadeOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BlockadeOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BlockadeOperation is not found in the empty JSON string", BlockadeOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BlockadeOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BlockadeOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BlockadeOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BlockadeOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BlockadeOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BlockadeOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BlockadeOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BlockadeOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BlockadeOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of BlockadeOperation + * @throws IOException if the JSON string is invalid with respect to BlockadeOperation + */ + public static BlockadeOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BlockadeOperation.class); + } + + /** + * Convert an instance of BlockadeOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BlockadeReleaseOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/BlockadeReleaseOperation.java new file mode 100644 index 0000000..aa71aad --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BlockadeReleaseOperation.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.OperationPayment; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BlockadeReleaseOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BlockadeReleaseOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "BLOCKADE_RELEASE"; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nonnull + private OperationPayment payment; + + public BlockadeReleaseOperation() { + this.type = this.getClass().getSimpleName(); + } + + public BlockadeReleaseOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public BlockadeReleaseOperation payment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nonnull + public OperationPayment getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BlockadeReleaseOperation blockadeReleaseOperation = (BlockadeReleaseOperation) o; + return Objects.equals(this.type, blockadeReleaseOperation.type) && + Objects.equals(this.payment, blockadeReleaseOperation.payment) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, payment, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BlockadeReleaseOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("payment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payment"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BlockadeReleaseOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BlockadeReleaseOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BlockadeReleaseOperation is not found in the empty JSON string", BlockadeReleaseOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BlockadeReleaseOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BlockadeReleaseOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BlockadeReleaseOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BlockadeReleaseOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BlockadeReleaseOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BlockadeReleaseOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BlockadeReleaseOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BlockadeReleaseOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BlockadeReleaseOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of BlockadeReleaseOperation + * @throws IOException if the JSON string is invalid with respect to BlockadeReleaseOperation + */ + public static BlockadeReleaseOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BlockadeReleaseOperation.class); + } + + /** + * Convert an instance of BlockadeReleaseOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BundleDiscountDTO.java b/src/main/java/pl/wtx/allegro/api/client/model/BundleDiscountDTO.java new file mode 100644 index 0000000..7a37d54 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BundleDiscountDTO.java @@ -0,0 +1,276 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BundleMarketplaceDTO; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BundleDiscountDTO + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BundleDiscountDTO { + public static final String SERIALIZED_NAME_MARKETPLACE = "marketplace"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE) + @javax.annotation.Nonnull + private BundleMarketplaceDTO marketplace; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public BundleDiscountDTO() { + } + + public BundleDiscountDTO marketplace(@javax.annotation.Nonnull BundleMarketplaceDTO marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get marketplace + * @return marketplace + */ + @javax.annotation.Nonnull + public BundleMarketplaceDTO getMarketplace() { + return marketplace; + } + + public void setMarketplace(@javax.annotation.Nonnull BundleMarketplaceDTO marketplace) { + this.marketplace = marketplace; + } + + + public BundleDiscountDTO amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Discount value. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public BundleDiscountDTO currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * Discount currency as a 3-letter code in accordance with <a href=\"https://en.wikipedia.org/wiki/ISO_4217\" target=\"_blank\">ISO 4217</a> standard. Has to be in base currency of specified marketplace. + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BundleDiscountDTO bundleDiscountDTO = (BundleDiscountDTO) o; + return Objects.equals(this.marketplace, bundleDiscountDTO.marketplace) && + Objects.equals(this.amount, bundleDiscountDTO.amount) && + Objects.equals(this.currency, bundleDiscountDTO.currency); + } + + @Override + public int hashCode() { + return Objects.hash(marketplace, amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BundleDiscountDTO {\n"); + sb.append(" marketplace: ").append(toIndentedString(marketplace)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplace"); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("marketplace"); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BundleDiscountDTO + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BundleDiscountDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BundleDiscountDTO is not found in the empty JSON string", BundleDiscountDTO.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BundleDiscountDTO.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BundleDiscountDTO` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BundleDiscountDTO.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `marketplace` + BundleMarketplaceDTO.validateJsonElement(jsonObj.get("marketplace")); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BundleDiscountDTO.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BundleDiscountDTO' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BundleDiscountDTO.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BundleDiscountDTO value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BundleDiscountDTO read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BundleDiscountDTO given an JSON string + * + * @param jsonString JSON string + * @return An instance of BundleDiscountDTO + * @throws IOException if the JSON string is invalid with respect to BundleDiscountDTO + */ + public static BundleDiscountDTO fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BundleDiscountDTO.class); + } + + /** + * Convert an instance of BundleDiscountDTO to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BundleMarketplaceDTO.java b/src/main/java/pl/wtx/allegro/api/client/model/BundleMarketplaceDTO.java new file mode 100644 index 0000000..fdd4583 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BundleMarketplaceDTO.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BundleMarketplaceDTO + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BundleMarketplaceDTO { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public BundleMarketplaceDTO() { + } + + public BundleMarketplaceDTO id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Marketplace ID. Available marketplaces can be determined using <a href=\"#operation/marketplacesGET\">GET /marketplaces</a>. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BundleMarketplaceDTO bundleMarketplaceDTO = (BundleMarketplaceDTO) o; + return Objects.equals(this.id, bundleMarketplaceDTO.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BundleMarketplaceDTO {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BundleMarketplaceDTO + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BundleMarketplaceDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BundleMarketplaceDTO is not found in the empty JSON string", BundleMarketplaceDTO.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BundleMarketplaceDTO.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BundleMarketplaceDTO` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BundleMarketplaceDTO.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BundleMarketplaceDTO.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BundleMarketplaceDTO' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BundleMarketplaceDTO.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BundleMarketplaceDTO value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BundleMarketplaceDTO read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BundleMarketplaceDTO given an JSON string + * + * @param jsonString JSON string + * @return An instance of BundleMarketplaceDTO + * @throws IOException if the JSON string is invalid with respect to BundleMarketplaceDTO + */ + public static BundleMarketplaceDTO fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BundleMarketplaceDTO.class); + } + + /** + * Convert an instance of BundleMarketplaceDTO to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BundledOfferDTO.java b/src/main/java/pl/wtx/allegro/api/client/model/BundledOfferDTO.java new file mode 100644 index 0000000..315443c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BundledOfferDTO.java @@ -0,0 +1,270 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BundledOfferDTO + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BundledOfferDTO { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_REQUIRED_QUANTITY = "requiredQuantity"; + @SerializedName(SERIALIZED_NAME_REQUIRED_QUANTITY) + @javax.annotation.Nonnull + private Integer requiredQuantity; + + public static final String SERIALIZED_NAME_ENTRY_POINT = "entryPoint"; + @SerializedName(SERIALIZED_NAME_ENTRY_POINT) + @javax.annotation.Nonnull + private Boolean entryPoint; + + public BundledOfferDTO() { + } + + public BundledOfferDTO id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Offer ID + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public BundledOfferDTO requiredQuantity(@javax.annotation.Nonnull Integer requiredQuantity) { + this.requiredQuantity = requiredQuantity; + return this; + } + + /** + * How many units of this offer will be in bundle. + * @return requiredQuantity + */ + @javax.annotation.Nonnull + public Integer getRequiredQuantity() { + return requiredQuantity; + } + + public void setRequiredQuantity(@javax.annotation.Nonnull Integer requiredQuantity) { + this.requiredQuantity = requiredQuantity; + } + + + public BundledOfferDTO entryPoint(@javax.annotation.Nonnull Boolean entryPoint) { + this.entryPoint = entryPoint; + return this; + } + + /** + * Set if bundle should be shown on offer page. + * @return entryPoint + */ + @javax.annotation.Nonnull + public Boolean getEntryPoint() { + return entryPoint; + } + + public void setEntryPoint(@javax.annotation.Nonnull Boolean entryPoint) { + this.entryPoint = entryPoint; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BundledOfferDTO bundledOfferDTO = (BundledOfferDTO) o; + return Objects.equals(this.id, bundledOfferDTO.id) && + Objects.equals(this.requiredQuantity, bundledOfferDTO.requiredQuantity) && + Objects.equals(this.entryPoint, bundledOfferDTO.entryPoint); + } + + @Override + public int hashCode() { + return Objects.hash(id, requiredQuantity, entryPoint); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BundledOfferDTO {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" requiredQuantity: ").append(toIndentedString(requiredQuantity)).append("\n"); + sb.append(" entryPoint: ").append(toIndentedString(entryPoint)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("requiredQuantity"); + openapiFields.add("entryPoint"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("requiredQuantity"); + openapiRequiredFields.add("entryPoint"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BundledOfferDTO + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BundledOfferDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BundledOfferDTO is not found in the empty JSON string", BundledOfferDTO.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BundledOfferDTO.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BundledOfferDTO` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BundledOfferDTO.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BundledOfferDTO.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BundledOfferDTO' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BundledOfferDTO.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BundledOfferDTO value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BundledOfferDTO read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BundledOfferDTO given an JSON string + * + * @param jsonString JSON string + * @return An instance of BundledOfferDTO + * @throws IOException if the JSON string is invalid with respect to BundledOfferDTO + */ + public static BundledOfferDTO fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BundledOfferDTO.class); + } + + /** + * Convert an instance of BundledOfferDTO to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BuyNowPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/BuyNowPrice.java new file mode 100644 index 0000000..1dc2ccc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BuyNowPrice.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The buy now or advertisement price (depending on the offer's format). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BuyNowPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public BuyNowPrice() { + } + + public BuyNowPrice amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public BuyNowPrice currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuyNowPrice buyNowPrice = (BuyNowPrice) o; + return Objects.equals(this.amount, buyNowPrice.amount) && + Objects.equals(this.currency, buyNowPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuyNowPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BuyNowPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuyNowPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BuyNowPrice is not found in the empty JSON string", BuyNowPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BuyNowPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BuyNowPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BuyNowPrice.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuyNowPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuyNowPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BuyNowPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BuyNowPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuyNowPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BuyNowPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuyNowPrice + * @throws IOException if the JSON string is invalid with respect to BuyNowPrice + */ + public static BuyNowPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BuyNowPrice.class); + } + + /** + * Convert an instance of BuyNowPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BuyerParticipant.java b/src/main/java/pl/wtx/allegro/api/client/model/BuyerParticipant.java new file mode 100644 index 0000000..5144f5b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BuyerParticipant.java @@ -0,0 +1,369 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OperationParticipantAddress; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The buyer's data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BuyerParticipant { + public static final String SERIALIZED_NAME_COMPANY_NAME = "companyName"; + @SerializedName(SERIALIZED_NAME_COMPANY_NAME) + @javax.annotation.Nullable + private String companyName; + + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nonnull + private String login; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nonnull + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nonnull + private String lastName; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private OperationParticipantAddress address; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public BuyerParticipant() { + } + + public BuyerParticipant companyName(@javax.annotation.Nullable String companyName) { + this.companyName = companyName; + return this; + } + + /** + * Company name. + * @return companyName + */ + @javax.annotation.Nullable + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(@javax.annotation.Nullable String companyName) { + this.companyName = companyName; + } + + + public BuyerParticipant login(@javax.annotation.Nonnull String login) { + this.login = login; + return this; + } + + /** + * Login. + * @return login + */ + @javax.annotation.Nonnull + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nonnull String login) { + this.login = login; + } + + + public BuyerParticipant firstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + return this; + } + + /** + * First name. + * @return firstName + */ + @javax.annotation.Nonnull + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + } + + + public BuyerParticipant lastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Last name. + * @return lastName + */ + @javax.annotation.Nonnull + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + } + + + public BuyerParticipant address(@javax.annotation.Nullable OperationParticipantAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public OperationParticipantAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable OperationParticipantAddress address) { + this.address = address; + } + + + public BuyerParticipant id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The buyers's ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuyerParticipant buyerParticipant = (BuyerParticipant) o; + return Objects.equals(this.companyName, buyerParticipant.companyName) && + Objects.equals(this.login, buyerParticipant.login) && + Objects.equals(this.firstName, buyerParticipant.firstName) && + Objects.equals(this.lastName, buyerParticipant.lastName) && + Objects.equals(this.address, buyerParticipant.address) && + Objects.equals(this.id, buyerParticipant.id); + } + + @Override + public int hashCode() { + return Objects.hash(companyName, login, firstName, lastName, address, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuyerParticipant {\n"); + sb.append(" companyName: ").append(toIndentedString(companyName)).append("\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("companyName"); + openapiFields.add("login"); + openapiFields.add("firstName"); + openapiFields.add("lastName"); + openapiFields.add("address"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("login"); + openapiRequiredFields.add("firstName"); + openapiRequiredFields.add("lastName"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BuyerParticipant + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuyerParticipant.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BuyerParticipant is not found in the empty JSON string", BuyerParticipant.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BuyerParticipant.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BuyerParticipant` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BuyerParticipant.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("companyName") != null && !jsonObj.get("companyName").isJsonNull()) && !jsonObj.get("companyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `companyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("companyName").toString())); + } + if (!jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + if (!jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if (!jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + OperationParticipantAddress.validateJsonElement(jsonObj.get("address")); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuyerParticipant.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuyerParticipant' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BuyerParticipant.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BuyerParticipant value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuyerParticipant read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BuyerParticipant given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuyerParticipant + * @throws IOException if the JSON string is invalid with respect to BuyerParticipant + */ + public static BuyerParticipant fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BuyerParticipant.class); + } + + /** + * Convert an instance of BuyerParticipant to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BuyerPreferencesReference.java b/src/main/java/pl/wtx/allegro/api/client/model/BuyerPreferencesReference.java new file mode 100644 index 0000000..8f018d8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BuyerPreferencesReference.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * BuyerPreferencesReference + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BuyerPreferencesReference { + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nullable + private String language; + + public BuyerPreferencesReference() { + } + + public BuyerPreferencesReference language(@javax.annotation.Nullable String language) { + this.language = language; + return this; + } + + /** + * Language + * @return language + */ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nullable String language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuyerPreferencesReference buyerPreferencesReference = (BuyerPreferencesReference) o; + return Objects.equals(this.language, buyerPreferencesReference.language); + } + + @Override + public int hashCode() { + return Objects.hash(language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuyerPreferencesReference {\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BuyerPreferencesReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuyerPreferencesReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BuyerPreferencesReference is not found in the empty JSON string", BuyerPreferencesReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BuyerPreferencesReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BuyerPreferencesReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuyerPreferencesReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuyerPreferencesReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BuyerPreferencesReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BuyerPreferencesReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuyerPreferencesReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BuyerPreferencesReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuyerPreferencesReference + * @throws IOException if the JSON string is invalid with respect to BuyerPreferencesReference + */ + public static BuyerPreferencesReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BuyerPreferencesReference.class); + } + + /** + * Convert an instance of BuyerPreferencesReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/BuyerReference.java b/src/main/java/pl/wtx/allegro/api/client/model/BuyerReference.java new file mode 100644 index 0000000..9a9a9fa --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/BuyerReference.java @@ -0,0 +1,336 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BuyerPreferencesReference; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Buyer data + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class BuyerReference { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nonnull + private String email; + + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nonnull + private String login; + + public static final String SERIALIZED_NAME_GUEST = "guest"; + @SerializedName(SERIALIZED_NAME_GUEST) + @javax.annotation.Nonnull + private Boolean guest; + + public static final String SERIALIZED_NAME_PREFERENCES = "preferences"; + @SerializedName(SERIALIZED_NAME_PREFERENCES) + @javax.annotation.Nullable + private BuyerPreferencesReference preferences; + + public BuyerReference() { + } + + public BuyerReference id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * buyer id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public BuyerReference email(@javax.annotation.Nonnull String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nonnull String email) { + this.email = email; + } + + + public BuyerReference login(@javax.annotation.Nonnull String login) { + this.login = login; + return this; + } + + /** + * Get login + * @return login + */ + @javax.annotation.Nonnull + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nonnull String login) { + this.login = login; + } + + + public BuyerReference guest(@javax.annotation.Nonnull Boolean guest) { + this.guest = guest; + return this; + } + + /** + * is a guest account? + * @return guest + */ + @javax.annotation.Nonnull + public Boolean getGuest() { + return guest; + } + + public void setGuest(@javax.annotation.Nonnull Boolean guest) { + this.guest = guest; + } + + + public BuyerReference preferences(@javax.annotation.Nullable BuyerPreferencesReference preferences) { + this.preferences = preferences; + return this; + } + + /** + * Get preferences + * @return preferences + */ + @javax.annotation.Nullable + public BuyerPreferencesReference getPreferences() { + return preferences; + } + + public void setPreferences(@javax.annotation.Nullable BuyerPreferencesReference preferences) { + this.preferences = preferences; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BuyerReference buyerReference = (BuyerReference) o; + return Objects.equals(this.id, buyerReference.id) && + Objects.equals(this.email, buyerReference.email) && + Objects.equals(this.login, buyerReference.login) && + Objects.equals(this.guest, buyerReference.guest) && + Objects.equals(this.preferences, buyerReference.preferences); + } + + @Override + public int hashCode() { + return Objects.hash(id, email, login, guest, preferences); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BuyerReference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" guest: ").append(toIndentedString(guest)).append("\n"); + sb.append(" preferences: ").append(toIndentedString(preferences)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("email"); + openapiFields.add("login"); + openapiFields.add("guest"); + openapiFields.add("preferences"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("login"); + openapiRequiredFields.add("guest"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BuyerReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BuyerReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BuyerReference is not found in the empty JSON string", BuyerReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BuyerReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BuyerReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BuyerReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + // validate the optional field `preferences` + if (jsonObj.get("preferences") != null && !jsonObj.get("preferences").isJsonNull()) { + BuyerPreferencesReference.validateJsonElement(jsonObj.get("preferences")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BuyerReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BuyerReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BuyerReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BuyerReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BuyerReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BuyerReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of BuyerReference + * @throws IOException if the JSON string is invalid with respect to BuyerReference + */ + public static BuyerReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BuyerReference.class); + } + + /** + * Convert an instance of BuyerReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CampaignRefusalReason.java b/src/main/java/pl/wtx/allegro/api/client/model/CampaignRefusalReason.java new file mode 100644 index 0000000..6df512f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CampaignRefusalReason.java @@ -0,0 +1,263 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.RefusalMessage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CampaignRefusalReason + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CampaignRefusalReason { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private String code; + + public static final String SERIALIZED_NAME_MESSAGES = "messages"; + @SerializedName(SERIALIZED_NAME_MESSAGES) + @javax.annotation.Nonnull + private List messages = new ArrayList<>(); + + public CampaignRefusalReason() { + } + + public CampaignRefusalReason code(@javax.annotation.Nonnull String code) { + this.code = code; + return this; + } + + /** + * Code corresponding to the message. For more information visit the list of available codes: <a href=\"../../tutorials/jak-przypisac-oferte-kampanii-GRaj0q6Gwuy#bledy-i-powody-odrzucenia\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/how-to-submit-offers-to-campaigns-AgGjd6EmyH4#errors-and-reasons-for-rejection\" target=\"_blank\">EN</a>. + * @return code + */ + @javax.annotation.Nonnull + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull String code) { + this.code = code; + } + + + public CampaignRefusalReason messages(@javax.annotation.Nonnull List messages) { + this.messages = messages; + return this; + } + + public CampaignRefusalReason addMessagesItem(RefusalMessage messagesItem) { + if (this.messages == null) { + this.messages = new ArrayList<>(); + } + this.messages.add(messagesItem); + return this; + } + + /** + * List of refusal messages. + * @return messages + */ + @javax.annotation.Nonnull + public List getMessages() { + return messages; + } + + public void setMessages(@javax.annotation.Nonnull List messages) { + this.messages = messages; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CampaignRefusalReason campaignRefusalReason = (CampaignRefusalReason) o; + return Objects.equals(this.code, campaignRefusalReason.code) && + Objects.equals(this.messages, campaignRefusalReason.messages); + } + + @Override + public int hashCode() { + return Objects.hash(code, messages); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CampaignRefusalReason {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" messages: ").append(toIndentedString(messages)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("messages"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("code"); + openapiRequiredFields.add("messages"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CampaignRefusalReason + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CampaignRefusalReason.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CampaignRefusalReason is not found in the empty JSON string", CampaignRefusalReason.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CampaignRefusalReason.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CampaignRefusalReason` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CampaignRefusalReason.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("messages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `messages` to be an array in the JSON string but got `%s`", jsonObj.get("messages").toString())); + } + + JsonArray jsonArraymessages = jsonObj.getAsJsonArray("messages"); + // validate the required field `messages` (array) + for (int i = 0; i < jsonArraymessages.size(); i++) { + RefusalMessage.validateJsonElement(jsonArraymessages.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CampaignRefusalReason.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CampaignRefusalReason' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CampaignRefusalReason.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CampaignRefusalReason value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CampaignRefusalReason read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CampaignRefusalReason given an JSON string + * + * @param jsonString JSON string + * @return An instance of CampaignRefusalReason + * @throws IOException if the JSON string is invalid with respect to CampaignRefusalReason + */ + public static CampaignRefusalReason fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CampaignRefusalReason.class); + } + + /** + * Convert an instance of CampaignRefusalReason to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CampaignRequestDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CampaignRequestDto.java new file mode 100644 index 0000000..204930d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CampaignRequestDto.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CampaignRequestDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CampaignRequestDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public CampaignRequestDto() { + } + + public CampaignRequestDto id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CampaignRequestDto campaignRequestDto = (CampaignRequestDto) o; + return Objects.equals(this.id, campaignRequestDto.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CampaignRequestDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CampaignRequestDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CampaignRequestDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CampaignRequestDto is not found in the empty JSON string", CampaignRequestDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CampaignRequestDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CampaignRequestDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CampaignRequestDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CampaignRequestDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CampaignRequestDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CampaignRequestDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CampaignRequestDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CampaignRequestDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CampaignRequestDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CampaignRequestDto + * @throws IOException if the JSON string is invalid with respect to CampaignRequestDto + */ + public static CampaignRequestDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CampaignRequestDto.class); + } + + /** + * Convert an instance of CampaignRequestDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CampaignResponseDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CampaignResponseDto.java new file mode 100644 index 0000000..6e96cf5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CampaignResponseDto.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CampaignResponseDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CampaignResponseDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public CampaignResponseDto() { + } + + public CampaignResponseDto id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CampaignResponseDto campaignResponseDto = (CampaignResponseDto) o; + return Objects.equals(this.id, campaignResponseDto.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CampaignResponseDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CampaignResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CampaignResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CampaignResponseDto is not found in the empty JSON string", CampaignResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CampaignResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CampaignResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CampaignResponseDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CampaignResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CampaignResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CampaignResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CampaignResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CampaignResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CampaignResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CampaignResponseDto + * @throws IOException if the JSON string is invalid with respect to CampaignResponseDto + */ + public static CampaignResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CampaignResponseDto.class); + } + + /** + * Convert an instance of CampaignResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CancelShipmentCommandStatusDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CancelShipmentCommandStatusDto.java new file mode 100644 index 0000000..0c64cb4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CancelShipmentCommandStatusDto.java @@ -0,0 +1,376 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error400; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CancelShipmentCommandStatusDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CancelShipmentCommandStatusDto { + public static final String SERIALIZED_NAME_COMMAND_ID = "commandId"; + @SerializedName(SERIALIZED_NAME_COMMAND_ID) + @javax.annotation.Nullable + private String commandId; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + IN_PROGRESS("IN_PROGRESS"), + + SUCCESS("SUCCESS"), + + ERROR("ERROR"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public static final String SERIALIZED_NAME_SHIPMENT_ID = "shipmentId"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_ID) + @javax.annotation.Nullable + private String shipmentId; + + public CancelShipmentCommandStatusDto() { + } + + public CancelShipmentCommandStatusDto commandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + return this; + } + + /** + * Command UUID + * @return commandId + */ + @javax.annotation.Nullable + public String getCommandId() { + return commandId; + } + + public void setCommandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + } + + + public CancelShipmentCommandStatusDto status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public CancelShipmentCommandStatusDto errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public CancelShipmentCommandStatusDto addErrorsItem(Error400 errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * List of errors. Available only, if operation finished with ERROR. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + public CancelShipmentCommandStatusDto shipmentId(@javax.annotation.Nullable String shipmentId) { + this.shipmentId = shipmentId; + return this; + } + + /** + * Generated shipment ID. Available only, if operation finished with SUCCESS. + * @return shipmentId + */ + @javax.annotation.Nullable + public String getShipmentId() { + return shipmentId; + } + + public void setShipmentId(@javax.annotation.Nullable String shipmentId) { + this.shipmentId = shipmentId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CancelShipmentCommandStatusDto cancelShipmentCommandStatusDto = (CancelShipmentCommandStatusDto) o; + return Objects.equals(this.commandId, cancelShipmentCommandStatusDto.commandId) && + Objects.equals(this.status, cancelShipmentCommandStatusDto.status) && + Objects.equals(this.errors, cancelShipmentCommandStatusDto.errors) && + Objects.equals(this.shipmentId, cancelShipmentCommandStatusDto.shipmentId); + } + + @Override + public int hashCode() { + return Objects.hash(commandId, status, errors, shipmentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CancelShipmentCommandStatusDto {\n"); + sb.append(" commandId: ").append(toIndentedString(commandId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" shipmentId: ").append(toIndentedString(shipmentId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("commandId"); + openapiFields.add("status"); + openapiFields.add("errors"); + openapiFields.add("shipmentId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CancelShipmentCommandStatusDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CancelShipmentCommandStatusDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CancelShipmentCommandStatusDto is not found in the empty JSON string", CancelShipmentCommandStatusDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CancelShipmentCommandStatusDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CancelShipmentCommandStatusDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("commandId") != null && !jsonObj.get("commandId").isJsonNull()) && !jsonObj.get("commandId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commandId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commandId").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error400.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + if ((jsonObj.get("shipmentId") != null && !jsonObj.get("shipmentId").isJsonNull()) && !jsonObj.get("shipmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `shipmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shipmentId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CancelShipmentCommandStatusDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CancelShipmentCommandStatusDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CancelShipmentCommandStatusDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CancelShipmentCommandStatusDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CancelShipmentCommandStatusDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CancelShipmentCommandStatusDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CancelShipmentCommandStatusDto + * @throws IOException if the JSON string is invalid with respect to CancelShipmentCommandStatusDto + */ + public static CancelShipmentCommandStatusDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CancelShipmentCommandStatusDto.class); + } + + /** + * Convert an instance of CancelShipmentCommandStatusDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Caption.java b/src/main/java/pl/wtx/allegro/api/client/model/Caption.java new file mode 100644 index 0000000..a108706 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Caption.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Caption + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Caption { + public static final String SERIALIZED_NAME_INDEX = "index"; + @SerializedName(SERIALIZED_NAME_INDEX) + @javax.annotation.Nonnull + private String index; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public Caption() { + } + + public Caption index(@javax.annotation.Nonnull String index) { + this.index = index; + return this; + } + + /** + * Get index + * @return index + */ + @javax.annotation.Nonnull + public String getIndex() { + return index; + } + + public void setIndex(@javax.annotation.Nonnull String index) { + this.index = index; + } + + + public Caption value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Caption caption = (Caption) o; + return Objects.equals(this.index, caption.index) && + Objects.equals(this.value, caption.value); + } + + @Override + public int hashCode() { + return Objects.hash(index, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Caption {\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("index"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("index"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Caption + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Caption.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Caption is not found in the empty JSON string", Caption.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Caption.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Caption` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Caption.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("index").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `index` to be a primitive type in the JSON string but got `%s`", jsonObj.get("index").toString())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Caption.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Caption' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Caption.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Caption value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Caption read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Caption given an JSON string + * + * @param jsonString JSON string + * @return An instance of Caption + * @throws IOException if the JSON string is invalid with respect to Caption + */ + public static Caption fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Caption.class); + } + + /** + * Convert an instance of Caption to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CarrierParcelTrackingResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CarrierParcelTrackingResponse.java new file mode 100644 index 0000000..dfa477a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CarrierParcelTrackingResponse.java @@ -0,0 +1,263 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParcelTrackingHistory; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CarrierParcelTrackingResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CarrierParcelTrackingResponse { + public static final String SERIALIZED_NAME_CARRIER_ID = "carrierId"; + @SerializedName(SERIALIZED_NAME_CARRIER_ID) + @javax.annotation.Nonnull + private String carrierId; + + public static final String SERIALIZED_NAME_WAYBILLS = "waybills"; + @SerializedName(SERIALIZED_NAME_WAYBILLS) + @javax.annotation.Nonnull + private List waybills = new ArrayList<>(); + + public CarrierParcelTrackingResponse() { + } + + public CarrierParcelTrackingResponse carrierId(@javax.annotation.Nonnull String carrierId) { + this.carrierId = carrierId; + return this; + } + + /** + * Carrier identifier. + * @return carrierId + */ + @javax.annotation.Nonnull + public String getCarrierId() { + return carrierId; + } + + public void setCarrierId(@javax.annotation.Nonnull String carrierId) { + this.carrierId = carrierId; + } + + + public CarrierParcelTrackingResponse waybills(@javax.annotation.Nonnull List waybills) { + this.waybills = waybills; + return this; + } + + public CarrierParcelTrackingResponse addWaybillsItem(ParcelTrackingHistory waybillsItem) { + if (this.waybills == null) { + this.waybills = new ArrayList<>(); + } + this.waybills.add(waybillsItem); + return this; + } + + /** + * Allegro parcel tracking history for multiple tracking numbers (waybills). + * @return waybills + */ + @javax.annotation.Nonnull + public List getWaybills() { + return waybills; + } + + public void setWaybills(@javax.annotation.Nonnull List waybills) { + this.waybills = waybills; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CarrierParcelTrackingResponse carrierParcelTrackingResponse = (CarrierParcelTrackingResponse) o; + return Objects.equals(this.carrierId, carrierParcelTrackingResponse.carrierId) && + Objects.equals(this.waybills, carrierParcelTrackingResponse.waybills); + } + + @Override + public int hashCode() { + return Objects.hash(carrierId, waybills); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CarrierParcelTrackingResponse {\n"); + sb.append(" carrierId: ").append(toIndentedString(carrierId)).append("\n"); + sb.append(" waybills: ").append(toIndentedString(waybills)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("carrierId"); + openapiFields.add("waybills"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("carrierId"); + openapiRequiredFields.add("waybills"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CarrierParcelTrackingResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CarrierParcelTrackingResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CarrierParcelTrackingResponse is not found in the empty JSON string", CarrierParcelTrackingResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CarrierParcelTrackingResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CarrierParcelTrackingResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CarrierParcelTrackingResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("carrierId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `carrierId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierId").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("waybills").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `waybills` to be an array in the JSON string but got `%s`", jsonObj.get("waybills").toString())); + } + + JsonArray jsonArraywaybills = jsonObj.getAsJsonArray("waybills"); + // validate the required field `waybills` (array) + for (int i = 0; i < jsonArraywaybills.size(); i++) { + ParcelTrackingHistory.validateJsonElement(jsonArraywaybills.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CarrierParcelTrackingResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CarrierParcelTrackingResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CarrierParcelTrackingResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CarrierParcelTrackingResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CarrierParcelTrackingResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CarrierParcelTrackingResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CarrierParcelTrackingResponse + * @throws IOException if the JSON string is invalid with respect to CarrierParcelTrackingResponse + */ + public static CarrierParcelTrackingResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CarrierParcelTrackingResponse.class); + } + + /** + * Convert an instance of CarrierParcelTrackingResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CashOnDeliveryDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CashOnDeliveryDto.java new file mode 100644 index 0000000..650331f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CashOnDeliveryDto.java @@ -0,0 +1,305 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CashOnDeliveryDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CashOnDeliveryDto { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public static final String SERIALIZED_NAME_OWNER_NAME = "ownerName"; + @SerializedName(SERIALIZED_NAME_OWNER_NAME) + @javax.annotation.Nullable + private String ownerName; + + public static final String SERIALIZED_NAME_IBAN = "iban"; + @SerializedName(SERIALIZED_NAME_IBAN) + @javax.annotation.Nullable + private String iban; + + public CashOnDeliveryDto() { + } + + public CashOnDeliveryDto amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Postpaid value + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public CashOnDeliveryDto currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * ISO 4217 currency code. + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + public CashOnDeliveryDto ownerName(@javax.annotation.Nullable String ownerName) { + this.ownerName = ownerName; + return this; + } + + /** + * Bank account owner. + * @return ownerName + */ + @javax.annotation.Nullable + public String getOwnerName() { + return ownerName; + } + + public void setOwnerName(@javax.annotation.Nullable String ownerName) { + this.ownerName = ownerName; + } + + + public CashOnDeliveryDto iban(@javax.annotation.Nullable String iban) { + this.iban = iban; + return this; + } + + /** + * Bank account number. + * @return iban + */ + @javax.annotation.Nullable + public String getIban() { + return iban; + } + + public void setIban(@javax.annotation.Nullable String iban) { + this.iban = iban; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CashOnDeliveryDto cashOnDeliveryDto = (CashOnDeliveryDto) o; + return Objects.equals(this.amount, cashOnDeliveryDto.amount) && + Objects.equals(this.currency, cashOnDeliveryDto.currency) && + Objects.equals(this.ownerName, cashOnDeliveryDto.ownerName) && + Objects.equals(this.iban, cashOnDeliveryDto.iban); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency, ownerName, iban); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CashOnDeliveryDto {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" ownerName: ").append(toIndentedString(ownerName)).append("\n"); + sb.append(" iban: ").append(toIndentedString(iban)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + openapiFields.add("ownerName"); + openapiFields.add("iban"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CashOnDeliveryDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CashOnDeliveryDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CashOnDeliveryDto is not found in the empty JSON string", CashOnDeliveryDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CashOnDeliveryDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CashOnDeliveryDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CashOnDeliveryDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + if ((jsonObj.get("ownerName") != null && !jsonObj.get("ownerName").isJsonNull()) && !jsonObj.get("ownerName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ownerName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ownerName").toString())); + } + if ((jsonObj.get("iban") != null && !jsonObj.get("iban").isJsonNull()) && !jsonObj.get("iban").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `iban` to be a primitive type in the JSON string but got `%s`", jsonObj.get("iban").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CashOnDeliveryDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CashOnDeliveryDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CashOnDeliveryDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CashOnDeliveryDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CashOnDeliveryDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CashOnDeliveryDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CashOnDeliveryDto + * @throws IOException if the JSON string is invalid with respect to CashOnDeliveryDto + */ + public static CashOnDeliveryDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CashOnDeliveryDto.class); + } + + /** + * Convert an instance of CashOnDeliveryDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CashOnDeliveryLimitDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CashOnDeliveryLimitDto.java new file mode 100644 index 0000000..a6a03d8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CashOnDeliveryLimitDto.java @@ -0,0 +1,347 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Definition of cash on delivery specification for method. If null, then COD is not supported. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CashOnDeliveryLimitDto { + public static final String SERIALIZED_NAME_LIMIT = "limit"; + @SerializedName(SERIALIZED_NAME_LIMIT) + @javax.annotation.Nullable + private BigDecimal limit; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency = "PLN"; + + /** + * Type of payment: Money transfer to merchant bank account or internal wallet payout + */ + @JsonAdapter(PaymentTypeEnum.Adapter.class) + public enum PaymentTypeEnum { + MONEY_TRANSFER("MONEY_TRANSFER"), + + WALLET_TRANSFER("WALLET_TRANSFER"); + + private String value; + + PaymentTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PaymentTypeEnum fromValue(String value) { + for (PaymentTypeEnum b : PaymentTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PaymentTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PaymentTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PaymentTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + PaymentTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_PAYMENT_TYPE = "paymentType"; + @SerializedName(SERIALIZED_NAME_PAYMENT_TYPE) + @javax.annotation.Nullable + private PaymentTypeEnum paymentType; + + public static final String SERIALIZED_NAME_FORCE_REQUIRE_IBAN = "forceRequireIban"; + @SerializedName(SERIALIZED_NAME_FORCE_REQUIRE_IBAN) + @javax.annotation.Nullable + private Boolean forceRequireIban; + + public CashOnDeliveryLimitDto() { + } + + public CashOnDeliveryLimitDto limit(@javax.annotation.Nullable BigDecimal limit) { + this.limit = limit; + return this; + } + + /** + * Maximum value + * @return limit + */ + @javax.annotation.Nullable + public BigDecimal getLimit() { + return limit; + } + + public void setLimit(@javax.annotation.Nullable BigDecimal limit) { + this.limit = limit; + } + + + public CashOnDeliveryLimitDto currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Supported currency: 'PLN' | 'CZK + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + public CashOnDeliveryLimitDto paymentType(@javax.annotation.Nullable PaymentTypeEnum paymentType) { + this.paymentType = paymentType; + return this; + } + + /** + * Type of payment: Money transfer to merchant bank account or internal wallet payout + * @return paymentType + */ + @javax.annotation.Nullable + public PaymentTypeEnum getPaymentType() { + return paymentType; + } + + public void setPaymentType(@javax.annotation.Nullable PaymentTypeEnum paymentType) { + this.paymentType = paymentType; + } + + + public CashOnDeliveryLimitDto forceRequireIban(@javax.annotation.Nullable Boolean forceRequireIban) { + this.forceRequireIban = forceRequireIban; + return this; + } + + /** + * Defined that COD required IBAN for process shipment. If true, then request of shipment creation without IBAN will be rejected. + * @return forceRequireIban + */ + @javax.annotation.Nullable + public Boolean getForceRequireIban() { + return forceRequireIban; + } + + public void setForceRequireIban(@javax.annotation.Nullable Boolean forceRequireIban) { + this.forceRequireIban = forceRequireIban; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CashOnDeliveryLimitDto cashOnDeliveryLimitDto = (CashOnDeliveryLimitDto) o; + return Objects.equals(this.limit, cashOnDeliveryLimitDto.limit) && + Objects.equals(this.currency, cashOnDeliveryLimitDto.currency) && + Objects.equals(this.paymentType, cashOnDeliveryLimitDto.paymentType) && + Objects.equals(this.forceRequireIban, cashOnDeliveryLimitDto.forceRequireIban); + } + + @Override + public int hashCode() { + return Objects.hash(limit, currency, paymentType, forceRequireIban); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CashOnDeliveryLimitDto {\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" paymentType: ").append(toIndentedString(paymentType)).append("\n"); + sb.append(" forceRequireIban: ").append(toIndentedString(forceRequireIban)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("limit"); + openapiFields.add("currency"); + openapiFields.add("paymentType"); + openapiFields.add("forceRequireIban"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CashOnDeliveryLimitDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CashOnDeliveryLimitDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CashOnDeliveryLimitDto is not found in the empty JSON string", CashOnDeliveryLimitDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CashOnDeliveryLimitDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CashOnDeliveryLimitDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + if ((jsonObj.get("paymentType") != null && !jsonObj.get("paymentType").isJsonNull()) && !jsonObj.get("paymentType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `paymentType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paymentType").toString())); + } + // validate the optional field `paymentType` + if (jsonObj.get("paymentType") != null && !jsonObj.get("paymentType").isJsonNull()) { + PaymentTypeEnum.validateJsonElement(jsonObj.get("paymentType")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CashOnDeliveryLimitDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CashOnDeliveryLimitDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CashOnDeliveryLimitDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CashOnDeliveryLimitDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CashOnDeliveryLimitDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CashOnDeliveryLimitDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CashOnDeliveryLimitDto + * @throws IOException if the JSON string is invalid with respect to CashOnDeliveryLimitDto + */ + public static CashOnDeliveryLimitDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CashOnDeliveryLimitDto.class); + } + + /** + * Convert an instance of CashOnDeliveryLimitDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoriesDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoriesDto.java new file mode 100644 index 0000000..0dbb371 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoriesDto.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CategoryDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The list of categories. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoriesDto { + public static final String SERIALIZED_NAME_CATEGORIES = "categories"; + @SerializedName(SERIALIZED_NAME_CATEGORIES) + @javax.annotation.Nullable + private List categories = new ArrayList<>(); + + public CategoriesDto() { + } + + public CategoriesDto categories(@javax.annotation.Nullable List categories) { + this.categories = categories; + return this; + } + + public CategoriesDto addCategoriesItem(CategoryDto categoriesItem) { + if (this.categories == null) { + this.categories = new ArrayList<>(); + } + this.categories.add(categoriesItem); + return this; + } + + /** + * Get categories + * @return categories + */ + @javax.annotation.Nullable + public List getCategories() { + return categories; + } + + public void setCategories(@javax.annotation.Nullable List categories) { + this.categories = categories; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoriesDto categoriesDto = (CategoriesDto) o; + return Objects.equals(this.categories, categoriesDto.categories); + } + + @Override + public int hashCode() { + return Objects.hash(categories); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoriesDto {\n"); + sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("categories"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoriesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoriesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoriesDto is not found in the empty JSON string", CategoriesDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoriesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoriesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("categories") != null && !jsonObj.get("categories").isJsonNull()) { + JsonArray jsonArraycategories = jsonObj.getAsJsonArray("categories"); + if (jsonArraycategories != null) { + // ensure the json data is an array + if (!jsonObj.get("categories").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `categories` to be an array in the JSON string but got `%s`", jsonObj.get("categories").toString())); + } + + // validate the optional field `categories` (array) + for (int i = 0; i < jsonArraycategories.size(); i++) { + CategoryDto.validateJsonElement(jsonArraycategories.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoriesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoriesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoriesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoriesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoriesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoriesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoriesDto + * @throws IOException if the JSON string is invalid with respect to CategoriesDto + */ + public static CategoriesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoriesDto.class); + } + + /** + * Convert an instance of CategoriesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoriesResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoriesResponse.java new file mode 100644 index 0000000..70f0f02 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoriesResponse.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CategoryResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoriesResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoriesResponse { + public static final String SERIALIZED_NAME_CATEGORIES = "categories"; + @SerializedName(SERIALIZED_NAME_CATEGORIES) + @javax.annotation.Nullable + private List categories = new ArrayList<>(); + + public CategoriesResponse() { + } + + public CategoriesResponse categories(@javax.annotation.Nullable List categories) { + this.categories = categories; + return this; + } + + public CategoriesResponse addCategoriesItem(CategoryResponse categoriesItem) { + if (this.categories == null) { + this.categories = new ArrayList<>(); + } + this.categories.add(categoriesItem); + return this; + } + + /** + * Get categories + * @return categories + */ + @javax.annotation.Nullable + public List getCategories() { + return categories; + } + + public void setCategories(@javax.annotation.Nullable List categories) { + this.categories = categories; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoriesResponse categoriesResponse = (CategoriesResponse) o; + return Objects.equals(this.categories, categoriesResponse.categories); + } + + @Override + public int hashCode() { + return Objects.hash(categories); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoriesResponse {\n"); + sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("categories"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoriesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoriesResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoriesResponse is not found in the empty JSON string", CategoriesResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoriesResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoriesResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("categories") != null && !jsonObj.get("categories").isJsonNull()) { + JsonArray jsonArraycategories = jsonObj.getAsJsonArray("categories"); + if (jsonArraycategories != null) { + // ensure the json data is an array + if (!jsonObj.get("categories").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `categories` to be an array in the JSON string but got `%s`", jsonObj.get("categories").toString())); + } + + // validate the optional field `categories` (array) + for (int i = 0; i < jsonArraycategories.size(); i++) { + CategoryResponse.validateJsonElement(jsonArraycategories.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoriesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoriesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoriesResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoriesResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoriesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoriesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoriesResponse + * @throws IOException if the JSON string is invalid with respect to CategoriesResponse + */ + public static CategoriesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoriesResponse.class); + } + + /** + * Convert an instance of CategoriesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Category.java b/src/main/java/pl/wtx/allegro/api/client/model/Category.java new file mode 100644 index 0000000..dd6d375 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Category.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Category + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Category { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public Category() { + } + + public Category id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Category identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Category + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Category.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Category` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Category.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Category' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Category value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Category read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Category given an JSON string + * + * @param jsonString JSON string + * @return An instance of Category + * @throws IOException if the JSON string is invalid with respect to Category + */ + public static Category fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Category.class); + } + + /** + * Convert an instance of Category to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryBaseEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryBaseEvent.java new file mode 100644 index 0000000..e51ec45 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryBaseEvent.java @@ -0,0 +1,243 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The data of an event. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryBaseEvent { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_OCCURRED_AT = "occurredAt"; + @SerializedName(SERIALIZED_NAME_OCCURRED_AT) + @javax.annotation.Nonnull + private OffsetDateTime occurredAt; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + public CategoryBaseEvent() { + this.type = this.getClass().getSimpleName(); + } + + public CategoryBaseEvent id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The ID of the event. It can be used in the `from` parameter of the query. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public CategoryBaseEvent occurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + /** + * The date and time when the change occurred, provided in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + * @return occurredAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getOccurredAt() { + return occurredAt; + } + + public void setOccurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + } + + + public CategoryBaseEvent type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The type of the change. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryBaseEvent categoryBaseEvent = (CategoryBaseEvent) o; + return Objects.equals(this.id, categoryBaseEvent.id) && + Objects.equals(this.occurredAt, categoryBaseEvent.occurredAt) && + Objects.equals(this.type, categoryBaseEvent.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, occurredAt, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryBaseEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" occurredAt: ").append(toIndentedString(occurredAt)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryBaseEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryBaseEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryBaseEvent is not found in the empty JSON string", CategoryBaseEvent.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "CATEGORY_CREATED": + CategoryCreatedEvent.validateJsonElement(jsonElement); + break; + case "CATEGORY_DELETED": + CategoryDeletedEvent.validateJsonElement(jsonElement); + break; + case "CATEGORY_MOVED": + CategoryMovedEvent.validateJsonElement(jsonElement); + break; + case "CATEGORY_RENAMED": + CategoryRenamedEvent.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of CategoryBaseEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryBaseEvent + * @throws IOException if the JSON string is invalid with respect to CategoryBaseEvent + */ + public static CategoryBaseEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryBaseEvent.class); + } + + /** + * Convert an instance of CategoryBaseEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryCreatedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryCreatedEvent.java new file mode 100644 index 0000000..535274e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryCreatedEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CategoryBaseEvent; +import pl.wtx.allegro.api.client.model.CategoryEventBaseCategory; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryCreatedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryCreatedEvent extends CategoryBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "CATEGORY_CREATED"; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nonnull + private CategoryEventBaseCategory category; + + public CategoryCreatedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public CategoryCreatedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public CategoryCreatedEvent category(@javax.annotation.Nonnull CategoryEventBaseCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nonnull + public CategoryEventBaseCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nonnull CategoryEventBaseCategory category) { + this.category = category; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryCreatedEvent categoryCreatedEvent = (CategoryCreatedEvent) o; + return Objects.equals(this.type, categoryCreatedEvent.type) && + Objects.equals(this.category, categoryCreatedEvent.category) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, category, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryCreatedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("category"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("category"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryCreatedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryCreatedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryCreatedEvent is not found in the empty JSON string", CategoryCreatedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryCreatedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryCreatedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategoryCreatedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryCreatedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryCreatedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryCreatedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryCreatedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryCreatedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryCreatedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryCreatedEvent + * @throws IOException if the JSON string is invalid with respect to CategoryCreatedEvent + */ + public static CategoryCreatedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryCreatedEvent.class); + } + + /** + * Convert an instance of CategoryCreatedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryDefinitionDescriptionResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDefinitionDescriptionResponse.java new file mode 100644 index 0000000..f0a0fc0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDefinitionDescriptionResponse.java @@ -0,0 +1,275 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryDefinitionDescriptionResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryDefinitionDescriptionResponse { + public static final String SERIALIZED_NAME_HINT = "hint"; + @SerializedName(SERIALIZED_NAME_HINT) + @javax.annotation.Nullable + private String hint; + + public static final String SERIALIZED_NAME_EDITABLE = "editable"; + @SerializedName(SERIALIZED_NAME_EDITABLE) + @javax.annotation.Nullable + private Boolean editable; + + public static final String SERIALIZED_NAME_DEFAULT = "default"; + @SerializedName(SERIALIZED_NAME_DEFAULT) + @javax.annotation.Nullable + private String _default; + + public CategoryDefinitionDescriptionResponse() { + } + + public CategoryDefinitionDescriptionResponse hint(@javax.annotation.Nullable String hint) { + this.hint = hint; + return this; + } + + /** + * Hint for the seller for better description for customers. + * @return hint + */ + @javax.annotation.Nullable + public String getHint() { + return hint; + } + + public void setHint(@javax.annotation.Nullable String hint) { + this.hint = hint; + } + + + public CategoryDefinitionDescriptionResponse editable(@javax.annotation.Nullable Boolean editable) { + this.editable = editable; + return this; + } + + /** + * Determines whether the description of additional service can be set by the seller, or it's provided by Allegro and cannot be changed. + * @return editable + */ + @javax.annotation.Nullable + public Boolean getEditable() { + return editable; + } + + public void setEditable(@javax.annotation.Nullable Boolean editable) { + this.editable = editable; + } + + + public CategoryDefinitionDescriptionResponse _default(@javax.annotation.Nullable String _default) { + this._default = _default; + return this; + } + + /** + * Default description of special additional service, provided by Allegro. + * @return _default + */ + @javax.annotation.Nullable + public String getDefault() { + return _default; + } + + public void setDefault(@javax.annotation.Nullable String _default) { + this._default = _default; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryDefinitionDescriptionResponse categoryDefinitionDescriptionResponse = (CategoryDefinitionDescriptionResponse) o; + return Objects.equals(this.hint, categoryDefinitionDescriptionResponse.hint) && + Objects.equals(this.editable, categoryDefinitionDescriptionResponse.editable) && + Objects.equals(this._default, categoryDefinitionDescriptionResponse._default); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(hint, editable, _default); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryDefinitionDescriptionResponse {\n"); + sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); + sb.append(" editable: ").append(toIndentedString(editable)).append("\n"); + sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("hint"); + openapiFields.add("editable"); + openapiFields.add("default"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryDefinitionDescriptionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryDefinitionDescriptionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryDefinitionDescriptionResponse is not found in the empty JSON string", CategoryDefinitionDescriptionResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryDefinitionDescriptionResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryDefinitionDescriptionResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) && !jsonObj.get("hint").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `hint` to be a primitive type in the JSON string but got `%s`", jsonObj.get("hint").toString())); + } + if ((jsonObj.get("default") != null && !jsonObj.get("default").isJsonNull()) && !jsonObj.get("default").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `default` to be a primitive type in the JSON string but got `%s`", jsonObj.get("default").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryDefinitionDescriptionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryDefinitionDescriptionResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryDefinitionDescriptionResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryDefinitionDescriptionResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryDefinitionDescriptionResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryDefinitionDescriptionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryDefinitionDescriptionResponse + * @throws IOException if the JSON string is invalid with respect to CategoryDefinitionDescriptionResponse + */ + public static CategoryDefinitionDescriptionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryDefinitionDescriptionResponse.class); + } + + /** + * Convert an instance of CategoryDefinitionDescriptionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryDefinitionResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDefinitionResponse.java new file mode 100644 index 0000000..326750c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDefinitionResponse.java @@ -0,0 +1,392 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AvailableConstraint; +import pl.wtx.allegro.api.client.model.CategoryDefinitionDescriptionResponse; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryDefinitionResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryDefinitionResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private CategoryDefinitionDescriptionResponse description; + + public static final String SERIALIZED_NAME_MAX_PRICE = "maxPrice"; + @SerializedName(SERIALIZED_NAME_MAX_PRICE) + @javax.annotation.Nullable + private Price maxPrice; + + public static final String SERIALIZED_NAME_AVAILABLE_CONSTRAINTS = "availableConstraints"; + @SerializedName(SERIALIZED_NAME_AVAILABLE_CONSTRAINTS) + @javax.annotation.Nullable + private List availableConstraints; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public CategoryDefinitionResponse() { + } + + public CategoryDefinitionResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of additional service definition. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CategoryDefinitionResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of additional service definition, that should be shown to the customer. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CategoryDefinitionResponse description(@javax.annotation.Nullable CategoryDefinitionDescriptionResponse description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public CategoryDefinitionDescriptionResponse getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable CategoryDefinitionDescriptionResponse description) { + this.description = description; + } + + + public CategoryDefinitionResponse maxPrice(@javax.annotation.Nullable Price maxPrice) { + this.maxPrice = maxPrice; + return this; + } + + /** + * Get maxPrice + * @return maxPrice + */ + @javax.annotation.Nullable + public Price getMaxPrice() { + return maxPrice; + } + + public void setMaxPrice(@javax.annotation.Nullable Price maxPrice) { + this.maxPrice = maxPrice; + } + + + public CategoryDefinitionResponse availableConstraints(@javax.annotation.Nullable List availableConstraints) { + this.availableConstraints = availableConstraints; + return this; + } + + public CategoryDefinitionResponse addAvailableConstraintsItem(AvailableConstraint availableConstraintsItem) { + if (this.availableConstraints == null) { + this.availableConstraints = new ArrayList<>(); + } + this.availableConstraints.add(availableConstraintsItem); + return this; + } + + /** + * Get availableConstraints + * @return availableConstraints + */ + @javax.annotation.Nullable + public List getAvailableConstraints() { + return availableConstraints; + } + + public void setAvailableConstraints(@javax.annotation.Nullable List availableConstraints) { + this.availableConstraints = availableConstraints; + } + + + public CategoryDefinitionResponse updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryDefinitionResponse categoryDefinitionResponse = (CategoryDefinitionResponse) o; + return Objects.equals(this.id, categoryDefinitionResponse.id) && + Objects.equals(this.name, categoryDefinitionResponse.name) && + Objects.equals(this.description, categoryDefinitionResponse.description) && + Objects.equals(this.maxPrice, categoryDefinitionResponse.maxPrice) && + Objects.equals(this.availableConstraints, categoryDefinitionResponse.availableConstraints) && + Objects.equals(this.updatedAt, categoryDefinitionResponse.updatedAt); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, maxPrice, availableConstraints, updatedAt); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryDefinitionResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" maxPrice: ").append(toIndentedString(maxPrice)).append("\n"); + sb.append(" availableConstraints: ").append(toIndentedString(availableConstraints)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("maxPrice"); + openapiFields.add("availableConstraints"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryDefinitionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryDefinitionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryDefinitionResponse is not found in the empty JSON string", CategoryDefinitionResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryDefinitionResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryDefinitionResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + CategoryDefinitionDescriptionResponse.validateJsonElement(jsonObj.get("description")); + } + // validate the optional field `maxPrice` + if (jsonObj.get("maxPrice") != null && !jsonObj.get("maxPrice").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("maxPrice")); + } + if (jsonObj.get("availableConstraints") != null && !jsonObj.get("availableConstraints").isJsonNull()) { + JsonArray jsonArrayavailableConstraints = jsonObj.getAsJsonArray("availableConstraints"); + if (jsonArrayavailableConstraints != null) { + // ensure the json data is an array + if (!jsonObj.get("availableConstraints").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `availableConstraints` to be an array in the JSON string but got `%s`", jsonObj.get("availableConstraints").toString())); + } + + // validate the optional field `availableConstraints` (array) + for (int i = 0; i < jsonArrayavailableConstraints.size(); i++) { + AvailableConstraint.validateJsonElement(jsonArrayavailableConstraints.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryDefinitionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryDefinitionResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryDefinitionResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryDefinitionResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryDefinitionResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryDefinitionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryDefinitionResponse + * @throws IOException if the JSON string is invalid with respect to CategoryDefinitionResponse + */ + public static CategoryDefinitionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryDefinitionResponse.class); + } + + /** + * Convert an instance of CategoryDefinitionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryDeletedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDeletedEvent.java new file mode 100644 index 0000000..e326d65 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDeletedEvent.java @@ -0,0 +1,275 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CategoryBaseEvent; +import pl.wtx.allegro.api.client.model.CategoryDeletedEventAllOfRedirectCategory; +import pl.wtx.allegro.api.client.model.CategoryEventBaseCategory; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryDeletedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryDeletedEvent extends CategoryBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "CATEGORY_DELETED"; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nonnull + private CategoryEventBaseCategory category; + + public static final String SERIALIZED_NAME_REDIRECT_CATEGORY = "redirectCategory"; + @SerializedName(SERIALIZED_NAME_REDIRECT_CATEGORY) + @javax.annotation.Nullable + private CategoryDeletedEventAllOfRedirectCategory redirectCategory; + + public CategoryDeletedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public CategoryDeletedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public CategoryDeletedEvent category(@javax.annotation.Nonnull CategoryEventBaseCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nonnull + public CategoryEventBaseCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nonnull CategoryEventBaseCategory category) { + this.category = category; + } + + + public CategoryDeletedEvent redirectCategory(@javax.annotation.Nullable CategoryDeletedEventAllOfRedirectCategory redirectCategory) { + this.redirectCategory = redirectCategory; + return this; + } + + /** + * Get redirectCategory + * @return redirectCategory + */ + @javax.annotation.Nullable + public CategoryDeletedEventAllOfRedirectCategory getRedirectCategory() { + return redirectCategory; + } + + public void setRedirectCategory(@javax.annotation.Nullable CategoryDeletedEventAllOfRedirectCategory redirectCategory) { + this.redirectCategory = redirectCategory; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryDeletedEvent categoryDeletedEvent = (CategoryDeletedEvent) o; + return Objects.equals(this.type, categoryDeletedEvent.type) && + Objects.equals(this.category, categoryDeletedEvent.category) && + Objects.equals(this.redirectCategory, categoryDeletedEvent.redirectCategory) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, category, redirectCategory, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryDeletedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" redirectCategory: ").append(toIndentedString(redirectCategory)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("category"); + openapiFields.add("redirectCategory"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("category"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryDeletedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryDeletedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryDeletedEvent is not found in the empty JSON string", CategoryDeletedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryDeletedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryDeletedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategoryDeletedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryDeletedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryDeletedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryDeletedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryDeletedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryDeletedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryDeletedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryDeletedEvent + * @throws IOException if the JSON string is invalid with respect to CategoryDeletedEvent + */ + public static CategoryDeletedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryDeletedEvent.class); + } + + /** + * Convert an instance of CategoryDeletedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryDeletedEventAllOfRedirectCategory.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDeletedEventAllOfRedirectCategory.java new file mode 100644 index 0000000..cfdc02f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDeletedEventAllOfRedirectCategory.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Category that should be used instead of deleted one. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryDeletedEventAllOfRedirectCategory { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public CategoryDeletedEventAllOfRedirectCategory() { + } + + public CategoryDeletedEventAllOfRedirectCategory id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the category. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryDeletedEventAllOfRedirectCategory categoryDeletedEventAllOfRedirectCategory = (CategoryDeletedEventAllOfRedirectCategory) o; + return Objects.equals(this.id, categoryDeletedEventAllOfRedirectCategory.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryDeletedEventAllOfRedirectCategory {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryDeletedEventAllOfRedirectCategory + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryDeletedEventAllOfRedirectCategory.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryDeletedEventAllOfRedirectCategory is not found in the empty JSON string", CategoryDeletedEventAllOfRedirectCategory.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryDeletedEventAllOfRedirectCategory.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryDeletedEventAllOfRedirectCategory` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryDeletedEventAllOfRedirectCategory.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryDeletedEventAllOfRedirectCategory' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryDeletedEventAllOfRedirectCategory.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryDeletedEventAllOfRedirectCategory value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryDeletedEventAllOfRedirectCategory read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryDeletedEventAllOfRedirectCategory given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryDeletedEventAllOfRedirectCategory + * @throws IOException if the JSON string is invalid with respect to CategoryDeletedEventAllOfRedirectCategory + */ + public static CategoryDeletedEventAllOfRedirectCategory fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryDeletedEventAllOfRedirectCategory.class); + } + + /** + * Convert an instance of CategoryDeletedEventAllOfRedirectCategory to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDto.java new file mode 100644 index 0000000..22b52cb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDto.java @@ -0,0 +1,327 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CategoryDtoParent; +import pl.wtx.allegro.api.client.model.CategoryOptionsDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The category data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_LEAF = "leaf"; + @SerializedName(SERIALIZED_NAME_LEAF) + @javax.annotation.Nullable + private Boolean leaf; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + @SerializedName(SERIALIZED_NAME_OPTIONS) + @javax.annotation.Nullable + private CategoryOptionsDto options; + + public static final String SERIALIZED_NAME_PARENT = "parent"; + @SerializedName(SERIALIZED_NAME_PARENT) + @javax.annotation.Nullable + private CategoryDtoParent parent; + + public CategoryDto() { + } + + public CategoryDto id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the category. This can be either in UUID format or an integer format. You should be ready to accept any string value as the category ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CategoryDto leaf(@javax.annotation.Nullable Boolean leaf) { + this.leaf = leaf; + return this; + } + + /** + * Indicates whether the category is at the lowest level. Leaf categories do not have any children. Offers can be listed only in leaf categories. + * @return leaf + */ + @javax.annotation.Nullable + public Boolean getLeaf() { + return leaf; + } + + public void setLeaf(@javax.annotation.Nullable Boolean leaf) { + this.leaf = leaf; + } + + + public CategoryDto name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the category in Polish. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CategoryDto options(@javax.annotation.Nullable CategoryOptionsDto options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + public CategoryOptionsDto getOptions() { + return options; + } + + public void setOptions(@javax.annotation.Nullable CategoryOptionsDto options) { + this.options = options; + } + + + public CategoryDto parent(@javax.annotation.Nullable CategoryDtoParent parent) { + this.parent = parent; + return this; + } + + /** + * Get parent + * @return parent + */ + @javax.annotation.Nullable + public CategoryDtoParent getParent() { + return parent; + } + + public void setParent(@javax.annotation.Nullable CategoryDtoParent parent) { + this.parent = parent; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryDto categoryDto = (CategoryDto) o; + return Objects.equals(this.id, categoryDto.id) && + Objects.equals(this.leaf, categoryDto.leaf) && + Objects.equals(this.name, categoryDto.name) && + Objects.equals(this.options, categoryDto.options) && + Objects.equals(this.parent, categoryDto.parent); + } + + @Override + public int hashCode() { + return Objects.hash(id, leaf, name, options, parent); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" leaf: ").append(toIndentedString(leaf)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append(" parent: ").append(toIndentedString(parent)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("leaf"); + openapiFields.add("name"); + openapiFields.add("options"); + openapiFields.add("parent"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryDto is not found in the empty JSON string", CategoryDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `options` + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { + CategoryOptionsDto.validateJsonElement(jsonObj.get("options")); + } + // validate the optional field `parent` + if (jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) { + CategoryDtoParent.validateJsonElement(jsonObj.get("parent")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryDto + * @throws IOException if the JSON string is invalid with respect to CategoryDto + */ + public static CategoryDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryDto.class); + } + + /** + * Convert an instance of CategoryDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryDtoParent.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDtoParent.java new file mode 100644 index 0000000..7429448 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryDtoParent.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The parent category data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryDtoParent { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public CategoryDtoParent() { + } + + public CategoryDtoParent id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the parent category. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryDtoParent categoryDtoParent = (CategoryDtoParent) o; + return Objects.equals(this.id, categoryDtoParent.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryDtoParent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryDtoParent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryDtoParent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryDtoParent is not found in the empty JSON string", CategoryDtoParent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryDtoParent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryDtoParent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryDtoParent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryDtoParent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryDtoParent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryDtoParent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryDtoParent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryDtoParent given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryDtoParent + * @throws IOException if the JSON string is invalid with respect to CategoryDtoParent + */ + public static CategoryDtoParent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryDtoParent.class); + } + + /** + * Convert an instance of CategoryDtoParent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryEventBaseCategory.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryEventBaseCategory.java new file mode 100644 index 0000000..b21a94e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryEventBaseCategory.java @@ -0,0 +1,295 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CategoryEventBaseCategoryParent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Category event category data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryEventBaseCategory { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_LEAF = "leaf"; + @SerializedName(SERIALIZED_NAME_LEAF) + @javax.annotation.Nullable + private Boolean leaf; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PARENT = "parent"; + @SerializedName(SERIALIZED_NAME_PARENT) + @javax.annotation.Nullable + private CategoryEventBaseCategoryParent parent; + + public CategoryEventBaseCategory() { + } + + public CategoryEventBaseCategory id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the category. This can be either in UUID format or an integer format. You should be ready to accept any string value as the category ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CategoryEventBaseCategory leaf(@javax.annotation.Nullable Boolean leaf) { + this.leaf = leaf; + return this; + } + + /** + * Indicates whether the category is at the lowest level. Leaf categories do not have any children. Offers can be listed only in leaf categories. + * @return leaf + */ + @javax.annotation.Nullable + public Boolean getLeaf() { + return leaf; + } + + public void setLeaf(@javax.annotation.Nullable Boolean leaf) { + this.leaf = leaf; + } + + + public CategoryEventBaseCategory name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the category. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CategoryEventBaseCategory parent(@javax.annotation.Nullable CategoryEventBaseCategoryParent parent) { + this.parent = parent; + return this; + } + + /** + * Get parent + * @return parent + */ + @javax.annotation.Nullable + public CategoryEventBaseCategoryParent getParent() { + return parent; + } + + public void setParent(@javax.annotation.Nullable CategoryEventBaseCategoryParent parent) { + this.parent = parent; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryEventBaseCategory categoryEventBaseCategory = (CategoryEventBaseCategory) o; + return Objects.equals(this.id, categoryEventBaseCategory.id) && + Objects.equals(this.leaf, categoryEventBaseCategory.leaf) && + Objects.equals(this.name, categoryEventBaseCategory.name) && + Objects.equals(this.parent, categoryEventBaseCategory.parent); + } + + @Override + public int hashCode() { + return Objects.hash(id, leaf, name, parent); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryEventBaseCategory {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" leaf: ").append(toIndentedString(leaf)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" parent: ").append(toIndentedString(parent)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("leaf"); + openapiFields.add("name"); + openapiFields.add("parent"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryEventBaseCategory + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryEventBaseCategory.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryEventBaseCategory is not found in the empty JSON string", CategoryEventBaseCategory.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryEventBaseCategory.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryEventBaseCategory` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `parent` + if (jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) { + CategoryEventBaseCategoryParent.validateJsonElement(jsonObj.get("parent")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryEventBaseCategory.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryEventBaseCategory' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryEventBaseCategory.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryEventBaseCategory value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryEventBaseCategory read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryEventBaseCategory given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryEventBaseCategory + * @throws IOException if the JSON string is invalid with respect to CategoryEventBaseCategory + */ + public static CategoryEventBaseCategory fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryEventBaseCategory.class); + } + + /** + * Convert an instance of CategoryEventBaseCategory to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryEventBaseCategoryParent.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryEventBaseCategoryParent.java new file mode 100644 index 0000000..9146d4e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryEventBaseCategoryParent.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The parent category data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryEventBaseCategoryParent { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public CategoryEventBaseCategoryParent() { + } + + public CategoryEventBaseCategoryParent id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the parent category. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryEventBaseCategoryParent categoryEventBaseCategoryParent = (CategoryEventBaseCategoryParent) o; + return Objects.equals(this.id, categoryEventBaseCategoryParent.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryEventBaseCategoryParent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryEventBaseCategoryParent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryEventBaseCategoryParent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryEventBaseCategoryParent is not found in the empty JSON string", CategoryEventBaseCategoryParent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryEventBaseCategoryParent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryEventBaseCategoryParent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryEventBaseCategoryParent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryEventBaseCategoryParent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryEventBaseCategoryParent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryEventBaseCategoryParent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryEventBaseCategoryParent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryEventBaseCategoryParent given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryEventBaseCategoryParent + * @throws IOException if the JSON string is invalid with respect to CategoryEventBaseCategoryParent + */ + public static CategoryEventBaseCategoryParent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryEventBaseCategoryParent.class); + } + + /** + * Convert an instance of CategoryEventBaseCategoryParent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryEventsResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryEventsResponse.java new file mode 100644 index 0000000..40a73ba --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryEventsResponse.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CategoryBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryEventsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryEventsResponse { + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nonnull + private List events = new ArrayList<>(); + + public CategoryEventsResponse() { + } + + public CategoryEventsResponse events(@javax.annotation.Nonnull List events) { + this.events = events; + return this; + } + + public CategoryEventsResponse addEventsItem(CategoryBaseEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * The list of events. + * @return events + */ + @javax.annotation.Nonnull + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nonnull List events) { + this.events = events; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryEventsResponse categoryEventsResponse = (CategoryEventsResponse) o; + return Objects.equals(this.events, categoryEventsResponse.events); + } + + @Override + public int hashCode() { + return Objects.hash(events); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryEventsResponse {\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("events"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("events"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryEventsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryEventsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryEventsResponse is not found in the empty JSON string", CategoryEventsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryEventsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryEventsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategoryEventsResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + + JsonArray jsonArrayevents = jsonObj.getAsJsonArray("events"); + // validate the required field `events` (array) + for (int i = 0; i < jsonArrayevents.size(); i++) { + CategoryBaseEvent.validateJsonElement(jsonArrayevents.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryEventsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryEventsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryEventsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryEventsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryEventsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryEventsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryEventsResponse + * @throws IOException if the JSON string is invalid with respect to CategoryEventsResponse + */ + public static CategoryEventsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryEventsResponse.class); + } + + /** + * Convert an instance of CategoryEventsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryMovedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryMovedEvent.java new file mode 100644 index 0000000..ffdf916 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryMovedEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CategoryBaseEvent; +import pl.wtx.allegro.api.client.model.CategoryEventBaseCategory; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryMovedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryMovedEvent extends CategoryBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "CATEGORY_MOVED"; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nonnull + private CategoryEventBaseCategory category; + + public CategoryMovedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public CategoryMovedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public CategoryMovedEvent category(@javax.annotation.Nonnull CategoryEventBaseCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nonnull + public CategoryEventBaseCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nonnull CategoryEventBaseCategory category) { + this.category = category; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryMovedEvent categoryMovedEvent = (CategoryMovedEvent) o; + return Objects.equals(this.type, categoryMovedEvent.type) && + Objects.equals(this.category, categoryMovedEvent.category) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, category, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryMovedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("category"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("category"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryMovedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryMovedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryMovedEvent is not found in the empty JSON string", CategoryMovedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryMovedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryMovedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategoryMovedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryMovedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryMovedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryMovedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryMovedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryMovedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryMovedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryMovedEvent + * @throws IOException if the JSON string is invalid with respect to CategoryMovedEvent + */ + public static CategoryMovedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryMovedEvent.class); + } + + /** + * Convert an instance of CategoryMovedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryOptionsDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryOptionsDto.java new file mode 100644 index 0000000..97387f6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryOptionsDto.java @@ -0,0 +1,365 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * A list of the different options which can be used with this category. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryOptionsDto { + public static final String SERIALIZED_NAME_ADVERTISEMENT = "advertisement"; + @SerializedName(SERIALIZED_NAME_ADVERTISEMENT) + @javax.annotation.Nullable + private Boolean advertisement; + + public static final String SERIALIZED_NAME_ADVERTISEMENT_PRICE_OPTIONAL = "advertisementPriceOptional"; + @SerializedName(SERIALIZED_NAME_ADVERTISEMENT_PRICE_OPTIONAL) + @javax.annotation.Nullable + private Boolean advertisementPriceOptional; + + public static final String SERIALIZED_NAME_VARIANTS_BY_COLOR_PATTERN_ALLOWED = "variantsByColorPatternAllowed"; + @SerializedName(SERIALIZED_NAME_VARIANTS_BY_COLOR_PATTERN_ALLOWED) + @javax.annotation.Nullable + private Boolean variantsByColorPatternAllowed; + + public static final String SERIALIZED_NAME_OFFERS_WITH_PRODUCT_PUBLICATION_ENABLED = "offersWithProductPublicationEnabled"; + @SerializedName(SERIALIZED_NAME_OFFERS_WITH_PRODUCT_PUBLICATION_ENABLED) + @javax.annotation.Nullable + private Boolean offersWithProductPublicationEnabled; + + public static final String SERIALIZED_NAME_PRODUCT_CREATION_ENABLED = "productCreationEnabled"; + @SerializedName(SERIALIZED_NAME_PRODUCT_CREATION_ENABLED) + @javax.annotation.Nullable + private Boolean productCreationEnabled; + + public static final String SERIALIZED_NAME_CUSTOM_PARAMETERS_ENABLED = "customParametersEnabled"; + @SerializedName(SERIALIZED_NAME_CUSTOM_PARAMETERS_ENABLED) + @javax.annotation.Nullable + private Boolean customParametersEnabled; + + public static final String SERIALIZED_NAME_SELLER_CAN_REQUIRE_PURCHASE_COMMENTS = "sellerCanRequirePurchaseComments"; + @SerializedName(SERIALIZED_NAME_SELLER_CAN_REQUIRE_PURCHASE_COMMENTS) + @javax.annotation.Nullable + private Boolean sellerCanRequirePurchaseComments; + + public CategoryOptionsDto() { + } + + public CategoryOptionsDto advertisement(@javax.annotation.Nullable Boolean advertisement) { + this.advertisement = advertisement; + return this; + } + + /** + * Indicates whether offers of type ADVERTISEMENT can be listed in this category. + * @return advertisement + */ + @javax.annotation.Nullable + public Boolean getAdvertisement() { + return advertisement; + } + + public void setAdvertisement(@javax.annotation.Nullable Boolean advertisement) { + this.advertisement = advertisement; + } + + + public CategoryOptionsDto advertisementPriceOptional(@javax.annotation.Nullable Boolean advertisementPriceOptional) { + this.advertisementPriceOptional = advertisementPriceOptional; + return this; + } + + /** + * Indicates whether advertisements listed in this category must have a price given. If the value is `true` then you don't have to provide a price when listing an advertisement in this category. + * @return advertisementPriceOptional + */ + @javax.annotation.Nullable + public Boolean getAdvertisementPriceOptional() { + return advertisementPriceOptional; + } + + public void setAdvertisementPriceOptional(@javax.annotation.Nullable Boolean advertisementPriceOptional) { + this.advertisementPriceOptional = advertisementPriceOptional; + } + + + public CategoryOptionsDto variantsByColorPatternAllowed(@javax.annotation.Nullable Boolean variantsByColorPatternAllowed) { + this.variantsByColorPatternAllowed = variantsByColorPatternAllowed; + return this; + } + + /** + * Indicates whether you can combine offers from this category into variant sets based on the color and pattern. + * @return variantsByColorPatternAllowed + */ + @javax.annotation.Nullable + public Boolean getVariantsByColorPatternAllowed() { + return variantsByColorPatternAllowed; + } + + public void setVariantsByColorPatternAllowed(@javax.annotation.Nullable Boolean variantsByColorPatternAllowed) { + this.variantsByColorPatternAllowed = variantsByColorPatternAllowed; + } + + + public CategoryOptionsDto offersWithProductPublicationEnabled(@javax.annotation.Nullable Boolean offersWithProductPublicationEnabled) { + this.offersWithProductPublicationEnabled = offersWithProductPublicationEnabled; + return this; + } + + /** + * Information whether the category supports assigning offers to a product. + * @return offersWithProductPublicationEnabled + */ + @javax.annotation.Nullable + public Boolean getOffersWithProductPublicationEnabled() { + return offersWithProductPublicationEnabled; + } + + public void setOffersWithProductPublicationEnabled(@javax.annotation.Nullable Boolean offersWithProductPublicationEnabled) { + this.offersWithProductPublicationEnabled = offersWithProductPublicationEnabled; + } + + + public CategoryOptionsDto productCreationEnabled(@javax.annotation.Nullable Boolean productCreationEnabled) { + this.productCreationEnabled = productCreationEnabled; + return this; + } + + /** + * Indicates whether the category supports creating products. + * @return productCreationEnabled + */ + @javax.annotation.Nullable + public Boolean getProductCreationEnabled() { + return productCreationEnabled; + } + + public void setProductCreationEnabled(@javax.annotation.Nullable Boolean productCreationEnabled) { + this.productCreationEnabled = productCreationEnabled; + } + + + public CategoryOptionsDto customParametersEnabled(@javax.annotation.Nullable Boolean customParametersEnabled) { + this.customParametersEnabled = customParametersEnabled; + return this; + } + + /** + * Indicates whether custom parameters can be added to offers in this category. + * @return customParametersEnabled + */ + @javax.annotation.Nullable + public Boolean getCustomParametersEnabled() { + return customParametersEnabled; + } + + public void setCustomParametersEnabled(@javax.annotation.Nullable Boolean customParametersEnabled) { + this.customParametersEnabled = customParametersEnabled; + } + + + public CategoryOptionsDto sellerCanRequirePurchaseComments(@javax.annotation.Nullable Boolean sellerCanRequirePurchaseComments) { + this.sellerCanRequirePurchaseComments = sellerCanRequirePurchaseComments; + return this; + } + + /** + * Indicates whether the category supports message to seller in `REQUIRED` mode. + * @return sellerCanRequirePurchaseComments + */ + @javax.annotation.Nullable + public Boolean getSellerCanRequirePurchaseComments() { + return sellerCanRequirePurchaseComments; + } + + public void setSellerCanRequirePurchaseComments(@javax.annotation.Nullable Boolean sellerCanRequirePurchaseComments) { + this.sellerCanRequirePurchaseComments = sellerCanRequirePurchaseComments; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryOptionsDto categoryOptionsDto = (CategoryOptionsDto) o; + return Objects.equals(this.advertisement, categoryOptionsDto.advertisement) && + Objects.equals(this.advertisementPriceOptional, categoryOptionsDto.advertisementPriceOptional) && + Objects.equals(this.variantsByColorPatternAllowed, categoryOptionsDto.variantsByColorPatternAllowed) && + Objects.equals(this.offersWithProductPublicationEnabled, categoryOptionsDto.offersWithProductPublicationEnabled) && + Objects.equals(this.productCreationEnabled, categoryOptionsDto.productCreationEnabled) && + Objects.equals(this.customParametersEnabled, categoryOptionsDto.customParametersEnabled) && + Objects.equals(this.sellerCanRequirePurchaseComments, categoryOptionsDto.sellerCanRequirePurchaseComments); + } + + @Override + public int hashCode() { + return Objects.hash(advertisement, advertisementPriceOptional, variantsByColorPatternAllowed, offersWithProductPublicationEnabled, productCreationEnabled, customParametersEnabled, sellerCanRequirePurchaseComments); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryOptionsDto {\n"); + sb.append(" advertisement: ").append(toIndentedString(advertisement)).append("\n"); + sb.append(" advertisementPriceOptional: ").append(toIndentedString(advertisementPriceOptional)).append("\n"); + sb.append(" variantsByColorPatternAllowed: ").append(toIndentedString(variantsByColorPatternAllowed)).append("\n"); + sb.append(" offersWithProductPublicationEnabled: ").append(toIndentedString(offersWithProductPublicationEnabled)).append("\n"); + sb.append(" productCreationEnabled: ").append(toIndentedString(productCreationEnabled)).append("\n"); + sb.append(" customParametersEnabled: ").append(toIndentedString(customParametersEnabled)).append("\n"); + sb.append(" sellerCanRequirePurchaseComments: ").append(toIndentedString(sellerCanRequirePurchaseComments)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("advertisement"); + openapiFields.add("advertisementPriceOptional"); + openapiFields.add("variantsByColorPatternAllowed"); + openapiFields.add("offersWithProductPublicationEnabled"); + openapiFields.add("productCreationEnabled"); + openapiFields.add("customParametersEnabled"); + openapiFields.add("sellerCanRequirePurchaseComments"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryOptionsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryOptionsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryOptionsDto is not found in the empty JSON string", CategoryOptionsDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryOptionsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryOptionsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryOptionsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryOptionsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryOptionsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryOptionsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryOptionsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryOptionsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryOptionsDto + * @throws IOException if the JSON string is invalid with respect to CategoryOptionsDto + */ + public static CategoryOptionsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryOptionsDto.class); + } + + /** + * Convert an instance of CategoryOptionsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameter.java new file mode 100644 index 0000000..35e98af --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameter.java @@ -0,0 +1,417 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.CategoryParameterDisplayConditions; +import pl.wtx.allegro.api.client.model.CategoryParameterOptions; +import pl.wtx.allegro.api.client.model.CategoryParameterRequirementConditions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryParameter { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + public static final String SERIALIZED_NAME_REQUIRED = "required"; + @SerializedName(SERIALIZED_NAME_REQUIRED) + @javax.annotation.Nullable + private Boolean required; + + public static final String SERIALIZED_NAME_REQUIRED_FOR_PRODUCT = "requiredForProduct"; + @SerializedName(SERIALIZED_NAME_REQUIRED_FOR_PRODUCT) + @javax.annotation.Nullable + private Boolean requiredForProduct; + + public static final String SERIALIZED_NAME_REQUIRED_IF = "requiredIf"; + @SerializedName(SERIALIZED_NAME_REQUIRED_IF) + @javax.annotation.Nullable + private CategoryParameterRequirementConditions requiredIf; + + public static final String SERIALIZED_NAME_DISPLAYED_IF = "displayedIf"; + @SerializedName(SERIALIZED_NAME_DISPLAYED_IF) + @javax.annotation.Nullable + private CategoryParameterDisplayConditions displayedIf; + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private String unit; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + @SerializedName(SERIALIZED_NAME_OPTIONS) + @javax.annotation.Nullable + private CategoryParameterOptions options; + + public CategoryParameter() { + this.type = this.getClass().getSimpleName(); + } + + public CategoryParameter id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the parameter. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CategoryParameter name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of the parameter in Polish. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CategoryParameter type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The type of the parameter. Other fields in this structure may appear based on the type of the parameter. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public CategoryParameter required(@javax.annotation.Nullable Boolean required) { + this.required = required; + return this; + } + + /** + * Indicates whether the value of this parameter must be set in an offer. Offers without required parameters set cannot be published. See also `requiredIf`. + * @return required + */ + @javax.annotation.Nullable + public Boolean getRequired() { + return required; + } + + public void setRequired(@javax.annotation.Nullable Boolean required) { + this.required = required; + } + + + public CategoryParameter requiredForProduct(@javax.annotation.Nullable Boolean requiredForProduct) { + this.requiredForProduct = requiredForProduct; + return this; + } + + /** + * Indicates whether the value of this parameter must be set in a product. Product without required parameters set cannot be created. + * @return requiredForProduct + */ + @javax.annotation.Nullable + public Boolean getRequiredForProduct() { + return requiredForProduct; + } + + public void setRequiredForProduct(@javax.annotation.Nullable Boolean requiredForProduct) { + this.requiredForProduct = requiredForProduct; + } + + + public CategoryParameter requiredIf(@javax.annotation.Nullable CategoryParameterRequirementConditions requiredIf) { + this.requiredIf = requiredIf; + return this; + } + + /** + * Get requiredIf + * @return requiredIf + */ + @javax.annotation.Nullable + public CategoryParameterRequirementConditions getRequiredIf() { + return requiredIf; + } + + public void setRequiredIf(@javax.annotation.Nullable CategoryParameterRequirementConditions requiredIf) { + this.requiredIf = requiredIf; + } + + + public CategoryParameter displayedIf(@javax.annotation.Nullable CategoryParameterDisplayConditions displayedIf) { + this.displayedIf = displayedIf; + return this; + } + + /** + * Get displayedIf + * @return displayedIf + */ + @javax.annotation.Nullable + public CategoryParameterDisplayConditions getDisplayedIf() { + return displayedIf; + } + + public void setDisplayedIf(@javax.annotation.Nullable CategoryParameterDisplayConditions displayedIf) { + this.displayedIf = displayedIf; + } + + + public CategoryParameter unit(@javax.annotation.Nullable String unit) { + this.unit = unit; + return this; + } + + /** + * The unit in which values of the parameter are used. May be `null`. + * @return unit + */ + @javax.annotation.Nullable + public String getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable String unit) { + this.unit = unit; + } + + + public CategoryParameter options(@javax.annotation.Nullable CategoryParameterOptions options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + public CategoryParameterOptions getOptions() { + return options; + } + + public void setOptions(@javax.annotation.Nullable CategoryParameterOptions options) { + this.options = options; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryParameter categoryParameter = (CategoryParameter) o; + return Objects.equals(this.id, categoryParameter.id) && + Objects.equals(this.name, categoryParameter.name) && + Objects.equals(this.type, categoryParameter.type) && + Objects.equals(this.required, categoryParameter.required) && + Objects.equals(this.requiredForProduct, categoryParameter.requiredForProduct) && + Objects.equals(this.requiredIf, categoryParameter.requiredIf) && + Objects.equals(this.displayedIf, categoryParameter.displayedIf) && + Objects.equals(this.unit, categoryParameter.unit) && + Objects.equals(this.options, categoryParameter.options); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, type, required, requiredForProduct, requiredIf, displayedIf, unit, options); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryParameter {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append(" requiredForProduct: ").append(toIndentedString(requiredForProduct)).append("\n"); + sb.append(" requiredIf: ").append(toIndentedString(requiredIf)).append("\n"); + sb.append(" displayedIf: ").append(toIndentedString(displayedIf)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("required"); + openapiFields.add("requiredForProduct"); + openapiFields.add("requiredIf"); + openapiFields.add("displayedIf"); + openapiFields.add("unit"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryParameter is not found in the empty JSON string", CategoryParameter.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "dictionary": + DictionaryCategoryParameter.validateJsonElement(jsonElement); + break; + case "float": + FloatCategoryParameter.validateJsonElement(jsonElement); + break; + case "integer": + IntegerCategoryParameter.validateJsonElement(jsonElement); + break; + case "string": + StringCategoryParameter.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of CategoryParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryParameter + * @throws IOException if the JSON string is invalid with respect to CategoryParameter + */ + public static CategoryParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryParameter.class); + } + + /** + * Convert an instance of CategoryParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterDisplayConditions.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterDisplayConditions.java new file mode 100644 index 0000000..a4e43e8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterDisplayConditions.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CategoryParameterWithValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Restricts the circumstances when this parameter should be displayed e.g. on a user form. `null` if this parameter is displayed always. Present if this parameter should be displayed only if all of the contained conditions of all condition types are fulfilled. At least one condition is contained if this field is present. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryParameterDisplayConditions { + public static final String SERIALIZED_NAME_PARAMETERS_WITH_VALUE = "parametersWithValue"; + @SerializedName(SERIALIZED_NAME_PARAMETERS_WITH_VALUE) + @javax.annotation.Nonnull + private List parametersWithValue = new ArrayList<>(); + + public CategoryParameterDisplayConditions() { + } + + public CategoryParameterDisplayConditions parametersWithValue(@javax.annotation.Nonnull List parametersWithValue) { + this.parametersWithValue = parametersWithValue; + return this; + } + + public CategoryParameterDisplayConditions addParametersWithValueItem(CategoryParameterWithValue parametersWithValueItem) { + if (this.parametersWithValue == null) { + this.parametersWithValue = new ArrayList<>(); + } + this.parametersWithValue.add(parametersWithValueItem); + return this; + } + + /** + * Condition type which displays this parameter only if each of the given other parameters has filled in one of the respective given value ids in an offer or product. Empty if no condition of this type is present. + * @return parametersWithValue + */ + @javax.annotation.Nonnull + public List getParametersWithValue() { + return parametersWithValue; + } + + public void setParametersWithValue(@javax.annotation.Nonnull List parametersWithValue) { + this.parametersWithValue = parametersWithValue; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryParameterDisplayConditions categoryParameterDisplayConditions = (CategoryParameterDisplayConditions) o; + return Objects.equals(this.parametersWithValue, categoryParameterDisplayConditions.parametersWithValue); + } + + @Override + public int hashCode() { + return Objects.hash(parametersWithValue); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryParameterDisplayConditions {\n"); + sb.append(" parametersWithValue: ").append(toIndentedString(parametersWithValue)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("parametersWithValue"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("parametersWithValue"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryParameterDisplayConditions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryParameterDisplayConditions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryParameterDisplayConditions is not found in the empty JSON string", CategoryParameterDisplayConditions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryParameterDisplayConditions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryParameterDisplayConditions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategoryParameterDisplayConditions.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("parametersWithValue").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parametersWithValue` to be an array in the JSON string but got `%s`", jsonObj.get("parametersWithValue").toString())); + } + + JsonArray jsonArrayparametersWithValue = jsonObj.getAsJsonArray("parametersWithValue"); + // validate the required field `parametersWithValue` (array) + for (int i = 0; i < jsonArrayparametersWithValue.size(); i++) { + CategoryParameterWithValue.validateJsonElement(jsonArrayparametersWithValue.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryParameterDisplayConditions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryParameterDisplayConditions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryParameterDisplayConditions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryParameterDisplayConditions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryParameterDisplayConditions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryParameterDisplayConditions given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryParameterDisplayConditions + * @throws IOException if the JSON string is invalid with respect to CategoryParameterDisplayConditions + */ + public static CategoryParameterDisplayConditions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryParameterDisplayConditions.class); + } + + /** + * Convert an instance of CategoryParameterDisplayConditions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterList.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterList.java new file mode 100644 index 0000000..c90f735 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterList.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CategoryParameter; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryParameterList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryParameterList { + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public CategoryParameterList() { + } + + public CategoryParameterList parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public CategoryParameterList addParametersItem(CategoryParameter parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * The list of parameters supported by the category. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryParameterList categoryParameterList = (CategoryParameterList) o; + return Objects.equals(this.parameters, categoryParameterList.parameters); + } + + @Override + public int hashCode() { + return Objects.hash(parameters); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryParameterList {\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("parameters"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryParameterList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryParameterList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryParameterList is not found in the empty JSON string", CategoryParameterList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryParameterList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryParameterList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + CategoryParameter.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryParameterList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryParameterList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryParameterList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryParameterList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryParameterList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryParameterList given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryParameterList + * @throws IOException if the JSON string is invalid with respect to CategoryParameterList + */ + public static CategoryParameterList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryParameterList.class); + } + + /** + * Convert an instance of CategoryParameterList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterOptions.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterOptions.java new file mode 100644 index 0000000..82c3f09 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterOptions.java @@ -0,0 +1,356 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * A list of the different options which can be used with this parameter. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryParameterOptions { + public static final String SERIALIZED_NAME_VARIANTS_ALLOWED = "variantsAllowed"; + @SerializedName(SERIALIZED_NAME_VARIANTS_ALLOWED) + @javax.annotation.Nullable + private Boolean variantsAllowed; + + public static final String SERIALIZED_NAME_VARIANTS_EQUAL = "variantsEqual"; + @SerializedName(SERIALIZED_NAME_VARIANTS_EQUAL) + @javax.annotation.Nullable + private Boolean variantsEqual; + + public static final String SERIALIZED_NAME_AMBIGUOUS_VALUE_ID = "ambiguousValueId"; + @SerializedName(SERIALIZED_NAME_AMBIGUOUS_VALUE_ID) + @javax.annotation.Nullable + private String ambiguousValueId; + + public static final String SERIALIZED_NAME_DEPENDS_ON_PARAMETER_ID = "dependsOnParameterId"; + @SerializedName(SERIALIZED_NAME_DEPENDS_ON_PARAMETER_ID) + @javax.annotation.Nullable + private String dependsOnParameterId; + + public static final String SERIALIZED_NAME_DESCRIBES_PRODUCT = "describesProduct"; + @SerializedName(SERIALIZED_NAME_DESCRIBES_PRODUCT) + @javax.annotation.Nullable + private Boolean describesProduct; + + public static final String SERIALIZED_NAME_CUSTOM_VALUES_ENABLED = "customValuesEnabled"; + @SerializedName(SERIALIZED_NAME_CUSTOM_VALUES_ENABLED) + @javax.annotation.Nullable + private Boolean customValuesEnabled; + + public CategoryParameterOptions() { + } + + public CategoryParameterOptions variantsAllowed(@javax.annotation.Nullable Boolean variantsAllowed) { + this.variantsAllowed = variantsAllowed; + return this; + } + + /** + * Parameters with this option enabled can be used for offer variants creation. + * @return variantsAllowed + */ + @javax.annotation.Nullable + public Boolean getVariantsAllowed() { + return variantsAllowed; + } + + public void setVariantsAllowed(@javax.annotation.Nullable Boolean variantsAllowed) { + this.variantsAllowed = variantsAllowed; + } + + + public CategoryParameterOptions variantsEqual(@javax.annotation.Nullable Boolean variantsEqual) { + this.variantsEqual = variantsEqual; + return this; + } + + /** + * All offer variants must have the same values in parameters with this option enabled. + * @return variantsEqual + */ + @javax.annotation.Nullable + public Boolean getVariantsEqual() { + return variantsEqual; + } + + public void setVariantsEqual(@javax.annotation.Nullable Boolean variantsEqual) { + this.variantsEqual = variantsEqual; + } + + + public CategoryParameterOptions ambiguousValueId(@javax.annotation.Nullable String ambiguousValueId) { + this.ambiguousValueId = ambiguousValueId; + return this; + } + + /** + * Indicates what value in the dictionary is defined as an ambiguous one. Only parameters with dictionaries might have this option defined. + * @return ambiguousValueId + */ + @javax.annotation.Nullable + public String getAmbiguousValueId() { + return ambiguousValueId; + } + + public void setAmbiguousValueId(@javax.annotation.Nullable String ambiguousValueId) { + this.ambiguousValueId = ambiguousValueId; + } + + + public CategoryParameterOptions dependsOnParameterId(@javax.annotation.Nullable String dependsOnParameterId) { + this.dependsOnParameterId = dependsOnParameterId; + return this; + } + + /** + * Indicates whether this parameter's allowed values depend on another parameter's values. This field is set only for dictionary parameters which have at least one dictionary value with dependent values (see also `dictionary[].dependsOnValueIds`). Otherwise this field is null. + * @return dependsOnParameterId + */ + @javax.annotation.Nullable + public String getDependsOnParameterId() { + return dependsOnParameterId; + } + + public void setDependsOnParameterId(@javax.annotation.Nullable String dependsOnParameterId) { + this.dependsOnParameterId = dependsOnParameterId; + } + + + public CategoryParameterOptions describesProduct(@javax.annotation.Nullable Boolean describesProduct) { + this.describesProduct = describesProduct; + return this; + } + + /** + * Indicates if parameter is used to define products. + * @return describesProduct + */ + @javax.annotation.Nullable + public Boolean getDescribesProduct() { + return describesProduct; + } + + public void setDescribesProduct(@javax.annotation.Nullable Boolean describesProduct) { + this.describesProduct = describesProduct; + } + + + public CategoryParameterOptions customValuesEnabled(@javax.annotation.Nullable Boolean customValuesEnabled) { + this.customValuesEnabled = customValuesEnabled; + return this; + } + + /** + * Indicates if a custom value can be added to a parameter with an ambiguous value. + * @return customValuesEnabled + */ + @javax.annotation.Nullable + public Boolean getCustomValuesEnabled() { + return customValuesEnabled; + } + + public void setCustomValuesEnabled(@javax.annotation.Nullable Boolean customValuesEnabled) { + this.customValuesEnabled = customValuesEnabled; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryParameterOptions categoryParameterOptions = (CategoryParameterOptions) o; + return Objects.equals(this.variantsAllowed, categoryParameterOptions.variantsAllowed) && + Objects.equals(this.variantsEqual, categoryParameterOptions.variantsEqual) && + Objects.equals(this.ambiguousValueId, categoryParameterOptions.ambiguousValueId) && + Objects.equals(this.dependsOnParameterId, categoryParameterOptions.dependsOnParameterId) && + Objects.equals(this.describesProduct, categoryParameterOptions.describesProduct) && + Objects.equals(this.customValuesEnabled, categoryParameterOptions.customValuesEnabled); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(variantsAllowed, variantsEqual, ambiguousValueId, dependsOnParameterId, describesProduct, customValuesEnabled); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryParameterOptions {\n"); + sb.append(" variantsAllowed: ").append(toIndentedString(variantsAllowed)).append("\n"); + sb.append(" variantsEqual: ").append(toIndentedString(variantsEqual)).append("\n"); + sb.append(" ambiguousValueId: ").append(toIndentedString(ambiguousValueId)).append("\n"); + sb.append(" dependsOnParameterId: ").append(toIndentedString(dependsOnParameterId)).append("\n"); + sb.append(" describesProduct: ").append(toIndentedString(describesProduct)).append("\n"); + sb.append(" customValuesEnabled: ").append(toIndentedString(customValuesEnabled)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("variantsAllowed"); + openapiFields.add("variantsEqual"); + openapiFields.add("ambiguousValueId"); + openapiFields.add("dependsOnParameterId"); + openapiFields.add("describesProduct"); + openapiFields.add("customValuesEnabled"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryParameterOptions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryParameterOptions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryParameterOptions is not found in the empty JSON string", CategoryParameterOptions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryParameterOptions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryParameterOptions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("ambiguousValueId") != null && !jsonObj.get("ambiguousValueId").isJsonNull()) && !jsonObj.get("ambiguousValueId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ambiguousValueId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ambiguousValueId").toString())); + } + if ((jsonObj.get("dependsOnParameterId") != null && !jsonObj.get("dependsOnParameterId").isJsonNull()) && !jsonObj.get("dependsOnParameterId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dependsOnParameterId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dependsOnParameterId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryParameterOptions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryParameterOptions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryParameterOptions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryParameterOptions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryParameterOptions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryParameterOptions given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryParameterOptions + * @throws IOException if the JSON string is invalid with respect to CategoryParameterOptions + */ + public static CategoryParameterOptions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryParameterOptions.class); + } + + /** + * Convert an instance of CategoryParameterOptions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterRequirementConditions.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterRequirementConditions.java new file mode 100644 index 0000000..d4f1b6b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterRequirementConditions.java @@ -0,0 +1,279 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CategoryParameterWithValue; +import pl.wtx.allegro.api.client.model.CategoryParameterWithoutValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Restricts the circumstances when this parameter is required. `null` if solely the `required` flag determines if this parameter is required. Present if this parameter is required only if all of the contained conditions of all condition types are fulfilled. At least one condition is contained if this field is present. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryParameterRequirementConditions { + public static final String SERIALIZED_NAME_PARAMETERS_WITH_VALUE = "parametersWithValue"; + @SerializedName(SERIALIZED_NAME_PARAMETERS_WITH_VALUE) + @javax.annotation.Nonnull + private List parametersWithValue = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PARAMETERS_WITHOUT_VALUE = "parametersWithoutValue"; + @SerializedName(SERIALIZED_NAME_PARAMETERS_WITHOUT_VALUE) + @javax.annotation.Nonnull + private List parametersWithoutValue = new ArrayList<>(); + + public CategoryParameterRequirementConditions() { + } + + public CategoryParameterRequirementConditions parametersWithValue(@javax.annotation.Nonnull List parametersWithValue) { + this.parametersWithValue = parametersWithValue; + return this; + } + + public CategoryParameterRequirementConditions addParametersWithValueItem(CategoryParameterWithValue parametersWithValueItem) { + if (this.parametersWithValue == null) { + this.parametersWithValue = new ArrayList<>(); + } + this.parametersWithValue.add(parametersWithValueItem); + return this; + } + + /** + * Condition type which requires this parameter only if each of the given other parameters has filled in one of the respective given value ids in an offer or product. Empty if no condition of this type is present. + * @return parametersWithValue + */ + @javax.annotation.Nonnull + public List getParametersWithValue() { + return parametersWithValue; + } + + public void setParametersWithValue(@javax.annotation.Nonnull List parametersWithValue) { + this.parametersWithValue = parametersWithValue; + } + + + public CategoryParameterRequirementConditions parametersWithoutValue(@javax.annotation.Nonnull List parametersWithoutValue) { + this.parametersWithoutValue = parametersWithoutValue; + return this; + } + + public CategoryParameterRequirementConditions addParametersWithoutValueItem(CategoryParameterWithoutValue parametersWithoutValueItem) { + if (this.parametersWithoutValue == null) { + this.parametersWithoutValue = new ArrayList<>(); + } + this.parametersWithoutValue.add(parametersWithoutValueItem); + return this; + } + + /** + * Condition type which requires this parameter only if each of the given other parameters has filled neither a value nor a value id in an offer or product. Empty if no condition of this type is present. + * @return parametersWithoutValue + */ + @javax.annotation.Nonnull + public List getParametersWithoutValue() { + return parametersWithoutValue; + } + + public void setParametersWithoutValue(@javax.annotation.Nonnull List parametersWithoutValue) { + this.parametersWithoutValue = parametersWithoutValue; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryParameterRequirementConditions categoryParameterRequirementConditions = (CategoryParameterRequirementConditions) o; + return Objects.equals(this.parametersWithValue, categoryParameterRequirementConditions.parametersWithValue) && + Objects.equals(this.parametersWithoutValue, categoryParameterRequirementConditions.parametersWithoutValue); + } + + @Override + public int hashCode() { + return Objects.hash(parametersWithValue, parametersWithoutValue); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryParameterRequirementConditions {\n"); + sb.append(" parametersWithValue: ").append(toIndentedString(parametersWithValue)).append("\n"); + sb.append(" parametersWithoutValue: ").append(toIndentedString(parametersWithoutValue)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("parametersWithValue"); + openapiFields.add("parametersWithoutValue"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("parametersWithValue"); + openapiRequiredFields.add("parametersWithoutValue"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryParameterRequirementConditions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryParameterRequirementConditions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryParameterRequirementConditions is not found in the empty JSON string", CategoryParameterRequirementConditions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryParameterRequirementConditions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryParameterRequirementConditions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategoryParameterRequirementConditions.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("parametersWithValue").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parametersWithValue` to be an array in the JSON string but got `%s`", jsonObj.get("parametersWithValue").toString())); + } + + JsonArray jsonArrayparametersWithValue = jsonObj.getAsJsonArray("parametersWithValue"); + // validate the required field `parametersWithValue` (array) + for (int i = 0; i < jsonArrayparametersWithValue.size(); i++) { + CategoryParameterWithValue.validateJsonElement(jsonArrayparametersWithValue.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("parametersWithoutValue").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parametersWithoutValue` to be an array in the JSON string but got `%s`", jsonObj.get("parametersWithoutValue").toString())); + } + + JsonArray jsonArrayparametersWithoutValue = jsonObj.getAsJsonArray("parametersWithoutValue"); + // validate the required field `parametersWithoutValue` (array) + for (int i = 0; i < jsonArrayparametersWithoutValue.size(); i++) { + CategoryParameterWithoutValue.validateJsonElement(jsonArrayparametersWithoutValue.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryParameterRequirementConditions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryParameterRequirementConditions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryParameterRequirementConditions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryParameterRequirementConditions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryParameterRequirementConditions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryParameterRequirementConditions given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryParameterRequirementConditions + * @throws IOException if the JSON string is invalid with respect to CategoryParameterRequirementConditions + */ + public static CategoryParameterRequirementConditions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryParameterRequirementConditions.class); + } + + /** + * Convert an instance of CategoryParameterRequirementConditions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterWithValue.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterWithValue.java new file mode 100644 index 0000000..01c79f7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterWithValue.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryParameterWithValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryParameterWithValue { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_ONE_OF_VALUE_IDS = "oneOfValueIds"; + @SerializedName(SERIALIZED_NAME_ONE_OF_VALUE_IDS) + @javax.annotation.Nonnull + private List oneOfValueIds = new ArrayList<>(); + + public CategoryParameterWithValue() { + } + + public CategoryParameterWithValue id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Id of another parameter with a value dictionary. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public CategoryParameterWithValue oneOfValueIds(@javax.annotation.Nonnull List oneOfValueIds) { + this.oneOfValueIds = oneOfValueIds; + return this; + } + + public CategoryParameterWithValue addOneOfValueIdsItem(String oneOfValueIdsItem) { + if (this.oneOfValueIds == null) { + this.oneOfValueIds = new ArrayList<>(); + } + this.oneOfValueIds.add(oneOfValueIdsItem); + return this; + } + + /** + * A list of value ids. One of them must be chosen in order to fulfill this condition. Not empty. + * @return oneOfValueIds + */ + @javax.annotation.Nonnull + public List getOneOfValueIds() { + return oneOfValueIds; + } + + public void setOneOfValueIds(@javax.annotation.Nonnull List oneOfValueIds) { + this.oneOfValueIds = oneOfValueIds; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryParameterWithValue categoryParameterWithValue = (CategoryParameterWithValue) o; + return Objects.equals(this.id, categoryParameterWithValue.id) && + Objects.equals(this.oneOfValueIds, categoryParameterWithValue.oneOfValueIds); + } + + @Override + public int hashCode() { + return Objects.hash(id, oneOfValueIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryParameterWithValue {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" oneOfValueIds: ").append(toIndentedString(oneOfValueIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("oneOfValueIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("oneOfValueIds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryParameterWithValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryParameterWithValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryParameterWithValue is not found in the empty JSON string", CategoryParameterWithValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryParameterWithValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryParameterWithValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategoryParameterWithValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // ensure the required json array is present + if (jsonObj.get("oneOfValueIds") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("oneOfValueIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `oneOfValueIds` to be an array in the JSON string but got `%s`", jsonObj.get("oneOfValueIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryParameterWithValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryParameterWithValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryParameterWithValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryParameterWithValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryParameterWithValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryParameterWithValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryParameterWithValue + * @throws IOException if the JSON string is invalid with respect to CategoryParameterWithValue + */ + public static CategoryParameterWithValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryParameterWithValue.class); + } + + /** + * Convert an instance of CategoryParameterWithValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterWithoutValue.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterWithoutValue.java new file mode 100644 index 0000000..20246d7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParameterWithoutValue.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryParameterWithoutValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryParameterWithoutValue { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public CategoryParameterWithoutValue() { + } + + public CategoryParameterWithoutValue id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Id of another parameter. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryParameterWithoutValue categoryParameterWithoutValue = (CategoryParameterWithoutValue) o; + return Objects.equals(this.id, categoryParameterWithoutValue.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryParameterWithoutValue {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryParameterWithoutValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryParameterWithoutValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryParameterWithoutValue is not found in the empty JSON string", CategoryParameterWithoutValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryParameterWithoutValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryParameterWithoutValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategoryParameterWithoutValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryParameterWithoutValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryParameterWithoutValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryParameterWithoutValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryParameterWithoutValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryParameterWithoutValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryParameterWithoutValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryParameterWithoutValue + * @throws IOException if the JSON string is invalid with respect to CategoryParameterWithoutValue + */ + public static CategoryParameterWithoutValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryParameterWithoutValue.class); + } + + /** + * Convert an instance of CategoryParameterWithoutValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChange.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChange.java new file mode 100644 index 0000000..cd9d470 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChange.java @@ -0,0 +1,234 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The data of an scheduled change. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryParametersScheduledBaseChange { + public static final String SERIALIZED_NAME_SCHEDULED_AT = "scheduledAt"; + @SerializedName(SERIALIZED_NAME_SCHEDULED_AT) + @javax.annotation.Nonnull + private OffsetDateTime scheduledAt; + + public static final String SERIALIZED_NAME_SCHEDULED_FOR = "scheduledFor"; + @SerializedName(SERIALIZED_NAME_SCHEDULED_FOR) + @javax.annotation.Nonnull + private OffsetDateTime scheduledFor; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + public CategoryParametersScheduledBaseChange() { + this.type = this.getClass().getSimpleName(); + } + + public CategoryParametersScheduledBaseChange scheduledAt(@javax.annotation.Nonnull OffsetDateTime scheduledAt) { + this.scheduledAt = scheduledAt; + return this; + } + + /** + * The date and time when the change was scheduled, provided in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + * @return scheduledAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getScheduledAt() { + return scheduledAt; + } + + public void setScheduledAt(@javax.annotation.Nonnull OffsetDateTime scheduledAt) { + this.scheduledAt = scheduledAt; + } + + + public CategoryParametersScheduledBaseChange scheduledFor(@javax.annotation.Nonnull OffsetDateTime scheduledFor) { + this.scheduledFor = scheduledFor; + return this; + } + + /** + * The date and time when the change will be effective from, provided in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + * @return scheduledFor + */ + @javax.annotation.Nonnull + public OffsetDateTime getScheduledFor() { + return scheduledFor; + } + + public void setScheduledFor(@javax.annotation.Nonnull OffsetDateTime scheduledFor) { + this.scheduledFor = scheduledFor; + } + + + public CategoryParametersScheduledBaseChange type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The type of the change. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryParametersScheduledBaseChange categoryParametersScheduledBaseChange = (CategoryParametersScheduledBaseChange) o; + return Objects.equals(this.scheduledAt, categoryParametersScheduledBaseChange.scheduledAt) && + Objects.equals(this.scheduledFor, categoryParametersScheduledBaseChange.scheduledFor) && + Objects.equals(this.type, categoryParametersScheduledBaseChange.type); + } + + @Override + public int hashCode() { + return Objects.hash(scheduledAt, scheduledFor, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryParametersScheduledBaseChange {\n"); + sb.append(" scheduledAt: ").append(toIndentedString(scheduledAt)).append("\n"); + sb.append(" scheduledFor: ").append(toIndentedString(scheduledFor)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheduledAt"); + openapiFields.add("scheduledFor"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scheduledAt"); + openapiRequiredFields.add("scheduledFor"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryParametersScheduledBaseChange + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryParametersScheduledBaseChange.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryParametersScheduledBaseChange is not found in the empty JSON string", CategoryParametersScheduledBaseChange.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "REQUIREMENT_CHANGE": + RequirementChange.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of CategoryParametersScheduledBaseChange given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryParametersScheduledBaseChange + * @throws IOException if the JSON string is invalid with respect to CategoryParametersScheduledBaseChange + */ + public static CategoryParametersScheduledBaseChange fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryParametersScheduledBaseChange.class); + } + + /** + * Convert an instance of CategoryParametersScheduledBaseChange to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChangeCategory.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChangeCategory.java new file mode 100644 index 0000000..c26e5b6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChangeCategory.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Category parameter scheduled change category data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryParametersScheduledBaseChangeCategory { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public CategoryParametersScheduledBaseChangeCategory() { + } + + public CategoryParametersScheduledBaseChangeCategory id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the category. This can be either in UUID format or an integer format. You should be ready to accept any string value as the category ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryParametersScheduledBaseChangeCategory categoryParametersScheduledBaseChangeCategory = (CategoryParametersScheduledBaseChangeCategory) o; + return Objects.equals(this.id, categoryParametersScheduledBaseChangeCategory.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryParametersScheduledBaseChangeCategory {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryParametersScheduledBaseChangeCategory + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryParametersScheduledBaseChangeCategory.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryParametersScheduledBaseChangeCategory is not found in the empty JSON string", CategoryParametersScheduledBaseChangeCategory.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryParametersScheduledBaseChangeCategory.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryParametersScheduledBaseChangeCategory` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryParametersScheduledBaseChangeCategory.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryParametersScheduledBaseChangeCategory' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryParametersScheduledBaseChangeCategory.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryParametersScheduledBaseChangeCategory value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryParametersScheduledBaseChangeCategory read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryParametersScheduledBaseChangeCategory given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryParametersScheduledBaseChangeCategory + * @throws IOException if the JSON string is invalid with respect to CategoryParametersScheduledBaseChangeCategory + */ + public static CategoryParametersScheduledBaseChangeCategory fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryParametersScheduledBaseChangeCategory.class); + } + + /** + * Convert an instance of CategoryParametersScheduledBaseChangeCategory to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChangeParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChangeParameter.java new file mode 100644 index 0000000..917330c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledBaseChangeParameter.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Category parameter scheduled change parameter data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryParametersScheduledBaseChangeParameter { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public CategoryParametersScheduledBaseChangeParameter() { + } + + public CategoryParametersScheduledBaseChangeParameter id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the Parameter. This can be either in UUID format or an integer format. You should be ready to accept any string value as the parameter ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryParametersScheduledBaseChangeParameter categoryParametersScheduledBaseChangeParameter = (CategoryParametersScheduledBaseChangeParameter) o; + return Objects.equals(this.id, categoryParametersScheduledBaseChangeParameter.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryParametersScheduledBaseChangeParameter {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryParametersScheduledBaseChangeParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryParametersScheduledBaseChangeParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryParametersScheduledBaseChangeParameter is not found in the empty JSON string", CategoryParametersScheduledBaseChangeParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryParametersScheduledBaseChangeParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryParametersScheduledBaseChangeParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryParametersScheduledBaseChangeParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryParametersScheduledBaseChangeParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryParametersScheduledBaseChangeParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryParametersScheduledBaseChangeParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryParametersScheduledBaseChangeParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryParametersScheduledBaseChangeParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryParametersScheduledBaseChangeParameter + * @throws IOException if the JSON string is invalid with respect to CategoryParametersScheduledBaseChangeParameter + */ + public static CategoryParametersScheduledBaseChangeParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryParametersScheduledBaseChangeParameter.class); + } + + /** + * Convert an instance of CategoryParametersScheduledBaseChangeParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledChangesResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledChangesResponse.java new file mode 100644 index 0000000..e2e0603 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryParametersScheduledChangesResponse.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CategoryParametersScheduledBaseChange; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryParametersScheduledChangesResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryParametersScheduledChangesResponse { + public static final String SERIALIZED_NAME_SCHEDULED_CHANGES = "scheduledChanges"; + @SerializedName(SERIALIZED_NAME_SCHEDULED_CHANGES) + @javax.annotation.Nonnull + private List scheduledChanges = new ArrayList<>(); + + public CategoryParametersScheduledChangesResponse() { + } + + public CategoryParametersScheduledChangesResponse scheduledChanges(@javax.annotation.Nonnull List scheduledChanges) { + this.scheduledChanges = scheduledChanges; + return this; + } + + public CategoryParametersScheduledChangesResponse addScheduledChangesItem(CategoryParametersScheduledBaseChange scheduledChangesItem) { + if (this.scheduledChanges == null) { + this.scheduledChanges = new ArrayList<>(); + } + this.scheduledChanges.add(scheduledChangesItem); + return this; + } + + /** + * The list of scheduled changes. + * @return scheduledChanges + */ + @javax.annotation.Nonnull + public List getScheduledChanges() { + return scheduledChanges; + } + + public void setScheduledChanges(@javax.annotation.Nonnull List scheduledChanges) { + this.scheduledChanges = scheduledChanges; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryParametersScheduledChangesResponse categoryParametersScheduledChangesResponse = (CategoryParametersScheduledChangesResponse) o; + return Objects.equals(this.scheduledChanges, categoryParametersScheduledChangesResponse.scheduledChanges); + } + + @Override + public int hashCode() { + return Objects.hash(scheduledChanges); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryParametersScheduledChangesResponse {\n"); + sb.append(" scheduledChanges: ").append(toIndentedString(scheduledChanges)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheduledChanges"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("scheduledChanges"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryParametersScheduledChangesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryParametersScheduledChangesResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryParametersScheduledChangesResponse is not found in the empty JSON string", CategoryParametersScheduledChangesResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryParametersScheduledChangesResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryParametersScheduledChangesResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategoryParametersScheduledChangesResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("scheduledChanges").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `scheduledChanges` to be an array in the JSON string but got `%s`", jsonObj.get("scheduledChanges").toString())); + } + + JsonArray jsonArrayscheduledChanges = jsonObj.getAsJsonArray("scheduledChanges"); + // validate the required field `scheduledChanges` (array) + for (int i = 0; i < jsonArrayscheduledChanges.size(); i++) { + CategoryParametersScheduledBaseChange.validateJsonElement(jsonArrayscheduledChanges.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryParametersScheduledChangesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryParametersScheduledChangesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryParametersScheduledChangesResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryParametersScheduledChangesResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryParametersScheduledChangesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryParametersScheduledChangesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryParametersScheduledChangesResponse + * @throws IOException if the JSON string is invalid with respect to CategoryParametersScheduledChangesResponse + */ + public static CategoryParametersScheduledChangesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryParametersScheduledChangesResponse.class); + } + + /** + * Convert an instance of CategoryParametersScheduledChangesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryProductParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryProductParameter.java new file mode 100644 index 0000000..3a45fea --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryProductParameter.java @@ -0,0 +1,362 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.CategoryParameterDisplayConditions; +import pl.wtx.allegro.api.client.model.CategoryParameterRequirementConditions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryProductParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryProductParameter { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + public static final String SERIALIZED_NAME_REQUIRED = "required"; + @SerializedName(SERIALIZED_NAME_REQUIRED) + @javax.annotation.Nullable + private Boolean required; + + public static final String SERIALIZED_NAME_REQUIRED_IF = "requiredIf"; + @SerializedName(SERIALIZED_NAME_REQUIRED_IF) + @javax.annotation.Nullable + private CategoryParameterRequirementConditions requiredIf; + + public static final String SERIALIZED_NAME_DISPLAYED_IF = "displayedIf"; + @SerializedName(SERIALIZED_NAME_DISPLAYED_IF) + @javax.annotation.Nullable + private CategoryParameterDisplayConditions displayedIf; + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private String unit; + + public CategoryProductParameter() { + this.type = this.getClass().getSimpleName(); + } + + public CategoryProductParameter id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the parameter. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CategoryProductParameter name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of the parameter in Polish. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CategoryProductParameter type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The type of the product parameter. Other fields in this structure may appear based on the type of the parameter. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public CategoryProductParameter required(@javax.annotation.Nullable Boolean required) { + this.required = required; + return this; + } + + /** + * Indicates whether the value of this parameter must be set in a product. Product without required parameters set cannot be created. See also `requiredIf`. + * @return required + */ + @javax.annotation.Nullable + public Boolean getRequired() { + return required; + } + + public void setRequired(@javax.annotation.Nullable Boolean required) { + this.required = required; + } + + + public CategoryProductParameter requiredIf(@javax.annotation.Nullable CategoryParameterRequirementConditions requiredIf) { + this.requiredIf = requiredIf; + return this; + } + + /** + * Get requiredIf + * @return requiredIf + */ + @javax.annotation.Nullable + public CategoryParameterRequirementConditions getRequiredIf() { + return requiredIf; + } + + public void setRequiredIf(@javax.annotation.Nullable CategoryParameterRequirementConditions requiredIf) { + this.requiredIf = requiredIf; + } + + + public CategoryProductParameter displayedIf(@javax.annotation.Nullable CategoryParameterDisplayConditions displayedIf) { + this.displayedIf = displayedIf; + return this; + } + + /** + * Get displayedIf + * @return displayedIf + */ + @javax.annotation.Nullable + public CategoryParameterDisplayConditions getDisplayedIf() { + return displayedIf; + } + + public void setDisplayedIf(@javax.annotation.Nullable CategoryParameterDisplayConditions displayedIf) { + this.displayedIf = displayedIf; + } + + + public CategoryProductParameter unit(@javax.annotation.Nullable String unit) { + this.unit = unit; + return this; + } + + /** + * The unit in which values of the parameter are used. May be `null`. + * @return unit + */ + @javax.annotation.Nullable + public String getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable String unit) { + this.unit = unit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryProductParameter categoryProductParameter = (CategoryProductParameter) o; + return Objects.equals(this.id, categoryProductParameter.id) && + Objects.equals(this.name, categoryProductParameter.name) && + Objects.equals(this.type, categoryProductParameter.type) && + Objects.equals(this.required, categoryProductParameter.required) && + Objects.equals(this.requiredIf, categoryProductParameter.requiredIf) && + Objects.equals(this.displayedIf, categoryProductParameter.displayedIf) && + Objects.equals(this.unit, categoryProductParameter.unit); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, type, required, requiredIf, displayedIf, unit); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryProductParameter {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append(" requiredIf: ").append(toIndentedString(requiredIf)).append("\n"); + sb.append(" displayedIf: ").append(toIndentedString(displayedIf)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("required"); + openapiFields.add("requiredIf"); + openapiFields.add("displayedIf"); + openapiFields.add("unit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryProductParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryProductParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryProductParameter is not found in the empty JSON string", CategoryProductParameter.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "dictionary": + DictionaryCategoryProductParameter.validateJsonElement(jsonElement); + break; + case "float": + FloatCategoryProductParameter.validateJsonElement(jsonElement); + break; + case "integer": + IntegerCategoryProductParameter.validateJsonElement(jsonElement); + break; + case "string": + StringCategoryProductParameter.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of CategoryProductParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryProductParameter + * @throws IOException if the JSON string is invalid with respect to CategoryProductParameter + */ + public static CategoryProductParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryProductParameter.class); + } + + /** + * Convert an instance of CategoryProductParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryProductParameterList.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryProductParameterList.java new file mode 100644 index 0000000..0e2700c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryProductParameterList.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CategoryProductParameter; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryProductParameterList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryProductParameterList { + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public CategoryProductParameterList() { + } + + public CategoryProductParameterList parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public CategoryProductParameterList addParametersItem(CategoryProductParameter parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * The list of product parameters supported by the category. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryProductParameterList categoryProductParameterList = (CategoryProductParameterList) o; + return Objects.equals(this.parameters, categoryProductParameterList.parameters); + } + + @Override + public int hashCode() { + return Objects.hash(parameters); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryProductParameterList {\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("parameters"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryProductParameterList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryProductParameterList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryProductParameterList is not found in the empty JSON string", CategoryProductParameterList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryProductParameterList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryProductParameterList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + CategoryProductParameter.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryProductParameterList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryProductParameterList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryProductParameterList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryProductParameterList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryProductParameterList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryProductParameterList given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryProductParameterList + * @throws IOException if the JSON string is invalid with respect to CategoryProductParameterList + */ + public static CategoryProductParameterList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryProductParameterList.class); + } + + /** + * Convert an instance of CategoryProductParameterList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryRenamedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryRenamedEvent.java new file mode 100644 index 0000000..548dd50 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryRenamedEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CategoryBaseEvent; +import pl.wtx.allegro.api.client.model.CategoryEventBaseCategory; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryRenamedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryRenamedEvent extends CategoryBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "CATEGORY_RENAMED"; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nonnull + private CategoryEventBaseCategory category; + + public CategoryRenamedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public CategoryRenamedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public CategoryRenamedEvent category(@javax.annotation.Nonnull CategoryEventBaseCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nonnull + public CategoryEventBaseCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nonnull CategoryEventBaseCategory category) { + this.category = category; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryRenamedEvent categoryRenamedEvent = (CategoryRenamedEvent) o; + return Objects.equals(this.type, categoryRenamedEvent.type) && + Objects.equals(this.category, categoryRenamedEvent.category) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, category, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryRenamedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("category"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("category"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryRenamedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryRenamedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryRenamedEvent is not found in the empty JSON string", CategoryRenamedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryRenamedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryRenamedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategoryRenamedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryRenamedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryRenamedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryRenamedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryRenamedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryRenamedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryRenamedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryRenamedEvent + * @throws IOException if the JSON string is invalid with respect to CategoryRenamedEvent + */ + public static CategoryRenamedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryRenamedEvent.class); + } + + /** + * Convert an instance of CategoryRenamedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryResponse.java new file mode 100644 index 0000000..83e0c06 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryResponse.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CategoryDefinitionResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryResponse { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_DEFINITIONS = "definitions"; + @SerializedName(SERIALIZED_NAME_DEFINITIONS) + @javax.annotation.Nullable + private List definitions = new ArrayList<>(); + + public CategoryResponse() { + } + + public CategoryResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the additional services category. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CategoryResponse definitions(@javax.annotation.Nullable List definitions) { + this.definitions = definitions; + return this; + } + + public CategoryResponse addDefinitionsItem(CategoryDefinitionResponse definitionsItem) { + if (this.definitions == null) { + this.definitions = new ArrayList<>(); + } + this.definitions.add(definitionsItem); + return this; + } + + /** + * Get definitions + * @return definitions + */ + @javax.annotation.Nullable + public List getDefinitions() { + return definitions; + } + + public void setDefinitions(@javax.annotation.Nullable List definitions) { + this.definitions = definitions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryResponse categoryResponse = (CategoryResponse) o; + return Objects.equals(this.name, categoryResponse.name) && + Objects.equals(this.definitions, categoryResponse.definitions); + } + + @Override + public int hashCode() { + return Objects.hash(name, definitions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryResponse {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" definitions: ").append(toIndentedString(definitions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("definitions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryResponse is not found in the empty JSON string", CategoryResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (jsonObj.get("definitions") != null && !jsonObj.get("definitions").isJsonNull()) { + JsonArray jsonArraydefinitions = jsonObj.getAsJsonArray("definitions"); + if (jsonArraydefinitions != null) { + // ensure the json data is an array + if (!jsonObj.get("definitions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `definitions` to be an array in the JSON string but got `%s`", jsonObj.get("definitions").toString())); + } + + // validate the optional field `definitions` (array) + for (int i = 0; i < jsonArraydefinitions.size(); i++) { + CategoryDefinitionResponse.validateJsonElement(jsonArraydefinitions.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryResponse + * @throws IOException if the JSON string is invalid with respect to CategoryResponse + */ + public static CategoryResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryResponse.class); + } + + /** + * Convert an instance of CategoryResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategorySuggestionCategoryNode.java b/src/main/java/pl/wtx/allegro/api/client/model/CategorySuggestionCategoryNode.java new file mode 100644 index 0000000..fb6083b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategorySuggestionCategoryNode.java @@ -0,0 +1,276 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Category suggestion category object. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategorySuggestionCategoryNode { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PARENT = "parent"; + @SerializedName(SERIALIZED_NAME_PARENT) + @javax.annotation.Nullable + private CategorySuggestionCategoryNode parent; + + public CategorySuggestionCategoryNode() { + } + + public CategorySuggestionCategoryNode id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * ID of category. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public CategorySuggestionCategoryNode name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Category name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public CategorySuggestionCategoryNode parent(@javax.annotation.Nullable CategorySuggestionCategoryNode parent) { + this.parent = parent; + return this; + } + + /** + * Get parent + * @return parent + */ + @javax.annotation.Nullable + public CategorySuggestionCategoryNode getParent() { + return parent; + } + + public void setParent(@javax.annotation.Nullable CategorySuggestionCategoryNode parent) { + this.parent = parent; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategorySuggestionCategoryNode categorySuggestionCategoryNode = (CategorySuggestionCategoryNode) o; + return Objects.equals(this.id, categorySuggestionCategoryNode.id) && + Objects.equals(this.name, categorySuggestionCategoryNode.name) && + Objects.equals(this.parent, categorySuggestionCategoryNode.parent); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, parent); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategorySuggestionCategoryNode {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" parent: ").append(toIndentedString(parent)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("parent"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategorySuggestionCategoryNode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategorySuggestionCategoryNode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategorySuggestionCategoryNode is not found in the empty JSON string", CategorySuggestionCategoryNode.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategorySuggestionCategoryNode.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategorySuggestionCategoryNode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategorySuggestionCategoryNode.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `parent` + if (jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) { + CategorySuggestionCategoryNode.validateJsonElement(jsonObj.get("parent")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategorySuggestionCategoryNode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategorySuggestionCategoryNode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategorySuggestionCategoryNode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategorySuggestionCategoryNode value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategorySuggestionCategoryNode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategorySuggestionCategoryNode given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategorySuggestionCategoryNode + * @throws IOException if the JSON string is invalid with respect to CategorySuggestionCategoryNode + */ + public static CategorySuggestionCategoryNode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategorySuggestionCategoryNode.class); + } + + /** + * Convert an instance of CategorySuggestionCategoryNode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategorySuggestionResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CategorySuggestionResponse.java new file mode 100644 index 0000000..3d98df4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategorySuggestionResponse.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CategorySuggestionCategoryNode; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategorySuggestionResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategorySuggestionResponse { + public static final String SERIALIZED_NAME_MATCHING_CATEGORIES = "matchingCategories"; + @SerializedName(SERIALIZED_NAME_MATCHING_CATEGORIES) + @javax.annotation.Nonnull + private List matchingCategories = new ArrayList<>(); + + public CategorySuggestionResponse() { + } + + public CategorySuggestionResponse matchingCategories(@javax.annotation.Nonnull List matchingCategories) { + this.matchingCategories = matchingCategories; + return this; + } + + public CategorySuggestionResponse addMatchingCategoriesItem(CategorySuggestionCategoryNode matchingCategoriesItem) { + if (this.matchingCategories == null) { + this.matchingCategories = new ArrayList<>(); + } + this.matchingCategories.add(matchingCategoriesItem); + return this; + } + + /** + * List of categories matching with given phrase. + * @return matchingCategories + */ + @javax.annotation.Nonnull + public List getMatchingCategories() { + return matchingCategories; + } + + public void setMatchingCategories(@javax.annotation.Nonnull List matchingCategories) { + this.matchingCategories = matchingCategories; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategorySuggestionResponse categorySuggestionResponse = (CategorySuggestionResponse) o; + return Objects.equals(this.matchingCategories, categorySuggestionResponse.matchingCategories); + } + + @Override + public int hashCode() { + return Objects.hash(matchingCategories); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategorySuggestionResponse {\n"); + sb.append(" matchingCategories: ").append(toIndentedString(matchingCategories)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("matchingCategories"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("matchingCategories"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategorySuggestionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategorySuggestionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategorySuggestionResponse is not found in the empty JSON string", CategorySuggestionResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategorySuggestionResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategorySuggestionResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CategorySuggestionResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("matchingCategories").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `matchingCategories` to be an array in the JSON string but got `%s`", jsonObj.get("matchingCategories").toString())); + } + + JsonArray jsonArraymatchingCategories = jsonObj.getAsJsonArray("matchingCategories"); + // validate the required field `matchingCategories` (array) + for (int i = 0; i < jsonArraymatchingCategories.size(); i++) { + CategorySuggestionCategoryNode.validateJsonElement(jsonArraymatchingCategories.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategorySuggestionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategorySuggestionResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategorySuggestionResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategorySuggestionResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategorySuggestionResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategorySuggestionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategorySuggestionResponse + * @throws IOException if the JSON string is invalid with respect to CategorySuggestionResponse + */ + public static CategorySuggestionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategorySuggestionResponse.class); + } + + /** + * Convert an instance of CategorySuggestionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CategoryTaxSettings.java b/src/main/java/pl/wtx/allegro/api/client/model/CategoryTaxSettings.java new file mode 100644 index 0000000..f338454 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CategoryTaxSettings.java @@ -0,0 +1,328 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.TaxExemption; +import pl.wtx.allegro.api.client.model.TaxRate; +import pl.wtx.allegro.api.client.model.TaxSubject; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CategoryTaxSettings + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CategoryTaxSettings { + public static final String SERIALIZED_NAME_SUBJECTS = "subjects"; + @SerializedName(SERIALIZED_NAME_SUBJECTS) + @javax.annotation.Nullable + private List subjects = new ArrayList<>(); + + public static final String SERIALIZED_NAME_RATES = "rates"; + @SerializedName(SERIALIZED_NAME_RATES) + @javax.annotation.Nullable + private List rates = new ArrayList<>(); + + public static final String SERIALIZED_NAME_EXEMPTIONS = "exemptions"; + @SerializedName(SERIALIZED_NAME_EXEMPTIONS) + @javax.annotation.Nullable + private List exemptions = new ArrayList<>(); + + public CategoryTaxSettings() { + } + + public CategoryTaxSettings subjects(@javax.annotation.Nullable List subjects) { + this.subjects = subjects; + return this; + } + + public CategoryTaxSettings addSubjectsItem(TaxSubject subjectsItem) { + if (this.subjects == null) { + this.subjects = new ArrayList<>(); + } + this.subjects.add(subjectsItem); + return this; + } + + /** + * A list of tax subjects. + * @return subjects + */ + @javax.annotation.Nullable + public List getSubjects() { + return subjects; + } + + public void setSubjects(@javax.annotation.Nullable List subjects) { + this.subjects = subjects; + } + + + public CategoryTaxSettings rates(@javax.annotation.Nullable List rates) { + this.rates = rates; + return this; + } + + public CategoryTaxSettings addRatesItem(TaxRate ratesItem) { + if (this.rates == null) { + this.rates = new ArrayList<>(); + } + this.rates.add(ratesItem); + return this; + } + + /** + * A list of tax rates. + * @return rates + */ + @javax.annotation.Nullable + public List getRates() { + return rates; + } + + public void setRates(@javax.annotation.Nullable List rates) { + this.rates = rates; + } + + + public CategoryTaxSettings exemptions(@javax.annotation.Nullable List exemptions) { + this.exemptions = exemptions; + return this; + } + + public CategoryTaxSettings addExemptionsItem(TaxExemption exemptionsItem) { + if (this.exemptions == null) { + this.exemptions = new ArrayList<>(); + } + this.exemptions.add(exemptionsItem); + return this; + } + + /** + * A list of tax exemptions. + * @return exemptions + */ + @javax.annotation.Nullable + public List getExemptions() { + return exemptions; + } + + public void setExemptions(@javax.annotation.Nullable List exemptions) { + this.exemptions = exemptions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CategoryTaxSettings categoryTaxSettings = (CategoryTaxSettings) o; + return Objects.equals(this.subjects, categoryTaxSettings.subjects) && + Objects.equals(this.rates, categoryTaxSettings.rates) && + Objects.equals(this.exemptions, categoryTaxSettings.exemptions); + } + + @Override + public int hashCode() { + return Objects.hash(subjects, rates, exemptions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CategoryTaxSettings {\n"); + sb.append(" subjects: ").append(toIndentedString(subjects)).append("\n"); + sb.append(" rates: ").append(toIndentedString(rates)).append("\n"); + sb.append(" exemptions: ").append(toIndentedString(exemptions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("subjects"); + openapiFields.add("rates"); + openapiFields.add("exemptions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CategoryTaxSettings + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CategoryTaxSettings.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CategoryTaxSettings is not found in the empty JSON string", CategoryTaxSettings.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CategoryTaxSettings.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CategoryTaxSettings` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("subjects") != null && !jsonObj.get("subjects").isJsonNull()) { + JsonArray jsonArraysubjects = jsonObj.getAsJsonArray("subjects"); + if (jsonArraysubjects != null) { + // ensure the json data is an array + if (!jsonObj.get("subjects").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `subjects` to be an array in the JSON string but got `%s`", jsonObj.get("subjects").toString())); + } + + // validate the optional field `subjects` (array) + for (int i = 0; i < jsonArraysubjects.size(); i++) { + TaxSubject.validateJsonElement(jsonArraysubjects.get(i)); + }; + } + } + if (jsonObj.get("rates") != null && !jsonObj.get("rates").isJsonNull()) { + JsonArray jsonArrayrates = jsonObj.getAsJsonArray("rates"); + if (jsonArrayrates != null) { + // ensure the json data is an array + if (!jsonObj.get("rates").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rates` to be an array in the JSON string but got `%s`", jsonObj.get("rates").toString())); + } + + // validate the optional field `rates` (array) + for (int i = 0; i < jsonArrayrates.size(); i++) { + TaxRate.validateJsonElement(jsonArrayrates.get(i)); + }; + } + } + if (jsonObj.get("exemptions") != null && !jsonObj.get("exemptions").isJsonNull()) { + JsonArray jsonArrayexemptions = jsonObj.getAsJsonArray("exemptions"); + if (jsonArrayexemptions != null) { + // ensure the json data is an array + if (!jsonObj.get("exemptions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `exemptions` to be an array in the JSON string but got `%s`", jsonObj.get("exemptions").toString())); + } + + // validate the optional field `exemptions` (array) + for (int i = 0; i < jsonArrayexemptions.size(); i++) { + TaxExemption.validateJsonElement(jsonArrayexemptions.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CategoryTaxSettings.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CategoryTaxSettings' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CategoryTaxSettings.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CategoryTaxSettings value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CategoryTaxSettings read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CategoryTaxSettings given an JSON string + * + * @param jsonString JSON string + * @return An instance of CategoryTaxSettings + * @throws IOException if the JSON string is invalid with respect to CategoryTaxSettings + */ + public static CategoryTaxSettings fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CategoryTaxSettings.class); + } + + /** + * Convert an instance of CategoryTaxSettings to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Cells.java b/src/main/java/pl/wtx/allegro/api/client/model/Cells.java new file mode 100644 index 0000000..d55715a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Cells.java @@ -0,0 +1,227 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Cells + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Cells { + public static final String SERIALIZED_NAME_CELLS = "cells"; + @SerializedName(SERIALIZED_NAME_CELLS) + @javax.annotation.Nonnull + private List cells = new ArrayList<>(); + + public Cells() { + } + + public Cells cells(@javax.annotation.Nonnull List cells) { + this.cells = cells; + return this; + } + + public Cells addCellsItem(String cellsItem) { + if (this.cells == null) { + this.cells = new ArrayList<>(); + } + this.cells.add(cellsItem); + return this; + } + + /** + * Get cells + * @return cells + */ + @javax.annotation.Nonnull + public List getCells() { + return cells; + } + + public void setCells(@javax.annotation.Nonnull List cells) { + this.cells = cells; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cells cells = (Cells) o; + return Objects.equals(this.cells, cells.cells); + } + + @Override + public int hashCode() { + return Objects.hash(cells); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cells {\n"); + sb.append(" cells: ").append(toIndentedString(cells)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("cells"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("cells"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Cells + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Cells.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Cells is not found in the empty JSON string", Cells.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Cells.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Cells` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Cells.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("cells") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("cells").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `cells` to be an array in the JSON string but got `%s`", jsonObj.get("cells").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Cells.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Cells' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Cells.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Cells value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Cells read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Cells given an JSON string + * + * @param jsonString JSON string + * @return An instance of Cells + * @throws IOException if the JSON string is invalid with respect to Cells + */ + public static Cells fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Cells.class); + } + + /** + * Convert an instance of Cells to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ChangePrice.java b/src/main/java/pl/wtx/allegro/api/client/model/ChangePrice.java new file mode 100644 index 0000000..276462c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ChangePrice.java @@ -0,0 +1,277 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.ChangePriceInput; +import pl.wtx.allegro.api.client.model.CommandOutput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ChangePrice + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ChangePrice { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nonnull + private ChangePriceInput input; + + public static final String SERIALIZED_NAME_OUTPUT = "output"; + @SerializedName(SERIALIZED_NAME_OUTPUT) + @javax.annotation.Nullable + private CommandOutput output; + + public ChangePrice() { + } + + public ChangePrice id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The unique command id provided in the input. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public ChangePrice input(@javax.annotation.Nonnull ChangePriceInput input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nonnull + public ChangePriceInput getInput() { + return input; + } + + public void setInput(@javax.annotation.Nonnull ChangePriceInput input) { + this.input = input; + } + + + public ChangePrice output(@javax.annotation.Nullable CommandOutput output) { + this.output = output; + return this; + } + + /** + * Get output + * @return output + */ + @javax.annotation.Nullable + public CommandOutput getOutput() { + return output; + } + + public void setOutput(@javax.annotation.Nullable CommandOutput output) { + this.output = output; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChangePrice changePrice = (ChangePrice) o; + return Objects.equals(this.id, changePrice.id) && + Objects.equals(this.input, changePrice.input) && + Objects.equals(this.output, changePrice.output); + } + + @Override + public int hashCode() { + return Objects.hash(id, input, output); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChangePrice {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("input"); + openapiFields.add("output"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("input"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChangePrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChangePrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChangePrice is not found in the empty JSON string", ChangePrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChangePrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChangePrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChangePrice.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `input` + ChangePriceInput.validateJsonElement(jsonObj.get("input")); + // validate the optional field `output` + if (jsonObj.get("output") != null && !jsonObj.get("output").isJsonNull()) { + CommandOutput.validateJsonElement(jsonObj.get("output")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChangePrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChangePrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChangePrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChangePrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChangePrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChangePrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChangePrice + * @throws IOException if the JSON string is invalid with respect to ChangePrice + */ + public static ChangePrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChangePrice.class); + } + + /** + * Convert an instance of ChangePrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ChangePriceInput.java b/src/main/java/pl/wtx/allegro/api/client/model/ChangePriceInput.java new file mode 100644 index 0000000..7fc2c4a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ChangePriceInput.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The input of the command, i.e. the new Buy Now price for the offer. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ChangePriceInput { + public static final String SERIALIZED_NAME_BUY_NOW_PRICE = "buyNowPrice"; + @SerializedName(SERIALIZED_NAME_BUY_NOW_PRICE) + @javax.annotation.Nonnull + private Price buyNowPrice; + + public ChangePriceInput() { + } + + public ChangePriceInput buyNowPrice(@javax.annotation.Nonnull Price buyNowPrice) { + this.buyNowPrice = buyNowPrice; + return this; + } + + /** + * Get buyNowPrice + * @return buyNowPrice + */ + @javax.annotation.Nonnull + public Price getBuyNowPrice() { + return buyNowPrice; + } + + public void setBuyNowPrice(@javax.annotation.Nonnull Price buyNowPrice) { + this.buyNowPrice = buyNowPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChangePriceInput changePriceInput = (ChangePriceInput) o; + return Objects.equals(this.buyNowPrice, changePriceInput.buyNowPrice); + } + + @Override + public int hashCode() { + return Objects.hash(buyNowPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChangePriceInput {\n"); + sb.append(" buyNowPrice: ").append(toIndentedString(buyNowPrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("buyNowPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("buyNowPrice"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChangePriceInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChangePriceInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChangePriceInput is not found in the empty JSON string", ChangePriceInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChangePriceInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChangePriceInput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChangePriceInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `buyNowPrice` + Price.validateJsonElement(jsonObj.get("buyNowPrice")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChangePriceInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChangePriceInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChangePriceInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChangePriceInput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChangePriceInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChangePriceInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChangePriceInput + * @throws IOException if the JSON string is invalid with respect to ChangePriceInput + */ + public static ChangePriceInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChangePriceInput.class); + } + + /** + * Convert an instance of ChangePriceInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ChangePriceWithoutOutput.java b/src/main/java/pl/wtx/allegro/api/client/model/ChangePriceWithoutOutput.java new file mode 100644 index 0000000..b77a4ed --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ChangePriceWithoutOutput.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.ChangePriceInput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ChangePriceWithoutOutput + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ChangePriceWithoutOutput { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nonnull + private ChangePriceInput input; + + public ChangePriceWithoutOutput() { + } + + public ChangePriceWithoutOutput id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The unique command id generated by you. This should be the same UUID as used in the path. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public ChangePriceWithoutOutput input(@javax.annotation.Nonnull ChangePriceInput input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nonnull + public ChangePriceInput getInput() { + return input; + } + + public void setInput(@javax.annotation.Nonnull ChangePriceInput input) { + this.input = input; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChangePriceWithoutOutput changePriceWithoutOutput = (ChangePriceWithoutOutput) o; + return Objects.equals(this.id, changePriceWithoutOutput.id) && + Objects.equals(this.input, changePriceWithoutOutput.input); + } + + @Override + public int hashCode() { + return Objects.hash(id, input); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChangePriceWithoutOutput {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("input"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("input"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChangePriceWithoutOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChangePriceWithoutOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChangePriceWithoutOutput is not found in the empty JSON string", ChangePriceWithoutOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChangePriceWithoutOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChangePriceWithoutOutput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChangePriceWithoutOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `input` + ChangePriceInput.validateJsonElement(jsonObj.get("input")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChangePriceWithoutOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChangePriceWithoutOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChangePriceWithoutOutput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChangePriceWithoutOutput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChangePriceWithoutOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChangePriceWithoutOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChangePriceWithoutOutput + * @throws IOException if the JSON string is invalid with respect to ChangePriceWithoutOutput + */ + public static ChangePriceWithoutOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChangePriceWithoutOutput.class); + } + + /** + * Convert an instance of ChangePriceWithoutOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ChangedParameterDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ChangedParameterDto.java new file mode 100644 index 0000000..03d6776 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ChangedParameterDto.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ChangedParameterDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ChangedParameterDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private String updatedAt; + + public ChangedParameterDto() { + } + + public ChangedParameterDto id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Parameter id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ChangedParameterDto updatedAt(@javax.annotation.Nullable String updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Time of last parameter change in ISO 8601 format. + * @return updatedAt + */ + @javax.annotation.Nullable + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable String updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChangedParameterDto changedParameterDto = (ChangedParameterDto) o; + return Objects.equals(this.id, changedParameterDto.id) && + Objects.equals(this.updatedAt, changedParameterDto.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChangedParameterDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChangedParameterDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChangedParameterDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChangedParameterDto is not found in the empty JSON string", ChangedParameterDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChangedParameterDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChangedParameterDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("updatedAt") != null && !jsonObj.get("updatedAt").isJsonNull()) && !jsonObj.get("updatedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `updatedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChangedParameterDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChangedParameterDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChangedParameterDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChangedParameterDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChangedParameterDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChangedParameterDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChangedParameterDto + * @throws IOException if the JSON string is invalid with respect to ChangedParameterDto + */ + public static ChangedParameterDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChangedParameterDto.class); + } + + /** + * Convert an instance of ChangedParameterDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ChangedTranslation.java b/src/main/java/pl/wtx/allegro/api/client/model/ChangedTranslation.java new file mode 100644 index 0000000..730ebe1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ChangedTranslation.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The changed translation. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ChangedTranslation { + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nullable + private String language; + + public ChangedTranslation() { + } + + public ChangedTranslation language(@javax.annotation.Nullable String language) { + this.language = language; + return this; + } + + /** + * Translation language + * @return language + */ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nullable String language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChangedTranslation changedTranslation = (ChangedTranslation) o; + return Objects.equals(this.language, changedTranslation.language); + } + + @Override + public int hashCode() { + return Objects.hash(language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChangedTranslation {\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChangedTranslation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChangedTranslation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChangedTranslation is not found in the empty JSON string", ChangedTranslation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChangedTranslation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChangedTranslation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChangedTranslation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChangedTranslation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChangedTranslation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChangedTranslation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChangedTranslation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChangedTranslation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChangedTranslation + * @throws IOException if the JSON string is invalid with respect to ChangedTranslation + */ + public static ChangedTranslation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChangedTranslation.class); + } + + /** + * Convert an instance of ChangedTranslation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CharityOrganization.java b/src/main/java/pl/wtx/allegro/api/client/model/CharityOrganization.java new file mode 100644 index 0000000..b2db29c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CharityOrganization.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CharityOrganization + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CharityOrganization { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public CharityOrganization() { + } + + public CharityOrganization name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * organization name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CharityOrganization charityOrganization = (CharityOrganization) o; + return Objects.equals(this.name, charityOrganization.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CharityOrganization {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CharityOrganization + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CharityOrganization.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CharityOrganization is not found in the empty JSON string", CharityOrganization.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CharityOrganization.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CharityOrganization` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CharityOrganization.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CharityOrganization' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CharityOrganization.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CharityOrganization value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CharityOrganization read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CharityOrganization given an JSON string + * + * @param jsonString JSON string + * @return An instance of CharityOrganization + * @throws IOException if the JSON string is invalid with respect to CharityOrganization + */ + public static CharityOrganization fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CharityOrganization.class); + } + + /** + * Convert an instance of CharityOrganization to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoice.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoice.java new file mode 100644 index 0000000..2d0a085 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoice.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CheckFormsNewOrderInvoiceFile; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckFormsNewOrderInvoice + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckFormsNewOrderInvoice { + public static final String SERIALIZED_NAME_FILE = "file"; + @SerializedName(SERIALIZED_NAME_FILE) + @javax.annotation.Nonnull + private CheckFormsNewOrderInvoiceFile _file; + + public static final String SERIALIZED_NAME_INVOICE_NUMBER = "invoiceNumber"; + @SerializedName(SERIALIZED_NAME_INVOICE_NUMBER) + @javax.annotation.Nullable + private String invoiceNumber; + + public CheckFormsNewOrderInvoice() { + } + + public CheckFormsNewOrderInvoice _file(@javax.annotation.Nonnull CheckFormsNewOrderInvoiceFile _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @javax.annotation.Nonnull + public CheckFormsNewOrderInvoiceFile getFile() { + return _file; + } + + public void setFile(@javax.annotation.Nonnull CheckFormsNewOrderInvoiceFile _file) { + this._file = _file; + } + + + public CheckFormsNewOrderInvoice invoiceNumber(@javax.annotation.Nullable String invoiceNumber) { + this.invoiceNumber = invoiceNumber; + return this; + } + + /** + * Get invoiceNumber + * @return invoiceNumber + */ + @javax.annotation.Nullable + public String getInvoiceNumber() { + return invoiceNumber; + } + + public void setInvoiceNumber(@javax.annotation.Nullable String invoiceNumber) { + this.invoiceNumber = invoiceNumber; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckFormsNewOrderInvoice checkFormsNewOrderInvoice = (CheckFormsNewOrderInvoice) o; + return Objects.equals(this._file, checkFormsNewOrderInvoice._file) && + Objects.equals(this.invoiceNumber, checkFormsNewOrderInvoice.invoiceNumber); + } + + @Override + public int hashCode() { + return Objects.hash(_file, invoiceNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckFormsNewOrderInvoice {\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" invoiceNumber: ").append(toIndentedString(invoiceNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("file"); + openapiFields.add("invoiceNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("file"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckFormsNewOrderInvoice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckFormsNewOrderInvoice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckFormsNewOrderInvoice is not found in the empty JSON string", CheckFormsNewOrderInvoice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckFormsNewOrderInvoice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckFormsNewOrderInvoice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckFormsNewOrderInvoice.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `file` + CheckFormsNewOrderInvoiceFile.validateJsonElement(jsonObj.get("file")); + if ((jsonObj.get("invoiceNumber") != null && !jsonObj.get("invoiceNumber").isJsonNull()) && !jsonObj.get("invoiceNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `invoiceNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoiceNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckFormsNewOrderInvoice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckFormsNewOrderInvoice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckFormsNewOrderInvoice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckFormsNewOrderInvoice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckFormsNewOrderInvoice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckFormsNewOrderInvoice given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckFormsNewOrderInvoice + * @throws IOException if the JSON string is invalid with respect to CheckFormsNewOrderInvoice + */ + public static CheckFormsNewOrderInvoice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckFormsNewOrderInvoice.class); + } + + /** + * Convert an instance of CheckFormsNewOrderInvoice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoiceFile.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoiceFile.java new file mode 100644 index 0000000..8111d91 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoiceFile.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckFormsNewOrderInvoiceFile + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckFormsNewOrderInvoiceFile { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public CheckFormsNewOrderInvoiceFile() { + } + + public CheckFormsNewOrderInvoiceFile name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckFormsNewOrderInvoiceFile checkFormsNewOrderInvoiceFile = (CheckFormsNewOrderInvoiceFile) o; + return Objects.equals(this.name, checkFormsNewOrderInvoiceFile.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckFormsNewOrderInvoiceFile {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckFormsNewOrderInvoiceFile + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckFormsNewOrderInvoiceFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckFormsNewOrderInvoiceFile is not found in the empty JSON string", CheckFormsNewOrderInvoiceFile.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckFormsNewOrderInvoiceFile.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckFormsNewOrderInvoiceFile` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckFormsNewOrderInvoiceFile.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckFormsNewOrderInvoiceFile.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckFormsNewOrderInvoiceFile' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckFormsNewOrderInvoiceFile.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckFormsNewOrderInvoiceFile value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckFormsNewOrderInvoiceFile read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckFormsNewOrderInvoiceFile given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckFormsNewOrderInvoiceFile + * @throws IOException if the JSON string is invalid with respect to CheckFormsNewOrderInvoiceFile + */ + public static CheckFormsNewOrderInvoiceFile fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckFormsNewOrderInvoiceFile.class); + } + + /** + * Convert an instance of CheckFormsNewOrderInvoiceFile to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoiceId.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoiceId.java new file mode 100644 index 0000000..8144648 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckFormsNewOrderInvoiceId.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckFormsNewOrderInvoiceId + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckFormsNewOrderInvoiceId { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public CheckFormsNewOrderInvoiceId() { + } + + public CheckFormsNewOrderInvoiceId id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckFormsNewOrderInvoiceId checkFormsNewOrderInvoiceId = (CheckFormsNewOrderInvoiceId) o; + return Objects.equals(this.id, checkFormsNewOrderInvoiceId.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckFormsNewOrderInvoiceId {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckFormsNewOrderInvoiceId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckFormsNewOrderInvoiceId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckFormsNewOrderInvoiceId is not found in the empty JSON string", CheckFormsNewOrderInvoiceId.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckFormsNewOrderInvoiceId.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckFormsNewOrderInvoiceId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckFormsNewOrderInvoiceId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckFormsNewOrderInvoiceId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckFormsNewOrderInvoiceId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckFormsNewOrderInvoiceId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckFormsNewOrderInvoiceId read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckFormsNewOrderInvoiceId given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckFormsNewOrderInvoiceId + * @throws IOException if the JSON string is invalid with respect to CheckFormsNewOrderInvoiceId + */ + public static CheckFormsNewOrderInvoiceId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckFormsNewOrderInvoiceId.class); + } + + /** + * Convert an instance of CheckFormsNewOrderInvoiceId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutForm.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutForm.java new file mode 100644 index 0000000..83d1c99 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutForm.java @@ -0,0 +1,737 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.CheckoutFormBuyerReference; +import pl.wtx.allegro.api.client.model.CheckoutFormDeliveryReference; +import pl.wtx.allegro.api.client.model.CheckoutFormDiscount; +import pl.wtx.allegro.api.client.model.CheckoutFormFulfillment; +import pl.wtx.allegro.api.client.model.CheckoutFormInvoiceInfo; +import pl.wtx.allegro.api.client.model.CheckoutFormLineItem; +import pl.wtx.allegro.api.client.model.CheckoutFormMarketplace; +import pl.wtx.allegro.api.client.model.CheckoutFormNoteReference; +import pl.wtx.allegro.api.client.model.CheckoutFormPaymentReference; +import pl.wtx.allegro.api.client.model.CheckoutFormStatus; +import pl.wtx.allegro.api.client.model.CheckoutFormSummary; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutForm + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutForm { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_MESSAGE_TO_SELLER = "messageToSeller"; + @SerializedName(SERIALIZED_NAME_MESSAGE_TO_SELLER) + @javax.annotation.Nullable + private String messageToSeller; + + public static final String SERIALIZED_NAME_BUYER = "buyer"; + @SerializedName(SERIALIZED_NAME_BUYER) + @javax.annotation.Nonnull + private CheckoutFormBuyerReference buyer; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nullable + private CheckoutFormPaymentReference payment; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private CheckoutFormStatus status; + + public static final String SERIALIZED_NAME_FULFILLMENT = "fulfillment"; + @SerializedName(SERIALIZED_NAME_FULFILLMENT) + @javax.annotation.Nullable + private CheckoutFormFulfillment fulfillment; + + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private CheckoutFormDeliveryReference delivery; + + public static final String SERIALIZED_NAME_INVOICE = "invoice"; + @SerializedName(SERIALIZED_NAME_INVOICE) + @javax.annotation.Nullable + private CheckoutFormInvoiceInfo invoice; + + public static final String SERIALIZED_NAME_LINE_ITEMS = "lineItems"; + @SerializedName(SERIALIZED_NAME_LINE_ITEMS) + @javax.annotation.Nonnull + private List lineItems = new ArrayList<>(); + + public static final String SERIALIZED_NAME_SURCHARGES = "surcharges"; + @SerializedName(SERIALIZED_NAME_SURCHARGES) + @javax.annotation.Nonnull + private List surcharges = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DISCOUNTS = "discounts"; + @Deprecated + @SerializedName(SERIALIZED_NAME_DISCOUNTS) + @javax.annotation.Nonnull + private List discounts = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NOTE = "note"; + @SerializedName(SERIALIZED_NAME_NOTE) + @javax.annotation.Nullable + private CheckoutFormNoteReference note; + + public static final String SERIALIZED_NAME_MARKETPLACE = "marketplace"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE) + @javax.annotation.Nullable + private CheckoutFormMarketplace marketplace; + + public static final String SERIALIZED_NAME_SUMMARY = "summary"; + @SerializedName(SERIALIZED_NAME_SUMMARY) + @javax.annotation.Nonnull + private CheckoutFormSummary summary; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private String updatedAt; + + public static final String SERIALIZED_NAME_REVISION = "revision"; + @SerializedName(SERIALIZED_NAME_REVISION) + @javax.annotation.Nullable + private String revision; + + public CheckoutForm() { + } + + public CheckoutForm id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Checkout form id + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public CheckoutForm messageToSeller(@javax.annotation.Nullable String messageToSeller) { + this.messageToSeller = messageToSeller; + return this; + } + + /** + * Message from buyer to seller + * @return messageToSeller + */ + @javax.annotation.Nullable + public String getMessageToSeller() { + return messageToSeller; + } + + public void setMessageToSeller(@javax.annotation.Nullable String messageToSeller) { + this.messageToSeller = messageToSeller; + } + + + public CheckoutForm buyer(@javax.annotation.Nonnull CheckoutFormBuyerReference buyer) { + this.buyer = buyer; + return this; + } + + /** + * Get buyer + * @return buyer + */ + @javax.annotation.Nonnull + public CheckoutFormBuyerReference getBuyer() { + return buyer; + } + + public void setBuyer(@javax.annotation.Nonnull CheckoutFormBuyerReference buyer) { + this.buyer = buyer; + } + + + public CheckoutForm payment(@javax.annotation.Nullable CheckoutFormPaymentReference payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nullable + public CheckoutFormPaymentReference getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nullable CheckoutFormPaymentReference payment) { + this.payment = payment; + } + + + public CheckoutForm status(@javax.annotation.Nonnull CheckoutFormStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public CheckoutFormStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull CheckoutFormStatus status) { + this.status = status; + } + + + public CheckoutForm fulfillment(@javax.annotation.Nullable CheckoutFormFulfillment fulfillment) { + this.fulfillment = fulfillment; + return this; + } + + /** + * Get fulfillment + * @return fulfillment + */ + @javax.annotation.Nullable + public CheckoutFormFulfillment getFulfillment() { + return fulfillment; + } + + public void setFulfillment(@javax.annotation.Nullable CheckoutFormFulfillment fulfillment) { + this.fulfillment = fulfillment; + } + + + public CheckoutForm delivery(@javax.annotation.Nullable CheckoutFormDeliveryReference delivery) { + this.delivery = delivery; + return this; + } + + /** + * Get delivery + * @return delivery + */ + @javax.annotation.Nullable + public CheckoutFormDeliveryReference getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable CheckoutFormDeliveryReference delivery) { + this.delivery = delivery; + } + + + public CheckoutForm invoice(@javax.annotation.Nullable CheckoutFormInvoiceInfo invoice) { + this.invoice = invoice; + return this; + } + + /** + * Get invoice + * @return invoice + */ + @javax.annotation.Nullable + public CheckoutFormInvoiceInfo getInvoice() { + return invoice; + } + + public void setInvoice(@javax.annotation.Nullable CheckoutFormInvoiceInfo invoice) { + this.invoice = invoice; + } + + + public CheckoutForm lineItems(@javax.annotation.Nonnull List lineItems) { + this.lineItems = lineItems; + return this; + } + + public CheckoutForm addLineItemsItem(CheckoutFormLineItem lineItemsItem) { + if (this.lineItems == null) { + this.lineItems = new ArrayList<>(); + } + this.lineItems.add(lineItemsItem); + return this; + } + + /** + * Get lineItems + * @return lineItems + */ + @javax.annotation.Nonnull + public List getLineItems() { + return lineItems; + } + + public void setLineItems(@javax.annotation.Nonnull List lineItems) { + this.lineItems = lineItems; + } + + + public CheckoutForm surcharges(@javax.annotation.Nonnull List surcharges) { + this.surcharges = surcharges; + return this; + } + + public CheckoutForm addSurchargesItem(CheckoutFormPaymentReference surchargesItem) { + if (this.surcharges == null) { + this.surcharges = new ArrayList<>(); + } + this.surcharges.add(surchargesItem); + return this; + } + + /** + * Get surcharges + * @return surcharges + */ + @javax.annotation.Nonnull + public List getSurcharges() { + return surcharges; + } + + public void setSurcharges(@javax.annotation.Nonnull List surcharges) { + this.surcharges = surcharges; + } + + + @Deprecated + public CheckoutForm discounts(@javax.annotation.Nonnull List discounts) { + this.discounts = discounts; + return this; + } + + public CheckoutForm addDiscountsItem(CheckoutFormDiscount discountsItem) { + if (this.discounts == null) { + this.discounts = new ArrayList<>(); + } + this.discounts.add(discountsItem); + return this; + } + + /** + * Deprecated. This field is deprecated in favor of `lineItems[].discounts` and will be removed in the future. + * @return discounts + * @deprecated + */ + @Deprecated + @javax.annotation.Nonnull + public List getDiscounts() { + return discounts; + } + + @Deprecated + public void setDiscounts(@javax.annotation.Nonnull List discounts) { + this.discounts = discounts; + } + + + public CheckoutForm note(@javax.annotation.Nullable CheckoutFormNoteReference note) { + this.note = note; + return this; + } + + /** + * Get note + * @return note + */ + @javax.annotation.Nullable + public CheckoutFormNoteReference getNote() { + return note; + } + + public void setNote(@javax.annotation.Nullable CheckoutFormNoteReference note) { + this.note = note; + } + + + public CheckoutForm marketplace(@javax.annotation.Nullable CheckoutFormMarketplace marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get marketplace + * @return marketplace + */ + @javax.annotation.Nullable + public CheckoutFormMarketplace getMarketplace() { + return marketplace; + } + + public void setMarketplace(@javax.annotation.Nullable CheckoutFormMarketplace marketplace) { + this.marketplace = marketplace; + } + + + public CheckoutForm summary(@javax.annotation.Nonnull CheckoutFormSummary summary) { + this.summary = summary; + return this; + } + + /** + * Get summary + * @return summary + */ + @javax.annotation.Nonnull + public CheckoutFormSummary getSummary() { + return summary; + } + + public void setSummary(@javax.annotation.Nonnull CheckoutFormSummary summary) { + this.summary = summary; + } + + + public CheckoutForm updatedAt(@javax.annotation.Nullable String updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return updatedAt + */ + @javax.annotation.Nullable + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable String updatedAt) { + this.updatedAt = updatedAt; + } + + + public CheckoutForm revision(@javax.annotation.Nullable String revision) { + this.revision = revision; + return this; + } + + /** + * Checkout form revision + * @return revision + */ + @javax.annotation.Nullable + public String getRevision() { + return revision; + } + + public void setRevision(@javax.annotation.Nullable String revision) { + this.revision = revision; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutForm checkoutForm = (CheckoutForm) o; + return Objects.equals(this.id, checkoutForm.id) && + Objects.equals(this.messageToSeller, checkoutForm.messageToSeller) && + Objects.equals(this.buyer, checkoutForm.buyer) && + Objects.equals(this.payment, checkoutForm.payment) && + Objects.equals(this.status, checkoutForm.status) && + Objects.equals(this.fulfillment, checkoutForm.fulfillment) && + Objects.equals(this.delivery, checkoutForm.delivery) && + Objects.equals(this.invoice, checkoutForm.invoice) && + Objects.equals(this.lineItems, checkoutForm.lineItems) && + Objects.equals(this.surcharges, checkoutForm.surcharges) && + Objects.equals(this.discounts, checkoutForm.discounts) && + Objects.equals(this.note, checkoutForm.note) && + Objects.equals(this.marketplace, checkoutForm.marketplace) && + Objects.equals(this.summary, checkoutForm.summary) && + Objects.equals(this.updatedAt, checkoutForm.updatedAt) && + Objects.equals(this.revision, checkoutForm.revision); + } + + @Override + public int hashCode() { + return Objects.hash(id, messageToSeller, buyer, payment, status, fulfillment, delivery, invoice, lineItems, surcharges, discounts, note, marketplace, summary, updatedAt, revision); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutForm {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" messageToSeller: ").append(toIndentedString(messageToSeller)).append("\n"); + sb.append(" buyer: ").append(toIndentedString(buyer)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" fulfillment: ").append(toIndentedString(fulfillment)).append("\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" invoice: ").append(toIndentedString(invoice)).append("\n"); + sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n"); + sb.append(" surcharges: ").append(toIndentedString(surcharges)).append("\n"); + sb.append(" discounts: ").append(toIndentedString(discounts)).append("\n"); + sb.append(" note: ").append(toIndentedString(note)).append("\n"); + sb.append(" marketplace: ").append(toIndentedString(marketplace)).append("\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" revision: ").append(toIndentedString(revision)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("messageToSeller"); + openapiFields.add("buyer"); + openapiFields.add("payment"); + openapiFields.add("status"); + openapiFields.add("fulfillment"); + openapiFields.add("delivery"); + openapiFields.add("invoice"); + openapiFields.add("lineItems"); + openapiFields.add("surcharges"); + openapiFields.add("discounts"); + openapiFields.add("note"); + openapiFields.add("marketplace"); + openapiFields.add("summary"); + openapiFields.add("updatedAt"); + openapiFields.add("revision"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("buyer"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("lineItems"); + openapiRequiredFields.add("surcharges"); + openapiRequiredFields.add("discounts"); + openapiRequiredFields.add("summary"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutForm + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutForm.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutForm is not found in the empty JSON string", CheckoutForm.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutForm.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutForm` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutForm.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("messageToSeller") != null && !jsonObj.get("messageToSeller").isJsonNull()) && !jsonObj.get("messageToSeller").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `messageToSeller` to be a primitive type in the JSON string but got `%s`", jsonObj.get("messageToSeller").toString())); + } + // validate the required field `buyer` + CheckoutFormBuyerReference.validateJsonElement(jsonObj.get("buyer")); + // validate the optional field `payment` + if (jsonObj.get("payment") != null && !jsonObj.get("payment").isJsonNull()) { + CheckoutFormPaymentReference.validateJsonElement(jsonObj.get("payment")); + } + // validate the required field `status` + CheckoutFormStatus.validateJsonElement(jsonObj.get("status")); + // validate the optional field `fulfillment` + if (jsonObj.get("fulfillment") != null && !jsonObj.get("fulfillment").isJsonNull()) { + CheckoutFormFulfillment.validateJsonElement(jsonObj.get("fulfillment")); + } + // validate the optional field `delivery` + if (jsonObj.get("delivery") != null && !jsonObj.get("delivery").isJsonNull()) { + CheckoutFormDeliveryReference.validateJsonElement(jsonObj.get("delivery")); + } + // validate the optional field `invoice` + if (jsonObj.get("invoice") != null && !jsonObj.get("invoice").isJsonNull()) { + CheckoutFormInvoiceInfo.validateJsonElement(jsonObj.get("invoice")); + } + // ensure the json data is an array + if (!jsonObj.get("lineItems").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `lineItems` to be an array in the JSON string but got `%s`", jsonObj.get("lineItems").toString())); + } + + JsonArray jsonArraylineItems = jsonObj.getAsJsonArray("lineItems"); + // validate the required field `lineItems` (array) + for (int i = 0; i < jsonArraylineItems.size(); i++) { + CheckoutFormLineItem.validateJsonElement(jsonArraylineItems.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("surcharges").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `surcharges` to be an array in the JSON string but got `%s`", jsonObj.get("surcharges").toString())); + } + + JsonArray jsonArraysurcharges = jsonObj.getAsJsonArray("surcharges"); + // validate the required field `surcharges` (array) + for (int i = 0; i < jsonArraysurcharges.size(); i++) { + CheckoutFormPaymentReference.validateJsonElement(jsonArraysurcharges.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("discounts").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `discounts` to be an array in the JSON string but got `%s`", jsonObj.get("discounts").toString())); + } + + JsonArray jsonArraydiscounts = jsonObj.getAsJsonArray("discounts"); + // validate the required field `discounts` (array) + for (int i = 0; i < jsonArraydiscounts.size(); i++) { + CheckoutFormDiscount.validateJsonElement(jsonArraydiscounts.get(i)); + }; + // validate the optional field `note` + if (jsonObj.get("note") != null && !jsonObj.get("note").isJsonNull()) { + CheckoutFormNoteReference.validateJsonElement(jsonObj.get("note")); + } + // validate the optional field `marketplace` + if (jsonObj.get("marketplace") != null && !jsonObj.get("marketplace").isJsonNull()) { + CheckoutFormMarketplace.validateJsonElement(jsonObj.get("marketplace")); + } + // validate the required field `summary` + CheckoutFormSummary.validateJsonElement(jsonObj.get("summary")); + if ((jsonObj.get("updatedAt") != null && !jsonObj.get("updatedAt").isJsonNull()) && !jsonObj.get("updatedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `updatedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedAt").toString())); + } + if ((jsonObj.get("revision") != null && !jsonObj.get("revision").isJsonNull()) && !jsonObj.get("revision").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `revision` to be a primitive type in the JSON string but got `%s`", jsonObj.get("revision").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutForm.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutForm' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutForm.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutForm value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutForm read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutForm given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutForm + * @throws IOException if the JSON string is invalid with respect to CheckoutForm + */ + public static CheckoutForm fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutForm.class); + } + + /** + * Convert an instance of CheckoutForm to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillCreated.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillCreated.java new file mode 100644 index 0000000..3705f9b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillCreated.java @@ -0,0 +1,378 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CheckoutFormAddWaybillCreatedLineItemsInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormAddWaybillCreated + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormAddWaybillCreated { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_WAYBILL = "waybill"; + @SerializedName(SERIALIZED_NAME_WAYBILL) + @javax.annotation.Nullable + private String waybill; + + public static final String SERIALIZED_NAME_CARRIER_ID = "carrierId"; + @SerializedName(SERIALIZED_NAME_CARRIER_ID) + @javax.annotation.Nullable + private String carrierId; + + public static final String SERIALIZED_NAME_CARRIER_NAME = "carrierName"; + @SerializedName(SERIALIZED_NAME_CARRIER_NAME) + @javax.annotation.Nullable + private String carrierName; + + public static final String SERIALIZED_NAME_LINE_ITEMS = "lineItems"; + @SerializedName(SERIALIZED_NAME_LINE_ITEMS) + @javax.annotation.Nullable + private List lineItems = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private String createdAt; + + public CheckoutFormAddWaybillCreated() { + } + + public CheckoutFormAddWaybillCreated id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Identifier of a shipment. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CheckoutFormAddWaybillCreated waybill(@javax.annotation.Nullable String waybill) { + this.waybill = waybill; + return this; + } + + /** + * Waybill number (parcel tracking number). Cannot be empty and must be no longer than 64 characters. + * @return waybill + */ + @javax.annotation.Nullable + public String getWaybill() { + return waybill; + } + + public void setWaybill(@javax.annotation.Nullable String waybill) { + this.waybill = waybill; + } + + + public CheckoutFormAddWaybillCreated carrierId(@javax.annotation.Nullable String carrierId) { + this.carrierId = carrierId; + return this; + } + + /** + * Supported carriers are available via <a href=\"#operation/getOrdersCarriersUsingGET\" target=\"_blank\">shipping carriers resource</a>. + * @return carrierId + */ + @javax.annotation.Nullable + public String getCarrierId() { + return carrierId; + } + + public void setCarrierId(@javax.annotation.Nullable String carrierId) { + this.carrierId = carrierId; + } + + + public CheckoutFormAddWaybillCreated carrierName(@javax.annotation.Nullable String carrierName) { + this.carrierName = carrierName; + return this; + } + + /** + * Carrier name to be provided only if carrierId is OTHER, otherwise it’s ignored. Must be no longer than 30 characters. + * @return carrierName + */ + @javax.annotation.Nullable + public String getCarrierName() { + return carrierName; + } + + public void setCarrierName(@javax.annotation.Nullable String carrierName) { + this.carrierName = carrierName; + } + + + public CheckoutFormAddWaybillCreated lineItems(@javax.annotation.Nullable List lineItems) { + this.lineItems = lineItems; + return this; + } + + public CheckoutFormAddWaybillCreated addLineItemsItem(CheckoutFormAddWaybillCreatedLineItemsInner lineItemsItem) { + if (this.lineItems == null) { + this.lineItems = new ArrayList<>(); + } + this.lineItems.add(lineItemsItem); + return this; + } + + /** + * List of order line items. They must be from the order specified in the path parameter. List cannot be empty. + * @return lineItems + */ + @javax.annotation.Nullable + public List getLineItems() { + return lineItems; + } + + public void setLineItems(@javax.annotation.Nullable List lineItems) { + this.lineItems = lineItems; + } + + + public CheckoutFormAddWaybillCreated createdAt(@javax.annotation.Nullable String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Date and time of the parcel tracking number registration in UTC (ISO8601 format). + * @return createdAt + */ + @javax.annotation.Nullable + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable String createdAt) { + this.createdAt = createdAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormAddWaybillCreated checkoutFormAddWaybillCreated = (CheckoutFormAddWaybillCreated) o; + return Objects.equals(this.id, checkoutFormAddWaybillCreated.id) && + Objects.equals(this.waybill, checkoutFormAddWaybillCreated.waybill) && + Objects.equals(this.carrierId, checkoutFormAddWaybillCreated.carrierId) && + Objects.equals(this.carrierName, checkoutFormAddWaybillCreated.carrierName) && + Objects.equals(this.lineItems, checkoutFormAddWaybillCreated.lineItems) && + Objects.equals(this.createdAt, checkoutFormAddWaybillCreated.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, waybill, carrierId, carrierName, lineItems, createdAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormAddWaybillCreated {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" waybill: ").append(toIndentedString(waybill)).append("\n"); + sb.append(" carrierId: ").append(toIndentedString(carrierId)).append("\n"); + sb.append(" carrierName: ").append(toIndentedString(carrierName)).append("\n"); + sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("waybill"); + openapiFields.add("carrierId"); + openapiFields.add("carrierName"); + openapiFields.add("lineItems"); + openapiFields.add("createdAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormAddWaybillCreated + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormAddWaybillCreated.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormAddWaybillCreated is not found in the empty JSON string", CheckoutFormAddWaybillCreated.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormAddWaybillCreated.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormAddWaybillCreated` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("waybill") != null && !jsonObj.get("waybill").isJsonNull()) && !jsonObj.get("waybill").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `waybill` to be a primitive type in the JSON string but got `%s`", jsonObj.get("waybill").toString())); + } + if ((jsonObj.get("carrierId") != null && !jsonObj.get("carrierId").isJsonNull()) && !jsonObj.get("carrierId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `carrierId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierId").toString())); + } + if ((jsonObj.get("carrierName") != null && !jsonObj.get("carrierName").isJsonNull()) && !jsonObj.get("carrierName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `carrierName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierName").toString())); + } + if (jsonObj.get("lineItems") != null && !jsonObj.get("lineItems").isJsonNull()) { + JsonArray jsonArraylineItems = jsonObj.getAsJsonArray("lineItems"); + if (jsonArraylineItems != null) { + // ensure the json data is an array + if (!jsonObj.get("lineItems").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `lineItems` to be an array in the JSON string but got `%s`", jsonObj.get("lineItems").toString())); + } + + // validate the optional field `lineItems` (array) + for (int i = 0; i < jsonArraylineItems.size(); i++) { + CheckoutFormAddWaybillCreatedLineItemsInner.validateJsonElement(jsonArraylineItems.get(i)); + }; + } + } + if ((jsonObj.get("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) && !jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormAddWaybillCreated.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormAddWaybillCreated' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormAddWaybillCreated.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormAddWaybillCreated value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormAddWaybillCreated read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormAddWaybillCreated given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormAddWaybillCreated + * @throws IOException if the JSON string is invalid with respect to CheckoutFormAddWaybillCreated + */ + public static CheckoutFormAddWaybillCreated fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormAddWaybillCreated.class); + } + + /** + * Convert an instance of CheckoutFormAddWaybillCreated to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillCreatedLineItemsInner.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillCreatedLineItemsInner.java new file mode 100644 index 0000000..e9dced1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillCreatedLineItemsInner.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormAddWaybillCreatedLineItemsInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormAddWaybillCreatedLineItemsInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public CheckoutFormAddWaybillCreatedLineItemsInner() { + } + + public CheckoutFormAddWaybillCreatedLineItemsInner id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Identifier of an order line item. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormAddWaybillCreatedLineItemsInner checkoutFormAddWaybillCreatedLineItemsInner = (CheckoutFormAddWaybillCreatedLineItemsInner) o; + return Objects.equals(this.id, checkoutFormAddWaybillCreatedLineItemsInner.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormAddWaybillCreatedLineItemsInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormAddWaybillCreatedLineItemsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormAddWaybillCreatedLineItemsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormAddWaybillCreatedLineItemsInner is not found in the empty JSON string", CheckoutFormAddWaybillCreatedLineItemsInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormAddWaybillCreatedLineItemsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormAddWaybillCreatedLineItemsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormAddWaybillCreatedLineItemsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormAddWaybillCreatedLineItemsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormAddWaybillCreatedLineItemsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormAddWaybillCreatedLineItemsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormAddWaybillCreatedLineItemsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormAddWaybillCreatedLineItemsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormAddWaybillCreatedLineItemsInner + * @throws IOException if the JSON string is invalid with respect to CheckoutFormAddWaybillCreatedLineItemsInner + */ + public static CheckoutFormAddWaybillCreatedLineItemsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormAddWaybillCreatedLineItemsInner.class); + } + + /** + * Convert an instance of CheckoutFormAddWaybillCreatedLineItemsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillRequest.java new file mode 100644 index 0000000..05da416 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillRequest.java @@ -0,0 +1,327 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CheckoutFormAddWaybillRequestLineItemsInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormAddWaybillRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormAddWaybillRequest { + public static final String SERIALIZED_NAME_CARRIER_ID = "carrierId"; + @SerializedName(SERIALIZED_NAME_CARRIER_ID) + @javax.annotation.Nonnull + private String carrierId; + + public static final String SERIALIZED_NAME_WAYBILL = "waybill"; + @SerializedName(SERIALIZED_NAME_WAYBILL) + @javax.annotation.Nonnull + private String waybill; + + public static final String SERIALIZED_NAME_CARRIER_NAME = "carrierName"; + @SerializedName(SERIALIZED_NAME_CARRIER_NAME) + @javax.annotation.Nullable + private String carrierName; + + public static final String SERIALIZED_NAME_LINE_ITEMS = "lineItems"; + @SerializedName(SERIALIZED_NAME_LINE_ITEMS) + @javax.annotation.Nullable + private List lineItems = new ArrayList<>(); + + public CheckoutFormAddWaybillRequest() { + } + + public CheckoutFormAddWaybillRequest carrierId(@javax.annotation.Nonnull String carrierId) { + this.carrierId = carrierId; + return this; + } + + /** + * Supported carriers are available via <a href=\"#operation/getOrdersCarriersUsingGET\" target=\"_blank\">shipping carriers resource</a>. + * @return carrierId + */ + @javax.annotation.Nonnull + public String getCarrierId() { + return carrierId; + } + + public void setCarrierId(@javax.annotation.Nonnull String carrierId) { + this.carrierId = carrierId; + } + + + public CheckoutFormAddWaybillRequest waybill(@javax.annotation.Nonnull String waybill) { + this.waybill = waybill; + return this; + } + + /** + * Waybill number (parcel tracking number). Cannot be empty and must be no longer than 64 characters. + * @return waybill + */ + @javax.annotation.Nonnull + public String getWaybill() { + return waybill; + } + + public void setWaybill(@javax.annotation.Nonnull String waybill) { + this.waybill = waybill; + } + + + public CheckoutFormAddWaybillRequest carrierName(@javax.annotation.Nullable String carrierName) { + this.carrierName = carrierName; + return this; + } + + /** + * Carrier name to be provided only if carrierId is OTHER, otherwise it’s ignored. Must be no longer than 30 characters. + * @return carrierName + */ + @javax.annotation.Nullable + public String getCarrierName() { + return carrierName; + } + + public void setCarrierName(@javax.annotation.Nullable String carrierName) { + this.carrierName = carrierName; + } + + + public CheckoutFormAddWaybillRequest lineItems(@javax.annotation.Nullable List lineItems) { + this.lineItems = lineItems; + return this; + } + + public CheckoutFormAddWaybillRequest addLineItemsItem(CheckoutFormAddWaybillRequestLineItemsInner lineItemsItem) { + if (this.lineItems == null) { + this.lineItems = new ArrayList<>(); + } + this.lineItems.add(lineItemsItem); + return this; + } + + /** + * List of order line items. They must be from the order specified in the path parameter. When list is not provided or it is empty it means that every item from an order is included in shipment. + * @return lineItems + */ + @javax.annotation.Nullable + public List getLineItems() { + return lineItems; + } + + public void setLineItems(@javax.annotation.Nullable List lineItems) { + this.lineItems = lineItems; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormAddWaybillRequest checkoutFormAddWaybillRequest = (CheckoutFormAddWaybillRequest) o; + return Objects.equals(this.carrierId, checkoutFormAddWaybillRequest.carrierId) && + Objects.equals(this.waybill, checkoutFormAddWaybillRequest.waybill) && + Objects.equals(this.carrierName, checkoutFormAddWaybillRequest.carrierName) && + Objects.equals(this.lineItems, checkoutFormAddWaybillRequest.lineItems); + } + + @Override + public int hashCode() { + return Objects.hash(carrierId, waybill, carrierName, lineItems); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormAddWaybillRequest {\n"); + sb.append(" carrierId: ").append(toIndentedString(carrierId)).append("\n"); + sb.append(" waybill: ").append(toIndentedString(waybill)).append("\n"); + sb.append(" carrierName: ").append(toIndentedString(carrierName)).append("\n"); + sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("carrierId"); + openapiFields.add("waybill"); + openapiFields.add("carrierName"); + openapiFields.add("lineItems"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("carrierId"); + openapiRequiredFields.add("waybill"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormAddWaybillRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormAddWaybillRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormAddWaybillRequest is not found in the empty JSON string", CheckoutFormAddWaybillRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormAddWaybillRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormAddWaybillRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormAddWaybillRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("carrierId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `carrierId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierId").toString())); + } + if (!jsonObj.get("waybill").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `waybill` to be a primitive type in the JSON string but got `%s`", jsonObj.get("waybill").toString())); + } + if ((jsonObj.get("carrierName") != null && !jsonObj.get("carrierName").isJsonNull()) && !jsonObj.get("carrierName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `carrierName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierName").toString())); + } + if (jsonObj.get("lineItems") != null && !jsonObj.get("lineItems").isJsonNull()) { + JsonArray jsonArraylineItems = jsonObj.getAsJsonArray("lineItems"); + if (jsonArraylineItems != null) { + // ensure the json data is an array + if (!jsonObj.get("lineItems").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `lineItems` to be an array in the JSON string but got `%s`", jsonObj.get("lineItems").toString())); + } + + // validate the optional field `lineItems` (array) + for (int i = 0; i < jsonArraylineItems.size(); i++) { + CheckoutFormAddWaybillRequestLineItemsInner.validateJsonElement(jsonArraylineItems.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormAddWaybillRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormAddWaybillRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormAddWaybillRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormAddWaybillRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormAddWaybillRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormAddWaybillRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormAddWaybillRequest + * @throws IOException if the JSON string is invalid with respect to CheckoutFormAddWaybillRequest + */ + public static CheckoutFormAddWaybillRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormAddWaybillRequest.class); + } + + /** + * Convert an instance of CheckoutFormAddWaybillRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillRequestLineItemsInner.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillRequestLineItemsInner.java new file mode 100644 index 0000000..02fd4e8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAddWaybillRequestLineItemsInner.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormAddWaybillRequestLineItemsInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormAddWaybillRequestLineItemsInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public CheckoutFormAddWaybillRequestLineItemsInner() { + } + + public CheckoutFormAddWaybillRequestLineItemsInner id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Identifier of an order line item. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormAddWaybillRequestLineItemsInner checkoutFormAddWaybillRequestLineItemsInner = (CheckoutFormAddWaybillRequestLineItemsInner) o; + return Objects.equals(this.id, checkoutFormAddWaybillRequestLineItemsInner.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormAddWaybillRequestLineItemsInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormAddWaybillRequestLineItemsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormAddWaybillRequestLineItemsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormAddWaybillRequestLineItemsInner is not found in the empty JSON string", CheckoutFormAddWaybillRequestLineItemsInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormAddWaybillRequestLineItemsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormAddWaybillRequestLineItemsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormAddWaybillRequestLineItemsInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormAddWaybillRequestLineItemsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormAddWaybillRequestLineItemsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormAddWaybillRequestLineItemsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormAddWaybillRequestLineItemsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormAddWaybillRequestLineItemsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormAddWaybillRequestLineItemsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormAddWaybillRequestLineItemsInner + * @throws IOException if the JSON string is invalid with respect to CheckoutFormAddWaybillRequestLineItemsInner + */ + public static CheckoutFormAddWaybillRequestLineItemsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormAddWaybillRequestLineItemsInner.class); + } + + /** + * Convert an instance of CheckoutFormAddWaybillRequestLineItemsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAdditionalService.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAdditionalService.java new file mode 100644 index 0000000..50023ec --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormAdditionalService.java @@ -0,0 +1,296 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormAdditionalService + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormAdditionalService { + public static final String SERIALIZED_NAME_DEFINITION_ID = "definitionId"; + @SerializedName(SERIALIZED_NAME_DEFINITION_ID) + @javax.annotation.Nullable + private String definitionId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private Price price; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public CheckoutFormAdditionalService() { + } + + public CheckoutFormAdditionalService definitionId(@javax.annotation.Nullable String definitionId) { + this.definitionId = definitionId; + return this; + } + + /** + * Additional service id + * @return definitionId + */ + @javax.annotation.Nullable + public String getDefinitionId() { + return definitionId; + } + + public void setDefinitionId(@javax.annotation.Nullable String definitionId) { + this.definitionId = definitionId; + } + + + public CheckoutFormAdditionalService name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Additional service name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CheckoutFormAdditionalService price(@javax.annotation.Nullable Price price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nullable + public Price getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable Price price) { + this.price = price; + } + + + public CheckoutFormAdditionalService quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Quantity of an additional service + * minimum: 1 + * @return quantity + */ + @javax.annotation.Nullable + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormAdditionalService checkoutFormAdditionalService = (CheckoutFormAdditionalService) o; + return Objects.equals(this.definitionId, checkoutFormAdditionalService.definitionId) && + Objects.equals(this.name, checkoutFormAdditionalService.name) && + Objects.equals(this.price, checkoutFormAdditionalService.price) && + Objects.equals(this.quantity, checkoutFormAdditionalService.quantity); + } + + @Override + public int hashCode() { + return Objects.hash(definitionId, name, price, quantity); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormAdditionalService {\n"); + sb.append(" definitionId: ").append(toIndentedString(definitionId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("definitionId"); + openapiFields.add("name"); + openapiFields.add("price"); + openapiFields.add("quantity"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormAdditionalService + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormAdditionalService.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormAdditionalService is not found in the empty JSON string", CheckoutFormAdditionalService.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormAdditionalService.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormAdditionalService` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("definitionId") != null && !jsonObj.get("definitionId").isJsonNull()) && !jsonObj.get("definitionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `definitionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("definitionId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `price` + if (jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("price")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormAdditionalService.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormAdditionalService' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormAdditionalService.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormAdditionalService value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormAdditionalService read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormAdditionalService given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormAdditionalService + * @throws IOException if the JSON string is invalid with respect to CheckoutFormAdditionalService + */ + public static CheckoutFormAdditionalService fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormAdditionalService.class); + } + + /** + * Convert an instance of CheckoutFormAdditionalService to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormBuyerAddressReference.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormBuyerAddressReference.java new file mode 100644 index 0000000..b7d4595 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormBuyerAddressReference.java @@ -0,0 +1,296 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Buyer address + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormBuyerAddressReference { + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nullable + private String street; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nullable + private String city; + + public static final String SERIALIZED_NAME_POST_CODE = "postCode"; + @SerializedName(SERIALIZED_NAME_POST_CODE) + @javax.annotation.Nullable + private String postCode; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode; + + public CheckoutFormBuyerAddressReference() { + } + + public CheckoutFormBuyerAddressReference street(@javax.annotation.Nullable String street) { + this.street = street; + return this; + } + + /** + * Street + * @return street + */ + @javax.annotation.Nullable + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nullable String street) { + this.street = street; + } + + + public CheckoutFormBuyerAddressReference city(@javax.annotation.Nullable String city) { + this.city = city; + return this; + } + + /** + * City name + * @return city + */ + @javax.annotation.Nullable + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nullable String city) { + this.city = city; + } + + + public CheckoutFormBuyerAddressReference postCode(@javax.annotation.Nullable String postCode) { + this.postCode = postCode; + return this; + } + + /** + * Postal code + * @return postCode + */ + @javax.annotation.Nullable + public String getPostCode() { + return postCode; + } + + public void setPostCode(@javax.annotation.Nullable String postCode) { + this.postCode = postCode; + } + + + public CheckoutFormBuyerAddressReference countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormBuyerAddressReference checkoutFormBuyerAddressReference = (CheckoutFormBuyerAddressReference) o; + return Objects.equals(this.street, checkoutFormBuyerAddressReference.street) && + Objects.equals(this.city, checkoutFormBuyerAddressReference.city) && + Objects.equals(this.postCode, checkoutFormBuyerAddressReference.postCode) && + Objects.equals(this.countryCode, checkoutFormBuyerAddressReference.countryCode); + } + + @Override + public int hashCode() { + return Objects.hash(street, city, postCode, countryCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormBuyerAddressReference {\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" postCode: ").append(toIndentedString(postCode)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("street"); + openapiFields.add("city"); + openapiFields.add("postCode"); + openapiFields.add("countryCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormBuyerAddressReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormBuyerAddressReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormBuyerAddressReference is not found in the empty JSON string", CheckoutFormBuyerAddressReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormBuyerAddressReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormBuyerAddressReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("street") != null && !jsonObj.get("street").isJsonNull()) && !jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if ((jsonObj.get("city") != null && !jsonObj.get("city").isJsonNull()) && !jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if ((jsonObj.get("postCode") != null && !jsonObj.get("postCode").isJsonNull()) && !jsonObj.get("postCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postCode").toString())); + } + if ((jsonObj.get("countryCode") != null && !jsonObj.get("countryCode").isJsonNull()) && !jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormBuyerAddressReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormBuyerAddressReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormBuyerAddressReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormBuyerAddressReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormBuyerAddressReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormBuyerAddressReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormBuyerAddressReference + * @throws IOException if the JSON string is invalid with respect to CheckoutFormBuyerAddressReference + */ + public static CheckoutFormBuyerAddressReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormBuyerAddressReference.class); + } + + /** + * Convert an instance of CheckoutFormBuyerAddressReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormBuyerReference.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormBuyerReference.java new file mode 100644 index 0000000..9e868f6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormBuyerReference.java @@ -0,0 +1,518 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BuyerPreferencesReference; +import pl.wtx.allegro.api.client.model.CheckoutFormBuyerAddressReference; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Buyer data + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormBuyerReference { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nonnull + private String email; + + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nonnull + private String login; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_COMPANY_NAME = "companyName"; + @SerializedName(SERIALIZED_NAME_COMPANY_NAME) + @javax.annotation.Nullable + private String companyName; + + public static final String SERIALIZED_NAME_GUEST = "guest"; + @SerializedName(SERIALIZED_NAME_GUEST) + @javax.annotation.Nonnull + private Boolean guest; + + public static final String SERIALIZED_NAME_PERSONAL_IDENTITY = "personalIdentity"; + @SerializedName(SERIALIZED_NAME_PERSONAL_IDENTITY) + @javax.annotation.Nullable + private String personalIdentity; + + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nullable + private String phoneNumber; + + public static final String SERIALIZED_NAME_PREFERENCES = "preferences"; + @SerializedName(SERIALIZED_NAME_PREFERENCES) + @javax.annotation.Nullable + private BuyerPreferencesReference preferences; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private CheckoutFormBuyerAddressReference address; + + public CheckoutFormBuyerReference() { + } + + public CheckoutFormBuyerReference id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * buyer id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public CheckoutFormBuyerReference email(@javax.annotation.Nonnull String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nonnull String email) { + this.email = email; + } + + + public CheckoutFormBuyerReference login(@javax.annotation.Nonnull String login) { + this.login = login; + return this; + } + + /** + * Get login + * @return login + */ + @javax.annotation.Nonnull + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nonnull String login) { + this.login = login; + } + + + public CheckoutFormBuyerReference firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Buyer's first name + * @return firstName + */ + @javax.annotation.Nullable + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public CheckoutFormBuyerReference lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Buyer's last name + * @return lastName + */ + @javax.annotation.Nullable + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public CheckoutFormBuyerReference companyName(@javax.annotation.Nullable String companyName) { + this.companyName = companyName; + return this; + } + + /** + * Company name + * @return companyName + */ + @javax.annotation.Nullable + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(@javax.annotation.Nullable String companyName) { + this.companyName = companyName; + } + + + public CheckoutFormBuyerReference guest(@javax.annotation.Nonnull Boolean guest) { + this.guest = guest; + return this; + } + + /** + * is a guest account? + * @return guest + */ + @javax.annotation.Nonnull + public Boolean getGuest() { + return guest; + } + + public void setGuest(@javax.annotation.Nonnull Boolean guest) { + this.guest = guest; + } + + + public CheckoutFormBuyerReference personalIdentity(@javax.annotation.Nullable String personalIdentity) { + this.personalIdentity = personalIdentity; + return this; + } + + /** + * Buyer's personal identity number (PESEL) + * @return personalIdentity + */ + @javax.annotation.Nullable + public String getPersonalIdentity() { + return personalIdentity; + } + + public void setPersonalIdentity(@javax.annotation.Nullable String personalIdentity) { + this.personalIdentity = personalIdentity; + } + + + public CheckoutFormBuyerReference phoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Phone number + * @return phoneNumber + */ + @javax.annotation.Nullable + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public CheckoutFormBuyerReference preferences(@javax.annotation.Nullable BuyerPreferencesReference preferences) { + this.preferences = preferences; + return this; + } + + /** + * Get preferences + * @return preferences + */ + @javax.annotation.Nullable + public BuyerPreferencesReference getPreferences() { + return preferences; + } + + public void setPreferences(@javax.annotation.Nullable BuyerPreferencesReference preferences) { + this.preferences = preferences; + } + + + public CheckoutFormBuyerReference address(@javax.annotation.Nullable CheckoutFormBuyerAddressReference address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public CheckoutFormBuyerAddressReference getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable CheckoutFormBuyerAddressReference address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormBuyerReference checkoutFormBuyerReference = (CheckoutFormBuyerReference) o; + return Objects.equals(this.id, checkoutFormBuyerReference.id) && + Objects.equals(this.email, checkoutFormBuyerReference.email) && + Objects.equals(this.login, checkoutFormBuyerReference.login) && + Objects.equals(this.firstName, checkoutFormBuyerReference.firstName) && + Objects.equals(this.lastName, checkoutFormBuyerReference.lastName) && + Objects.equals(this.companyName, checkoutFormBuyerReference.companyName) && + Objects.equals(this.guest, checkoutFormBuyerReference.guest) && + Objects.equals(this.personalIdentity, checkoutFormBuyerReference.personalIdentity) && + Objects.equals(this.phoneNumber, checkoutFormBuyerReference.phoneNumber) && + Objects.equals(this.preferences, checkoutFormBuyerReference.preferences) && + Objects.equals(this.address, checkoutFormBuyerReference.address); + } + + @Override + public int hashCode() { + return Objects.hash(id, email, login, firstName, lastName, companyName, guest, personalIdentity, phoneNumber, preferences, address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormBuyerReference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" companyName: ").append(toIndentedString(companyName)).append("\n"); + sb.append(" guest: ").append(toIndentedString(guest)).append("\n"); + sb.append(" personalIdentity: ").append(toIndentedString(personalIdentity)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" preferences: ").append(toIndentedString(preferences)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("email"); + openapiFields.add("login"); + openapiFields.add("firstName"); + openapiFields.add("lastName"); + openapiFields.add("companyName"); + openapiFields.add("guest"); + openapiFields.add("personalIdentity"); + openapiFields.add("phoneNumber"); + openapiFields.add("preferences"); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("login"); + openapiRequiredFields.add("guest"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormBuyerReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormBuyerReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormBuyerReference is not found in the empty JSON string", CheckoutFormBuyerReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormBuyerReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormBuyerReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormBuyerReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if ((jsonObj.get("companyName") != null && !jsonObj.get("companyName").isJsonNull()) && !jsonObj.get("companyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `companyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("companyName").toString())); + } + if ((jsonObj.get("personalIdentity") != null && !jsonObj.get("personalIdentity").isJsonNull()) && !jsonObj.get("personalIdentity").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `personalIdentity` to be a primitive type in the JSON string but got `%s`", jsonObj.get("personalIdentity").toString())); + } + if ((jsonObj.get("phoneNumber") != null && !jsonObj.get("phoneNumber").isJsonNull()) && !jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + // validate the optional field `preferences` + if (jsonObj.get("preferences") != null && !jsonObj.get("preferences").isJsonNull()) { + BuyerPreferencesReference.validateJsonElement(jsonObj.get("preferences")); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + CheckoutFormBuyerAddressReference.validateJsonElement(jsonObj.get("address")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormBuyerReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormBuyerReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormBuyerReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormBuyerReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormBuyerReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormBuyerReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormBuyerReference + * @throws IOException if the JSON string is invalid with respect to CheckoutFormBuyerReference + */ + public static CheckoutFormBuyerReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormBuyerReference.class); + } + + /** + * Convert an instance of CheckoutFormBuyerReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryAddress.java new file mode 100644 index 0000000..443426d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryAddress.java @@ -0,0 +1,459 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormDeliveryAddress + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormDeliveryAddress { + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nonnull + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nonnull + private String lastName; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_ZIP_CODE = "zipCode"; + @SerializedName(SERIALIZED_NAME_ZIP_CODE) + @javax.annotation.Nonnull + private String zipCode; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode; + + public static final String SERIALIZED_NAME_COMPANY_NAME = "companyName"; + @SerializedName(SERIALIZED_NAME_COMPANY_NAME) + @javax.annotation.Nullable + private String companyName; + + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nullable + private String phoneNumber; + + public static final String SERIALIZED_NAME_MODIFIED_AT = "modifiedAt"; + @SerializedName(SERIALIZED_NAME_MODIFIED_AT) + @javax.annotation.Nullable + private String modifiedAt; + + public CheckoutFormDeliveryAddress() { + } + + public CheckoutFormDeliveryAddress firstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Receiver's first name + * @return firstName + */ + @javax.annotation.Nonnull + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + } + + + public CheckoutFormDeliveryAddress lastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Receiver's last name + * @return lastName + */ + @javax.annotation.Nonnull + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + } + + + public CheckoutFormDeliveryAddress street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Street name + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public CheckoutFormDeliveryAddress city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * City name + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public CheckoutFormDeliveryAddress zipCode(@javax.annotation.Nonnull String zipCode) { + this.zipCode = zipCode; + return this; + } + + /** + * Postal code + * @return zipCode + */ + @javax.annotation.Nonnull + public String getZipCode() { + return zipCode; + } + + public void setZipCode(@javax.annotation.Nonnull String zipCode) { + this.zipCode = zipCode; + } + + + public CheckoutFormDeliveryAddress countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + public CheckoutFormDeliveryAddress companyName(@javax.annotation.Nullable String companyName) { + this.companyName = companyName; + return this; + } + + /** + * Company name + * @return companyName + */ + @javax.annotation.Nullable + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(@javax.annotation.Nullable String companyName) { + this.companyName = companyName; + } + + + public CheckoutFormDeliveryAddress phoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Phone number + * @return phoneNumber + */ + @javax.annotation.Nullable + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public CheckoutFormDeliveryAddress modifiedAt(@javax.annotation.Nullable String modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * Address modification date + * @return modifiedAt + */ + @javax.annotation.Nullable + public String getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(@javax.annotation.Nullable String modifiedAt) { + this.modifiedAt = modifiedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormDeliveryAddress checkoutFormDeliveryAddress = (CheckoutFormDeliveryAddress) o; + return Objects.equals(this.firstName, checkoutFormDeliveryAddress.firstName) && + Objects.equals(this.lastName, checkoutFormDeliveryAddress.lastName) && + Objects.equals(this.street, checkoutFormDeliveryAddress.street) && + Objects.equals(this.city, checkoutFormDeliveryAddress.city) && + Objects.equals(this.zipCode, checkoutFormDeliveryAddress.zipCode) && + Objects.equals(this.countryCode, checkoutFormDeliveryAddress.countryCode) && + Objects.equals(this.companyName, checkoutFormDeliveryAddress.companyName) && + Objects.equals(this.phoneNumber, checkoutFormDeliveryAddress.phoneNumber) && + Objects.equals(this.modifiedAt, checkoutFormDeliveryAddress.modifiedAt); + } + + @Override + public int hashCode() { + return Objects.hash(firstName, lastName, street, city, zipCode, countryCode, companyName, phoneNumber, modifiedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormDeliveryAddress {\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" zipCode: ").append(toIndentedString(zipCode)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" companyName: ").append(toIndentedString(companyName)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("firstName"); + openapiFields.add("lastName"); + openapiFields.add("street"); + openapiFields.add("city"); + openapiFields.add("zipCode"); + openapiFields.add("countryCode"); + openapiFields.add("companyName"); + openapiFields.add("phoneNumber"); + openapiFields.add("modifiedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("firstName"); + openapiRequiredFields.add("lastName"); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("zipCode"); + openapiRequiredFields.add("countryCode"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormDeliveryAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormDeliveryAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormDeliveryAddress is not found in the empty JSON string", CheckoutFormDeliveryAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormDeliveryAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormDeliveryAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormDeliveryAddress.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if (!jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if (!jsonObj.get("zipCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `zipCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("zipCode").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if ((jsonObj.get("companyName") != null && !jsonObj.get("companyName").isJsonNull()) && !jsonObj.get("companyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `companyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("companyName").toString())); + } + if ((jsonObj.get("phoneNumber") != null && !jsonObj.get("phoneNumber").isJsonNull()) && !jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + if ((jsonObj.get("modifiedAt") != null && !jsonObj.get("modifiedAt").isJsonNull()) && !jsonObj.get("modifiedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `modifiedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("modifiedAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormDeliveryAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormDeliveryAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormDeliveryAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormDeliveryAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormDeliveryAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormDeliveryAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormDeliveryAddress + * @throws IOException if the JSON string is invalid with respect to CheckoutFormDeliveryAddress + */ + public static CheckoutFormDeliveryAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormDeliveryAddress.class); + } + + /** + * Convert an instance of CheckoutFormDeliveryAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryCancellation.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryCancellation.java new file mode 100644 index 0000000..083872b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryCancellation.java @@ -0,0 +1,212 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The delivery cancellation information. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormDeliveryCancellation { + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + @javax.annotation.Nonnull + private OffsetDateTime date; + + public CheckoutFormDeliveryCancellation() { + } + + public CheckoutFormDeliveryCancellation date(@javax.annotation.Nonnull OffsetDateTime date) { + this.date = date; + return this; + } + + /** + * ISO date when the delivery was cancelled. + * @return date + */ + @javax.annotation.Nonnull + public OffsetDateTime getDate() { + return date; + } + + public void setDate(@javax.annotation.Nonnull OffsetDateTime date) { + this.date = date; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormDeliveryCancellation checkoutFormDeliveryCancellation = (CheckoutFormDeliveryCancellation) o; + return Objects.equals(this.date, checkoutFormDeliveryCancellation.date); + } + + @Override + public int hashCode() { + return Objects.hash(date); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormDeliveryCancellation {\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("date"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("date"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormDeliveryCancellation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormDeliveryCancellation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormDeliveryCancellation is not found in the empty JSON string", CheckoutFormDeliveryCancellation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormDeliveryCancellation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormDeliveryCancellation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormDeliveryCancellation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormDeliveryCancellation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormDeliveryCancellation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormDeliveryCancellation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormDeliveryCancellation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormDeliveryCancellation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormDeliveryCancellation given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormDeliveryCancellation + * @throws IOException if the JSON string is invalid with respect to CheckoutFormDeliveryCancellation + */ + public static CheckoutFormDeliveryCancellation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormDeliveryCancellation.class); + } + + /** + * Convert an instance of CheckoutFormDeliveryCancellation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryMethod.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryMethod.java new file mode 100644 index 0000000..169c575 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryMethod.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormDeliveryMethod + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormDeliveryMethod { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public CheckoutFormDeliveryMethod() { + } + + public CheckoutFormDeliveryMethod id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Delivery method id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CheckoutFormDeliveryMethod name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Delivery method name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormDeliveryMethod checkoutFormDeliveryMethod = (CheckoutFormDeliveryMethod) o; + return Objects.equals(this.id, checkoutFormDeliveryMethod.id) && + Objects.equals(this.name, checkoutFormDeliveryMethod.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormDeliveryMethod {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormDeliveryMethod + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormDeliveryMethod.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormDeliveryMethod is not found in the empty JSON string", CheckoutFormDeliveryMethod.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormDeliveryMethod.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormDeliveryMethod` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormDeliveryMethod.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormDeliveryMethod' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormDeliveryMethod.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormDeliveryMethod value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormDeliveryMethod read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormDeliveryMethod given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormDeliveryMethod + * @throws IOException if the JSON string is invalid with respect to CheckoutFormDeliveryMethod + */ + public static CheckoutFormDeliveryMethod fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormDeliveryMethod.class); + } + + /** + * Convert an instance of CheckoutFormDeliveryMethod to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryPickupPoint.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryPickupPoint.java new file mode 100644 index 0000000..bb12d3e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryPickupPoint.java @@ -0,0 +1,298 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CheckoutFormDeliveryPickupPointAddress; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormDeliveryPickupPoint + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormDeliveryPickupPoint { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private CheckoutFormDeliveryPickupPointAddress address; + + public CheckoutFormDeliveryPickupPoint() { + } + + public CheckoutFormDeliveryPickupPoint id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Delivery point id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CheckoutFormDeliveryPickupPoint name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Delivery point name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CheckoutFormDeliveryPickupPoint description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Delivery point description + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + public CheckoutFormDeliveryPickupPoint address(@javax.annotation.Nullable CheckoutFormDeliveryPickupPointAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public CheckoutFormDeliveryPickupPointAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable CheckoutFormDeliveryPickupPointAddress address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormDeliveryPickupPoint checkoutFormDeliveryPickupPoint = (CheckoutFormDeliveryPickupPoint) o; + return Objects.equals(this.id, checkoutFormDeliveryPickupPoint.id) && + Objects.equals(this.name, checkoutFormDeliveryPickupPoint.name) && + Objects.equals(this.description, checkoutFormDeliveryPickupPoint.description) && + Objects.equals(this.address, checkoutFormDeliveryPickupPoint.address); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description, address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormDeliveryPickupPoint {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormDeliveryPickupPoint + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormDeliveryPickupPoint.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormDeliveryPickupPoint is not found in the empty JSON string", CheckoutFormDeliveryPickupPoint.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormDeliveryPickupPoint.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormDeliveryPickupPoint` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + CheckoutFormDeliveryPickupPointAddress.validateJsonElement(jsonObj.get("address")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormDeliveryPickupPoint.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormDeliveryPickupPoint' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormDeliveryPickupPoint.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormDeliveryPickupPoint value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormDeliveryPickupPoint read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormDeliveryPickupPoint given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormDeliveryPickupPoint + * @throws IOException if the JSON string is invalid with respect to CheckoutFormDeliveryPickupPoint + */ + public static CheckoutFormDeliveryPickupPoint fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormDeliveryPickupPoint.class); + } + + /** + * Convert an instance of CheckoutFormDeliveryPickupPoint to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryPickupPointAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryPickupPointAddress.java new file mode 100644 index 0000000..8159992 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryPickupPointAddress.java @@ -0,0 +1,296 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormDeliveryPickupPointAddress + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormDeliveryPickupPointAddress { + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nullable + private String street; + + public static final String SERIALIZED_NAME_ZIP_CODE = "zipCode"; + @SerializedName(SERIALIZED_NAME_ZIP_CODE) + @javax.annotation.Nullable + private String zipCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nullable + private String city; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode; + + public CheckoutFormDeliveryPickupPointAddress() { + } + + public CheckoutFormDeliveryPickupPointAddress street(@javax.annotation.Nullable String street) { + this.street = street; + return this; + } + + /** + * Delivery point street name + * @return street + */ + @javax.annotation.Nullable + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nullable String street) { + this.street = street; + } + + + public CheckoutFormDeliveryPickupPointAddress zipCode(@javax.annotation.Nullable String zipCode) { + this.zipCode = zipCode; + return this; + } + + /** + * Delivery point postal code + * @return zipCode + */ + @javax.annotation.Nullable + public String getZipCode() { + return zipCode; + } + + public void setZipCode(@javax.annotation.Nullable String zipCode) { + this.zipCode = zipCode; + } + + + public CheckoutFormDeliveryPickupPointAddress city(@javax.annotation.Nullable String city) { + this.city = city; + return this; + } + + /** + * City name + * @return city + */ + @javax.annotation.Nullable + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nullable String city) { + this.city = city; + } + + + public CheckoutFormDeliveryPickupPointAddress countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormDeliveryPickupPointAddress checkoutFormDeliveryPickupPointAddress = (CheckoutFormDeliveryPickupPointAddress) o; + return Objects.equals(this.street, checkoutFormDeliveryPickupPointAddress.street) && + Objects.equals(this.zipCode, checkoutFormDeliveryPickupPointAddress.zipCode) && + Objects.equals(this.city, checkoutFormDeliveryPickupPointAddress.city) && + Objects.equals(this.countryCode, checkoutFormDeliveryPickupPointAddress.countryCode); + } + + @Override + public int hashCode() { + return Objects.hash(street, zipCode, city, countryCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormDeliveryPickupPointAddress {\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" zipCode: ").append(toIndentedString(zipCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("street"); + openapiFields.add("zipCode"); + openapiFields.add("city"); + openapiFields.add("countryCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormDeliveryPickupPointAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormDeliveryPickupPointAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormDeliveryPickupPointAddress is not found in the empty JSON string", CheckoutFormDeliveryPickupPointAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormDeliveryPickupPointAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormDeliveryPickupPointAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("street") != null && !jsonObj.get("street").isJsonNull()) && !jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if ((jsonObj.get("zipCode") != null && !jsonObj.get("zipCode").isJsonNull()) && !jsonObj.get("zipCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `zipCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("zipCode").toString())); + } + if ((jsonObj.get("city") != null && !jsonObj.get("city").isJsonNull()) && !jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if ((jsonObj.get("countryCode") != null && !jsonObj.get("countryCode").isJsonNull()) && !jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormDeliveryPickupPointAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormDeliveryPickupPointAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormDeliveryPickupPointAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormDeliveryPickupPointAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormDeliveryPickupPointAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormDeliveryPickupPointAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormDeliveryPickupPointAddress + * @throws IOException if the JSON string is invalid with respect to CheckoutFormDeliveryPickupPointAddress + */ + public static CheckoutFormDeliveryPickupPointAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormDeliveryPickupPointAddress.class); + } + + /** + * Convert an instance of CheckoutFormDeliveryPickupPointAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryReference.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryReference.java new file mode 100644 index 0000000..8667230 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryReference.java @@ -0,0 +1,423 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CheckoutFormDeliveryAddress; +import pl.wtx.allegro.api.client.model.CheckoutFormDeliveryCancellation; +import pl.wtx.allegro.api.client.model.CheckoutFormDeliveryMethod; +import pl.wtx.allegro.api.client.model.CheckoutFormDeliveryPickupPoint; +import pl.wtx.allegro.api.client.model.CheckoutFormDeliveryTime; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormDeliveryReference + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormDeliveryReference { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private CheckoutFormDeliveryAddress address; + + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + @javax.annotation.Nullable + private CheckoutFormDeliveryMethod method; + + public static final String SERIALIZED_NAME_PICKUP_POINT = "pickupPoint"; + @SerializedName(SERIALIZED_NAME_PICKUP_POINT) + @javax.annotation.Nullable + private CheckoutFormDeliveryPickupPoint pickupPoint; + + public static final String SERIALIZED_NAME_COST = "cost"; + @SerializedName(SERIALIZED_NAME_COST) + @javax.annotation.Nullable + private Price cost; + + public static final String SERIALIZED_NAME_TIME = "time"; + @SerializedName(SERIALIZED_NAME_TIME) + @javax.annotation.Nullable + private CheckoutFormDeliveryTime time; + + public static final String SERIALIZED_NAME_SMART = "smart"; + @SerializedName(SERIALIZED_NAME_SMART) + @javax.annotation.Nullable + private Boolean smart; + + public static final String SERIALIZED_NAME_CANCELLATION = "cancellation"; + @SerializedName(SERIALIZED_NAME_CANCELLATION) + @javax.annotation.Nullable + private CheckoutFormDeliveryCancellation cancellation; + + public static final String SERIALIZED_NAME_CALCULATED_NUMBER_OF_PACKAGES = "calculatedNumberOfPackages"; + @SerializedName(SERIALIZED_NAME_CALCULATED_NUMBER_OF_PACKAGES) + @javax.annotation.Nullable + private Integer calculatedNumberOfPackages; + + public CheckoutFormDeliveryReference() { + } + + public CheckoutFormDeliveryReference address(@javax.annotation.Nullable CheckoutFormDeliveryAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public CheckoutFormDeliveryAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable CheckoutFormDeliveryAddress address) { + this.address = address; + } + + + public CheckoutFormDeliveryReference method(@javax.annotation.Nullable CheckoutFormDeliveryMethod method) { + this.method = method; + return this; + } + + /** + * Get method + * @return method + */ + @javax.annotation.Nullable + public CheckoutFormDeliveryMethod getMethod() { + return method; + } + + public void setMethod(@javax.annotation.Nullable CheckoutFormDeliveryMethod method) { + this.method = method; + } + + + public CheckoutFormDeliveryReference pickupPoint(@javax.annotation.Nullable CheckoutFormDeliveryPickupPoint pickupPoint) { + this.pickupPoint = pickupPoint; + return this; + } + + /** + * Get pickupPoint + * @return pickupPoint + */ + @javax.annotation.Nullable + public CheckoutFormDeliveryPickupPoint getPickupPoint() { + return pickupPoint; + } + + public void setPickupPoint(@javax.annotation.Nullable CheckoutFormDeliveryPickupPoint pickupPoint) { + this.pickupPoint = pickupPoint; + } + + + public CheckoutFormDeliveryReference cost(@javax.annotation.Nullable Price cost) { + this.cost = cost; + return this; + } + + /** + * Get cost + * @return cost + */ + @javax.annotation.Nullable + public Price getCost() { + return cost; + } + + public void setCost(@javax.annotation.Nullable Price cost) { + this.cost = cost; + } + + + public CheckoutFormDeliveryReference time(@javax.annotation.Nullable CheckoutFormDeliveryTime time) { + this.time = time; + return this; + } + + /** + * Get time + * @return time + */ + @javax.annotation.Nullable + public CheckoutFormDeliveryTime getTime() { + return time; + } + + public void setTime(@javax.annotation.Nullable CheckoutFormDeliveryTime time) { + this.time = time; + } + + + public CheckoutFormDeliveryReference smart(@javax.annotation.Nullable Boolean smart) { + this.smart = smart; + return this; + } + + /** + * Buyer used a SMART option + * @return smart + */ + @javax.annotation.Nullable + public Boolean getSmart() { + return smart; + } + + public void setSmart(@javax.annotation.Nullable Boolean smart) { + this.smart = smart; + } + + + public CheckoutFormDeliveryReference cancellation(@javax.annotation.Nullable CheckoutFormDeliveryCancellation cancellation) { + this.cancellation = cancellation; + return this; + } + + /** + * Get cancellation + * @return cancellation + */ + @javax.annotation.Nullable + public CheckoutFormDeliveryCancellation getCancellation() { + return cancellation; + } + + public void setCancellation(@javax.annotation.Nullable CheckoutFormDeliveryCancellation cancellation) { + this.cancellation = cancellation; + } + + + public CheckoutFormDeliveryReference calculatedNumberOfPackages(@javax.annotation.Nullable Integer calculatedNumberOfPackages) { + this.calculatedNumberOfPackages = calculatedNumberOfPackages; + return this; + } + + /** + * Calculated number of packages. + * minimum: 0 + * @return calculatedNumberOfPackages + */ + @javax.annotation.Nullable + public Integer getCalculatedNumberOfPackages() { + return calculatedNumberOfPackages; + } + + public void setCalculatedNumberOfPackages(@javax.annotation.Nullable Integer calculatedNumberOfPackages) { + this.calculatedNumberOfPackages = calculatedNumberOfPackages; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormDeliveryReference checkoutFormDeliveryReference = (CheckoutFormDeliveryReference) o; + return Objects.equals(this.address, checkoutFormDeliveryReference.address) && + Objects.equals(this.method, checkoutFormDeliveryReference.method) && + Objects.equals(this.pickupPoint, checkoutFormDeliveryReference.pickupPoint) && + Objects.equals(this.cost, checkoutFormDeliveryReference.cost) && + Objects.equals(this.time, checkoutFormDeliveryReference.time) && + Objects.equals(this.smart, checkoutFormDeliveryReference.smart) && + Objects.equals(this.cancellation, checkoutFormDeliveryReference.cancellation) && + Objects.equals(this.calculatedNumberOfPackages, checkoutFormDeliveryReference.calculatedNumberOfPackages); + } + + @Override + public int hashCode() { + return Objects.hash(address, method, pickupPoint, cost, time, smart, cancellation, calculatedNumberOfPackages); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormDeliveryReference {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" pickupPoint: ").append(toIndentedString(pickupPoint)).append("\n"); + sb.append(" cost: ").append(toIndentedString(cost)).append("\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" smart: ").append(toIndentedString(smart)).append("\n"); + sb.append(" cancellation: ").append(toIndentedString(cancellation)).append("\n"); + sb.append(" calculatedNumberOfPackages: ").append(toIndentedString(calculatedNumberOfPackages)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + openapiFields.add("method"); + openapiFields.add("pickupPoint"); + openapiFields.add("cost"); + openapiFields.add("time"); + openapiFields.add("smart"); + openapiFields.add("cancellation"); + openapiFields.add("calculatedNumberOfPackages"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormDeliveryReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormDeliveryReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormDeliveryReference is not found in the empty JSON string", CheckoutFormDeliveryReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormDeliveryReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormDeliveryReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + CheckoutFormDeliveryAddress.validateJsonElement(jsonObj.get("address")); + } + // validate the optional field `method` + if (jsonObj.get("method") != null && !jsonObj.get("method").isJsonNull()) { + CheckoutFormDeliveryMethod.validateJsonElement(jsonObj.get("method")); + } + // validate the optional field `pickupPoint` + if (jsonObj.get("pickupPoint") != null && !jsonObj.get("pickupPoint").isJsonNull()) { + CheckoutFormDeliveryPickupPoint.validateJsonElement(jsonObj.get("pickupPoint")); + } + // validate the optional field `cost` + if (jsonObj.get("cost") != null && !jsonObj.get("cost").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("cost")); + } + // validate the optional field `time` + if (jsonObj.get("time") != null && !jsonObj.get("time").isJsonNull()) { + CheckoutFormDeliveryTime.validateJsonElement(jsonObj.get("time")); + } + // validate the optional field `cancellation` + if (jsonObj.get("cancellation") != null && !jsonObj.get("cancellation").isJsonNull()) { + CheckoutFormDeliveryCancellation.validateJsonElement(jsonObj.get("cancellation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormDeliveryReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormDeliveryReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormDeliveryReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormDeliveryReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormDeliveryReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormDeliveryReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormDeliveryReference + * @throws IOException if the JSON string is invalid with respect to CheckoutFormDeliveryReference + */ + public static CheckoutFormDeliveryReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormDeliveryReference.class); + } + + /** + * Convert an instance of CheckoutFormDeliveryReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTime.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTime.java new file mode 100644 index 0000000..ce35991 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTime.java @@ -0,0 +1,300 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CheckoutFormDeliveryTimeDispatch; +import pl.wtx.allegro.api.client.model.CheckoutFormDeliveryTimeGuaranteed; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormDeliveryTime + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormDeliveryTime { + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private OffsetDateTime from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private OffsetDateTime to; + + public static final String SERIALIZED_NAME_GUARANTEED = "guaranteed"; + @Deprecated + @SerializedName(SERIALIZED_NAME_GUARANTEED) + @javax.annotation.Nullable + private CheckoutFormDeliveryTimeGuaranteed guaranteed; + + public static final String SERIALIZED_NAME_DISPATCH = "dispatch"; + @SerializedName(SERIALIZED_NAME_DISPATCH) + @javax.annotation.Nullable + private CheckoutFormDeliveryTimeDispatch dispatch; + + public CheckoutFormDeliveryTime() { + } + + public CheckoutFormDeliveryTime from(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + return this; + } + + /** + * ISO date when the earliest delivery attempt can take place. + * @return from + */ + @javax.annotation.Nullable + public OffsetDateTime getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + } + + + public CheckoutFormDeliveryTime to(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + return this; + } + + /** + * ISO date when the latest delivery attempt can take place. + * @return to + */ + @javax.annotation.Nullable + public OffsetDateTime getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + } + + + @Deprecated + public CheckoutFormDeliveryTime guaranteed(@javax.annotation.Nullable CheckoutFormDeliveryTimeGuaranteed guaranteed) { + this.guaranteed = guaranteed; + return this; + } + + /** + * Get guaranteed + * @return guaranteed + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public CheckoutFormDeliveryTimeGuaranteed getGuaranteed() { + return guaranteed; + } + + @Deprecated + public void setGuaranteed(@javax.annotation.Nullable CheckoutFormDeliveryTimeGuaranteed guaranteed) { + this.guaranteed = guaranteed; + } + + + public CheckoutFormDeliveryTime dispatch(@javax.annotation.Nullable CheckoutFormDeliveryTimeDispatch dispatch) { + this.dispatch = dispatch; + return this; + } + + /** + * Get dispatch + * @return dispatch + */ + @javax.annotation.Nullable + public CheckoutFormDeliveryTimeDispatch getDispatch() { + return dispatch; + } + + public void setDispatch(@javax.annotation.Nullable CheckoutFormDeliveryTimeDispatch dispatch) { + this.dispatch = dispatch; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormDeliveryTime checkoutFormDeliveryTime = (CheckoutFormDeliveryTime) o; + return Objects.equals(this.from, checkoutFormDeliveryTime.from) && + Objects.equals(this.to, checkoutFormDeliveryTime.to) && + Objects.equals(this.guaranteed, checkoutFormDeliveryTime.guaranteed) && + Objects.equals(this.dispatch, checkoutFormDeliveryTime.dispatch); + } + + @Override + public int hashCode() { + return Objects.hash(from, to, guaranteed, dispatch); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormDeliveryTime {\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" guaranteed: ").append(toIndentedString(guaranteed)).append("\n"); + sb.append(" dispatch: ").append(toIndentedString(dispatch)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("guaranteed"); + openapiFields.add("dispatch"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormDeliveryTime + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormDeliveryTime.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormDeliveryTime is not found in the empty JSON string", CheckoutFormDeliveryTime.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormDeliveryTime.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormDeliveryTime` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `guaranteed` + if (jsonObj.get("guaranteed") != null && !jsonObj.get("guaranteed").isJsonNull()) { + CheckoutFormDeliveryTimeGuaranteed.validateJsonElement(jsonObj.get("guaranteed")); + } + // validate the optional field `dispatch` + if (jsonObj.get("dispatch") != null && !jsonObj.get("dispatch").isJsonNull()) { + CheckoutFormDeliveryTimeDispatch.validateJsonElement(jsonObj.get("dispatch")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormDeliveryTime.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormDeliveryTime' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormDeliveryTime.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormDeliveryTime value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormDeliveryTime read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormDeliveryTime given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormDeliveryTime + * @throws IOException if the JSON string is invalid with respect to CheckoutFormDeliveryTime + */ + public static CheckoutFormDeliveryTime fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormDeliveryTime.class); + } + + /** + * Convert an instance of CheckoutFormDeliveryTime to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTimeDispatch.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTimeDispatch.java new file mode 100644 index 0000000..a518d14 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTimeDispatch.java @@ -0,0 +1,231 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Dates when delivery should be dispatched, passed to the provider. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormDeliveryTimeDispatch { + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private OffsetDateTime from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private OffsetDateTime to; + + public CheckoutFormDeliveryTimeDispatch() { + } + + public CheckoutFormDeliveryTimeDispatch from(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + return this; + } + + /** + * ISO date when the earliest dispatch should take place. + * @return from + */ + @javax.annotation.Nullable + public OffsetDateTime getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + } + + + public CheckoutFormDeliveryTimeDispatch to(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + return this; + } + + /** + * ISO date when the latest dispatch should take place. + * @return to + */ + @javax.annotation.Nullable + public OffsetDateTime getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormDeliveryTimeDispatch checkoutFormDeliveryTimeDispatch = (CheckoutFormDeliveryTimeDispatch) o; + return Objects.equals(this.from, checkoutFormDeliveryTimeDispatch.from) && + Objects.equals(this.to, checkoutFormDeliveryTimeDispatch.to); + } + + @Override + public int hashCode() { + return Objects.hash(from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormDeliveryTimeDispatch {\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormDeliveryTimeDispatch + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormDeliveryTimeDispatch.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormDeliveryTimeDispatch is not found in the empty JSON string", CheckoutFormDeliveryTimeDispatch.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormDeliveryTimeDispatch.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormDeliveryTimeDispatch` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormDeliveryTimeDispatch.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormDeliveryTimeDispatch' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormDeliveryTimeDispatch.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormDeliveryTimeDispatch value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormDeliveryTimeDispatch read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormDeliveryTimeDispatch given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormDeliveryTimeDispatch + * @throws IOException if the JSON string is invalid with respect to CheckoutFormDeliveryTimeDispatch + */ + public static CheckoutFormDeliveryTimeDispatch fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormDeliveryTimeDispatch.class); + } + + /** + * Convert an instance of CheckoutFormDeliveryTimeDispatch to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTimeGuaranteed.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTimeGuaranteed.java new file mode 100644 index 0000000..b1c20d6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDeliveryTimeGuaranteed.java @@ -0,0 +1,233 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Guaranteed date when first delivery attempt takes place. This is always filled for Allegro One Courier delivery method. This field is deprecated in favor of `delivery.time.from` and `delivery.time.to`. + * @deprecated + */ +@Deprecated +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormDeliveryTimeGuaranteed { + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private OffsetDateTime from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private OffsetDateTime to; + + public CheckoutFormDeliveryTimeGuaranteed() { + } + + public CheckoutFormDeliveryTimeGuaranteed from(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + return this; + } + + /** + * ISO date when the earliest delivery attempt can take place. + * @return from + */ + @javax.annotation.Nullable + public OffsetDateTime getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable OffsetDateTime from) { + this.from = from; + } + + + public CheckoutFormDeliveryTimeGuaranteed to(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + return this; + } + + /** + * ISO date when the latest delivery attempt can take place. + * @return to + */ + @javax.annotation.Nullable + public OffsetDateTime getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable OffsetDateTime to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormDeliveryTimeGuaranteed checkoutFormDeliveryTimeGuaranteed = (CheckoutFormDeliveryTimeGuaranteed) o; + return Objects.equals(this.from, checkoutFormDeliveryTimeGuaranteed.from) && + Objects.equals(this.to, checkoutFormDeliveryTimeGuaranteed.to); + } + + @Override + public int hashCode() { + return Objects.hash(from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormDeliveryTimeGuaranteed {\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormDeliveryTimeGuaranteed + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormDeliveryTimeGuaranteed.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormDeliveryTimeGuaranteed is not found in the empty JSON string", CheckoutFormDeliveryTimeGuaranteed.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormDeliveryTimeGuaranteed.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormDeliveryTimeGuaranteed` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormDeliveryTimeGuaranteed.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormDeliveryTimeGuaranteed' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormDeliveryTimeGuaranteed.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormDeliveryTimeGuaranteed value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormDeliveryTimeGuaranteed read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormDeliveryTimeGuaranteed given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormDeliveryTimeGuaranteed + * @throws IOException if the JSON string is invalid with respect to CheckoutFormDeliveryTimeGuaranteed + */ + public static CheckoutFormDeliveryTimeGuaranteed fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormDeliveryTimeGuaranteed.class); + } + + /** + * Convert an instance of CheckoutFormDeliveryTimeGuaranteed to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDiscount.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDiscount.java new file mode 100644 index 0000000..e9e1c07 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormDiscount.java @@ -0,0 +1,276 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormDiscount + * @deprecated + */ +@Deprecated +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormDiscount { + /** + * Describes the types of discounts used in the checkout form. The types of discounts can be as follows: * `COUPON` - a coupon was used during payment * `BUNDLE` - some items were bought as a bundle * `MULTIPACK` - at least one item was bought with a multipack option turned on * `CROSSMULTIPACK` - some items, each from a different offer, were bought together as a multipack * `ALLEGRO_PRICES` - some items are included in the Allegro Prices program + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + COUPON("COUPON"), + + BUNDLE("BUNDLE"), + + MULTIPACK("MULTIPACK"), + + CROSSMULTIPACK("CROSSMULTIPACK"), + + ALLEGRO_PRICES("ALLEGRO_PRICES"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public CheckoutFormDiscount() { + } + + public CheckoutFormDiscount type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Describes the types of discounts used in the checkout form. The types of discounts can be as follows: * `COUPON` - a coupon was used during payment * `BUNDLE` - some items were bought as a bundle * `MULTIPACK` - at least one item was bought with a multipack option turned on * `CROSSMULTIPACK` - some items, each from a different offer, were bought together as a multipack * `ALLEGRO_PRICES` - some items are included in the Allegro Prices program + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormDiscount checkoutFormDiscount = (CheckoutFormDiscount) o; + return Objects.equals(this.type, checkoutFormDiscount.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormDiscount {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormDiscount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormDiscount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormDiscount is not found in the empty JSON string", CheckoutFormDiscount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormDiscount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormDiscount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormDiscount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormDiscount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormDiscount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormDiscount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormDiscount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormDiscount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormDiscount given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormDiscount + * @throws IOException if the JSON string is invalid with respect to CheckoutFormDiscount + */ + public static CheckoutFormDiscount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormDiscount.class); + } + + /** + * Convert an instance of CheckoutFormDiscount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillment.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillment.java new file mode 100644 index 0000000..a5d0e68 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillment.java @@ -0,0 +1,240 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CheckoutFormFulfillmentShipmentSummary; +import pl.wtx.allegro.api.client.model.CheckoutFormFulfillmentStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormFulfillment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormFulfillment { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private CheckoutFormFulfillmentStatus status; + + public static final String SERIALIZED_NAME_SHIPMENT_SUMMARY = "shipmentSummary"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_SUMMARY) + @javax.annotation.Nullable + private CheckoutFormFulfillmentShipmentSummary shipmentSummary; + + public CheckoutFormFulfillment() { + } + + public CheckoutFormFulfillment status(@javax.annotation.Nullable CheckoutFormFulfillmentStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public CheckoutFormFulfillmentStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable CheckoutFormFulfillmentStatus status) { + this.status = status; + } + + + public CheckoutFormFulfillment shipmentSummary(@javax.annotation.Nullable CheckoutFormFulfillmentShipmentSummary shipmentSummary) { + this.shipmentSummary = shipmentSummary; + return this; + } + + /** + * Get shipmentSummary + * @return shipmentSummary + */ + @javax.annotation.Nullable + public CheckoutFormFulfillmentShipmentSummary getShipmentSummary() { + return shipmentSummary; + } + + public void setShipmentSummary(@javax.annotation.Nullable CheckoutFormFulfillmentShipmentSummary shipmentSummary) { + this.shipmentSummary = shipmentSummary; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormFulfillment checkoutFormFulfillment = (CheckoutFormFulfillment) o; + return Objects.equals(this.status, checkoutFormFulfillment.status) && + Objects.equals(this.shipmentSummary, checkoutFormFulfillment.shipmentSummary); + } + + @Override + public int hashCode() { + return Objects.hash(status, shipmentSummary); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormFulfillment {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" shipmentSummary: ").append(toIndentedString(shipmentSummary)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("shipmentSummary"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormFulfillment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormFulfillment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormFulfillment is not found in the empty JSON string", CheckoutFormFulfillment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormFulfillment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormFulfillment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + CheckoutFormFulfillmentStatus.validateJsonElement(jsonObj.get("status")); + } + // validate the optional field `shipmentSummary` + if (jsonObj.get("shipmentSummary") != null && !jsonObj.get("shipmentSummary").isJsonNull()) { + CheckoutFormFulfillmentShipmentSummary.validateJsonElement(jsonObj.get("shipmentSummary")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormFulfillment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormFulfillment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormFulfillment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormFulfillment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormFulfillment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormFulfillment given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormFulfillment + * @throws IOException if the JSON string is invalid with respect to CheckoutFormFulfillment + */ + public static CheckoutFormFulfillment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormFulfillment.class); + } + + /** + * Convert an instance of CheckoutFormFulfillment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentShipmentSummary.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentShipmentSummary.java new file mode 100644 index 0000000..9de997b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentShipmentSummary.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CheckoutFormFulfillmentShipmentSummaryLineItemsSent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormFulfillmentShipmentSummary + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormFulfillmentShipmentSummary { + public static final String SERIALIZED_NAME_LINE_ITEMS_SENT = "lineItemsSent"; + @SerializedName(SERIALIZED_NAME_LINE_ITEMS_SENT) + @javax.annotation.Nullable + private CheckoutFormFulfillmentShipmentSummaryLineItemsSent lineItemsSent; + + public CheckoutFormFulfillmentShipmentSummary() { + } + + public CheckoutFormFulfillmentShipmentSummary lineItemsSent(@javax.annotation.Nullable CheckoutFormFulfillmentShipmentSummaryLineItemsSent lineItemsSent) { + this.lineItemsSent = lineItemsSent; + return this; + } + + /** + * Get lineItemsSent + * @return lineItemsSent + */ + @javax.annotation.Nullable + public CheckoutFormFulfillmentShipmentSummaryLineItemsSent getLineItemsSent() { + return lineItemsSent; + } + + public void setLineItemsSent(@javax.annotation.Nullable CheckoutFormFulfillmentShipmentSummaryLineItemsSent lineItemsSent) { + this.lineItemsSent = lineItemsSent; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormFulfillmentShipmentSummary checkoutFormFulfillmentShipmentSummary = (CheckoutFormFulfillmentShipmentSummary) o; + return Objects.equals(this.lineItemsSent, checkoutFormFulfillmentShipmentSummary.lineItemsSent); + } + + @Override + public int hashCode() { + return Objects.hash(lineItemsSent); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormFulfillmentShipmentSummary {\n"); + sb.append(" lineItemsSent: ").append(toIndentedString(lineItemsSent)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("lineItemsSent"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormFulfillmentShipmentSummary + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormFulfillmentShipmentSummary.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormFulfillmentShipmentSummary is not found in the empty JSON string", CheckoutFormFulfillmentShipmentSummary.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormFulfillmentShipmentSummary.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormFulfillmentShipmentSummary` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `lineItemsSent` + if (jsonObj.get("lineItemsSent") != null && !jsonObj.get("lineItemsSent").isJsonNull()) { + CheckoutFormFulfillmentShipmentSummaryLineItemsSent.validateJsonElement(jsonObj.get("lineItemsSent")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormFulfillmentShipmentSummary.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormFulfillmentShipmentSummary' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormFulfillmentShipmentSummary.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormFulfillmentShipmentSummary value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormFulfillmentShipmentSummary read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormFulfillmentShipmentSummary given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormFulfillmentShipmentSummary + * @throws IOException if the JSON string is invalid with respect to CheckoutFormFulfillmentShipmentSummary + */ + public static CheckoutFormFulfillmentShipmentSummary fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormFulfillmentShipmentSummary.class); + } + + /** + * Convert an instance of CheckoutFormFulfillmentShipmentSummary to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentShipmentSummaryLineItemsSent.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentShipmentSummaryLineItemsSent.java new file mode 100644 index 0000000..6a0e683 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentShipmentSummaryLineItemsSent.java @@ -0,0 +1,80 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Indicates how many line items have tracking number specified. + */ +@JsonAdapter(CheckoutFormFulfillmentShipmentSummaryLineItemsSent.Adapter.class) +public enum CheckoutFormFulfillmentShipmentSummaryLineItemsSent { + + NONE("NONE"), + + SOME("SOME"), + + ALL("ALL"); + + private String value; + + CheckoutFormFulfillmentShipmentSummaryLineItemsSent(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CheckoutFormFulfillmentShipmentSummaryLineItemsSent fromValue(String value) { + for (CheckoutFormFulfillmentShipmentSummaryLineItemsSent b : CheckoutFormFulfillmentShipmentSummaryLineItemsSent.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CheckoutFormFulfillmentShipmentSummaryLineItemsSent enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CheckoutFormFulfillmentShipmentSummaryLineItemsSent read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CheckoutFormFulfillmentShipmentSummaryLineItemsSent.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CheckoutFormFulfillmentShipmentSummaryLineItemsSent.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentStatus.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentStatus.java new file mode 100644 index 0000000..da4bf75 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormFulfillmentStatus.java @@ -0,0 +1,92 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Order seller status. The status is managed by the seller, however in some cases the seller can enable automatic change of the status in the Orders [settings](https://salescenter.allegro.com/orders/settings). Order changes to `SENT` status when a tracking number is added to the order and the seller has enabled corresponding setting (see: [here](https://help.allegro.com/sell/en/a/sales-management-via-advanced-settings-of-the-list-of-offers-and-orders-6M9E0wr5Rt5#automatic-status-change-after-adding-a-tracking-number)). Order can be switched to `RETURNED` status when both the buyer returns all order's items and the seller makes a refund for all of the order's items (either automatically or manually, see: [here](https://help.allegro.com/sell/en/a/how-can-i-issue-a-refund-to-the-buyer-k1wRo9wBXUx)). The `RETURNED` status cannot be set by the seller - it changes automatically when corresponding setting is enabled in sale settings (see: [here](https://help.allegro.com/sell/en/a/how-to-use-the-orders-tab-6M9E0wO9BFw#filtering-and-searching-for-orders)). + */ +@JsonAdapter(CheckoutFormFulfillmentStatus.Adapter.class) +public enum CheckoutFormFulfillmentStatus { + + NEW("NEW"), + + PROCESSING("PROCESSING"), + + READY_FOR_SHIPMENT("READY_FOR_SHIPMENT"), + + READY_FOR_PICKUP("READY_FOR_PICKUP"), + + SENT("SENT"), + + PICKED_UP("PICKED_UP"), + + CANCELLED("CANCELLED"), + + SUSPENDED("SUSPENDED"), + + RETURNED("RETURNED"); + + private String value; + + CheckoutFormFulfillmentStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CheckoutFormFulfillmentStatus fromValue(String value) { + for (CheckoutFormFulfillmentStatus b : CheckoutFormFulfillmentStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CheckoutFormFulfillmentStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CheckoutFormFulfillmentStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CheckoutFormFulfillmentStatus.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CheckoutFormFulfillmentStatus.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddress.java new file mode 100644 index 0000000..04a2f52 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddress.java @@ -0,0 +1,371 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CheckoutFormInvoiceAddressCompany; +import pl.wtx.allegro.api.client.model.CheckoutFormInvoiceAddressNaturalPerson; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormInvoiceAddress + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormInvoiceAddress { + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_ZIP_CODE = "zipCode"; + @SerializedName(SERIALIZED_NAME_ZIP_CODE) + @javax.annotation.Nonnull + private String zipCode; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode; + + public static final String SERIALIZED_NAME_COMPANY = "company"; + @SerializedName(SERIALIZED_NAME_COMPANY) + @javax.annotation.Nullable + private CheckoutFormInvoiceAddressCompany company; + + public static final String SERIALIZED_NAME_NATURAL_PERSON = "naturalPerson"; + @SerializedName(SERIALIZED_NAME_NATURAL_PERSON) + @javax.annotation.Nullable + private CheckoutFormInvoiceAddressNaturalPerson naturalPerson; + + public CheckoutFormInvoiceAddress() { + } + + public CheckoutFormInvoiceAddress street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Street name + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public CheckoutFormInvoiceAddress city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * City name + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public CheckoutFormInvoiceAddress zipCode(@javax.annotation.Nonnull String zipCode) { + this.zipCode = zipCode; + return this; + } + + /** + * Postal code + * @return zipCode + */ + @javax.annotation.Nonnull + public String getZipCode() { + return zipCode; + } + + public void setZipCode(@javax.annotation.Nonnull String zipCode) { + this.zipCode = zipCode; + } + + + public CheckoutFormInvoiceAddress countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + public CheckoutFormInvoiceAddress company(@javax.annotation.Nullable CheckoutFormInvoiceAddressCompany company) { + this.company = company; + return this; + } + + /** + * Get company + * @return company + */ + @javax.annotation.Nullable + public CheckoutFormInvoiceAddressCompany getCompany() { + return company; + } + + public void setCompany(@javax.annotation.Nullable CheckoutFormInvoiceAddressCompany company) { + this.company = company; + } + + + public CheckoutFormInvoiceAddress naturalPerson(@javax.annotation.Nullable CheckoutFormInvoiceAddressNaturalPerson naturalPerson) { + this.naturalPerson = naturalPerson; + return this; + } + + /** + * Get naturalPerson + * @return naturalPerson + */ + @javax.annotation.Nullable + public CheckoutFormInvoiceAddressNaturalPerson getNaturalPerson() { + return naturalPerson; + } + + public void setNaturalPerson(@javax.annotation.Nullable CheckoutFormInvoiceAddressNaturalPerson naturalPerson) { + this.naturalPerson = naturalPerson; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormInvoiceAddress checkoutFormInvoiceAddress = (CheckoutFormInvoiceAddress) o; + return Objects.equals(this.street, checkoutFormInvoiceAddress.street) && + Objects.equals(this.city, checkoutFormInvoiceAddress.city) && + Objects.equals(this.zipCode, checkoutFormInvoiceAddress.zipCode) && + Objects.equals(this.countryCode, checkoutFormInvoiceAddress.countryCode) && + Objects.equals(this.company, checkoutFormInvoiceAddress.company) && + Objects.equals(this.naturalPerson, checkoutFormInvoiceAddress.naturalPerson); + } + + @Override + public int hashCode() { + return Objects.hash(street, city, zipCode, countryCode, company, naturalPerson); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormInvoiceAddress {\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" zipCode: ").append(toIndentedString(zipCode)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" company: ").append(toIndentedString(company)).append("\n"); + sb.append(" naturalPerson: ").append(toIndentedString(naturalPerson)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("street"); + openapiFields.add("city"); + openapiFields.add("zipCode"); + openapiFields.add("countryCode"); + openapiFields.add("company"); + openapiFields.add("naturalPerson"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("zipCode"); + openapiRequiredFields.add("countryCode"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormInvoiceAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormInvoiceAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormInvoiceAddress is not found in the empty JSON string", CheckoutFormInvoiceAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormInvoiceAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormInvoiceAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormInvoiceAddress.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if (!jsonObj.get("zipCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `zipCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("zipCode").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + // validate the optional field `company` + if (jsonObj.get("company") != null && !jsonObj.get("company").isJsonNull()) { + CheckoutFormInvoiceAddressCompany.validateJsonElement(jsonObj.get("company")); + } + // validate the optional field `naturalPerson` + if (jsonObj.get("naturalPerson") != null && !jsonObj.get("naturalPerson").isJsonNull()) { + CheckoutFormInvoiceAddressNaturalPerson.validateJsonElement(jsonObj.get("naturalPerson")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormInvoiceAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormInvoiceAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormInvoiceAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormInvoiceAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormInvoiceAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormInvoiceAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormInvoiceAddress + * @throws IOException if the JSON string is invalid with respect to CheckoutFormInvoiceAddress + */ + public static CheckoutFormInvoiceAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormInvoiceAddress.class); + } + + /** + * Convert an instance of CheckoutFormInvoiceAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressCompany.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressCompany.java new file mode 100644 index 0000000..ec45fa5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressCompany.java @@ -0,0 +1,388 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CheckoutFormInvoiceAddressCompanyId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Setting the value to null indicates a private purchase, while any other value indicates a corporate purchase. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormInvoiceAddressCompany { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_IDS = "ids"; + @SerializedName(SERIALIZED_NAME_IDS) + @javax.annotation.Nullable + private List ids = new ArrayList<>(); + + /** + * The vat payer status: - `ACTIVE` - user explicitly declared as an active VAT taxpayer, - `NON_ACTIVE` - user explicitly declared as not an active VAT taxpayer, - `NOT_APPLICABLE` - user hasn't declared the VAT taxpayer status, or it's not applicable for given address type or provided company numbers. + */ + @JsonAdapter(VatPayerStatusEnum.Adapter.class) + public enum VatPayerStatusEnum { + ACTIVE("ACTIVE"), + + NON_ACTIVE("NON_ACTIVE"), + + NOT_APPLICABLE("NOT_APPLICABLE"); + + private String value; + + VatPayerStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static VatPayerStatusEnum fromValue(String value) { + for (VatPayerStatusEnum b : VatPayerStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final VatPayerStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public VatPayerStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return VatPayerStatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + VatPayerStatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_VAT_PAYER_STATUS = "vatPayerStatus"; + @SerializedName(SERIALIZED_NAME_VAT_PAYER_STATUS) + @javax.annotation.Nonnull + private VatPayerStatusEnum vatPayerStatus; + + public static final String SERIALIZED_NAME_TAX_ID = "taxId"; + @Deprecated + @SerializedName(SERIALIZED_NAME_TAX_ID) + @javax.annotation.Nullable + private String taxId; + + public CheckoutFormInvoiceAddressCompany() { + } + + public CheckoutFormInvoiceAddressCompany name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Name of a company for which invoice should be issued. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public CheckoutFormInvoiceAddressCompany ids(@javax.annotation.Nullable List ids) { + this.ids = ids; + return this; + } + + public CheckoutFormInvoiceAddressCompany addIdsItem(CheckoutFormInvoiceAddressCompanyId idsItem) { + if (this.ids == null) { + this.ids = new ArrayList<>(); + } + this.ids.add(idsItem); + return this; + } + + /** + * Tax ids of a company for which invoice should be issued. + * @return ids + */ + @javax.annotation.Nullable + public List getIds() { + return ids; + } + + public void setIds(@javax.annotation.Nullable List ids) { + this.ids = ids; + } + + + public CheckoutFormInvoiceAddressCompany vatPayerStatus(@javax.annotation.Nonnull VatPayerStatusEnum vatPayerStatus) { + this.vatPayerStatus = vatPayerStatus; + return this; + } + + /** + * The vat payer status: - `ACTIVE` - user explicitly declared as an active VAT taxpayer, - `NON_ACTIVE` - user explicitly declared as not an active VAT taxpayer, - `NOT_APPLICABLE` - user hasn't declared the VAT taxpayer status, or it's not applicable for given address type or provided company numbers. + * @return vatPayerStatus + */ + @javax.annotation.Nonnull + public VatPayerStatusEnum getVatPayerStatus() { + return vatPayerStatus; + } + + public void setVatPayerStatus(@javax.annotation.Nonnull VatPayerStatusEnum vatPayerStatus) { + this.vatPayerStatus = vatPayerStatus; + } + + + @Deprecated + public CheckoutFormInvoiceAddressCompany taxId(@javax.annotation.Nullable String taxId) { + this.taxId = taxId; + return this; + } + + /** + * Tax id. + * @return taxId + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public String getTaxId() { + return taxId; + } + + @Deprecated + public void setTaxId(@javax.annotation.Nullable String taxId) { + this.taxId = taxId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormInvoiceAddressCompany checkoutFormInvoiceAddressCompany = (CheckoutFormInvoiceAddressCompany) o; + return Objects.equals(this.name, checkoutFormInvoiceAddressCompany.name) && + Objects.equals(this.ids, checkoutFormInvoiceAddressCompany.ids) && + Objects.equals(this.vatPayerStatus, checkoutFormInvoiceAddressCompany.vatPayerStatus) && + Objects.equals(this.taxId, checkoutFormInvoiceAddressCompany.taxId); + } + + @Override + public int hashCode() { + return Objects.hash(name, ids, vatPayerStatus, taxId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormInvoiceAddressCompany {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" ids: ").append(toIndentedString(ids)).append("\n"); + sb.append(" vatPayerStatus: ").append(toIndentedString(vatPayerStatus)).append("\n"); + sb.append(" taxId: ").append(toIndentedString(taxId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("ids"); + openapiFields.add("vatPayerStatus"); + openapiFields.add("taxId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("vatPayerStatus"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormInvoiceAddressCompany + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormInvoiceAddressCompany.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormInvoiceAddressCompany is not found in the empty JSON string", CheckoutFormInvoiceAddressCompany.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormInvoiceAddressCompany.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormInvoiceAddressCompany` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormInvoiceAddressCompany.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (jsonObj.get("ids") != null && !jsonObj.get("ids").isJsonNull()) { + JsonArray jsonArrayids = jsonObj.getAsJsonArray("ids"); + if (jsonArrayids != null) { + // ensure the json data is an array + if (!jsonObj.get("ids").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ids` to be an array in the JSON string but got `%s`", jsonObj.get("ids").toString())); + } + + // validate the optional field `ids` (array) + for (int i = 0; i < jsonArrayids.size(); i++) { + CheckoutFormInvoiceAddressCompanyId.validateJsonElement(jsonArrayids.get(i)); + }; + } + } + if (!jsonObj.get("vatPayerStatus").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `vatPayerStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("vatPayerStatus").toString())); + } + // validate the required field `vatPayerStatus` + VatPayerStatusEnum.validateJsonElement(jsonObj.get("vatPayerStatus")); + if ((jsonObj.get("taxId") != null && !jsonObj.get("taxId").isJsonNull()) && !jsonObj.get("taxId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `taxId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormInvoiceAddressCompany.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormInvoiceAddressCompany' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormInvoiceAddressCompany.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormInvoiceAddressCompany value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormInvoiceAddressCompany read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormInvoiceAddressCompany given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormInvoiceAddressCompany + * @throws IOException if the JSON string is invalid with respect to CheckoutFormInvoiceAddressCompany + */ + public static CheckoutFormInvoiceAddressCompany fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormInvoiceAddressCompany.class); + } + + /** + * Convert an instance of CheckoutFormInvoiceAddressCompany to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressCompanyId.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressCompanyId.java new file mode 100644 index 0000000..591c08e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressCompanyId.java @@ -0,0 +1,311 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormInvoiceAddressCompanyId + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormInvoiceAddressCompanyId { + /** + * The tax id type. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + PL_NIP("PL_NIP"), + + CZ_ICO("CZ_ICO"), + + CZ_DIC("CZ_DIC"), + + HU_ADOSZAM("HU_ADOSZAM"), + + SK_ICO("SK_ICO"), + + SK_IC_DPH("SK_IC_DPH"), + + VAT_EU("VAT_EU"), + + OTHER("OTHER"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public CheckoutFormInvoiceAddressCompanyId() { + } + + public CheckoutFormInvoiceAddressCompanyId type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * The tax id type. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public CheckoutFormInvoiceAddressCompanyId value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * The tax id value. + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormInvoiceAddressCompanyId checkoutFormInvoiceAddressCompanyId = (CheckoutFormInvoiceAddressCompanyId) o; + return Objects.equals(this.type, checkoutFormInvoiceAddressCompanyId.type) && + Objects.equals(this.value, checkoutFormInvoiceAddressCompanyId.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormInvoiceAddressCompanyId {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormInvoiceAddressCompanyId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormInvoiceAddressCompanyId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormInvoiceAddressCompanyId is not found in the empty JSON string", CheckoutFormInvoiceAddressCompanyId.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormInvoiceAddressCompanyId.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormInvoiceAddressCompanyId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormInvoiceAddressCompanyId.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormInvoiceAddressCompanyId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormInvoiceAddressCompanyId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormInvoiceAddressCompanyId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormInvoiceAddressCompanyId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormInvoiceAddressCompanyId read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormInvoiceAddressCompanyId given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormInvoiceAddressCompanyId + * @throws IOException if the JSON string is invalid with respect to CheckoutFormInvoiceAddressCompanyId + */ + public static CheckoutFormInvoiceAddressCompanyId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormInvoiceAddressCompanyId.class); + } + + /** + * Convert an instance of CheckoutFormInvoiceAddressCompanyId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressNaturalPerson.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressNaturalPerson.java new file mode 100644 index 0000000..0a2a67a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceAddressNaturalPerson.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormInvoiceAddressNaturalPerson + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormInvoiceAddressNaturalPerson { + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nonnull + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nonnull + private String lastName; + + public CheckoutFormInvoiceAddressNaturalPerson() { + } + + public CheckoutFormInvoiceAddressNaturalPerson firstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Invoice receiver first name + * @return firstName + */ + @javax.annotation.Nonnull + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + } + + + public CheckoutFormInvoiceAddressNaturalPerson lastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Invoice receiver last name + * @return lastName + */ + @javax.annotation.Nonnull + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormInvoiceAddressNaturalPerson checkoutFormInvoiceAddressNaturalPerson = (CheckoutFormInvoiceAddressNaturalPerson) o; + return Objects.equals(this.firstName, checkoutFormInvoiceAddressNaturalPerson.firstName) && + Objects.equals(this.lastName, checkoutFormInvoiceAddressNaturalPerson.lastName); + } + + @Override + public int hashCode() { + return Objects.hash(firstName, lastName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormInvoiceAddressNaturalPerson {\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("firstName"); + openapiFields.add("lastName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("firstName"); + openapiRequiredFields.add("lastName"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormInvoiceAddressNaturalPerson + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormInvoiceAddressNaturalPerson.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormInvoiceAddressNaturalPerson is not found in the empty JSON string", CheckoutFormInvoiceAddressNaturalPerson.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormInvoiceAddressNaturalPerson.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormInvoiceAddressNaturalPerson` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormInvoiceAddressNaturalPerson.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if (!jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormInvoiceAddressNaturalPerson.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormInvoiceAddressNaturalPerson' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormInvoiceAddressNaturalPerson.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormInvoiceAddressNaturalPerson value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormInvoiceAddressNaturalPerson read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormInvoiceAddressNaturalPerson given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormInvoiceAddressNaturalPerson + * @throws IOException if the JSON string is invalid with respect to CheckoutFormInvoiceAddressNaturalPerson + */ + public static CheckoutFormInvoiceAddressNaturalPerson fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormInvoiceAddressNaturalPerson.class); + } + + /** + * Convert an instance of CheckoutFormInvoiceAddressNaturalPerson to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceInfo.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceInfo.java new file mode 100644 index 0000000..60e0003 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormInvoiceInfo.java @@ -0,0 +1,314 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CheckoutFormInvoiceAddress; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormInvoiceInfo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormInvoiceInfo { + public static final String SERIALIZED_NAME_REQUIRED = "required"; + @SerializedName(SERIALIZED_NAME_REQUIRED) + @javax.annotation.Nonnull + private Boolean required; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private CheckoutFormInvoiceAddress address; + + public static final String SERIALIZED_NAME_DUE_DATE = "dueDate"; + @SerializedName(SERIALIZED_NAME_DUE_DATE) + @javax.annotation.Nullable + private String dueDate; + + public static final String SERIALIZED_NAME_FEATURES = "features"; + @SerializedName(SERIALIZED_NAME_FEATURES) + @javax.annotation.Nullable + private List features = new ArrayList<>(); + + public CheckoutFormInvoiceInfo() { + } + + public CheckoutFormInvoiceInfo required(@javax.annotation.Nonnull Boolean required) { + this.required = required; + return this; + } + + /** + * Is invoice required by buyer? + * @return required + */ + @javax.annotation.Nonnull + public Boolean getRequired() { + return required; + } + + public void setRequired(@javax.annotation.Nonnull Boolean required) { + this.required = required; + } + + + public CheckoutFormInvoiceInfo address(@javax.annotation.Nullable CheckoutFormInvoiceAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public CheckoutFormInvoiceAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable CheckoutFormInvoiceAddress address) { + this.address = address; + } + + + public CheckoutFormInvoiceInfo dueDate(@javax.annotation.Nullable String dueDate) { + this.dueDate = dueDate; + return this; + } + + /** + * Due date to put on an invoice for Extended Payment Terms purchases. For other payment methods this field will be null. + * @return dueDate + */ + @javax.annotation.Nullable + public String getDueDate() { + return dueDate; + } + + public void setDueDate(@javax.annotation.Nullable String dueDate) { + this.dueDate = dueDate; + } + + + public CheckoutFormInvoiceInfo features(@javax.annotation.Nullable List features) { + this.features = features; + return this; + } + + public CheckoutFormInvoiceInfo addFeaturesItem(String featuresItem) { + if (this.features == null) { + this.features = new ArrayList<>(); + } + this.features.add(featuresItem); + return this; + } + + /** + * Invoice features list: - VAT_EU_VERIFIED - order's data is verified for VAT EU transactions. The presence of this feature means that VAT_EU number will appear in `address.company.ids` field. This feature flag is mutually exclusive with `VAT_EU_UNVERIFIED` feature. Read more: <a href=\"../../news/serwisy-zagraniczne-allegro-od-18-listopada-2024-pozwolimy-wszystkim-sprzedajacym-udostepnic-oferty-na-business-allegro-cz-oraz-wdrozymy-wsparcie-dla-transakcji-wewnatrzwspolnotowych-1nayOPKLaSr\" target=\"_blank\">PL</a> / <a href=\"../../news/allegro-foreign-marketplaces-starting-november-18-2024-we-will-allow-all-sellers-to-list-offers-on-business-allegro-cz-and-implement-support-for-intra-community-transactions-1nayOPKLaSr\" target=\"_blank\">EN</a>. - VAT_EU_UNVERIFIED - order meets the conditions of VAT EU transaction, but the Buyer's VAT_EU number is not verified. This feature flag is mutually exclusive with `VAT_EU_VERIFIED` feature. Read more: <a href=\"../../news/serwisy-zagraniczne-allegro-od-18-listopada-2024-pozwolimy-wszystkim-sprzedajacym-udostepnic-oferty-na-business-allegro-cz-oraz-wdrozymy-wsparcie-dla-transakcji-wewnatrzwspolnotowych-1nayOPKLaSr\" target=\"_blank\">PL</a> / <a href=\"../../news/allegro-foreign-marketplaces-starting-november-18-2024-we-will-allow-all-sellers-to-list-offers-on-business-allegro-cz-and-implement-support-for-intra-community-transactions-1nayOPKLaSr\" target=\"_blank\">EN</a>. + * @return features + */ + @javax.annotation.Nullable + public List getFeatures() { + return features; + } + + public void setFeatures(@javax.annotation.Nullable List features) { + this.features = features; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormInvoiceInfo checkoutFormInvoiceInfo = (CheckoutFormInvoiceInfo) o; + return Objects.equals(this.required, checkoutFormInvoiceInfo.required) && + Objects.equals(this.address, checkoutFormInvoiceInfo.address) && + Objects.equals(this.dueDate, checkoutFormInvoiceInfo.dueDate) && + Objects.equals(this.features, checkoutFormInvoiceInfo.features); + } + + @Override + public int hashCode() { + return Objects.hash(required, address, dueDate, features); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormInvoiceInfo {\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" dueDate: ").append(toIndentedString(dueDate)).append("\n"); + sb.append(" features: ").append(toIndentedString(features)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("required"); + openapiFields.add("address"); + openapiFields.add("dueDate"); + openapiFields.add("features"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("required"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormInvoiceInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormInvoiceInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormInvoiceInfo is not found in the empty JSON string", CheckoutFormInvoiceInfo.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormInvoiceInfo.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormInvoiceInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormInvoiceInfo.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + CheckoutFormInvoiceAddress.validateJsonElement(jsonObj.get("address")); + } + if ((jsonObj.get("dueDate") != null && !jsonObj.get("dueDate").isJsonNull()) && !jsonObj.get("dueDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dueDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dueDate").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("features") != null && !jsonObj.get("features").isJsonNull() && !jsonObj.get("features").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `features` to be an array in the JSON string but got `%s`", jsonObj.get("features").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormInvoiceInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormInvoiceInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormInvoiceInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormInvoiceInfo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormInvoiceInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormInvoiceInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormInvoiceInfo + * @throws IOException if the JSON string is invalid with respect to CheckoutFormInvoiceInfo + */ + public static CheckoutFormInvoiceInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormInvoiceInfo.class); + } + + /** + * Convert an instance of CheckoutFormInvoiceInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormLineItem.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormLineItem.java new file mode 100644 index 0000000..86995d8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormLineItem.java @@ -0,0 +1,581 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.CheckoutFormAdditionalService; +import pl.wtx.allegro.api.client.model.CheckoutFormLineItemTax; +import pl.wtx.allegro.api.client.model.LineItemDiscount; +import pl.wtx.allegro.api.client.model.LineItemReconciliation; +import pl.wtx.allegro.api.client.model.LineItemVoucher; +import pl.wtx.allegro.api.client.model.OfferReference; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Order item + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormLineItem { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OfferReference offer; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nonnull + private BigDecimal quantity; + + public static final String SERIALIZED_NAME_ORIGINAL_PRICE = "originalPrice"; + @SerializedName(SERIALIZED_NAME_ORIGINAL_PRICE) + @javax.annotation.Nonnull + private Price originalPrice; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nonnull + private Price price; + + public static final String SERIALIZED_NAME_RECONCILIATION = "reconciliation"; + @SerializedName(SERIALIZED_NAME_RECONCILIATION) + @javax.annotation.Nullable + private LineItemReconciliation reconciliation; + + public static final String SERIALIZED_NAME_SELECTED_ADDITIONAL_SERVICES = "selectedAdditionalServices"; + @SerializedName(SERIALIZED_NAME_SELECTED_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private List selectedAdditionalServices = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VOUCHERS = "vouchers"; + @SerializedName(SERIALIZED_NAME_VOUCHERS) + @javax.annotation.Nullable + private List vouchers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAX = "tax"; + @SerializedName(SERIALIZED_NAME_TAX) + @javax.annotation.Nullable + private CheckoutFormLineItemTax tax; + + public static final String SERIALIZED_NAME_BOUGHT_AT = "boughtAt"; + @SerializedName(SERIALIZED_NAME_BOUGHT_AT) + @javax.annotation.Nullable + private OffsetDateTime boughtAt; + + public static final String SERIALIZED_NAME_DISCOUNTS = "discounts"; + @SerializedName(SERIALIZED_NAME_DISCOUNTS) + @javax.annotation.Nullable + private List discounts = new ArrayList<>(); + + public CheckoutFormLineItem() { + } + + public CheckoutFormLineItem id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Line item identifier + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public CheckoutFormLineItem offer(@javax.annotation.Nonnull OfferReference offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OfferReference getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OfferReference offer) { + this.offer = offer; + } + + + public CheckoutFormLineItem quantity(@javax.annotation.Nonnull BigDecimal quantity) { + this.quantity = quantity; + return this; + } + + /** + * quantity + * minimum: 1 + * @return quantity + */ + @javax.annotation.Nonnull + public BigDecimal getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nonnull BigDecimal quantity) { + this.quantity = quantity; + } + + + public CheckoutFormLineItem originalPrice(@javax.annotation.Nonnull Price originalPrice) { + this.originalPrice = originalPrice; + return this; + } + + /** + * Get originalPrice + * @return originalPrice + */ + @javax.annotation.Nonnull + public Price getOriginalPrice() { + return originalPrice; + } + + public void setOriginalPrice(@javax.annotation.Nonnull Price originalPrice) { + this.originalPrice = originalPrice; + } + + + public CheckoutFormLineItem price(@javax.annotation.Nonnull Price price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nonnull + public Price getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nonnull Price price) { + this.price = price; + } + + + public CheckoutFormLineItem reconciliation(@javax.annotation.Nullable LineItemReconciliation reconciliation) { + this.reconciliation = reconciliation; + return this; + } + + /** + * Get reconciliation + * @return reconciliation + */ + @javax.annotation.Nullable + public LineItemReconciliation getReconciliation() { + return reconciliation; + } + + public void setReconciliation(@javax.annotation.Nullable LineItemReconciliation reconciliation) { + this.reconciliation = reconciliation; + } + + + public CheckoutFormLineItem selectedAdditionalServices(@javax.annotation.Nullable List selectedAdditionalServices) { + this.selectedAdditionalServices = selectedAdditionalServices; + return this; + } + + public CheckoutFormLineItem addSelectedAdditionalServicesItem(CheckoutFormAdditionalService selectedAdditionalServicesItem) { + if (this.selectedAdditionalServices == null) { + this.selectedAdditionalServices = new ArrayList<>(); + } + this.selectedAdditionalServices.add(selectedAdditionalServicesItem); + return this; + } + + /** + * Get selectedAdditionalServices + * @return selectedAdditionalServices + */ + @javax.annotation.Nullable + public List getSelectedAdditionalServices() { + return selectedAdditionalServices; + } + + public void setSelectedAdditionalServices(@javax.annotation.Nullable List selectedAdditionalServices) { + this.selectedAdditionalServices = selectedAdditionalServices; + } + + + public CheckoutFormLineItem vouchers(@javax.annotation.Nullable List vouchers) { + this.vouchers = vouchers; + return this; + } + + public CheckoutFormLineItem addVouchersItem(LineItemVoucher vouchersItem) { + if (this.vouchers == null) { + this.vouchers = new ArrayList<>(); + } + this.vouchers.add(vouchersItem); + return this; + } + + /** + * Get vouchers + * @return vouchers + */ + @javax.annotation.Nullable + public List getVouchers() { + return vouchers; + } + + public void setVouchers(@javax.annotation.Nullable List vouchers) { + this.vouchers = vouchers; + } + + + public CheckoutFormLineItem tax(@javax.annotation.Nullable CheckoutFormLineItemTax tax) { + this.tax = tax; + return this; + } + + /** + * Get tax + * @return tax + */ + @javax.annotation.Nullable + public CheckoutFormLineItemTax getTax() { + return tax; + } + + public void setTax(@javax.annotation.Nullable CheckoutFormLineItemTax tax) { + this.tax = tax; + } + + + public CheckoutFormLineItem boughtAt(@javax.annotation.Nullable OffsetDateTime boughtAt) { + this.boughtAt = boughtAt; + return this; + } + + /** + * ISO date when offer was bought + * @return boughtAt + */ + @javax.annotation.Nullable + public OffsetDateTime getBoughtAt() { + return boughtAt; + } + + public void setBoughtAt(@javax.annotation.Nullable OffsetDateTime boughtAt) { + this.boughtAt = boughtAt; + } + + + public CheckoutFormLineItem discounts(@javax.annotation.Nullable List discounts) { + this.discounts = discounts; + return this; + } + + public CheckoutFormLineItem addDiscountsItem(LineItemDiscount discountsItem) { + if (this.discounts == null) { + this.discounts = new ArrayList<>(); + } + this.discounts.add(discountsItem); + return this; + } + + /** + * Get discounts + * @return discounts + */ + @javax.annotation.Nullable + public List getDiscounts() { + return discounts; + } + + public void setDiscounts(@javax.annotation.Nullable List discounts) { + this.discounts = discounts; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormLineItem checkoutFormLineItem = (CheckoutFormLineItem) o; + return Objects.equals(this.id, checkoutFormLineItem.id) && + Objects.equals(this.offer, checkoutFormLineItem.offer) && + Objects.equals(this.quantity, checkoutFormLineItem.quantity) && + Objects.equals(this.originalPrice, checkoutFormLineItem.originalPrice) && + Objects.equals(this.price, checkoutFormLineItem.price) && + Objects.equals(this.reconciliation, checkoutFormLineItem.reconciliation) && + Objects.equals(this.selectedAdditionalServices, checkoutFormLineItem.selectedAdditionalServices) && + Objects.equals(this.vouchers, checkoutFormLineItem.vouchers) && + Objects.equals(this.tax, checkoutFormLineItem.tax) && + Objects.equals(this.boughtAt, checkoutFormLineItem.boughtAt) && + Objects.equals(this.discounts, checkoutFormLineItem.discounts); + } + + @Override + public int hashCode() { + return Objects.hash(id, offer, quantity, originalPrice, price, reconciliation, selectedAdditionalServices, vouchers, tax, boughtAt, discounts); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormLineItem {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" originalPrice: ").append(toIndentedString(originalPrice)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" reconciliation: ").append(toIndentedString(reconciliation)).append("\n"); + sb.append(" selectedAdditionalServices: ").append(toIndentedString(selectedAdditionalServices)).append("\n"); + sb.append(" vouchers: ").append(toIndentedString(vouchers)).append("\n"); + sb.append(" tax: ").append(toIndentedString(tax)).append("\n"); + sb.append(" boughtAt: ").append(toIndentedString(boughtAt)).append("\n"); + sb.append(" discounts: ").append(toIndentedString(discounts)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("offer"); + openapiFields.add("quantity"); + openapiFields.add("originalPrice"); + openapiFields.add("price"); + openapiFields.add("reconciliation"); + openapiFields.add("selectedAdditionalServices"); + openapiFields.add("vouchers"); + openapiFields.add("tax"); + openapiFields.add("boughtAt"); + openapiFields.add("discounts"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("quantity"); + openapiRequiredFields.add("originalPrice"); + openapiRequiredFields.add("price"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormLineItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormLineItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormLineItem is not found in the empty JSON string", CheckoutFormLineItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormLineItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormLineItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormLineItem.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `offer` + OfferReference.validateJsonElement(jsonObj.get("offer")); + // validate the required field `originalPrice` + Price.validateJsonElement(jsonObj.get("originalPrice")); + // validate the required field `price` + Price.validateJsonElement(jsonObj.get("price")); + // validate the optional field `reconciliation` + if (jsonObj.get("reconciliation") != null && !jsonObj.get("reconciliation").isJsonNull()) { + LineItemReconciliation.validateJsonElement(jsonObj.get("reconciliation")); + } + if (jsonObj.get("selectedAdditionalServices") != null && !jsonObj.get("selectedAdditionalServices").isJsonNull()) { + JsonArray jsonArrayselectedAdditionalServices = jsonObj.getAsJsonArray("selectedAdditionalServices"); + if (jsonArrayselectedAdditionalServices != null) { + // ensure the json data is an array + if (!jsonObj.get("selectedAdditionalServices").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `selectedAdditionalServices` to be an array in the JSON string but got `%s`", jsonObj.get("selectedAdditionalServices").toString())); + } + + // validate the optional field `selectedAdditionalServices` (array) + for (int i = 0; i < jsonArrayselectedAdditionalServices.size(); i++) { + CheckoutFormAdditionalService.validateJsonElement(jsonArrayselectedAdditionalServices.get(i)); + }; + } + } + if (jsonObj.get("vouchers") != null && !jsonObj.get("vouchers").isJsonNull()) { + JsonArray jsonArrayvouchers = jsonObj.getAsJsonArray("vouchers"); + if (jsonArrayvouchers != null) { + // ensure the json data is an array + if (!jsonObj.get("vouchers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `vouchers` to be an array in the JSON string but got `%s`", jsonObj.get("vouchers").toString())); + } + + // validate the optional field `vouchers` (array) + for (int i = 0; i < jsonArrayvouchers.size(); i++) { + LineItemVoucher.validateJsonElement(jsonArrayvouchers.get(i)); + }; + } + } + // validate the optional field `tax` + if (jsonObj.get("tax") != null && !jsonObj.get("tax").isJsonNull()) { + CheckoutFormLineItemTax.validateJsonElement(jsonObj.get("tax")); + } + if (jsonObj.get("discounts") != null && !jsonObj.get("discounts").isJsonNull()) { + JsonArray jsonArraydiscounts = jsonObj.getAsJsonArray("discounts"); + if (jsonArraydiscounts != null) { + // ensure the json data is an array + if (!jsonObj.get("discounts").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `discounts` to be an array in the JSON string but got `%s`", jsonObj.get("discounts").toString())); + } + + // validate the optional field `discounts` (array) + for (int i = 0; i < jsonArraydiscounts.size(); i++) { + LineItemDiscount.validateJsonElement(jsonArraydiscounts.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormLineItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormLineItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormLineItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormLineItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormLineItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormLineItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormLineItem + * @throws IOException if the JSON string is invalid with respect to CheckoutFormLineItem + */ + public static CheckoutFormLineItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormLineItem.class); + } + + /** + * Convert an instance of CheckoutFormLineItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormLineItemTax.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormLineItemTax.java new file mode 100644 index 0000000..925b79a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormLineItemTax.java @@ -0,0 +1,278 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormLineItemTax + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormLineItemTax { + public static final String SERIALIZED_NAME_RATE = "rate"; + @SerializedName(SERIALIZED_NAME_RATE) + @javax.annotation.Nullable + private String rate; + + public static final String SERIALIZED_NAME_SUBJECT = "subject"; + @SerializedName(SERIALIZED_NAME_SUBJECT) + @javax.annotation.Nullable + private String subject; + + public static final String SERIALIZED_NAME_EXEMPTION = "exemption"; + @SerializedName(SERIALIZED_NAME_EXEMPTION) + @javax.annotation.Nullable + private String exemption; + + public CheckoutFormLineItemTax() { + } + + public CheckoutFormLineItemTax rate(@javax.annotation.Nullable String rate) { + this.rate = rate; + return this; + } + + /** + * The tax rate. + * @return rate + */ + @javax.annotation.Nullable + public String getRate() { + return rate; + } + + public void setRate(@javax.annotation.Nullable String rate) { + this.rate = rate; + } + + + public CheckoutFormLineItemTax subject(@javax.annotation.Nullable String subject) { + this.subject = subject; + return this; + } + + /** + * The subject of taxation. + * @return subject + */ + @javax.annotation.Nullable + public String getSubject() { + return subject; + } + + public void setSubject(@javax.annotation.Nullable String subject) { + this.subject = subject; + } + + + public CheckoutFormLineItemTax exemption(@javax.annotation.Nullable String exemption) { + this.exemption = exemption; + return this; + } + + /** + * The exemption of taxation. + * @return exemption + */ + @javax.annotation.Nullable + public String getExemption() { + return exemption; + } + + public void setExemption(@javax.annotation.Nullable String exemption) { + this.exemption = exemption; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormLineItemTax checkoutFormLineItemTax = (CheckoutFormLineItemTax) o; + return Objects.equals(this.rate, checkoutFormLineItemTax.rate) && + Objects.equals(this.subject, checkoutFormLineItemTax.subject) && + Objects.equals(this.exemption, checkoutFormLineItemTax.exemption); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(rate, subject, exemption); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormLineItemTax {\n"); + sb.append(" rate: ").append(toIndentedString(rate)).append("\n"); + sb.append(" subject: ").append(toIndentedString(subject)).append("\n"); + sb.append(" exemption: ").append(toIndentedString(exemption)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rate"); + openapiFields.add("subject"); + openapiFields.add("exemption"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormLineItemTax + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormLineItemTax.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormLineItemTax is not found in the empty JSON string", CheckoutFormLineItemTax.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormLineItemTax.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormLineItemTax` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("rate") != null && !jsonObj.get("rate").isJsonNull()) && !jsonObj.get("rate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `rate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rate").toString())); + } + if ((jsonObj.get("subject") != null && !jsonObj.get("subject").isJsonNull()) && !jsonObj.get("subject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `subject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subject").toString())); + } + if ((jsonObj.get("exemption") != null && !jsonObj.get("exemption").isJsonNull()) && !jsonObj.get("exemption").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `exemption` to be a primitive type in the JSON string but got `%s`", jsonObj.get("exemption").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormLineItemTax.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormLineItemTax' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormLineItemTax.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormLineItemTax value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormLineItemTax read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormLineItemTax given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormLineItemTax + * @throws IOException if the JSON string is invalid with respect to CheckoutFormLineItemTax + */ + public static CheckoutFormLineItemTax fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormLineItemTax.class); + } + + /** + * Convert an instance of CheckoutFormLineItemTax to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormMarketplace.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormMarketplace.java new file mode 100644 index 0000000..e31627e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormMarketplace.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormMarketplace + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormMarketplace { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public CheckoutFormMarketplace() { + } + + public CheckoutFormMarketplace id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Id of the purchase marketplace + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormMarketplace checkoutFormMarketplace = (CheckoutFormMarketplace) o; + return Objects.equals(this.id, checkoutFormMarketplace.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormMarketplace {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormMarketplace + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormMarketplace.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormMarketplace is not found in the empty JSON string", CheckoutFormMarketplace.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormMarketplace.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormMarketplace` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormMarketplace.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormMarketplace.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormMarketplace' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormMarketplace.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormMarketplace value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormMarketplace read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormMarketplace given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormMarketplace + * @throws IOException if the JSON string is invalid with respect to CheckoutFormMarketplace + */ + public static CheckoutFormMarketplace fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormMarketplace.class); + } + + /** + * Convert an instance of CheckoutFormMarketplace to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormNoteReference.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormNoteReference.java new file mode 100644 index 0000000..11a6086 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormNoteReference.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormNoteReference + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormNoteReference { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public CheckoutFormNoteReference() { + } + + public CheckoutFormNoteReference text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Seller's note for the order + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormNoteReference checkoutFormNoteReference = (CheckoutFormNoteReference) o; + return Objects.equals(this.text, checkoutFormNoteReference.text); + } + + @Override + public int hashCode() { + return Objects.hash(text); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormNoteReference {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("text"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormNoteReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormNoteReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormNoteReference is not found in the empty JSON string", CheckoutFormNoteReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormNoteReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormNoteReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormNoteReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormNoteReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormNoteReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormNoteReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormNoteReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormNoteReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormNoteReference + * @throws IOException if the JSON string is invalid with respect to CheckoutFormNoteReference + */ + public static CheckoutFormNoteReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormNoteReference.class); + } + + /** + * Convert an instance of CheckoutFormNoteReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormOrderWaybillResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormOrderWaybillResponse.java new file mode 100644 index 0000000..2f9afc1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormOrderWaybillResponse.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CheckoutFormAddWaybillCreated; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormOrderWaybillResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormOrderWaybillResponse { + public static final String SERIALIZED_NAME_SHIPMENTS = "shipments"; + @SerializedName(SERIALIZED_NAME_SHIPMENTS) + @javax.annotation.Nullable + private List shipments = new ArrayList<>(); + + public CheckoutFormOrderWaybillResponse() { + } + + public CheckoutFormOrderWaybillResponse shipments(@javax.annotation.Nullable List shipments) { + this.shipments = shipments; + return this; + } + + public CheckoutFormOrderWaybillResponse addShipmentsItem(CheckoutFormAddWaybillCreated shipmentsItem) { + if (this.shipments == null) { + this.shipments = new ArrayList<>(); + } + this.shipments.add(shipmentsItem); + return this; + } + + /** + * List of parcel tracking numbers currently assigned to the order. + * @return shipments + */ + @javax.annotation.Nullable + public List getShipments() { + return shipments; + } + + public void setShipments(@javax.annotation.Nullable List shipments) { + this.shipments = shipments; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormOrderWaybillResponse checkoutFormOrderWaybillResponse = (CheckoutFormOrderWaybillResponse) o; + return Objects.equals(this.shipments, checkoutFormOrderWaybillResponse.shipments); + } + + @Override + public int hashCode() { + return Objects.hash(shipments); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormOrderWaybillResponse {\n"); + sb.append(" shipments: ").append(toIndentedString(shipments)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shipments"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormOrderWaybillResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormOrderWaybillResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormOrderWaybillResponse is not found in the empty JSON string", CheckoutFormOrderWaybillResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormOrderWaybillResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormOrderWaybillResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("shipments") != null && !jsonObj.get("shipments").isJsonNull()) { + JsonArray jsonArrayshipments = jsonObj.getAsJsonArray("shipments"); + if (jsonArrayshipments != null) { + // ensure the json data is an array + if (!jsonObj.get("shipments").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `shipments` to be an array in the JSON string but got `%s`", jsonObj.get("shipments").toString())); + } + + // validate the optional field `shipments` (array) + for (int i = 0; i < jsonArrayshipments.size(); i++) { + CheckoutFormAddWaybillCreated.validateJsonElement(jsonArrayshipments.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormOrderWaybillResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormOrderWaybillResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormOrderWaybillResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormOrderWaybillResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormOrderWaybillResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormOrderWaybillResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormOrderWaybillResponse + * @throws IOException if the JSON string is invalid with respect to CheckoutFormOrderWaybillResponse + */ + public static CheckoutFormOrderWaybillResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormOrderWaybillResponse.class); + } + + /** + * Convert an instance of CheckoutFormOrderWaybillResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentProvider.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentProvider.java new file mode 100644 index 0000000..dba52a6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentProvider.java @@ -0,0 +1,84 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Payment provider: * `PAYU` - processed by PAYU operator. * `P24` - processed by PRZELEWY24 operator. * `AF` - processed by Allegro Finance operator. * `OFFLINE` - offline payment. * `EPT` - extended payment term with Allegro Pay Business. + */ +@JsonAdapter(CheckoutFormPaymentProvider.Adapter.class) +public enum CheckoutFormPaymentProvider { + + PAYU("PAYU"), + + P24("P24"), + + AF("AF"), + + OFFLINE("OFFLINE"), + + EPT("EPT"); + + private String value; + + CheckoutFormPaymentProvider(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CheckoutFormPaymentProvider fromValue(String value) { + for (CheckoutFormPaymentProvider b : CheckoutFormPaymentProvider.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CheckoutFormPaymentProvider enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CheckoutFormPaymentProvider read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CheckoutFormPaymentProvider.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CheckoutFormPaymentProvider.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentReference.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentReference.java new file mode 100644 index 0000000..7564c16 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentReference.java @@ -0,0 +1,410 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.CheckoutFormPaymentProvider; +import pl.wtx.allegro.api.client.model.CheckoutFormPaymentType; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormPaymentReference + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormPaymentReference { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private CheckoutFormPaymentType type; + + public static final String SERIALIZED_NAME_PROVIDER = "provider"; + @SerializedName(SERIALIZED_NAME_PROVIDER) + @javax.annotation.Nullable + private CheckoutFormPaymentProvider provider; + + public static final String SERIALIZED_NAME_FINISHED_AT = "finishedAt"; + @SerializedName(SERIALIZED_NAME_FINISHED_AT) + @javax.annotation.Nullable + private OffsetDateTime finishedAt; + + public static final String SERIALIZED_NAME_PAID_AMOUNT = "paidAmount"; + @SerializedName(SERIALIZED_NAME_PAID_AMOUNT) + @javax.annotation.Nullable + private Price paidAmount; + + public static final String SERIALIZED_NAME_RECONCILIATION = "reconciliation"; + @SerializedName(SERIALIZED_NAME_RECONCILIATION) + @javax.annotation.Nullable + private Price reconciliation; + + public static final String SERIALIZED_NAME_FEATURES = "features"; + @SerializedName(SERIALIZED_NAME_FEATURES) + @javax.annotation.Nullable + private List features = new ArrayList<>(); + + public CheckoutFormPaymentReference() { + } + + public CheckoutFormPaymentReference id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Payment id + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public CheckoutFormPaymentReference type(@javax.annotation.Nonnull CheckoutFormPaymentType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public CheckoutFormPaymentType getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull CheckoutFormPaymentType type) { + this.type = type; + } + + + public CheckoutFormPaymentReference provider(@javax.annotation.Nullable CheckoutFormPaymentProvider provider) { + this.provider = provider; + return this; + } + + /** + * Get provider + * @return provider + */ + @javax.annotation.Nullable + public CheckoutFormPaymentProvider getProvider() { + return provider; + } + + public void setProvider(@javax.annotation.Nullable CheckoutFormPaymentProvider provider) { + this.provider = provider; + } + + + public CheckoutFormPaymentReference finishedAt(@javax.annotation.Nullable OffsetDateTime finishedAt) { + this.finishedAt = finishedAt; + return this; + } + + /** + * Date when the event occurred + * @return finishedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getFinishedAt() { + return finishedAt; + } + + public void setFinishedAt(@javax.annotation.Nullable OffsetDateTime finishedAt) { + this.finishedAt = finishedAt; + } + + + public CheckoutFormPaymentReference paidAmount(@javax.annotation.Nullable Price paidAmount) { + this.paidAmount = paidAmount; + return this; + } + + /** + * Get paidAmount + * @return paidAmount + */ + @javax.annotation.Nullable + public Price getPaidAmount() { + return paidAmount; + } + + public void setPaidAmount(@javax.annotation.Nullable Price paidAmount) { + this.paidAmount = paidAmount; + } + + + public CheckoutFormPaymentReference reconciliation(@javax.annotation.Nullable Price reconciliation) { + this.reconciliation = reconciliation; + return this; + } + + /** + * Get reconciliation + * @return reconciliation + */ + @javax.annotation.Nullable + public Price getReconciliation() { + return reconciliation; + } + + public void setReconciliation(@javax.annotation.Nullable Price reconciliation) { + this.reconciliation = reconciliation; + } + + + public CheckoutFormPaymentReference features(@javax.annotation.Nullable List features) { + this.features = features; + return this; + } + + public CheckoutFormPaymentReference addFeaturesItem(String featuresItem) { + if (this.features == null) { + this.features = new ArrayList<>(); + } + this.features.add(featuresItem); + return this; + } + + /** + * Payment additional features: - `ALLEGRO_PAY` - The payment was made using Allegro Pay. + * @return features + */ + @javax.annotation.Nullable + public List getFeatures() { + return features; + } + + public void setFeatures(@javax.annotation.Nullable List features) { + this.features = features; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormPaymentReference checkoutFormPaymentReference = (CheckoutFormPaymentReference) o; + return Objects.equals(this.id, checkoutFormPaymentReference.id) && + Objects.equals(this.type, checkoutFormPaymentReference.type) && + Objects.equals(this.provider, checkoutFormPaymentReference.provider) && + Objects.equals(this.finishedAt, checkoutFormPaymentReference.finishedAt) && + Objects.equals(this.paidAmount, checkoutFormPaymentReference.paidAmount) && + Objects.equals(this.reconciliation, checkoutFormPaymentReference.reconciliation) && + Objects.equals(this.features, checkoutFormPaymentReference.features); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, provider, finishedAt, paidAmount, reconciliation, features); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormPaymentReference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" finishedAt: ").append(toIndentedString(finishedAt)).append("\n"); + sb.append(" paidAmount: ").append(toIndentedString(paidAmount)).append("\n"); + sb.append(" reconciliation: ").append(toIndentedString(reconciliation)).append("\n"); + sb.append(" features: ").append(toIndentedString(features)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("provider"); + openapiFields.add("finishedAt"); + openapiFields.add("paidAmount"); + openapiFields.add("reconciliation"); + openapiFields.add("features"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormPaymentReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormPaymentReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormPaymentReference is not found in the empty JSON string", CheckoutFormPaymentReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormPaymentReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormPaymentReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormPaymentReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `type` + CheckoutFormPaymentType.validateJsonElement(jsonObj.get("type")); + // validate the optional field `provider` + if (jsonObj.get("provider") != null && !jsonObj.get("provider").isJsonNull()) { + CheckoutFormPaymentProvider.validateJsonElement(jsonObj.get("provider")); + } + // validate the optional field `paidAmount` + if (jsonObj.get("paidAmount") != null && !jsonObj.get("paidAmount").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("paidAmount")); + } + // validate the optional field `reconciliation` + if (jsonObj.get("reconciliation") != null && !jsonObj.get("reconciliation").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("reconciliation")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("features") != null && !jsonObj.get("features").isJsonNull() && !jsonObj.get("features").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `features` to be an array in the JSON string but got `%s`", jsonObj.get("features").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormPaymentReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormPaymentReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormPaymentReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormPaymentReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormPaymentReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormPaymentReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormPaymentReference + * @throws IOException if the JSON string is invalid with respect to CheckoutFormPaymentReference + */ + public static CheckoutFormPaymentReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormPaymentReference.class); + } + + /** + * Convert an instance of CheckoutFormPaymentReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentType.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentType.java new file mode 100644 index 0000000..7ebc8f4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormPaymentType.java @@ -0,0 +1,84 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Payment type + */ +@JsonAdapter(CheckoutFormPaymentType.Adapter.class) +public enum CheckoutFormPaymentType { + + CASH_ON_DELIVERY("CASH_ON_DELIVERY"), + + WIRE_TRANSFER("WIRE_TRANSFER"), + + ONLINE("ONLINE"), + + SPLIT_PAYMENT("SPLIT_PAYMENT"), + + EXTENDED_TERM("EXTENDED_TERM"); + + private String value; + + CheckoutFormPaymentType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CheckoutFormPaymentType fromValue(String value) { + for (CheckoutFormPaymentType b : CheckoutFormPaymentType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CheckoutFormPaymentType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CheckoutFormPaymentType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CheckoutFormPaymentType.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CheckoutFormPaymentType.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormReference.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormReference.java new file mode 100644 index 0000000..fa1e005 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormReference.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormReference + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormReference { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_REVISION = "revision"; + @SerializedName(SERIALIZED_NAME_REVISION) + @javax.annotation.Nullable + private String revision; + + public CheckoutFormReference() { + } + + public CheckoutFormReference id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Checkout form identifier + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public CheckoutFormReference revision(@javax.annotation.Nullable String revision) { + this.revision = revision; + return this; + } + + /** + * Checkout form revision + * @return revision + */ + @javax.annotation.Nullable + public String getRevision() { + return revision; + } + + public void setRevision(@javax.annotation.Nullable String revision) { + this.revision = revision; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormReference checkoutFormReference = (CheckoutFormReference) o; + return Objects.equals(this.id, checkoutFormReference.id) && + Objects.equals(this.revision, checkoutFormReference.revision); + } + + @Override + public int hashCode() { + return Objects.hash(id, revision); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormReference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" revision: ").append(toIndentedString(revision)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("revision"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormReference is not found in the empty JSON string", CheckoutFormReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("revision") != null && !jsonObj.get("revision").isJsonNull()) && !jsonObj.get("revision").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `revision` to be a primitive type in the JSON string but got `%s`", jsonObj.get("revision").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormReference + * @throws IOException if the JSON string is invalid with respect to CheckoutFormReference + */ + public static CheckoutFormReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormReference.class); + } + + /** + * Convert an instance of CheckoutFormReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormStatus.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormStatus.java new file mode 100644 index 0000000..208ef28 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormStatus.java @@ -0,0 +1,82 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Describes status of the form delivery and purchase options based on payment and purchase status. * `BOUGHT` - purchase without checkout form filled in * `FILLED_IN` - checkout form filled in but payment is not completed yet so data could still change * `READY_FOR_PROCESSING` - payment completed. Purchase is ready for processing. * `CANCELLED` - purchase cancelled by buyer. + */ +@JsonAdapter(CheckoutFormStatus.Adapter.class) +public enum CheckoutFormStatus { + + BOUGHT("BOUGHT"), + + FILLED_IN("FILLED_IN"), + + READY_FOR_PROCESSING("READY_FOR_PROCESSING"), + + CANCELLED("CANCELLED"); + + private String value; + + CheckoutFormStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CheckoutFormStatus fromValue(String value) { + for (CheckoutFormStatus b : CheckoutFormStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CheckoutFormStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CheckoutFormStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CheckoutFormStatus.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CheckoutFormStatus.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormSummary.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormSummary.java new file mode 100644 index 0000000..04030a0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormSummary.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CheckoutFormSummaryTotalToPay; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormSummary + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormSummary { + public static final String SERIALIZED_NAME_TOTAL_TO_PAY = "totalToPay"; + @SerializedName(SERIALIZED_NAME_TOTAL_TO_PAY) + @javax.annotation.Nonnull + private CheckoutFormSummaryTotalToPay totalToPay; + + public CheckoutFormSummary() { + } + + public CheckoutFormSummary totalToPay(@javax.annotation.Nonnull CheckoutFormSummaryTotalToPay totalToPay) { + this.totalToPay = totalToPay; + return this; + } + + /** + * Get totalToPay + * @return totalToPay + */ + @javax.annotation.Nonnull + public CheckoutFormSummaryTotalToPay getTotalToPay() { + return totalToPay; + } + + public void setTotalToPay(@javax.annotation.Nonnull CheckoutFormSummaryTotalToPay totalToPay) { + this.totalToPay = totalToPay; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormSummary checkoutFormSummary = (CheckoutFormSummary) o; + return Objects.equals(this.totalToPay, checkoutFormSummary.totalToPay); + } + + @Override + public int hashCode() { + return Objects.hash(totalToPay); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormSummary {\n"); + sb.append(" totalToPay: ").append(toIndentedString(totalToPay)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("totalToPay"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("totalToPay"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormSummary + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormSummary.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormSummary is not found in the empty JSON string", CheckoutFormSummary.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormSummary.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormSummary` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormSummary.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `totalToPay` + CheckoutFormSummaryTotalToPay.validateJsonElement(jsonObj.get("totalToPay")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormSummary.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormSummary' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormSummary.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormSummary value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormSummary read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormSummary given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormSummary + * @throws IOException if the JSON string is invalid with respect to CheckoutFormSummary + */ + public static CheckoutFormSummary fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormSummary.class); + } + + /** + * Convert an instance of CheckoutFormSummary to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormSummaryTotalToPay.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormSummaryTotalToPay.java new file mode 100644 index 0000000..e83fa78 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormSummaryTotalToPay.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormSummaryTotalToPay + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormSummaryTotalToPay { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public CheckoutFormSummaryTotalToPay() { + } + + public CheckoutFormSummaryTotalToPay amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public CheckoutFormSummaryTotalToPay currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormSummaryTotalToPay checkoutFormSummaryTotalToPay = (CheckoutFormSummaryTotalToPay) o; + return Objects.equals(this.amount, checkoutFormSummaryTotalToPay.amount) && + Objects.equals(this.currency, checkoutFormSummaryTotalToPay.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormSummaryTotalToPay {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormSummaryTotalToPay + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormSummaryTotalToPay.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormSummaryTotalToPay is not found in the empty JSON string", CheckoutFormSummaryTotalToPay.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormSummaryTotalToPay.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormSummaryTotalToPay` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutFormSummaryTotalToPay.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormSummaryTotalToPay.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormSummaryTotalToPay' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormSummaryTotalToPay.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormSummaryTotalToPay value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormSummaryTotalToPay read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormSummaryTotalToPay given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormSummaryTotalToPay + * @throws IOException if the JSON string is invalid with respect to CheckoutFormSummaryTotalToPay + */ + public static CheckoutFormSummaryTotalToPay fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormSummaryTotalToPay.class); + } + + /** + * Convert an instance of CheckoutFormSummaryTotalToPay to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutForms.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutForms.java new file mode 100644 index 0000000..a1ace56 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutForms.java @@ -0,0 +1,291 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CheckoutForm; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutForms + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutForms { + public static final String SERIALIZED_NAME_CHECKOUT_FORMS = "checkoutForms"; + @SerializedName(SERIALIZED_NAME_CHECKOUT_FORMS) + @javax.annotation.Nonnull + private List checkoutForms = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nonnull + private BigDecimal count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nonnull + private BigDecimal totalCount; + + public CheckoutForms() { + } + + public CheckoutForms checkoutForms(@javax.annotation.Nonnull List checkoutForms) { + this.checkoutForms = checkoutForms; + return this; + } + + public CheckoutForms addCheckoutFormsItem(CheckoutForm checkoutFormsItem) { + if (this.checkoutForms == null) { + this.checkoutForms = new ArrayList<>(); + } + this.checkoutForms.add(checkoutFormsItem); + return this; + } + + /** + * Get checkoutForms + * @return checkoutForms + */ + @javax.annotation.Nonnull + public List getCheckoutForms() { + return checkoutForms; + } + + public void setCheckoutForms(@javax.annotation.Nonnull List checkoutForms) { + this.checkoutForms = checkoutForms; + } + + + public CheckoutForms count(@javax.annotation.Nonnull BigDecimal count) { + this.count = count; + return this; + } + + /** + * number of returned objects + * minimum: 1 + * @return count + */ + @javax.annotation.Nonnull + public BigDecimal getCount() { + return count; + } + + public void setCount(@javax.annotation.Nonnull BigDecimal count) { + this.count = count; + } + + + public CheckoutForms totalCount(@javax.annotation.Nonnull BigDecimal totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Number of all objects of requested status(es) available (regardless of the provided limit and offset) + * minimum: 1 + * @return totalCount + */ + @javax.annotation.Nonnull + public BigDecimal getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nonnull BigDecimal totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutForms checkoutForms = (CheckoutForms) o; + return Objects.equals(this.checkoutForms, checkoutForms.checkoutForms) && + Objects.equals(this.count, checkoutForms.count) && + Objects.equals(this.totalCount, checkoutForms.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(checkoutForms, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutForms {\n"); + sb.append(" checkoutForms: ").append(toIndentedString(checkoutForms)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("checkoutForms"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("checkoutForms"); + openapiRequiredFields.add("count"); + openapiRequiredFields.add("totalCount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutForms + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutForms.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutForms is not found in the empty JSON string", CheckoutForms.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutForms.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutForms` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CheckoutForms.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("checkoutForms").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `checkoutForms` to be an array in the JSON string but got `%s`", jsonObj.get("checkoutForms").toString())); + } + + JsonArray jsonArraycheckoutForms = jsonObj.getAsJsonArray("checkoutForms"); + // validate the required field `checkoutForms` (array) + for (int i = 0; i < jsonArraycheckoutForms.size(); i++) { + CheckoutForm.validateJsonElement(jsonArraycheckoutForms.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutForms.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutForms' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutForms.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutForms value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutForms read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutForms given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutForms + * @throws IOException if the JSON string is invalid with respect to CheckoutForms + */ + public static CheckoutForms fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutForms.class); + } + + /** + * Convert an instance of CheckoutForms to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoice.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoice.java new file mode 100644 index 0000000..a78cf0f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoice.java @@ -0,0 +1,296 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CheckoutFormsOrderInvoiceFile; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormsOrderInvoice + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormsOrderInvoice { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_INVOICE_NUMBER = "invoiceNumber"; + @SerializedName(SERIALIZED_NAME_INVOICE_NUMBER) + @javax.annotation.Nullable + private String invoiceNumber; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_FILE = "file"; + @SerializedName(SERIALIZED_NAME_FILE) + @javax.annotation.Nullable + private CheckoutFormsOrderInvoiceFile _file; + + public CheckoutFormsOrderInvoice() { + } + + public CheckoutFormsOrderInvoice id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CheckoutFormsOrderInvoice invoiceNumber(@javax.annotation.Nullable String invoiceNumber) { + this.invoiceNumber = invoiceNumber; + return this; + } + + /** + * Get invoiceNumber + * @return invoiceNumber + */ + @javax.annotation.Nullable + public String getInvoiceNumber() { + return invoiceNumber; + } + + public void setInvoiceNumber(@javax.annotation.Nullable String invoiceNumber) { + this.invoiceNumber = invoiceNumber; + } + + + public CheckoutFormsOrderInvoice createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public CheckoutFormsOrderInvoice _file(@javax.annotation.Nullable CheckoutFormsOrderInvoiceFile _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @javax.annotation.Nullable + public CheckoutFormsOrderInvoiceFile getFile() { + return _file; + } + + public void setFile(@javax.annotation.Nullable CheckoutFormsOrderInvoiceFile _file) { + this._file = _file; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormsOrderInvoice checkoutFormsOrderInvoice = (CheckoutFormsOrderInvoice) o; + return Objects.equals(this.id, checkoutFormsOrderInvoice.id) && + Objects.equals(this.invoiceNumber, checkoutFormsOrderInvoice.invoiceNumber) && + Objects.equals(this.createdAt, checkoutFormsOrderInvoice.createdAt) && + Objects.equals(this._file, checkoutFormsOrderInvoice._file); + } + + @Override + public int hashCode() { + return Objects.hash(id, invoiceNumber, createdAt, _file); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormsOrderInvoice {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" invoiceNumber: ").append(toIndentedString(invoiceNumber)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("invoiceNumber"); + openapiFields.add("createdAt"); + openapiFields.add("file"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormsOrderInvoice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormsOrderInvoice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormsOrderInvoice is not found in the empty JSON string", CheckoutFormsOrderInvoice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormsOrderInvoice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormsOrderInvoice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("invoiceNumber") != null && !jsonObj.get("invoiceNumber").isJsonNull()) && !jsonObj.get("invoiceNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `invoiceNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoiceNumber").toString())); + } + // validate the optional field `file` + if (jsonObj.get("file") != null && !jsonObj.get("file").isJsonNull()) { + CheckoutFormsOrderInvoiceFile.validateJsonElement(jsonObj.get("file")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormsOrderInvoice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormsOrderInvoice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormsOrderInvoice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormsOrderInvoice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormsOrderInvoice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormsOrderInvoice given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormsOrderInvoice + * @throws IOException if the JSON string is invalid with respect to CheckoutFormsOrderInvoice + */ + public static CheckoutFormsOrderInvoice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormsOrderInvoice.class); + } + + /** + * Convert an instance of CheckoutFormsOrderInvoice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoiceFile.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoiceFile.java new file mode 100644 index 0000000..0c33e5b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoiceFile.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CheckoutFormsOrderInvoiceFileSecurityVerification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormsOrderInvoiceFile + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormsOrderInvoiceFile { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_UPLOADED_AT = "uploadedAt"; + @SerializedName(SERIALIZED_NAME_UPLOADED_AT) + @javax.annotation.Nullable + private OffsetDateTime uploadedAt; + + public static final String SERIALIZED_NAME_SECURITY_VERIFICATION = "securityVerification"; + @SerializedName(SERIALIZED_NAME_SECURITY_VERIFICATION) + @javax.annotation.Nullable + private CheckoutFormsOrderInvoiceFileSecurityVerification securityVerification; + + public CheckoutFormsOrderInvoiceFile() { + } + + public CheckoutFormsOrderInvoiceFile name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CheckoutFormsOrderInvoiceFile uploadedAt(@javax.annotation.Nullable OffsetDateTime uploadedAt) { + this.uploadedAt = uploadedAt; + return this; + } + + /** + * Get uploadedAt + * @return uploadedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUploadedAt() { + return uploadedAt; + } + + public void setUploadedAt(@javax.annotation.Nullable OffsetDateTime uploadedAt) { + this.uploadedAt = uploadedAt; + } + + + public CheckoutFormsOrderInvoiceFile securityVerification(@javax.annotation.Nullable CheckoutFormsOrderInvoiceFileSecurityVerification securityVerification) { + this.securityVerification = securityVerification; + return this; + } + + /** + * Get securityVerification + * @return securityVerification + */ + @javax.annotation.Nullable + public CheckoutFormsOrderInvoiceFileSecurityVerification getSecurityVerification() { + return securityVerification; + } + + public void setSecurityVerification(@javax.annotation.Nullable CheckoutFormsOrderInvoiceFileSecurityVerification securityVerification) { + this.securityVerification = securityVerification; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormsOrderInvoiceFile checkoutFormsOrderInvoiceFile = (CheckoutFormsOrderInvoiceFile) o; + return Objects.equals(this.name, checkoutFormsOrderInvoiceFile.name) && + Objects.equals(this.uploadedAt, checkoutFormsOrderInvoiceFile.uploadedAt) && + Objects.equals(this.securityVerification, checkoutFormsOrderInvoiceFile.securityVerification); + } + + @Override + public int hashCode() { + return Objects.hash(name, uploadedAt, securityVerification); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormsOrderInvoiceFile {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" uploadedAt: ").append(toIndentedString(uploadedAt)).append("\n"); + sb.append(" securityVerification: ").append(toIndentedString(securityVerification)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("uploadedAt"); + openapiFields.add("securityVerification"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormsOrderInvoiceFile + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormsOrderInvoiceFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormsOrderInvoiceFile is not found in the empty JSON string", CheckoutFormsOrderInvoiceFile.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormsOrderInvoiceFile.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormsOrderInvoiceFile` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `securityVerification` + if (jsonObj.get("securityVerification") != null && !jsonObj.get("securityVerification").isJsonNull()) { + CheckoutFormsOrderInvoiceFileSecurityVerification.validateJsonElement(jsonObj.get("securityVerification")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormsOrderInvoiceFile.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormsOrderInvoiceFile' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormsOrderInvoiceFile.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormsOrderInvoiceFile value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormsOrderInvoiceFile read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormsOrderInvoiceFile given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormsOrderInvoiceFile + * @throws IOException if the JSON string is invalid with respect to CheckoutFormsOrderInvoiceFile + */ + public static CheckoutFormsOrderInvoiceFile fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormsOrderInvoiceFile.class); + } + + /** + * Convert an instance of CheckoutFormsOrderInvoiceFile to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoiceFileSecurityVerification.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoiceFileSecurityVerification.java new file mode 100644 index 0000000..22155a5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoiceFileSecurityVerification.java @@ -0,0 +1,292 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormsOrderInvoiceFileSecurityVerification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormsOrderInvoiceFileSecurityVerification { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACCEPTED("ACCEPTED"), + + REJECTED("REJECTED"), + + WAITING("WAITING"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_VERIFIED_AT = "verifiedAt"; + @SerializedName(SERIALIZED_NAME_VERIFIED_AT) + @javax.annotation.Nullable + private OffsetDateTime verifiedAt; + + public CheckoutFormsOrderInvoiceFileSecurityVerification() { + } + + public CheckoutFormsOrderInvoiceFileSecurityVerification status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public CheckoutFormsOrderInvoiceFileSecurityVerification verifiedAt(@javax.annotation.Nullable OffsetDateTime verifiedAt) { + this.verifiedAt = verifiedAt; + return this; + } + + /** + * Get verifiedAt + * @return verifiedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getVerifiedAt() { + return verifiedAt; + } + + public void setVerifiedAt(@javax.annotation.Nullable OffsetDateTime verifiedAt) { + this.verifiedAt = verifiedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormsOrderInvoiceFileSecurityVerification checkoutFormsOrderInvoiceFileSecurityVerification = (CheckoutFormsOrderInvoiceFileSecurityVerification) o; + return Objects.equals(this.status, checkoutFormsOrderInvoiceFileSecurityVerification.status) && + Objects.equals(this.verifiedAt, checkoutFormsOrderInvoiceFileSecurityVerification.verifiedAt); + } + + @Override + public int hashCode() { + return Objects.hash(status, verifiedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormsOrderInvoiceFileSecurityVerification {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" verifiedAt: ").append(toIndentedString(verifiedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("verifiedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormsOrderInvoiceFileSecurityVerification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormsOrderInvoiceFileSecurityVerification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormsOrderInvoiceFileSecurityVerification is not found in the empty JSON string", CheckoutFormsOrderInvoiceFileSecurityVerification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormsOrderInvoiceFileSecurityVerification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormsOrderInvoiceFileSecurityVerification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormsOrderInvoiceFileSecurityVerification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormsOrderInvoiceFileSecurityVerification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormsOrderInvoiceFileSecurityVerification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormsOrderInvoiceFileSecurityVerification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormsOrderInvoiceFileSecurityVerification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormsOrderInvoiceFileSecurityVerification given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormsOrderInvoiceFileSecurityVerification + * @throws IOException if the JSON string is invalid with respect to CheckoutFormsOrderInvoiceFileSecurityVerification + */ + public static CheckoutFormsOrderInvoiceFileSecurityVerification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormsOrderInvoiceFileSecurityVerification.class); + } + + /** + * Convert an instance of CheckoutFormsOrderInvoiceFileSecurityVerification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoices.java b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoices.java new file mode 100644 index 0000000..570b7f5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CheckoutFormsOrderInvoices.java @@ -0,0 +1,255 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CheckoutFormsOrderInvoice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CheckoutFormsOrderInvoices + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CheckoutFormsOrderInvoices { + public static final String SERIALIZED_NAME_INVOICES = "invoices"; + @SerializedName(SERIALIZED_NAME_INVOICES) + @javax.annotation.Nullable + private List invoices = new ArrayList<>(); + + public static final String SERIALIZED_NAME_HAS_EXTERNAL_INVOICES = "hasExternalInvoices"; + @SerializedName(SERIALIZED_NAME_HAS_EXTERNAL_INVOICES) + @javax.annotation.Nullable + private Boolean hasExternalInvoices; + + public CheckoutFormsOrderInvoices() { + } + + public CheckoutFormsOrderInvoices invoices(@javax.annotation.Nullable List invoices) { + this.invoices = invoices; + return this; + } + + public CheckoutFormsOrderInvoices addInvoicesItem(CheckoutFormsOrderInvoice invoicesItem) { + if (this.invoices == null) { + this.invoices = new ArrayList<>(); + } + this.invoices.add(invoicesItem); + return this; + } + + /** + * Get invoices + * @return invoices + */ + @javax.annotation.Nullable + public List getInvoices() { + return invoices; + } + + public void setInvoices(@javax.annotation.Nullable List invoices) { + this.invoices = invoices; + } + + + public CheckoutFormsOrderInvoices hasExternalInvoices(@javax.annotation.Nullable Boolean hasExternalInvoices) { + this.hasExternalInvoices = hasExternalInvoices; + return this; + } + + /** + * Informs whether an invoice or a proof-of-purchase has been sent outside of Allegro platform + * @return hasExternalInvoices + */ + @javax.annotation.Nullable + public Boolean getHasExternalInvoices() { + return hasExternalInvoices; + } + + public void setHasExternalInvoices(@javax.annotation.Nullable Boolean hasExternalInvoices) { + this.hasExternalInvoices = hasExternalInvoices; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CheckoutFormsOrderInvoices checkoutFormsOrderInvoices = (CheckoutFormsOrderInvoices) o; + return Objects.equals(this.invoices, checkoutFormsOrderInvoices.invoices) && + Objects.equals(this.hasExternalInvoices, checkoutFormsOrderInvoices.hasExternalInvoices); + } + + @Override + public int hashCode() { + return Objects.hash(invoices, hasExternalInvoices); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CheckoutFormsOrderInvoices {\n"); + sb.append(" invoices: ").append(toIndentedString(invoices)).append("\n"); + sb.append(" hasExternalInvoices: ").append(toIndentedString(hasExternalInvoices)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("invoices"); + openapiFields.add("hasExternalInvoices"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CheckoutFormsOrderInvoices + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CheckoutFormsOrderInvoices.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CheckoutFormsOrderInvoices is not found in the empty JSON string", CheckoutFormsOrderInvoices.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CheckoutFormsOrderInvoices.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CheckoutFormsOrderInvoices` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("invoices") != null && !jsonObj.get("invoices").isJsonNull()) { + JsonArray jsonArrayinvoices = jsonObj.getAsJsonArray("invoices"); + if (jsonArrayinvoices != null) { + // ensure the json data is an array + if (!jsonObj.get("invoices").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `invoices` to be an array in the JSON string but got `%s`", jsonObj.get("invoices").toString())); + } + + // validate the optional field `invoices` (array) + for (int i = 0; i < jsonArrayinvoices.size(); i++) { + CheckoutFormsOrderInvoice.validateJsonElement(jsonArrayinvoices.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CheckoutFormsOrderInvoices.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CheckoutFormsOrderInvoices' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CheckoutFormsOrderInvoices.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CheckoutFormsOrderInvoices value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CheckoutFormsOrderInvoices read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CheckoutFormsOrderInvoices given an JSON string + * + * @param jsonString JSON string + * @return An instance of CheckoutFormsOrderInvoices + * @throws IOException if the JSON string is invalid with respect to CheckoutFormsOrderInvoices + */ + public static CheckoutFormsOrderInvoices fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CheckoutFormsOrderInvoices.class); + } + + /** + * Convert an instance of CheckoutFormsOrderInvoices to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedDailyEventStatResponseDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedDailyEventStatResponseDto.java new file mode 100644 index 0000000..103f49c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedDailyEventStatResponseDto.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ClassifiedEventStat; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedDailyEventStatResponseDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedDailyEventStatResponseDto { + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + @javax.annotation.Nullable + private String date; + + public static final String SERIALIZED_NAME_EVENT_STATS = "eventStats"; + @SerializedName(SERIALIZED_NAME_EVENT_STATS) + @javax.annotation.Nullable + private List eventStats = new ArrayList<>(); + + public ClassifiedDailyEventStatResponseDto() { + } + + public ClassifiedDailyEventStatResponseDto date(@javax.annotation.Nullable String date) { + this.date = date; + return this; + } + + /** + * Date in format yyyy-MM-dd + * @return date + */ + @javax.annotation.Nullable + public String getDate() { + return date; + } + + public void setDate(@javax.annotation.Nullable String date) { + this.date = date; + } + + + public ClassifiedDailyEventStatResponseDto eventStats(@javax.annotation.Nullable List eventStats) { + this.eventStats = eventStats; + return this; + } + + public ClassifiedDailyEventStatResponseDto addEventStatsItem(ClassifiedEventStat eventStatsItem) { + if (this.eventStats == null) { + this.eventStats = new ArrayList<>(); + } + this.eventStats.add(eventStatsItem); + return this; + } + + /** + * List of event types with number of occurrences. + * @return eventStats + */ + @javax.annotation.Nullable + public List getEventStats() { + return eventStats; + } + + public void setEventStats(@javax.annotation.Nullable List eventStats) { + this.eventStats = eventStats; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedDailyEventStatResponseDto classifiedDailyEventStatResponseDto = (ClassifiedDailyEventStatResponseDto) o; + return Objects.equals(this.date, classifiedDailyEventStatResponseDto.date) && + Objects.equals(this.eventStats, classifiedDailyEventStatResponseDto.eventStats); + } + + @Override + public int hashCode() { + return Objects.hash(date, eventStats); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedDailyEventStatResponseDto {\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" eventStats: ").append(toIndentedString(eventStats)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("date"); + openapiFields.add("eventStats"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedDailyEventStatResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedDailyEventStatResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedDailyEventStatResponseDto is not found in the empty JSON string", ClassifiedDailyEventStatResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedDailyEventStatResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedDailyEventStatResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("date") != null && !jsonObj.get("date").isJsonNull()) && !jsonObj.get("date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("date").toString())); + } + if (jsonObj.get("eventStats") != null && !jsonObj.get("eventStats").isJsonNull()) { + JsonArray jsonArrayeventStats = jsonObj.getAsJsonArray("eventStats"); + if (jsonArrayeventStats != null) { + // ensure the json data is an array + if (!jsonObj.get("eventStats").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `eventStats` to be an array in the JSON string but got `%s`", jsonObj.get("eventStats").toString())); + } + + // validate the optional field `eventStats` (array) + for (int i = 0; i < jsonArrayeventStats.size(); i++) { + ClassifiedEventStat.validateJsonElement(jsonArrayeventStats.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedDailyEventStatResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedDailyEventStatResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedDailyEventStatResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedDailyEventStatResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedDailyEventStatResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedDailyEventStatResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedDailyEventStatResponseDto + * @throws IOException if the JSON string is invalid with respect to ClassifiedDailyEventStatResponseDto + */ + public static ClassifiedDailyEventStatResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedDailyEventStatResponseDto.class); + } + + /** + * Convert an instance of ClassifiedDailyEventStatResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedEventStat.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedEventStat.java new file mode 100644 index 0000000..c068238 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedEventStat.java @@ -0,0 +1,235 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ClassifiedStatEventType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedEventStat + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedEventStat { + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + @javax.annotation.Nullable + private ClassifiedStatEventType eventType; + + public ClassifiedEventStat() { + } + + public ClassifiedEventStat count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public ClassifiedEventStat eventType(@javax.annotation.Nullable ClassifiedStatEventType eventType) { + this.eventType = eventType; + return this; + } + + /** + * Get eventType + * @return eventType + */ + @javax.annotation.Nullable + public ClassifiedStatEventType getEventType() { + return eventType; + } + + public void setEventType(@javax.annotation.Nullable ClassifiedStatEventType eventType) { + this.eventType = eventType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedEventStat classifiedEventStat = (ClassifiedEventStat) o; + return Objects.equals(this.count, classifiedEventStat.count) && + Objects.equals(this.eventType, classifiedEventStat.eventType); + } + + @Override + public int hashCode() { + return Objects.hash(count, eventType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedEventStat {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("count"); + openapiFields.add("eventType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedEventStat + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedEventStat.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedEventStat is not found in the empty JSON string", ClassifiedEventStat.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedEventStat.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedEventStat` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `eventType` + if (jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) { + ClassifiedStatEventType.validateJsonElement(jsonObj.get("eventType")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedEventStat.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedEventStat' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedEventStat.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedEventStat value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedEventStat read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedEventStat given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedEventStat + * @throws IOException if the JSON string is invalid with respect to ClassifiedEventStat + */ + public static ClassifiedEventStat fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedEventStat.class); + } + + /** + * Convert an instance of ClassifiedEventStat to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedExtension.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedExtension.java new file mode 100644 index 0000000..2fcd7e0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedExtension.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedExtension + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedExtension { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public ClassifiedExtension() { + } + + public ClassifiedExtension description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * The classified extension description. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + public ClassifiedExtension name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The classified extension name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedExtension classifiedExtension = (ClassifiedExtension) o; + return Objects.equals(this.description, classifiedExtension.description) && + Objects.equals(this.name, classifiedExtension.name); + } + + @Override + public int hashCode() { + return Objects.hash(description, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedExtension {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("description"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedExtension + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedExtension.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedExtension is not found in the empty JSON string", ClassifiedExtension.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedExtension.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedExtension` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedExtension.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedExtension' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedExtension.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedExtension value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedExtension read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedExtension given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedExtension + * @throws IOException if the JSON string is invalid with respect to ClassifiedExtension + */ + public static ClassifiedExtension fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedExtension.class); + } + + /** + * Convert an instance of ClassifiedExtension to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedExtraPackage.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedExtraPackage.java new file mode 100644 index 0000000..21663ff --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedExtraPackage.java @@ -0,0 +1,233 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedExtraPackage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedExtraPackage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_REPUBLISH = "republish"; + @SerializedName(SERIALIZED_NAME_REPUBLISH) + @javax.annotation.Nullable + private Boolean republish; + + public ClassifiedExtraPackage() { + } + + public ClassifiedExtraPackage id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The classifieds extra package ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ClassifiedExtraPackage republish(@javax.annotation.Nullable Boolean republish) { + this.republish = republish; + return this; + } + + /** + * Extra package with this flag set to true will be recreated when offer is being republished + * @return republish + */ + @javax.annotation.Nullable + public Boolean getRepublish() { + return republish; + } + + public void setRepublish(@javax.annotation.Nullable Boolean republish) { + this.republish = republish; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedExtraPackage classifiedExtraPackage = (ClassifiedExtraPackage) o; + return Objects.equals(this.id, classifiedExtraPackage.id) && + Objects.equals(this.republish, classifiedExtraPackage.republish); + } + + @Override + public int hashCode() { + return Objects.hash(id, republish); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedExtraPackage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" republish: ").append(toIndentedString(republish)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("republish"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedExtraPackage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedExtraPackage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedExtraPackage is not found in the empty JSON string", ClassifiedExtraPackage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedExtraPackage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedExtraPackage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedExtraPackage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedExtraPackage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedExtraPackage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedExtraPackage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedExtraPackage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedExtraPackage given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedExtraPackage + * @throws IOException if the JSON string is invalid with respect to ClassifiedExtraPackage + */ + public static ClassifiedExtraPackage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedExtraPackage.class); + } + + /** + * Convert an instance of ClassifiedExtraPackage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackage.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackage.java new file mode 100644 index 0000000..ed52e81 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackage.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedPackage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedPackage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ClassifiedPackage() { + } + + public ClassifiedPackage id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The classifieds package ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedPackage classifiedPackage = (ClassifiedPackage) o; + return Objects.equals(this.id, classifiedPackage.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedPackage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedPackage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedPackage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedPackage is not found in the empty JSON string", ClassifiedPackage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedPackage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedPackage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedPackage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedPackage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedPackage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedPackage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedPackage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedPackage given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedPackage + * @throws IOException if the JSON string is invalid with respect to ClassifiedPackage + */ + public static ClassifiedPackage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedPackage.class); + } + + /** + * Convert an instance of ClassifiedPackage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackageConfig.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackageConfig.java new file mode 100644 index 0000000..89412e1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackageConfig.java @@ -0,0 +1,464 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ClassifiedExtension; +import pl.wtx.allegro.api.client.model.ClassifiedPromotion; +import pl.wtx.allegro.api.client.model.ClassifiedPublication; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedPackageConfig + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedPackageConfig { + public static final String SERIALIZED_NAME_EXTENSIONS = "extensions"; + @SerializedName(SERIALIZED_NAME_EXTENSIONS) + @javax.annotation.Nullable + private List extensions = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PROMOTIONS = "promotions"; + @SerializedName(SERIALIZED_NAME_PROMOTIONS) + @javax.annotation.Nullable + private List promotions = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private ClassifiedPublication publication; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BASE("BASE"), + + EXTRA("EXTRA"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public ClassifiedPackageConfig() { + } + + public ClassifiedPackageConfig extensions(@javax.annotation.Nullable List extensions) { + this.extensions = extensions; + return this; + } + + public ClassifiedPackageConfig addExtensionsItem(ClassifiedExtension extensionsItem) { + if (this.extensions == null) { + this.extensions = new ArrayList<>(); + } + this.extensions.add(extensionsItem); + return this; + } + + /** + * Get extensions + * @return extensions + */ + @javax.annotation.Nullable + public List getExtensions() { + return extensions; + } + + public void setExtensions(@javax.annotation.Nullable List extensions) { + this.extensions = extensions; + } + + + public ClassifiedPackageConfig id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The classifieds package ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public ClassifiedPackageConfig name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The classifieds package name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ClassifiedPackageConfig promotions(@javax.annotation.Nullable List promotions) { + this.promotions = promotions; + return this; + } + + public ClassifiedPackageConfig addPromotionsItem(ClassifiedPromotion promotionsItem) { + if (this.promotions == null) { + this.promotions = new ArrayList<>(); + } + this.promotions.add(promotionsItem); + return this; + } + + /** + * A list of additional promotions included in the package. + * @return promotions + */ + @javax.annotation.Nullable + public List getPromotions() { + return promotions; + } + + public void setPromotions(@javax.annotation.Nullable List promotions) { + this.promotions = promotions; + } + + + public ClassifiedPackageConfig publication(@javax.annotation.Nullable ClassifiedPublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public ClassifiedPublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable ClassifiedPublication publication) { + this.publication = publication; + } + + + public ClassifiedPackageConfig type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedPackageConfig classifiedPackageConfig = (ClassifiedPackageConfig) o; + return Objects.equals(this.extensions, classifiedPackageConfig.extensions) && + Objects.equals(this.id, classifiedPackageConfig.id) && + Objects.equals(this.name, classifiedPackageConfig.name) && + Objects.equals(this.promotions, classifiedPackageConfig.promotions) && + Objects.equals(this.publication, classifiedPackageConfig.publication) && + Objects.equals(this.type, classifiedPackageConfig.type); + } + + @Override + public int hashCode() { + return Objects.hash(extensions, id, name, promotions, publication, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedPackageConfig {\n"); + sb.append(" extensions: ").append(toIndentedString(extensions)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" promotions: ").append(toIndentedString(promotions)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("extensions"); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("promotions"); + openapiFields.add("publication"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedPackageConfig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedPackageConfig.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedPackageConfig is not found in the empty JSON string", ClassifiedPackageConfig.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedPackageConfig.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedPackageConfig` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClassifiedPackageConfig.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("extensions") != null && !jsonObj.get("extensions").isJsonNull()) { + JsonArray jsonArrayextensions = jsonObj.getAsJsonArray("extensions"); + if (jsonArrayextensions != null) { + // ensure the json data is an array + if (!jsonObj.get("extensions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `extensions` to be an array in the JSON string but got `%s`", jsonObj.get("extensions").toString())); + } + + // validate the optional field `extensions` (array) + for (int i = 0; i < jsonArrayextensions.size(); i++) { + ClassifiedExtension.validateJsonElement(jsonArrayextensions.get(i)); + }; + } + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (jsonObj.get("promotions") != null && !jsonObj.get("promotions").isJsonNull()) { + JsonArray jsonArraypromotions = jsonObj.getAsJsonArray("promotions"); + if (jsonArraypromotions != null) { + // ensure the json data is an array + if (!jsonObj.get("promotions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `promotions` to be an array in the JSON string but got `%s`", jsonObj.get("promotions").toString())); + } + + // validate the optional field `promotions` (array) + for (int i = 0; i < jsonArraypromotions.size(); i++) { + ClassifiedPromotion.validateJsonElement(jsonArraypromotions.get(i)); + }; + } + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + ClassifiedPublication.validateJsonElement(jsonObj.get("publication")); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedPackageConfig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedPackageConfig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedPackageConfig.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedPackageConfig value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedPackageConfig read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedPackageConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedPackageConfig + * @throws IOException if the JSON string is invalid with respect to ClassifiedPackageConfig + */ + public static ClassifiedPackageConfig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedPackageConfig.class); + } + + /** + * Convert an instance of ClassifiedPackageConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackageConfigs.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackageConfigs.java new file mode 100644 index 0000000..847807a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackageConfigs.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ClassifiedPackageConfig; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedPackageConfigs + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedPackageConfigs { + public static final String SERIALIZED_NAME_PACKAGES = "packages"; + @SerializedName(SERIALIZED_NAME_PACKAGES) + @javax.annotation.Nonnull + private List packages = new ArrayList<>(); + + public ClassifiedPackageConfigs() { + } + + public ClassifiedPackageConfigs packages(@javax.annotation.Nonnull List packages) { + this.packages = packages; + return this; + } + + public ClassifiedPackageConfigs addPackagesItem(ClassifiedPackageConfig packagesItem) { + if (this.packages == null) { + this.packages = new ArrayList<>(); + } + this.packages.add(packagesItem); + return this; + } + + /** + * Get packages + * @return packages + */ + @javax.annotation.Nonnull + public List getPackages() { + return packages; + } + + public void setPackages(@javax.annotation.Nonnull List packages) { + this.packages = packages; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedPackageConfigs classifiedPackageConfigs = (ClassifiedPackageConfigs) o; + return Objects.equals(this.packages, classifiedPackageConfigs.packages); + } + + @Override + public int hashCode() { + return Objects.hash(packages); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedPackageConfigs {\n"); + sb.append(" packages: ").append(toIndentedString(packages)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("packages"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("packages"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedPackageConfigs + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedPackageConfigs.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedPackageConfigs is not found in the empty JSON string", ClassifiedPackageConfigs.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedPackageConfigs.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedPackageConfigs` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClassifiedPackageConfigs.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("packages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `packages` to be an array in the JSON string but got `%s`", jsonObj.get("packages").toString())); + } + + JsonArray jsonArraypackages = jsonObj.getAsJsonArray("packages"); + // validate the required field `packages` (array) + for (int i = 0; i < jsonArraypackages.size(); i++) { + ClassifiedPackageConfig.validateJsonElement(jsonArraypackages.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedPackageConfigs.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedPackageConfigs' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedPackageConfigs.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedPackageConfigs value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedPackageConfigs read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedPackageConfigs given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedPackageConfigs + * @throws IOException if the JSON string is invalid with respect to ClassifiedPackageConfigs + */ + public static ClassifiedPackageConfigs fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedPackageConfigs.class); + } + + /** + * Convert an instance of ClassifiedPackageConfigs to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackages.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackages.java new file mode 100644 index 0000000..757cf0e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPackages.java @@ -0,0 +1,265 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ClassifiedPackage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedPackages + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedPackages { + public static final String SERIALIZED_NAME_BASE_PACKAGE = "basePackage"; + @SerializedName(SERIALIZED_NAME_BASE_PACKAGE) + @javax.annotation.Nonnull + private ClassifiedPackage basePackage; + + public static final String SERIALIZED_NAME_EXTRA_PACKAGES = "extraPackages"; + @SerializedName(SERIALIZED_NAME_EXTRA_PACKAGES) + @javax.annotation.Nullable + private List extraPackages = new ArrayList<>(); + + public ClassifiedPackages() { + } + + public ClassifiedPackages basePackage(@javax.annotation.Nonnull ClassifiedPackage basePackage) { + this.basePackage = basePackage; + return this; + } + + /** + * Get basePackage + * @return basePackage + */ + @javax.annotation.Nonnull + public ClassifiedPackage getBasePackage() { + return basePackage; + } + + public void setBasePackage(@javax.annotation.Nonnull ClassifiedPackage basePackage) { + this.basePackage = basePackage; + } + + + public ClassifiedPackages extraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + return this; + } + + public ClassifiedPackages addExtraPackagesItem(ClassifiedPackage extraPackagesItem) { + if (this.extraPackages == null) { + this.extraPackages = new ArrayList<>(); + } + this.extraPackages.add(extraPackagesItem); + return this; + } + + /** + * Get extraPackages + * @return extraPackages + */ + @javax.annotation.Nullable + public List getExtraPackages() { + return extraPackages; + } + + public void setExtraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedPackages classifiedPackages = (ClassifiedPackages) o; + return Objects.equals(this.basePackage, classifiedPackages.basePackage) && + Objects.equals(this.extraPackages, classifiedPackages.extraPackages); + } + + @Override + public int hashCode() { + return Objects.hash(basePackage, extraPackages); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedPackages {\n"); + sb.append(" basePackage: ").append(toIndentedString(basePackage)).append("\n"); + sb.append(" extraPackages: ").append(toIndentedString(extraPackages)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("basePackage"); + openapiFields.add("extraPackages"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("basePackage"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedPackages + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedPackages.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedPackages is not found in the empty JSON string", ClassifiedPackages.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedPackages.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedPackages` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClassifiedPackages.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `basePackage` + ClassifiedPackage.validateJsonElement(jsonObj.get("basePackage")); + if (jsonObj.get("extraPackages") != null && !jsonObj.get("extraPackages").isJsonNull()) { + JsonArray jsonArrayextraPackages = jsonObj.getAsJsonArray("extraPackages"); + if (jsonArrayextraPackages != null) { + // ensure the json data is an array + if (!jsonObj.get("extraPackages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `extraPackages` to be an array in the JSON string but got `%s`", jsonObj.get("extraPackages").toString())); + } + + // validate the optional field `extraPackages` (array) + for (int i = 0; i < jsonArrayextraPackages.size(); i++) { + ClassifiedPackage.validateJsonElement(jsonArrayextraPackages.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedPackages.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedPackages' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedPackages.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedPackages value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedPackages read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedPackages given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedPackages + * @throws IOException if the JSON string is invalid with respect to ClassifiedPackages + */ + public static ClassifiedPackages fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedPackages.class); + } + + /** + * Convert an instance of ClassifiedPackages to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPromotion.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPromotion.java new file mode 100644 index 0000000..59c7a9c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPromotion.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedPromotion + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedPromotion { + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + @javax.annotation.Nonnull + private String duration; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public ClassifiedPromotion() { + } + + public ClassifiedPromotion duration(@javax.annotation.Nonnull String duration) { + this.duration = duration; + return this; + } + + /** + * Duration in ISO 8601 format. + * @return duration + */ + @javax.annotation.Nonnull + public String getDuration() { + return duration; + } + + public void setDuration(@javax.annotation.Nonnull String duration) { + this.duration = duration; + } + + + public ClassifiedPromotion name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Name of the promotion. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedPromotion classifiedPromotion = (ClassifiedPromotion) o; + return Objects.equals(this.duration, classifiedPromotion.duration) && + Objects.equals(this.name, classifiedPromotion.name); + } + + @Override + public int hashCode() { + return Objects.hash(duration, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedPromotion {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("duration"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("duration"); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedPromotion + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedPromotion.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedPromotion is not found in the empty JSON string", ClassifiedPromotion.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedPromotion.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedPromotion` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClassifiedPromotion.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedPromotion.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedPromotion' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedPromotion.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedPromotion value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedPromotion read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedPromotion given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedPromotion + * @throws IOException if the JSON string is invalid with respect to ClassifiedPromotion + */ + public static ClassifiedPromotion fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedPromotion.class); + } + + /** + * Convert an instance of ClassifiedPromotion to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPublication.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPublication.java new file mode 100644 index 0000000..6fb9d0f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedPublication.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedPublication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedPublication { + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + @javax.annotation.Nonnull + private String duration; + + public ClassifiedPublication() { + } + + public ClassifiedPublication duration(@javax.annotation.Nonnull String duration) { + this.duration = duration; + return this; + } + + /** + * Duration in ISO 8601 format. + * @return duration + */ + @javax.annotation.Nonnull + public String getDuration() { + return duration; + } + + public void setDuration(@javax.annotation.Nonnull String duration) { + this.duration = duration; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedPublication classifiedPublication = (ClassifiedPublication) o; + return Objects.equals(this.duration, classifiedPublication.duration); + } + + @Override + public int hashCode() { + return Objects.hash(duration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedPublication {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("duration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("duration"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedPublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedPublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedPublication is not found in the empty JSON string", ClassifiedPublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedPublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedPublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClassifiedPublication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedPublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedPublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedPublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedPublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedPublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedPublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedPublication + * @throws IOException if the JSON string is invalid with respect to ClassifiedPublication + */ + public static ClassifiedPublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedPublication.class); + } + + /** + * Convert an instance of ClassifiedPublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedResponse.java new file mode 100644 index 0000000..dace30a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedResponse.java @@ -0,0 +1,263 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ClassifiedExtraPackage; +import pl.wtx.allegro.api.client.model.ClassifiedPackage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedResponse { + public static final String SERIALIZED_NAME_BASE_PACKAGE = "basePackage"; + @SerializedName(SERIALIZED_NAME_BASE_PACKAGE) + @javax.annotation.Nonnull + private ClassifiedPackage basePackage; + + public static final String SERIALIZED_NAME_EXTRA_PACKAGES = "extraPackages"; + @SerializedName(SERIALIZED_NAME_EXTRA_PACKAGES) + @javax.annotation.Nonnull + private List extraPackages = new ArrayList<>(); + + public ClassifiedResponse() { + } + + public ClassifiedResponse basePackage(@javax.annotation.Nonnull ClassifiedPackage basePackage) { + this.basePackage = basePackage; + return this; + } + + /** + * Get basePackage + * @return basePackage + */ + @javax.annotation.Nonnull + public ClassifiedPackage getBasePackage() { + return basePackage; + } + + public void setBasePackage(@javax.annotation.Nonnull ClassifiedPackage basePackage) { + this.basePackage = basePackage; + } + + + public ClassifiedResponse extraPackages(@javax.annotation.Nonnull List extraPackages) { + this.extraPackages = extraPackages; + return this; + } + + public ClassifiedResponse addExtraPackagesItem(ClassifiedExtraPackage extraPackagesItem) { + if (this.extraPackages == null) { + this.extraPackages = new ArrayList<>(); + } + this.extraPackages.add(extraPackagesItem); + return this; + } + + /** + * Get extraPackages + * @return extraPackages + */ + @javax.annotation.Nonnull + public List getExtraPackages() { + return extraPackages; + } + + public void setExtraPackages(@javax.annotation.Nonnull List extraPackages) { + this.extraPackages = extraPackages; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedResponse classifiedResponse = (ClassifiedResponse) o; + return Objects.equals(this.basePackage, classifiedResponse.basePackage) && + Objects.equals(this.extraPackages, classifiedResponse.extraPackages); + } + + @Override + public int hashCode() { + return Objects.hash(basePackage, extraPackages); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedResponse {\n"); + sb.append(" basePackage: ").append(toIndentedString(basePackage)).append("\n"); + sb.append(" extraPackages: ").append(toIndentedString(extraPackages)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("basePackage"); + openapiFields.add("extraPackages"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("basePackage"); + openapiRequiredFields.add("extraPackages"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedResponse is not found in the empty JSON string", ClassifiedResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClassifiedResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `basePackage` + ClassifiedPackage.validateJsonElement(jsonObj.get("basePackage")); + // ensure the json data is an array + if (!jsonObj.get("extraPackages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `extraPackages` to be an array in the JSON string but got `%s`", jsonObj.get("extraPackages").toString())); + } + + JsonArray jsonArrayextraPackages = jsonObj.getAsJsonArray("extraPackages"); + // validate the required field `extraPackages` (array) + for (int i = 0; i < jsonArrayextraPackages.size(); i++) { + ClassifiedExtraPackage.validateJsonElement(jsonArrayextraPackages.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedResponse + * @throws IOException if the JSON string is invalid with respect to ClassifiedResponse + */ + public static ClassifiedResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedResponse.class); + } + + /** + * Convert an instance of ClassifiedResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedStatEventType.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedStatEventType.java new file mode 100644 index 0000000..a8edcd1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedStatEventType.java @@ -0,0 +1,84 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Classified statistical event type. + */ +@JsonAdapter(ClassifiedStatEventType.Adapter.class) +public enum ClassifiedStatEventType { + + SHOWED_PHONE_NUMBER("SHOWED_PHONE_NUMBER"), + + ASKED_QUESTION("ASKED_QUESTION"), + + CLICKED_ASK_QUESTION("CLICKED_ASK_QUESTION"), + + ADDED_TO_FAVOURITES("ADDED_TO_FAVOURITES"), + + REMOVED_FROM_FAVOURITES("REMOVED_FROM_FAVOURITES"); + + private String value; + + ClassifiedStatEventType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ClassifiedStatEventType fromValue(String value) { + for (ClassifiedStatEventType b : ClassifiedStatEventType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ClassifiedStatEventType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ClassifiedStatEventType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ClassifiedStatEventType.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ClassifiedStatEventType.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedsPackages.java b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedsPackages.java new file mode 100644 index 0000000..e21c515 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ClassifiedsPackages.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ClassifiedExtraPackage; +import pl.wtx.allegro.api.client.model.ClassifiedPackage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ClassifiedsPackages + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ClassifiedsPackages { + public static final String SERIALIZED_NAME_BASE_PACKAGE = "basePackage"; + @SerializedName(SERIALIZED_NAME_BASE_PACKAGE) + @javax.annotation.Nullable + private ClassifiedPackage basePackage; + + public static final String SERIALIZED_NAME_EXTRA_PACKAGES = "extraPackages"; + @SerializedName(SERIALIZED_NAME_EXTRA_PACKAGES) + @javax.annotation.Nullable + private List extraPackages = new ArrayList<>(); + + public ClassifiedsPackages() { + } + + public ClassifiedsPackages basePackage(@javax.annotation.Nullable ClassifiedPackage basePackage) { + this.basePackage = basePackage; + return this; + } + + /** + * Get basePackage + * @return basePackage + */ + @javax.annotation.Nullable + public ClassifiedPackage getBasePackage() { + return basePackage; + } + + public void setBasePackage(@javax.annotation.Nullable ClassifiedPackage basePackage) { + this.basePackage = basePackage; + } + + + public ClassifiedsPackages extraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + return this; + } + + public ClassifiedsPackages addExtraPackagesItem(ClassifiedExtraPackage extraPackagesItem) { + if (this.extraPackages == null) { + this.extraPackages = new ArrayList<>(); + } + this.extraPackages.add(extraPackagesItem); + return this; + } + + /** + * An array of extra packages. + * @return extraPackages + */ + @javax.annotation.Nullable + public List getExtraPackages() { + return extraPackages; + } + + public void setExtraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassifiedsPackages classifiedsPackages = (ClassifiedsPackages) o; + return Objects.equals(this.basePackage, classifiedsPackages.basePackage) && + Objects.equals(this.extraPackages, classifiedsPackages.extraPackages); + } + + @Override + public int hashCode() { + return Objects.hash(basePackage, extraPackages); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassifiedsPackages {\n"); + sb.append(" basePackage: ").append(toIndentedString(basePackage)).append("\n"); + sb.append(" extraPackages: ").append(toIndentedString(extraPackages)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("basePackage"); + openapiFields.add("extraPackages"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClassifiedsPackages + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClassifiedsPackages.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClassifiedsPackages is not found in the empty JSON string", ClassifiedsPackages.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClassifiedsPackages.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassifiedsPackages` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `basePackage` + if (jsonObj.get("basePackage") != null && !jsonObj.get("basePackage").isJsonNull()) { + ClassifiedPackage.validateJsonElement(jsonObj.get("basePackage")); + } + if (jsonObj.get("extraPackages") != null && !jsonObj.get("extraPackages").isJsonNull()) { + JsonArray jsonArrayextraPackages = jsonObj.getAsJsonArray("extraPackages"); + if (jsonArrayextraPackages != null) { + // ensure the json data is an array + if (!jsonObj.get("extraPackages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `extraPackages` to be an array in the JSON string but got `%s`", jsonObj.get("extraPackages").toString())); + } + + // validate the optional field `extraPackages` (array) + for (int i = 0; i < jsonArrayextraPackages.size(); i++) { + ClassifiedExtraPackage.validateJsonElement(jsonArrayextraPackages.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClassifiedsPackages.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClassifiedsPackages' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClassifiedsPackages.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClassifiedsPackages value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClassifiedsPackages read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ClassifiedsPackages given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClassifiedsPackages + * @throws IOException if the JSON string is invalid with respect to ClassifiedsPackages + */ + public static ClassifiedsPackages fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClassifiedsPackages.class); + } + + /** + * Convert an instance of ClassifiedsPackages to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CommandOutput.java b/src/main/java/pl/wtx/allegro/api/client/model/CommandOutput.java new file mode 100644 index 0000000..8f2f771 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CommandOutput.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error; +import pl.wtx.allegro.api.client.model.ProcessingStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The output of the command. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CommandOutput { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private ProcessingStatus status; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public CommandOutput() { + } + + public CommandOutput status(@javax.annotation.Nullable ProcessingStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public ProcessingStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable ProcessingStatus status) { + this.status = status; + } + + + public CommandOutput errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public CommandOutput addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CommandOutput commandOutput = (CommandOutput) o; + return Objects.equals(this.status, commandOutput.status) && + Objects.equals(this.errors, commandOutput.errors); + } + + @Override + public int hashCode() { + return Objects.hash(status, errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CommandOutput {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CommandOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CommandOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CommandOutput is not found in the empty JSON string", CommandOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CommandOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CommandOutput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + ProcessingStatus.validateJsonElement(jsonObj.get("status")); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CommandOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CommandOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CommandOutput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CommandOutput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CommandOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CommandOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of CommandOutput + * @throws IOException if the JSON string is invalid with respect to CommandOutput + */ + public static CommandOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CommandOutput.class); + } + + /** + * Convert an instance of CommandOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CommandTask.java b/src/main/java/pl/wtx/allegro/api/client/model/CommandTask.java new file mode 100644 index 0000000..470d6d6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CommandTask.java @@ -0,0 +1,350 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error; +import pl.wtx.allegro.api.client.model.OfferId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Status of single command task. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CommandTask { + public static final String SERIALIZED_NAME_FIELD = "field"; + @SerializedName(SERIALIZED_NAME_FIELD) + @javax.annotation.Nullable + private String field; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private OfferId offer; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private String status; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public CommandTask() { + } + + public CommandTask field(@javax.annotation.Nullable String field) { + this.field = field; + return this; + } + + /** + * Modified field as JSON path. + * @return field + */ + @javax.annotation.Nullable + public String getField() { + return field; + } + + public void setField(@javax.annotation.Nullable String field) { + this.field = field; + } + + + public CommandTask message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * General fail reason. You should check the errors structure to get more detailed information of the encountered errors. + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + public CommandTask offer(@javax.annotation.Nullable OfferId offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public OfferId getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable OfferId offer) { + this.offer = offer; + } + + + public CommandTask status(@javax.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Available statuses: NEW, SUCCESS, FAIL + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable String status) { + this.status = status; + } + + + public CommandTask errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public CommandTask addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * The list of error objects explaining the problems with command processing for the given offer. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CommandTask commandTask = (CommandTask) o; + return Objects.equals(this.field, commandTask.field) && + Objects.equals(this.message, commandTask.message) && + Objects.equals(this.offer, commandTask.offer) && + Objects.equals(this.status, commandTask.status) && + Objects.equals(this.errors, commandTask.errors); + } + + @Override + public int hashCode() { + return Objects.hash(field, message, offer, status, errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CommandTask {\n"); + sb.append(" field: ").append(toIndentedString(field)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("field"); + openapiFields.add("message"); + openapiFields.add("offer"); + openapiFields.add("status"); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CommandTask + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CommandTask.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CommandTask is not found in the empty JSON string", CommandTask.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CommandTask.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CommandTask` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("field") != null && !jsonObj.get("field").isJsonNull()) && !jsonObj.get("field").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `field` to be a primitive type in the JSON string but got `%s`", jsonObj.get("field").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + OfferId.validateJsonElement(jsonObj.get("offer")); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CommandTask.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CommandTask' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CommandTask.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CommandTask value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CommandTask read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CommandTask given an JSON string + * + * @param jsonString JSON string + * @return An instance of CommandTask + * @throws IOException if the JSON string is invalid with respect to CommandTask + */ + public static CommandTask fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CommandTask.class); + } + + /** + * Convert an instance of CommandTask to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CommentVBeta1.java b/src/main/java/pl/wtx/allegro/api/client/model/CommentVBeta1.java new file mode 100644 index 0000000..25fb968 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CommentVBeta1.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CommentVBeta1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CommentVBeta1 { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nullable + private String language; + + public CommentVBeta1() { + } + + public CommentVBeta1 text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Text of user's comment. + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + public CommentVBeta1 language(@javax.annotation.Nullable String language) { + this.language = language; + return this; + } + + /** + * Language of the user comment. + * @return language + */ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nullable String language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CommentVBeta1 commentVBeta1 = (CommentVBeta1) o; + return Objects.equals(this.text, commentVBeta1.text) && + Objects.equals(this.language, commentVBeta1.language); + } + + @Override + public int hashCode() { + return Objects.hash(text, language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CommentVBeta1 {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("text"); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CommentVBeta1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CommentVBeta1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CommentVBeta1 is not found in the empty JSON string", CommentVBeta1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CommentVBeta1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CommentVBeta1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CommentVBeta1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CommentVBeta1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CommentVBeta1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CommentVBeta1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CommentVBeta1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CommentVBeta1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CommentVBeta1 + * @throws IOException if the JSON string is invalid with respect to CommentVBeta1 + */ + public static CommentVBeta1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CommentVBeta1.class); + } + + /** + * Convert an instance of CommentVBeta1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CommissionResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CommissionResponse.java new file mode 100644 index 0000000..cd1487d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CommissionResponse.java @@ -0,0 +1,268 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CommissionResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CommissionResponse { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_FEE = "fee"; + @SerializedName(SERIALIZED_NAME_FEE) + @javax.annotation.Nullable + private Price fee; + + public CommissionResponse() { + } + + public CommissionResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Commission fee name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CommissionResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Commission fee type. + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public CommissionResponse fee(@javax.annotation.Nullable Price fee) { + this.fee = fee; + return this; + } + + /** + * Get fee + * @return fee + */ + @javax.annotation.Nullable + public Price getFee() { + return fee; + } + + public void setFee(@javax.annotation.Nullable Price fee) { + this.fee = fee; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CommissionResponse commissionResponse = (CommissionResponse) o; + return Objects.equals(this.name, commissionResponse.name) && + Objects.equals(this.type, commissionResponse.type) && + Objects.equals(this.fee, commissionResponse.fee); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, fee); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CommissionResponse {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("fee"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CommissionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CommissionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CommissionResponse is not found in the empty JSON string", CommissionResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CommissionResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CommissionResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `fee` + if (jsonObj.get("fee") != null && !jsonObj.get("fee").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("fee")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CommissionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CommissionResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CommissionResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CommissionResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CommissionResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CommissionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CommissionResponse + * @throws IOException if the JSON string is invalid with respect to CommissionResponse + */ + public static CommissionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CommissionResponse.class); + } + + /** + * Convert an instance of CommissionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Company.java b/src/main/java/pl/wtx/allegro/api/client/model/Company.java new file mode 100644 index 0000000..527bac6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Company.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Company + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Company { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_TAX_ID = "taxId"; + @SerializedName(SERIALIZED_NAME_TAX_ID) + @javax.annotation.Nullable + private String taxId; + + public Company() { + } + + public Company name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * User's company name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public Company taxId(@javax.annotation.Nullable String taxId) { + this.taxId = taxId; + return this; + } + + /** + * User's tax identification number. + * @return taxId + */ + @javax.annotation.Nullable + public String getTaxId() { + return taxId; + } + + public void setTaxId(@javax.annotation.Nullable String taxId) { + this.taxId = taxId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Company company = (Company) o; + return Objects.equals(this.name, company.name) && + Objects.equals(this.taxId, company.taxId); + } + + @Override + public int hashCode() { + return Objects.hash(name, taxId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Company {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" taxId: ").append(toIndentedString(taxId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("taxId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Company + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Company.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Company is not found in the empty JSON string", Company.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Company.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Company` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("taxId") != null && !jsonObj.get("taxId").isJsonNull()) && !jsonObj.get("taxId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `taxId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Company.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Company' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Company.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Company value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Company read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Company given an JSON string + * + * @param jsonString JSON string + * @return An instance of Company + * @throws IOException if the JSON string is invalid with respect to Company + */ + public static Company fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Company.class); + } + + /** + * Convert an instance of Company to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityList.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityList.java new file mode 100644 index 0000000..9003081 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityList.java @@ -0,0 +1,183 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityList { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type = "MANUAL"; + + public CompatibilityList() { + this.type = this.getClass().getSimpleName(); + } + + public CompatibilityList type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Type of the compatibility list, two values are acceptable: `MANUAL`, `PRODUCT_BASED`. <ul> <li>`MANUAL` - for offers not associated with product - compatibility list is created with items provided by user directly in the body of the request.</li> <li>`PRODUCT_BASED` - for offers associated with product - if compatibility list is provided in the product details (GET/sale/products/{productId}), it needs to be included in the offer in unchanged form. </li> </ul> + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityList compatibilityList = (CompatibilityList) o; + return Objects.equals(this.type, compatibilityList.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityList {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityList is not found in the empty JSON string", CompatibilityList.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "MANUAL": + CompatibilityListManual.validateJsonElement(jsonElement); + break; + case "PRODUCT_BASED": + CompatibilityListProductBased.validateJsonElement(jsonElement); + break; + case "CompatibilityListProductBasedProductOfferResponse": + CompatibilityListProductBasedProductOfferResponse.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of CompatibilityList given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityList + * @throws IOException if the JSON string is invalid with respect to CompatibilityList + */ + public static CompatibilityList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityList.class); + } + + /** + * Convert an instance of CompatibilityList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListIdItem.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListIdItem.java new file mode 100644 index 0000000..91c455e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListIdItem.java @@ -0,0 +1,306 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CompatibilityListIdItemAdditionalInfo; +import pl.wtx.allegro.api.client.model.CompatibilityListItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListIdItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListIdItem extends CompatibilityListItem { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "ID"; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public static final String SERIALIZED_NAME_ADDITIONAL_INFO = "additionalInfo"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFO) + @javax.annotation.Nullable + private List additionalInfo = new ArrayList<>(); + + public CompatibilityListIdItem() { + this.type = this.getClass().getSimpleName(); + } + + public CompatibilityListIdItem type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public CompatibilityListIdItem id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Id of the compatible item. Should be used in categories where ID version of compatible list is supported. See <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\"> supported-categories</a> resource. <a href=\"../../compatibility_list\" target=\"_blank\">Read more</a>. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public CompatibilityListIdItem text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Text description of the compatible item. When creating (Post) or updating (Put) a compatibility list the field is ignored. + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + public CompatibilityListIdItem additionalInfo(@javax.annotation.Nullable List additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + public CompatibilityListIdItem addAdditionalInfoItem(CompatibilityListIdItemAdditionalInfo additionalInfoItem) { + if (this.additionalInfo == null) { + this.additionalInfo = new ArrayList<>(); + } + this.additionalInfo.add(additionalInfoItem); + return this; + } + + /** + * Details of the compatible item represented by ID. + * @return additionalInfo + */ + @javax.annotation.Nullable + public List getAdditionalInfo() { + return additionalInfo; + } + + public void setAdditionalInfo(@javax.annotation.Nullable List additionalInfo) { + this.additionalInfo = additionalInfo; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListIdItem compatibilityListIdItem = (CompatibilityListIdItem) o; + return Objects.equals(this.type, compatibilityListIdItem.type) && + Objects.equals(this.id, compatibilityListIdItem.id) && + Objects.equals(this.text, compatibilityListIdItem.text) && + Objects.equals(this.additionalInfo, compatibilityListIdItem.additionalInfo) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, text, additionalInfo, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListIdItem {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("text"); + openapiFields.add("additionalInfo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListIdItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListIdItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListIdItem is not found in the empty JSON string", CompatibilityListIdItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListIdItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListIdItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CompatibilityListIdItem.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListIdItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListIdItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListIdItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListIdItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListIdItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListIdItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListIdItem + * @throws IOException if the JSON string is invalid with respect to CompatibilityListIdItem + */ + public static CompatibilityListIdItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListIdItem.class); + } + + /** + * Convert an instance of CompatibilityListIdItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListIdItemAdditionalInfo.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListIdItemAdditionalInfo.java new file mode 100644 index 0000000..7e3ee19 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListIdItemAdditionalInfo.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListIdItemAdditionalInfo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListIdItemAdditionalInfo { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public CompatibilityListIdItemAdditionalInfo() { + } + + public CompatibilityListIdItemAdditionalInfo value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * Additional information describing the compatible item. E.g. for cars it can be an engine code or an equipment version. + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListIdItemAdditionalInfo compatibilityListIdItemAdditionalInfo = (CompatibilityListIdItemAdditionalInfo) o; + return Objects.equals(this.value, compatibilityListIdItemAdditionalInfo.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListIdItemAdditionalInfo {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListIdItemAdditionalInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListIdItemAdditionalInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListIdItemAdditionalInfo is not found in the empty JSON string", CompatibilityListIdItemAdditionalInfo.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListIdItemAdditionalInfo.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListIdItemAdditionalInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CompatibilityListIdItemAdditionalInfo.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListIdItemAdditionalInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListIdItemAdditionalInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListIdItemAdditionalInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListIdItemAdditionalInfo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListIdItemAdditionalInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListIdItemAdditionalInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListIdItemAdditionalInfo + * @throws IOException if the JSON string is invalid with respect to CompatibilityListIdItemAdditionalInfo + */ + public static CompatibilityListIdItemAdditionalInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListIdItemAdditionalInfo.class); + } + + /** + * Convert an instance of CompatibilityListIdItemAdditionalInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListItem.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListItem.java new file mode 100644 index 0000000..dabe79d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListItem.java @@ -0,0 +1,180 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListItem { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + public CompatibilityListItem() { + this.type = this.getClass().getSimpleName(); + } + + public CompatibilityListItem type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListItem compatibilityListItem = (CompatibilityListItem) o; + return Objects.equals(this.type, compatibilityListItem.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListItem {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListItem is not found in the empty JSON string", CompatibilityListItem.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "ID": + CompatibilityListIdItem.validateJsonElement(jsonElement); + break; + case "TEXT": + CompatibilityListTextItem.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of CompatibilityListItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListItem + * @throws IOException if the JSON string is invalid with respect to CompatibilityListItem + */ + public static CompatibilityListItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListItem.class); + } + + /** + * Convert an instance of CompatibilityListItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListItemProductBased.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListItemProductBased.java new file mode 100644 index 0000000..3fd74be --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListItemProductBased.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListItemProductBased + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListItemProductBased { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public CompatibilityListItemProductBased() { + } + + public CompatibilityListItemProductBased text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Text description of the compatible item. + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListItemProductBased compatibilityListItemProductBased = (CompatibilityListItemProductBased) o; + return Objects.equals(this.text, compatibilityListItemProductBased.text); + } + + @Override + public int hashCode() { + return Objects.hash(text); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListItemProductBased {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("text"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListItemProductBased + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListItemProductBased.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListItemProductBased is not found in the empty JSON string", CompatibilityListItemProductBased.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListItemProductBased.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListItemProductBased` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListItemProductBased.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListItemProductBased' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListItemProductBased.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListItemProductBased value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListItemProductBased read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListItemProductBased given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListItemProductBased + * @throws IOException if the JSON string is invalid with respect to CompatibilityListItemProductBased + */ + public static CompatibilityListItemProductBased fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListItemProductBased.class); + } + + /** + * Convert an instance of CompatibilityListItemProductBased to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListManual.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListManual.java new file mode 100644 index 0000000..ac26d66 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListManual.java @@ -0,0 +1,227 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CompatibilityList; +import pl.wtx.allegro.api.client.model.CompatibilityListItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListManual + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListManual extends CompatibilityList { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public CompatibilityListManual() { + this.type = this.getClass().getSimpleName(); + } + + public CompatibilityListManual items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public CompatibilityListManual addItemsItem(CompatibilityListItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * List of the compatible items. Maximum number of elements on the list depends on type of included compatible items. Configuration and details concerning the compatible items in selected category are provided in the response for GET <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\"> supported-categories</a> resource in `validationRules` object. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListManual compatibilityListManual = (CompatibilityListManual) o; + return Objects.equals(this.items, compatibilityListManual.items) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(items, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListManual {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("items"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListManual + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListManual.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListManual is not found in the empty JSON string", CompatibilityListManual.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListManual.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListManual` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CompatibilityListManual.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListManual.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListManual' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListManual.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListManual value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListManual read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListManual given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListManual + * @throws IOException if the JSON string is invalid with respect to CompatibilityListManual + */ + public static CompatibilityListManual fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListManual.class); + } + + /** + * Convert an instance of CompatibilityListManual to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListManualType.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListManualType.java new file mode 100644 index 0000000..ffd0a2a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListManualType.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CompatibilityListItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListManualType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListManualType { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public CompatibilityListManualType() { + } + + public CompatibilityListManualType items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public CompatibilityListManualType addItemsItem(CompatibilityListItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * List of the compatible items. Maximum number of elements on the list depends on type of included compatible items. Configuration and details concerning the compatible items in selected category are provided in the response for GET <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\"> supported-categories</a> resource in `validationRules` object. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListManualType compatibilityListManualType = (CompatibilityListManualType) o; + return Objects.equals(this.items, compatibilityListManualType.items); + } + + @Override + public int hashCode() { + return Objects.hash(items); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListManualType {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("items"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListManualType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListManualType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListManualType is not found in the empty JSON string", CompatibilityListManualType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListManualType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListManualType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CompatibilityListManualType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + CompatibilityListItem.validateJsonElement(jsonArrayitems.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListManualType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListManualType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListManualType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListManualType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListManualType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListManualType given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListManualType + * @throws IOException if the JSON string is invalid with respect to CompatibilityListManualType + */ + public static CompatibilityListManualType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListManualType.class); + } + + /** + * Convert an instance of CompatibilityListManualType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductBased.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductBased.java new file mode 100644 index 0000000..5f7f802 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductBased.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CompatibilityList; +import pl.wtx.allegro.api.client.model.CompatibilityListItemProductBased; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListProductBased + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListProductBased extends CompatibilityList { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nullable + private List items = new ArrayList<>(); + + public CompatibilityListProductBased() { + this.type = this.getClass().getSimpleName(); + } + + public CompatibilityListProductBased id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Id of product-based compatibility list. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public CompatibilityListProductBased items(@javax.annotation.Nullable List items) { + this.items = items; + return this; + } + + public CompatibilityListProductBased addItemsItem(CompatibilityListItemProductBased itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Text representation of the compatibility list items. Provided for informational purposes only - ignored when creating (Post) or updating (Put) compatibility list in the offer. + * @return items + */ + @javax.annotation.Nullable + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nullable List items) { + this.items = items; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListProductBased compatibilityListProductBased = (CompatibilityListProductBased) o; + return Objects.equals(this.id, compatibilityListProductBased.id) && + Objects.equals(this.items, compatibilityListProductBased.items) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(id, items, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListProductBased {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListProductBased + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListProductBased.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListProductBased is not found in the empty JSON string", CompatibilityListProductBased.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListProductBased.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListProductBased` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CompatibilityListProductBased.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListProductBased.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListProductBased' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListProductBased.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListProductBased value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListProductBased read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListProductBased given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListProductBased + * @throws IOException if the JSON string is invalid with respect to CompatibilityListProductBased + */ + public static CompatibilityListProductBased fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListProductBased.class); + } + + /** + * Convert an instance of CompatibilityListProductBased to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductBasedProductOfferResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductBasedProductOfferResponse.java new file mode 100644 index 0000000..f06e19d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductBasedProductOfferResponse.java @@ -0,0 +1,226 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CompatibilityList; +import pl.wtx.allegro.api.client.model.CompatibilityListItemProductBased; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListProductBasedProductOfferResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListProductBasedProductOfferResponse extends CompatibilityList { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nullable + private List items = new ArrayList<>(); + + public CompatibilityListProductBasedProductOfferResponse() { + this.type = this.getClass().getSimpleName(); + } + + public CompatibilityListProductBasedProductOfferResponse items(@javax.annotation.Nullable List items) { + this.items = items; + return this; + } + + public CompatibilityListProductBasedProductOfferResponse addItemsItem(CompatibilityListItemProductBased itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Text representation of the compatibility list items. Provided for informational purposes only - ignored when creating (Post) or updating (Put) compatibility list in the offer. + * @return items + */ + @javax.annotation.Nullable + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nullable List items) { + this.items = items; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListProductBasedProductOfferResponse compatibilityListProductBasedProductOfferResponse = (CompatibilityListProductBasedProductOfferResponse) o; + return Objects.equals(this.items, compatibilityListProductBasedProductOfferResponse.items) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(items, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListProductBasedProductOfferResponse {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListProductBasedProductOfferResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListProductBasedProductOfferResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListProductBasedProductOfferResponse is not found in the empty JSON string", CompatibilityListProductBasedProductOfferResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListProductBasedProductOfferResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListProductBasedProductOfferResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CompatibilityListProductBasedProductOfferResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListProductBasedProductOfferResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListProductBasedProductOfferResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListProductBasedProductOfferResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListProductBasedProductOfferResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListProductBasedProductOfferResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListProductBasedProductOfferResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListProductBasedProductOfferResponse + * @throws IOException if the JSON string is invalid with respect to CompatibilityListProductBasedProductOfferResponse + */ + public static CompatibilityListProductBasedProductOfferResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListProductBasedProductOfferResponse.class); + } + + /** + * Convert an instance of CompatibilityListProductBasedProductOfferResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductOfferResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductOfferResponse.java new file mode 100644 index 0000000..dd45bc7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListProductOfferResponse.java @@ -0,0 +1,211 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListProductOfferResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListProductOfferResponse { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type = "MANUAL"; + + public CompatibilityListProductOfferResponse() { + this.type = this.getClass().getSimpleName(); + } + + public CompatibilityListProductOfferResponse type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Type of the compatibility list, two values are acceptable: `MANUAL`, `PRODUCT_BASED`. <ul> <li>`MANUAL` - for offers not associated with product - compatibility list is created with items provided by user directly in the body of the request.</li> <li>`PRODUCT_BASED` - for offers associated with product - if compatibility list is provided in the product details (GET/sale/products/{productId}), it needs to be included in the offer in unchanged form. </li> </ul> + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListProductOfferResponse compatibilityListProductOfferResponse = (CompatibilityListProductOfferResponse) o; + return Objects.equals(this.type, compatibilityListProductOfferResponse.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListProductOfferResponse {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListProductOfferResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListProductOfferResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListProductOfferResponse is not found in the empty JSON string", CompatibilityListProductOfferResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListProductOfferResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListProductOfferResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CompatibilityListProductOfferResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListProductOfferResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListProductOfferResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListProductOfferResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListProductOfferResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListProductOfferResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListProductOfferResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListProductOfferResponse + * @throws IOException if the JSON string is invalid with respect to CompatibilityListProductOfferResponse + */ + public static CompatibilityListProductOfferResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListProductOfferResponse.class); + } + + /** + * Convert an instance of CompatibilityListProductOfferResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDto.java new file mode 100644 index 0000000..ea9bd94 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDto.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListSupportedCategoriesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListSupportedCategoriesDto { + public static final String SERIALIZED_NAME_SUPPORTED_CATEGORIES = "supportedCategories"; + @SerializedName(SERIALIZED_NAME_SUPPORTED_CATEGORIES) + @javax.annotation.Nullable + private List supportedCategories = new ArrayList<>(); + + public CompatibilityListSupportedCategoriesDto() { + } + + public CompatibilityListSupportedCategoriesDto supportedCategories(@javax.annotation.Nullable List supportedCategories) { + this.supportedCategories = supportedCategories; + return this; + } + + public CompatibilityListSupportedCategoriesDto addSupportedCategoriesItem(CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner supportedCategoriesItem) { + if (this.supportedCategories == null) { + this.supportedCategories = new ArrayList<>(); + } + this.supportedCategories.add(supportedCategoriesItem); + return this; + } + + /** + * List with information about categories where compatibility list is supported. <a href=\" https://developer.allegro.pl/compatibility_list/\" target=\"_blank\">Read more</a>. + * @return supportedCategories + */ + @javax.annotation.Nullable + public List getSupportedCategories() { + return supportedCategories; + } + + public void setSupportedCategories(@javax.annotation.Nullable List supportedCategories) { + this.supportedCategories = supportedCategories; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListSupportedCategoriesDto compatibilityListSupportedCategoriesDto = (CompatibilityListSupportedCategoriesDto) o; + return Objects.equals(this.supportedCategories, compatibilityListSupportedCategoriesDto.supportedCategories); + } + + @Override + public int hashCode() { + return Objects.hash(supportedCategories); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListSupportedCategoriesDto {\n"); + sb.append(" supportedCategories: ").append(toIndentedString(supportedCategories)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("supportedCategories"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListSupportedCategoriesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListSupportedCategoriesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListSupportedCategoriesDto is not found in the empty JSON string", CompatibilityListSupportedCategoriesDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListSupportedCategoriesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListSupportedCategoriesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("supportedCategories") != null && !jsonObj.get("supportedCategories").isJsonNull()) { + JsonArray jsonArraysupportedCategories = jsonObj.getAsJsonArray("supportedCategories"); + if (jsonArraysupportedCategories != null) { + // ensure the json data is an array + if (!jsonObj.get("supportedCategories").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `supportedCategories` to be an array in the JSON string but got `%s`", jsonObj.get("supportedCategories").toString())); + } + + // validate the optional field `supportedCategories` (array) + for (int i = 0; i < jsonArraysupportedCategories.size(); i++) { + CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.validateJsonElement(jsonArraysupportedCategories.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListSupportedCategoriesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListSupportedCategoriesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListSupportedCategoriesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListSupportedCategoriesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListSupportedCategoriesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListSupportedCategoriesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListSupportedCategoriesDto + * @throws IOException if the JSON string is invalid with respect to CompatibilityListSupportedCategoriesDto + */ + public static CompatibilityListSupportedCategoriesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListSupportedCategoriesDto.class); + } + + /** + * Convert an instance of CompatibilityListSupportedCategoriesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.java new file mode 100644 index 0000000..e2f881e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.java @@ -0,0 +1,384 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner { + public static final String SERIALIZED_NAME_CATEGORY_ID = "categoryId"; + @SerializedName(SERIALIZED_NAME_CATEGORY_ID) + @javax.annotation.Nullable + private String categoryId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ITEMS_TYPE = "itemsType"; + @SerializedName(SERIALIZED_NAME_ITEMS_TYPE) + @javax.annotation.Nullable + private String itemsType; + + /** + * Type of the representation of compatible item. <ul> <li>`TEXT` - item on compatibility list has to be provided as plain text.</li> <li>`ID` - item on compatibility list has to be provided as identifier of compatible product. To obtain it please use <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatible-products/get\">compatible-products</a> resource together with `itemsType` supported in particular category. </li> </ul> + */ + @JsonAdapter(InputTypeEnum.Adapter.class) + public enum InputTypeEnum { + TEXT("TEXT"), + + ID("ID"); + + private String value; + + InputTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static InputTypeEnum fromValue(String value) { + for (InputTypeEnum b : InputTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final InputTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public InputTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return InputTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + InputTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_INPUT_TYPE = "inputType"; + @SerializedName(SERIALIZED_NAME_INPUT_TYPE) + @javax.annotation.Nullable + private InputTypeEnum inputType; + + public static final String SERIALIZED_NAME_VALIDATION_RULES = "validationRules"; + @SerializedName(SERIALIZED_NAME_VALIDATION_RULES) + @javax.annotation.Nullable + private CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules validationRules; + + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner() { + } + + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner categoryId(@javax.annotation.Nullable String categoryId) { + this.categoryId = categoryId; + return this; + } + + /** + * Identifier of the category, where you can use the compatibility list in an offer listed in the category or in all subcategories, which belongs to returned category. + * @return categoryId + */ + @javax.annotation.Nullable + public String getCategoryId() { + return categoryId; + } + + public void setCategoryId(@javax.annotation.Nullable String categoryId) { + this.categoryId = categoryId; + } + + + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of supported category. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner itemsType(@javax.annotation.Nullable String itemsType) { + this.itemsType = itemsType; + return this; + } + + /** + * Type of the compatible item. + * @return itemsType + */ + @javax.annotation.Nullable + public String getItemsType() { + return itemsType; + } + + public void setItemsType(@javax.annotation.Nullable String itemsType) { + this.itemsType = itemsType; + } + + + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner inputType(@javax.annotation.Nullable InputTypeEnum inputType) { + this.inputType = inputType; + return this; + } + + /** + * Type of the representation of compatible item. <ul> <li>`TEXT` - item on compatibility list has to be provided as plain text.</li> <li>`ID` - item on compatibility list has to be provided as identifier of compatible product. To obtain it please use <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatible-products/get\">compatible-products</a> resource together with `itemsType` supported in particular category. </li> </ul> + * @return inputType + */ + @javax.annotation.Nullable + public InputTypeEnum getInputType() { + return inputType; + } + + public void setInputType(@javax.annotation.Nullable InputTypeEnum inputType) { + this.inputType = inputType; + } + + + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner validationRules(@javax.annotation.Nullable CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules validationRules) { + this.validationRules = validationRules; + return this; + } + + /** + * Get validationRules + * @return validationRules + */ + @javax.annotation.Nullable + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules getValidationRules() { + return validationRules; + } + + public void setValidationRules(@javax.annotation.Nullable CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules validationRules) { + this.validationRules = validationRules; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner compatibilityListSupportedCategoriesDtoSupportedCategoriesInner = (CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner) o; + return Objects.equals(this.categoryId, compatibilityListSupportedCategoriesDtoSupportedCategoriesInner.categoryId) && + Objects.equals(this.name, compatibilityListSupportedCategoriesDtoSupportedCategoriesInner.name) && + Objects.equals(this.itemsType, compatibilityListSupportedCategoriesDtoSupportedCategoriesInner.itemsType) && + Objects.equals(this.inputType, compatibilityListSupportedCategoriesDtoSupportedCategoriesInner.inputType) && + Objects.equals(this.validationRules, compatibilityListSupportedCategoriesDtoSupportedCategoriesInner.validationRules); + } + + @Override + public int hashCode() { + return Objects.hash(categoryId, name, itemsType, inputType, validationRules); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner {\n"); + sb.append(" categoryId: ").append(toIndentedString(categoryId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" itemsType: ").append(toIndentedString(itemsType)).append("\n"); + sb.append(" inputType: ").append(toIndentedString(inputType)).append("\n"); + sb.append(" validationRules: ").append(toIndentedString(validationRules)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("categoryId"); + openapiFields.add("name"); + openapiFields.add("itemsType"); + openapiFields.add("inputType"); + openapiFields.add("validationRules"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner is not found in the empty JSON string", CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("categoryId") != null && !jsonObj.get("categoryId").isJsonNull()) && !jsonObj.get("categoryId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `categoryId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("categoryId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("itemsType") != null && !jsonObj.get("itemsType").isJsonNull()) && !jsonObj.get("itemsType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `itemsType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("itemsType").toString())); + } + if ((jsonObj.get("inputType") != null && !jsonObj.get("inputType").isJsonNull()) && !jsonObj.get("inputType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `inputType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("inputType").toString())); + } + // validate the optional field `inputType` + if (jsonObj.get("inputType") != null && !jsonObj.get("inputType").isJsonNull()) { + InputTypeEnum.validateJsonElement(jsonObj.get("inputType")); + } + // validate the optional field `validationRules` + if (jsonObj.get("validationRules") != null && !jsonObj.get("validationRules").isJsonNull()) { + CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.validateJsonElement(jsonObj.get("validationRules")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner + * @throws IOException if the JSON string is invalid with respect to CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner + */ + public static CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner.class); + } + + /** + * Convert an instance of CompatibilityListSupportedCategoriesDtoSupportedCategoriesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.java new file mode 100644 index 0000000..bcaeb6a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Additional information about constraints assigned to the category. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules { + public static final String SERIALIZED_NAME_MAX_ROWS = "maxRows"; + @SerializedName(SERIALIZED_NAME_MAX_ROWS) + @javax.annotation.Nullable + private Integer maxRows; + + public static final String SERIALIZED_NAME_MAX_CHARACTERS_PER_LINE = "maxCharactersPerLine"; + @SerializedName(SERIALIZED_NAME_MAX_CHARACTERS_PER_LINE) + @javax.annotation.Nullable + private Integer maxCharactersPerLine; + + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules() { + } + + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules maxRows(@javax.annotation.Nullable Integer maxRows) { + this.maxRows = maxRows; + return this; + } + + /** + * Maximum number of items allowed on compatibility list. + * minimum: 1 + * @return maxRows + */ + @javax.annotation.Nullable + public Integer getMaxRows() { + return maxRows; + } + + public void setMaxRows(@javax.annotation.Nullable Integer maxRows) { + this.maxRows = maxRows; + } + + + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules maxCharactersPerLine(@javax.annotation.Nullable Integer maxCharactersPerLine) { + this.maxCharactersPerLine = maxCharactersPerLine; + return this; + } + + /** + * Maximum length of single item on the list. + * minimum: 1 + * @return maxCharactersPerLine + */ + @javax.annotation.Nullable + public Integer getMaxCharactersPerLine() { + return maxCharactersPerLine; + } + + public void setMaxCharactersPerLine(@javax.annotation.Nullable Integer maxCharactersPerLine) { + this.maxCharactersPerLine = maxCharactersPerLine; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules compatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules = (CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules) o; + return Objects.equals(this.maxRows, compatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.maxRows) && + Objects.equals(this.maxCharactersPerLine, compatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.maxCharactersPerLine); + } + + @Override + public int hashCode() { + return Objects.hash(maxRows, maxCharactersPerLine); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules {\n"); + sb.append(" maxRows: ").append(toIndentedString(maxRows)).append("\n"); + sb.append(" maxCharactersPerLine: ").append(toIndentedString(maxCharactersPerLine)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("maxRows"); + openapiFields.add("maxCharactersPerLine"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules is not found in the empty JSON string", CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules + * @throws IOException if the JSON string is invalid with respect to CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules + */ + public static CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules.class); + } + + /** + * Convert an instance of CompatibilityListSupportedCategoriesDtoSupportedCategoriesInnerValidationRules to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListTextItem.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListTextItem.java new file mode 100644 index 0000000..ae791a7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibilityListTextItem.java @@ -0,0 +1,241 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CompatibilityListItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibilityListTextItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibilityListTextItem extends CompatibilityListItem { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "TEXT"; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nonnull + private String text; + + public CompatibilityListTextItem() { + this.type = this.getClass().getSimpleName(); + } + + public CompatibilityListTextItem type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public CompatibilityListTextItem text(@javax.annotation.Nonnull String text) { + this.text = text; + return this; + } + + /** + * Text description of the compatible item. Maximum length of the text depends on category where compatible item is used. Should be used in categories where TEXT version of compatible list is supported. See <a href=\"/documentation/#tag/Compatibility-List/paths/~1sale~1compatibility-list~1supported-categories/get\"> supported-categories</a> resource. <a href=\"../../compatibility_list\" target=\"_blank\">Read more</a>. + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nonnull String text) { + this.text = text; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibilityListTextItem compatibilityListTextItem = (CompatibilityListTextItem) o; + return Objects.equals(this.type, compatibilityListTextItem.type) && + Objects.equals(this.text, compatibilityListTextItem.text) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibilityListTextItem {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("text"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("text"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibilityListTextItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibilityListTextItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibilityListTextItem is not found in the empty JSON string", CompatibilityListTextItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibilityListTextItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibilityListTextItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CompatibilityListTextItem.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibilityListTextItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibilityListTextItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibilityListTextItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibilityListTextItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibilityListTextItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibilityListTextItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibilityListTextItem + * @throws IOException if the JSON string is invalid with respect to CompatibilityListTextItem + */ + public static CompatibilityListTextItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibilityListTextItem.class); + } + + /** + * Convert an instance of CompatibilityListTextItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDto.java new file mode 100644 index 0000000..84d850d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDto.java @@ -0,0 +1,320 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CompatibleProductDtoAttributesInner; +import pl.wtx.allegro.api.client.model.CompatibleProductDtoGroup; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibleProductDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibleProductDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public static final String SERIALIZED_NAME_GROUP = "group"; + @SerializedName(SERIALIZED_NAME_GROUP) + @javax.annotation.Nullable + private CompatibleProductDtoGroup group; + + public static final String SERIALIZED_NAME_ATTRIBUTES = "attributes"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES) + @javax.annotation.Nullable + private List attributes = new ArrayList<>(); + + public CompatibleProductDto() { + } + + public CompatibleProductDto id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Identifier of the compatible product. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CompatibleProductDto text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Textual representation of the compatible product. + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + public CompatibleProductDto group(@javax.annotation.Nullable CompatibleProductDtoGroup group) { + this.group = group; + return this; + } + + /** + * Get group + * @return group + */ + @javax.annotation.Nullable + public CompatibleProductDtoGroup getGroup() { + return group; + } + + public void setGroup(@javax.annotation.Nullable CompatibleProductDtoGroup group) { + this.group = group; + } + + + public CompatibleProductDto attributes(@javax.annotation.Nullable List attributes) { + this.attributes = attributes; + return this; + } + + public CompatibleProductDto addAttributesItem(CompatibleProductDtoAttributesInner attributesItem) { + if (this.attributes == null) { + this.attributes = new ArrayList<>(); + } + this.attributes.add(attributesItem); + return this; + } + + /** + * List of compatible products attributes. + * @return attributes + */ + @javax.annotation.Nullable + public List getAttributes() { + return attributes; + } + + public void setAttributes(@javax.annotation.Nullable List attributes) { + this.attributes = attributes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibleProductDto compatibleProductDto = (CompatibleProductDto) o; + return Objects.equals(this.id, compatibleProductDto.id) && + Objects.equals(this.text, compatibleProductDto.text) && + Objects.equals(this.group, compatibleProductDto.group) && + Objects.equals(this.attributes, compatibleProductDto.attributes); + } + + @Override + public int hashCode() { + return Objects.hash(id, text, group, attributes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibleProductDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" group: ").append(toIndentedString(group)).append("\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("text"); + openapiFields.add("group"); + openapiFields.add("attributes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibleProductDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibleProductDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibleProductDto is not found in the empty JSON string", CompatibleProductDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibleProductDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibleProductDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + // validate the optional field `group` + if (jsonObj.get("group") != null && !jsonObj.get("group").isJsonNull()) { + CompatibleProductDtoGroup.validateJsonElement(jsonObj.get("group")); + } + if (jsonObj.get("attributes") != null && !jsonObj.get("attributes").isJsonNull()) { + JsonArray jsonArrayattributes = jsonObj.getAsJsonArray("attributes"); + if (jsonArrayattributes != null) { + // ensure the json data is an array + if (!jsonObj.get("attributes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `attributes` to be an array in the JSON string but got `%s`", jsonObj.get("attributes").toString())); + } + + // validate the optional field `attributes` (array) + for (int i = 0; i < jsonArrayattributes.size(); i++) { + CompatibleProductDtoAttributesInner.validateJsonElement(jsonArrayattributes.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibleProductDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibleProductDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibleProductDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibleProductDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibleProductDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibleProductDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibleProductDto + * @throws IOException if the JSON string is invalid with respect to CompatibleProductDto + */ + public static CompatibleProductDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibleProductDto.class); + } + + /** + * Convert an instance of CompatibleProductDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDtoAttributesInner.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDtoAttributesInner.java new file mode 100644 index 0000000..a7984aa --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDtoAttributesInner.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibleProductDtoAttributesInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibleProductDtoAttributesInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public CompatibleProductDtoAttributesInner() { + } + + public CompatibleProductDtoAttributesInner id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Identifier of an attribute + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CompatibleProductDtoAttributesInner values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public CompatibleProductDtoAttributesInner addValuesItem(String valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * List of attribute's values. + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibleProductDtoAttributesInner compatibleProductDtoAttributesInner = (CompatibleProductDtoAttributesInner) o; + return Objects.equals(this.id, compatibleProductDtoAttributesInner.id) && + Objects.equals(this.values, compatibleProductDtoAttributesInner.values); + } + + @Override + public int hashCode() { + return Objects.hash(id, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibleProductDtoAttributesInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("values"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibleProductDtoAttributesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibleProductDtoAttributesInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibleProductDtoAttributesInner is not found in the empty JSON string", CompatibleProductDtoAttributesInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibleProductDtoAttributesInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibleProductDtoAttributesInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibleProductDtoAttributesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibleProductDtoAttributesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibleProductDtoAttributesInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibleProductDtoAttributesInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibleProductDtoAttributesInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibleProductDtoAttributesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibleProductDtoAttributesInner + * @throws IOException if the JSON string is invalid with respect to CompatibleProductDtoAttributesInner + */ + public static CompatibleProductDtoAttributesInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibleProductDtoAttributesInner.class); + } + + /** + * Convert an instance of CompatibleProductDtoAttributesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDtoGroup.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDtoGroup.java new file mode 100644 index 0000000..59c29ad --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductDtoGroup.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Group to which compatible product is assigned to. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibleProductDtoGroup { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public CompatibleProductDtoGroup() { + } + + public CompatibleProductDtoGroup id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Identifier of the group. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibleProductDtoGroup compatibleProductDtoGroup = (CompatibleProductDtoGroup) o; + return Objects.equals(this.id, compatibleProductDtoGroup.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibleProductDtoGroup {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibleProductDtoGroup + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibleProductDtoGroup.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibleProductDtoGroup is not found in the empty JSON string", CompatibleProductDtoGroup.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibleProductDtoGroup.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibleProductDtoGroup` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibleProductDtoGroup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibleProductDtoGroup' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibleProductDtoGroup.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibleProductDtoGroup value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibleProductDtoGroup read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibleProductDtoGroup given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibleProductDtoGroup + * @throws IOException if the JSON string is invalid with respect to CompatibleProductDtoGroup + */ + public static CompatibleProductDtoGroup fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibleProductDtoGroup.class); + } + + /** + * Convert an instance of CompatibleProductDtoGroup to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsGroupsDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsGroupsDto.java new file mode 100644 index 0000000..c916c30 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsGroupsDto.java @@ -0,0 +1,284 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CompatibleProductsGroupsDtoGroupsInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibleProductsGroupsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibleProductsGroupsDto { + public static final String SERIALIZED_NAME_GROUPS = "groups"; + @SerializedName(SERIALIZED_NAME_GROUPS) + @javax.annotation.Nullable + private List groups = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private Integer totalCount; + + public CompatibleProductsGroupsDto() { + } + + public CompatibleProductsGroupsDto groups(@javax.annotation.Nullable List groups) { + this.groups = groups; + return this; + } + + public CompatibleProductsGroupsDto addGroupsItem(CompatibleProductsGroupsDtoGroupsInner groupsItem) { + if (this.groups == null) { + this.groups = new ArrayList<>(); + } + this.groups.add(groupsItem); + return this; + } + + /** + * List of groups for given type of compatible products. + * @return groups + */ + @javax.annotation.Nullable + public List getGroups() { + return groups; + } + + public void setGroups(@javax.annotation.Nullable List groups) { + this.groups = groups; + } + + + public CompatibleProductsGroupsDto count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Number of returned elements. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public CompatibleProductsGroupsDto totalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of available elements. + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibleProductsGroupsDto compatibleProductsGroupsDto = (CompatibleProductsGroupsDto) o; + return Objects.equals(this.groups, compatibleProductsGroupsDto.groups) && + Objects.equals(this.count, compatibleProductsGroupsDto.count) && + Objects.equals(this.totalCount, compatibleProductsGroupsDto.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(groups, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibleProductsGroupsDto {\n"); + sb.append(" groups: ").append(toIndentedString(groups)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("groups"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibleProductsGroupsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibleProductsGroupsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibleProductsGroupsDto is not found in the empty JSON string", CompatibleProductsGroupsDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibleProductsGroupsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibleProductsGroupsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("groups") != null && !jsonObj.get("groups").isJsonNull()) { + JsonArray jsonArraygroups = jsonObj.getAsJsonArray("groups"); + if (jsonArraygroups != null) { + // ensure the json data is an array + if (!jsonObj.get("groups").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `groups` to be an array in the JSON string but got `%s`", jsonObj.get("groups").toString())); + } + + // validate the optional field `groups` (array) + for (int i = 0; i < jsonArraygroups.size(); i++) { + CompatibleProductsGroupsDtoGroupsInner.validateJsonElement(jsonArraygroups.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibleProductsGroupsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibleProductsGroupsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibleProductsGroupsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibleProductsGroupsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibleProductsGroupsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibleProductsGroupsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibleProductsGroupsDto + * @throws IOException if the JSON string is invalid with respect to CompatibleProductsGroupsDto + */ + public static CompatibleProductsGroupsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibleProductsGroupsDto.class); + } + + /** + * Convert an instance of CompatibleProductsGroupsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsGroupsDtoGroupsInner.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsGroupsDtoGroupsInner.java new file mode 100644 index 0000000..aebb5ae --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsGroupsDtoGroupsInner.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibleProductsGroupsDtoGroupsInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibleProductsGroupsDtoGroupsInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public CompatibleProductsGroupsDtoGroupsInner() { + } + + public CompatibleProductsGroupsDtoGroupsInner id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Identifier of the group. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CompatibleProductsGroupsDtoGroupsInner text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Name of the group. + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibleProductsGroupsDtoGroupsInner compatibleProductsGroupsDtoGroupsInner = (CompatibleProductsGroupsDtoGroupsInner) o; + return Objects.equals(this.id, compatibleProductsGroupsDtoGroupsInner.id) && + Objects.equals(this.text, compatibleProductsGroupsDtoGroupsInner.text); + } + + @Override + public int hashCode() { + return Objects.hash(id, text); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibleProductsGroupsDtoGroupsInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("text"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibleProductsGroupsDtoGroupsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibleProductsGroupsDtoGroupsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibleProductsGroupsDtoGroupsInner is not found in the empty JSON string", CompatibleProductsGroupsDtoGroupsInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibleProductsGroupsDtoGroupsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibleProductsGroupsDtoGroupsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibleProductsGroupsDtoGroupsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibleProductsGroupsDtoGroupsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibleProductsGroupsDtoGroupsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibleProductsGroupsDtoGroupsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibleProductsGroupsDtoGroupsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibleProductsGroupsDtoGroupsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibleProductsGroupsDtoGroupsInner + * @throws IOException if the JSON string is invalid with respect to CompatibleProductsGroupsDtoGroupsInner + */ + public static CompatibleProductsGroupsDtoGroupsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibleProductsGroupsDtoGroupsInner.class); + } + + /** + * Convert an instance of CompatibleProductsGroupsDtoGroupsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsListDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsListDto.java new file mode 100644 index 0000000..3735256 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompatibleProductsListDto.java @@ -0,0 +1,284 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CompatibleProductDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompatibleProductsListDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompatibleProductsListDto { + public static final String SERIALIZED_NAME_COMPATIBLE_PRODUCTS = "compatibleProducts"; + @SerializedName(SERIALIZED_NAME_COMPATIBLE_PRODUCTS) + @javax.annotation.Nullable + private List compatibleProducts = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private Integer totalCount; + + public CompatibleProductsListDto() { + } + + public CompatibleProductsListDto compatibleProducts(@javax.annotation.Nullable List compatibleProducts) { + this.compatibleProducts = compatibleProducts; + return this; + } + + public CompatibleProductsListDto addCompatibleProductsItem(CompatibleProductDto compatibleProductsItem) { + if (this.compatibleProducts == null) { + this.compatibleProducts = new ArrayList<>(); + } + this.compatibleProducts.add(compatibleProductsItem); + return this; + } + + /** + * List of compatible products for given type and parameters. + * @return compatibleProducts + */ + @javax.annotation.Nullable + public List getCompatibleProducts() { + return compatibleProducts; + } + + public void setCompatibleProducts(@javax.annotation.Nullable List compatibleProducts) { + this.compatibleProducts = compatibleProducts; + } + + + public CompatibleProductsListDto count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Number of returned elements. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public CompatibleProductsListDto totalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of available elements. Field is not present when `phrase` parameter is used. + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompatibleProductsListDto compatibleProductsListDto = (CompatibleProductsListDto) o; + return Objects.equals(this.compatibleProducts, compatibleProductsListDto.compatibleProducts) && + Objects.equals(this.count, compatibleProductsListDto.count) && + Objects.equals(this.totalCount, compatibleProductsListDto.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(compatibleProducts, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompatibleProductsListDto {\n"); + sb.append(" compatibleProducts: ").append(toIndentedString(compatibleProducts)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("compatibleProducts"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompatibleProductsListDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompatibleProductsListDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompatibleProductsListDto is not found in the empty JSON string", CompatibleProductsListDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompatibleProductsListDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompatibleProductsListDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("compatibleProducts") != null && !jsonObj.get("compatibleProducts").isJsonNull()) { + JsonArray jsonArraycompatibleProducts = jsonObj.getAsJsonArray("compatibleProducts"); + if (jsonArraycompatibleProducts != null) { + // ensure the json data is an array + if (!jsonObj.get("compatibleProducts").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `compatibleProducts` to be an array in the JSON string but got `%s`", jsonObj.get("compatibleProducts").toString())); + } + + // validate the optional field `compatibleProducts` (array) + for (int i = 0; i < jsonArraycompatibleProducts.size(); i++) { + CompatibleProductDto.validateJsonElement(jsonArraycompatibleProducts.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompatibleProductsListDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompatibleProductsListDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompatibleProductsListDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompatibleProductsListDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompatibleProductsListDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompatibleProductsListDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompatibleProductsListDto + * @throws IOException if the JSON string is invalid with respect to CompatibleProductsListDto + */ + public static CompatibleProductsListDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompatibleProductsListDto.class); + } + + /** + * Convert an instance of CompatibleProductsListDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CompensationOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/CompensationOperation.java new file mode 100644 index 0000000..1deb59b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CompensationOperation.java @@ -0,0 +1,225 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CompensationOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CompensationOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "COMPENSATION"; + + public CompensationOperation() { + this.type = this.getClass().getSimpleName(); + } + + public CompensationOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompensationOperation compensationOperation = (CompensationOperation) o; + return Objects.equals(this.type, compensationOperation.type) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompensationOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CompensationOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CompensationOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CompensationOperation is not found in the empty JSON string", CompensationOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CompensationOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CompensationOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CompensationOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CompensationOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CompensationOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CompensationOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CompensationOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CompensationOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CompensationOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of CompensationOperation + * @throws IOException if the JSON string is invalid with respect to CompensationOperation + */ + public static CompensationOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CompensationOperation.class); + } + + /** + * Convert an instance of CompensationOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ConstraintCriteria.java b/src/main/java/pl/wtx/allegro/api/client/model/ConstraintCriteria.java new file mode 100644 index 0000000..dd5329c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ConstraintCriteria.java @@ -0,0 +1,344 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.JustId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ConstraintCriteria + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ConstraintCriteria { + public static final String SERIALIZED_NAME_COUNTRY = "country"; + @SerializedName(SERIALIZED_NAME_COUNTRY) + @javax.annotation.Nullable + private String country; + + /** + * Constraint type. COUNTRY_SAME_QUANTITY is used by additional services that are realised before shipping (e.g. GIFT_WRAP), while COUNTRY_DELIVERY_SAME_QUANTITY is for additional services that are realised in delivery (e.g. CARRY_IN). + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + COUNTRY_SAME_QUANTITY("COUNTRY_SAME_QUANTITY"), + + COUNTRY_DELIVERY_SAME_QUANTITY("COUNTRY_DELIVERY_SAME_QUANTITY"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String SERIALIZED_NAME_DELIVERY_METHODS = "deliveryMethods"; + @SerializedName(SERIALIZED_NAME_DELIVERY_METHODS) + @javax.annotation.Nullable + private List deliveryMethods = new ArrayList<>(); + + public ConstraintCriteria() { + } + + public ConstraintCriteria country(@javax.annotation.Nullable String country) { + this.country = country; + return this; + } + + /** + * Get country + * @return country + */ + @javax.annotation.Nullable + public String getCountry() { + return country; + } + + public void setCountry(@javax.annotation.Nullable String country) { + this.country = country; + } + + + public ConstraintCriteria type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Constraint type. COUNTRY_SAME_QUANTITY is used by additional services that are realised before shipping (e.g. GIFT_WRAP), while COUNTRY_DELIVERY_SAME_QUANTITY is for additional services that are realised in delivery (e.g. CARRY_IN). + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public ConstraintCriteria deliveryMethods(@javax.annotation.Nullable List deliveryMethods) { + this.deliveryMethods = deliveryMethods; + return this; + } + + public ConstraintCriteria addDeliveryMethodsItem(JustId deliveryMethodsItem) { + if (this.deliveryMethods == null) { + this.deliveryMethods = new ArrayList<>(); + } + this.deliveryMethods.add(deliveryMethodsItem); + return this; + } + + /** + * This is used by additional services that are realised in transport (e.g. CARRY_IN), and this field exists together with COUNTRY_DELIVERY_SAME_QUANTITY constraint type. It describes which delivery methods can realise particular service. + * @return deliveryMethods + */ + @javax.annotation.Nullable + public List getDeliveryMethods() { + return deliveryMethods; + } + + public void setDeliveryMethods(@javax.annotation.Nullable List deliveryMethods) { + this.deliveryMethods = deliveryMethods; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConstraintCriteria constraintCriteria = (ConstraintCriteria) o; + return Objects.equals(this.country, constraintCriteria.country) && + Objects.equals(this.type, constraintCriteria.type) && + Objects.equals(this.deliveryMethods, constraintCriteria.deliveryMethods); + } + + @Override + public int hashCode() { + return Objects.hash(country, type, deliveryMethods); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConstraintCriteria {\n"); + sb.append(" country: ").append(toIndentedString(country)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" deliveryMethods: ").append(toIndentedString(deliveryMethods)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("country"); + openapiFields.add("type"); + openapiFields.add("deliveryMethods"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConstraintCriteria + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConstraintCriteria.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConstraintCriteria is not found in the empty JSON string", ConstraintCriteria.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ConstraintCriteria.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ConstraintCriteria` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("country") != null && !jsonObj.get("country").isJsonNull()) && !jsonObj.get("country").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `country` to be a primitive type in the JSON string but got `%s`", jsonObj.get("country").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + if (jsonObj.get("deliveryMethods") != null && !jsonObj.get("deliveryMethods").isJsonNull()) { + JsonArray jsonArraydeliveryMethods = jsonObj.getAsJsonArray("deliveryMethods"); + if (jsonArraydeliveryMethods != null) { + // ensure the json data is an array + if (!jsonObj.get("deliveryMethods").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `deliveryMethods` to be an array in the JSON string but got `%s`", jsonObj.get("deliveryMethods").toString())); + } + + // validate the optional field `deliveryMethods` (array) + for (int i = 0; i < jsonArraydeliveryMethods.size(); i++) { + JustId.validateJsonElement(jsonArraydeliveryMethods.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConstraintCriteria.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConstraintCriteria' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConstraintCriteria.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConstraintCriteria value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ConstraintCriteria read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConstraintCriteria given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConstraintCriteria + * @throws IOException if the JSON string is invalid with respect to ConstraintCriteria + */ + public static ConstraintCriteria fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConstraintCriteria.class); + } + + /** + * Convert an instance of ConstraintCriteria to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Contact.java b/src/main/java/pl/wtx/allegro/api/client/model/Contact.java new file mode 100644 index 0000000..b0e54b0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Contact.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contact + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Contact { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public Contact() { + } + + public Contact id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of contact. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Contact contact = (Contact) o; + return Objects.equals(this.id, contact.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Contact {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Contact + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Contact.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Contact is not found in the empty JSON string", Contact.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Contact.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Contact` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Contact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Contact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Contact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Contact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Contact read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Contact given an JSON string + * + * @param jsonString JSON string + * @return An instance of Contact + * @throws IOException if the JSON string is invalid with respect to Contact + */ + public static Contact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Contact.class); + } + + /** + * Convert an instance of Contact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ContactRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ContactRequest.java new file mode 100644 index 0000000..03a62bb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ContactRequest.java @@ -0,0 +1,308 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.EmailRequest; +import pl.wtx.allegro.api.client.model.PhonesRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ContactRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ContactRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_EMAILS = "emails"; + @SerializedName(SERIALIZED_NAME_EMAILS) + @javax.annotation.Nullable + private List emails = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PHONES = "phones"; + @SerializedName(SERIALIZED_NAME_PHONES) + @javax.annotation.Nullable + private List phones = new ArrayList<>(); + + public ContactRequest() { + } + + public ContactRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ContactRequest emails(@javax.annotation.Nullable List emails) { + this.emails = emails; + return this; + } + + public ContactRequest addEmailsItem(EmailRequest emailsItem) { + if (this.emails == null) { + this.emails = new ArrayList<>(); + } + this.emails.add(emailsItem); + return this; + } + + /** + * Get emails + * @return emails + */ + @javax.annotation.Nullable + public List getEmails() { + return emails; + } + + public void setEmails(@javax.annotation.Nullable List emails) { + this.emails = emails; + } + + + public ContactRequest phones(@javax.annotation.Nullable List phones) { + this.phones = phones; + return this; + } + + public ContactRequest addPhonesItem(PhonesRequest phonesItem) { + if (this.phones == null) { + this.phones = new ArrayList<>(); + } + this.phones.add(phonesItem); + return this; + } + + /** + * Get phones + * @return phones + */ + @javax.annotation.Nullable + public List getPhones() { + return phones; + } + + public void setPhones(@javax.annotation.Nullable List phones) { + this.phones = phones; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ContactRequest contactRequest = (ContactRequest) o; + return Objects.equals(this.name, contactRequest.name) && + Objects.equals(this.emails, contactRequest.emails) && + Objects.equals(this.phones, contactRequest.phones); + } + + @Override + public int hashCode() { + return Objects.hash(name, emails, phones); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContactRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" emails: ").append(toIndentedString(emails)).append("\n"); + sb.append(" phones: ").append(toIndentedString(phones)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("emails"); + openapiFields.add("phones"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ContactRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ContactRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ContactRequest is not found in the empty JSON string", ContactRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ContactRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ContactRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (jsonObj.get("emails") != null && !jsonObj.get("emails").isJsonNull()) { + JsonArray jsonArrayemails = jsonObj.getAsJsonArray("emails"); + if (jsonArrayemails != null) { + // ensure the json data is an array + if (!jsonObj.get("emails").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `emails` to be an array in the JSON string but got `%s`", jsonObj.get("emails").toString())); + } + + // validate the optional field `emails` (array) + for (int i = 0; i < jsonArrayemails.size(); i++) { + EmailRequest.validateJsonElement(jsonArrayemails.get(i)); + }; + } + } + if (jsonObj.get("phones") != null && !jsonObj.get("phones").isJsonNull()) { + JsonArray jsonArrayphones = jsonObj.getAsJsonArray("phones"); + if (jsonArrayphones != null) { + // ensure the json data is an array + if (!jsonObj.get("phones").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `phones` to be an array in the JSON string but got `%s`", jsonObj.get("phones").toString())); + } + + // validate the optional field `phones` (array) + for (int i = 0; i < jsonArrayphones.size(); i++) { + PhonesRequest.validateJsonElement(jsonArrayphones.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ContactRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ContactRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ContactRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ContactRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ContactRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ContactRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ContactRequest + * @throws IOException if the JSON string is invalid with respect to ContactRequest + */ + public static ContactRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ContactRequest.class); + } + + /** + * Convert an instance of ContactRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ContactResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ContactResponse.java new file mode 100644 index 0000000..37b59d2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ContactResponse.java @@ -0,0 +1,338 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.EmailResponse; +import pl.wtx.allegro.api.client.model.PhonesResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ContactResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ContactResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_EMAILS = "emails"; + @SerializedName(SERIALIZED_NAME_EMAILS) + @javax.annotation.Nullable + private List emails = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PHONES = "phones"; + @SerializedName(SERIALIZED_NAME_PHONES) + @javax.annotation.Nullable + private List phones = new ArrayList<>(); + + public ContactResponse() { + } + + public ContactResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ContactResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ContactResponse emails(@javax.annotation.Nullable List emails) { + this.emails = emails; + return this; + } + + public ContactResponse addEmailsItem(EmailResponse emailsItem) { + if (this.emails == null) { + this.emails = new ArrayList<>(); + } + this.emails.add(emailsItem); + return this; + } + + /** + * Get emails + * @return emails + */ + @javax.annotation.Nullable + public List getEmails() { + return emails; + } + + public void setEmails(@javax.annotation.Nullable List emails) { + this.emails = emails; + } + + + public ContactResponse phones(@javax.annotation.Nullable List phones) { + this.phones = phones; + return this; + } + + public ContactResponse addPhonesItem(PhonesResponse phonesItem) { + if (this.phones == null) { + this.phones = new ArrayList<>(); + } + this.phones.add(phonesItem); + return this; + } + + /** + * Get phones + * @return phones + */ + @javax.annotation.Nullable + public List getPhones() { + return phones; + } + + public void setPhones(@javax.annotation.Nullable List phones) { + this.phones = phones; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ContactResponse contactResponse = (ContactResponse) o; + return Objects.equals(this.id, contactResponse.id) && + Objects.equals(this.name, contactResponse.name) && + Objects.equals(this.emails, contactResponse.emails) && + Objects.equals(this.phones, contactResponse.phones); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, emails, phones); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContactResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" emails: ").append(toIndentedString(emails)).append("\n"); + sb.append(" phones: ").append(toIndentedString(phones)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("emails"); + openapiFields.add("phones"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ContactResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ContactResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ContactResponse is not found in the empty JSON string", ContactResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ContactResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ContactResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (jsonObj.get("emails") != null && !jsonObj.get("emails").isJsonNull()) { + JsonArray jsonArrayemails = jsonObj.getAsJsonArray("emails"); + if (jsonArrayemails != null) { + // ensure the json data is an array + if (!jsonObj.get("emails").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `emails` to be an array in the JSON string but got `%s`", jsonObj.get("emails").toString())); + } + + // validate the optional field `emails` (array) + for (int i = 0; i < jsonArrayemails.size(); i++) { + EmailResponse.validateJsonElement(jsonArrayemails.get(i)); + }; + } + } + if (jsonObj.get("phones") != null && !jsonObj.get("phones").isJsonNull()) { + JsonArray jsonArrayphones = jsonObj.getAsJsonArray("phones"); + if (jsonArrayphones != null) { + // ensure the json data is an array + if (!jsonObj.get("phones").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `phones` to be an array in the JSON string but got `%s`", jsonObj.get("phones").toString())); + } + + // validate the optional field `phones` (array) + for (int i = 0; i < jsonArrayphones.size(); i++) { + PhonesResponse.validateJsonElement(jsonArrayphones.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ContactResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ContactResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ContactResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ContactResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ContactResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ContactResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ContactResponse + * @throws IOException if the JSON string is invalid with respect to ContactResponse + */ + public static ContactResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ContactResponse.class); + } + + /** + * Convert an instance of ContactResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ContactResponseList.java b/src/main/java/pl/wtx/allegro/api/client/model/ContactResponseList.java new file mode 100644 index 0000000..407ae56 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ContactResponseList.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ContactResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ContactResponseList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ContactResponseList { + public static final String SERIALIZED_NAME_CONTACTS = "contacts"; + @SerializedName(SERIALIZED_NAME_CONTACTS) + @javax.annotation.Nullable + private List contacts = new ArrayList<>(); + + public ContactResponseList() { + } + + public ContactResponseList contacts(@javax.annotation.Nullable List contacts) { + this.contacts = contacts; + return this; + } + + public ContactResponseList addContactsItem(ContactResponse contactsItem) { + if (this.contacts == null) { + this.contacts = new ArrayList<>(); + } + this.contacts.add(contactsItem); + return this; + } + + /** + * Get contacts + * @return contacts + */ + @javax.annotation.Nullable + public List getContacts() { + return contacts; + } + + public void setContacts(@javax.annotation.Nullable List contacts) { + this.contacts = contacts; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ContactResponseList contactResponseList = (ContactResponseList) o; + return Objects.equals(this.contacts, contactResponseList.contacts); + } + + @Override + public int hashCode() { + return Objects.hash(contacts); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContactResponseList {\n"); + sb.append(" contacts: ").append(toIndentedString(contacts)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("contacts"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ContactResponseList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ContactResponseList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ContactResponseList is not found in the empty JSON string", ContactResponseList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ContactResponseList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ContactResponseList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("contacts") != null && !jsonObj.get("contacts").isJsonNull()) { + JsonArray jsonArraycontacts = jsonObj.getAsJsonArray("contacts"); + if (jsonArraycontacts != null) { + // ensure the json data is an array + if (!jsonObj.get("contacts").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `contacts` to be an array in the JSON string but got `%s`", jsonObj.get("contacts").toString())); + } + + // validate the optional field `contacts` (array) + for (int i = 0; i < jsonArraycontacts.size(); i++) { + ContactResponse.validateJsonElement(jsonArraycontacts.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ContactResponseList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ContactResponseList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ContactResponseList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ContactResponseList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ContactResponseList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ContactResponseList given an JSON string + * + * @param jsonString JSON string + * @return An instance of ContactResponseList + * @throws IOException if the JSON string is invalid with respect to ContactResponseList + */ + public static ContactResponseList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ContactResponseList.class); + } + + /** + * Convert an instance of ContactResponseList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ContributionOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/ContributionOperation.java new file mode 100644 index 0000000..6b9cfc4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ContributionOperation.java @@ -0,0 +1,283 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.BuyerParticipant; +import pl.wtx.allegro.api.client.model.OperationPayment; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ContributionOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ContributionOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "CONTRIBUTION"; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nonnull + private OperationPayment payment; + + public static final String SERIALIZED_NAME_PARTICIPANT = "participant"; + @SerializedName(SERIALIZED_NAME_PARTICIPANT) + @javax.annotation.Nonnull + private BuyerParticipant participant; + + public ContributionOperation() { + this.type = this.getClass().getSimpleName(); + } + + public ContributionOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ContributionOperation payment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nonnull + public OperationPayment getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + } + + + public ContributionOperation participant(@javax.annotation.Nonnull BuyerParticipant participant) { + this.participant = participant; + return this; + } + + /** + * Get participant + * @return participant + */ + @javax.annotation.Nonnull + public BuyerParticipant getParticipant() { + return participant; + } + + public void setParticipant(@javax.annotation.Nonnull BuyerParticipant participant) { + this.participant = participant; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ContributionOperation contributionOperation = (ContributionOperation) o; + return Objects.equals(this.type, contributionOperation.type) && + Objects.equals(this.payment, contributionOperation.payment) && + Objects.equals(this.participant, contributionOperation.participant) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, payment, participant, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContributionOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append(" participant: ").append(toIndentedString(participant)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("payment"); + openapiFields.add("participant"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payment"); + openapiRequiredFields.add("participant"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ContributionOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ContributionOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ContributionOperation is not found in the empty JSON string", ContributionOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ContributionOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ContributionOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ContributionOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ContributionOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ContributionOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ContributionOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ContributionOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ContributionOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ContributionOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ContributionOperation + * @throws IOException if the JSON string is invalid with respect to ContributionOperation + */ + public static ContributionOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ContributionOperation.class); + } + + /** + * Convert an instance of ContributionOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Coordinates.java b/src/main/java/pl/wtx/allegro/api/client/model/Coordinates.java new file mode 100644 index 0000000..fbfa4c1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Coordinates.java @@ -0,0 +1,243 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Coordinates + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Coordinates { + public static final String SERIALIZED_NAME_LAT = "lat"; + @SerializedName(SERIALIZED_NAME_LAT) + @javax.annotation.Nonnull + private Double lat; + + public static final String SERIALIZED_NAME_LON = "lon"; + @SerializedName(SERIALIZED_NAME_LON) + @javax.annotation.Nonnull + private Double lon; + + public Coordinates() { + } + + public Coordinates lat(@javax.annotation.Nonnull Double lat) { + this.lat = lat; + return this; + } + + /** + * Get lat + * minimum: -90 + * maximum: 90 + * @return lat + */ + @javax.annotation.Nonnull + public Double getLat() { + return lat; + } + + public void setLat(@javax.annotation.Nonnull Double lat) { + this.lat = lat; + } + + + public Coordinates lon(@javax.annotation.Nonnull Double lon) { + this.lon = lon; + return this; + } + + /** + * Get lon + * minimum: -180 + * maximum: 180 + * @return lon + */ + @javax.annotation.Nonnull + public Double getLon() { + return lon; + } + + public void setLon(@javax.annotation.Nonnull Double lon) { + this.lon = lon; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Coordinates coordinates = (Coordinates) o; + return Objects.equals(this.lat, coordinates.lat) && + Objects.equals(this.lon, coordinates.lon); + } + + @Override + public int hashCode() { + return Objects.hash(lat, lon); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Coordinates {\n"); + sb.append(" lat: ").append(toIndentedString(lat)).append("\n"); + sb.append(" lon: ").append(toIndentedString(lon)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("lat"); + openapiFields.add("lon"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("lat"); + openapiRequiredFields.add("lon"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Coordinates + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Coordinates.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Coordinates is not found in the empty JSON string", Coordinates.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Coordinates.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Coordinates` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Coordinates.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Coordinates.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Coordinates' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Coordinates.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Coordinates value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Coordinates read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Coordinates given an JSON string + * + * @param jsonString JSON string + * @return An instance of Coordinates + * @throws IOException if the JSON string is invalid with respect to Coordinates + */ + public static Coordinates fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Coordinates.class); + } + + /** + * Convert an instance of Coordinates to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CorrectionOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/CorrectionOperation.java new file mode 100644 index 0000000..a801958 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CorrectionOperation.java @@ -0,0 +1,225 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CorrectionOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CorrectionOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "CORRECTION"; + + public CorrectionOperation() { + this.type = this.getClass().getSimpleName(); + } + + public CorrectionOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CorrectionOperation correctionOperation = (CorrectionOperation) o; + return Objects.equals(this.type, correctionOperation.type) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CorrectionOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CorrectionOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CorrectionOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CorrectionOperation is not found in the empty JSON string", CorrectionOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CorrectionOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CorrectionOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CorrectionOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CorrectionOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CorrectionOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CorrectionOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CorrectionOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CorrectionOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CorrectionOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of CorrectionOperation + * @throws IOException if the JSON string is invalid with respect to CorrectionOperation + */ + public static CorrectionOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CorrectionOperation.class); + } + + /** + * Convert an instance of CorrectionOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Courier.java b/src/main/java/pl/wtx/allegro/api/client/model/Courier.java new file mode 100644 index 0000000..6d42085 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Courier.java @@ -0,0 +1,277 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents courier details of shipping. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Courier { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_TRACKING_NUMBERS = "trackingNumbers"; + @SerializedName(SERIALIZED_NAME_TRACKING_NUMBERS) + @javax.annotation.Nullable + private List trackingNumbers = new ArrayList<>(); + + public Courier() { + } + + public Courier id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Supported courier ids are ALLEGRO, DB_SCHENKER, DHL, DPD, DPD_SK, INPOST, ORLEN, POCZTA_POLSKA, SUUS, UPS. If requested courier is not supported then use OTHER value and provide courier name in name field. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public Courier name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Courier name to be provided only if id is OTHER, otherwise it's ignored. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public Courier trackingNumbers(@javax.annotation.Nullable List trackingNumbers) { + this.trackingNumbers = trackingNumbers; + return this; + } + + public Courier addTrackingNumbersItem(String trackingNumbersItem) { + if (this.trackingNumbers == null) { + this.trackingNumbers = new ArrayList<>(); + } + this.trackingNumbers.add(trackingNumbersItem); + return this; + } + + /** + * List of tracking numbers. + * @return trackingNumbers + */ + @javax.annotation.Nullable + public List getTrackingNumbers() { + return trackingNumbers; + } + + public void setTrackingNumbers(@javax.annotation.Nullable List trackingNumbers) { + this.trackingNumbers = trackingNumbers; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Courier courier = (Courier) o; + return Objects.equals(this.id, courier.id) && + Objects.equals(this.name, courier.name) && + Objects.equals(this.trackingNumbers, courier.trackingNumbers); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, trackingNumbers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Courier {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" trackingNumbers: ").append(toIndentedString(trackingNumbers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("trackingNumbers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Courier + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Courier.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Courier is not found in the empty JSON string", Courier.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Courier.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Courier` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("trackingNumbers") != null && !jsonObj.get("trackingNumbers").isJsonNull() && !jsonObj.get("trackingNumbers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `trackingNumbers` to be an array in the JSON string but got `%s`", jsonObj.get("trackingNumbers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Courier.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Courier' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Courier.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Courier value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Courier read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Courier given an JSON string + * + * @param jsonString JSON string + * @return An instance of Courier + * @throws IOException if the JSON string is invalid with respect to Courier + */ + public static Courier fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Courier.class); + } + + /** + * Convert an instance of Courier to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CourierBySellerShipping.java b/src/main/java/pl/wtx/allegro/api/client/model/CourierBySellerShipping.java new file mode 100644 index 0000000..c90f13d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CourierBySellerShipping.java @@ -0,0 +1,289 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Courier; +import pl.wtx.allegro.api.client.model.Shipping; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CourierBySellerShipping + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CourierBySellerShipping extends Shipping { + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + @javax.annotation.Nullable + protected String method = "COURIER_BY_SELLER"; + + public static final String SERIALIZED_NAME_COURIER = "courier"; + @SerializedName(SERIALIZED_NAME_COURIER) + @javax.annotation.Nullable + private Courier courier; + + public static final String SERIALIZED_NAME_ESTIMATED_TIME_OF_ARRIVAL = "estimatedTimeOfArrival"; + @SerializedName(SERIALIZED_NAME_ESTIMATED_TIME_OF_ARRIVAL) + @javax.annotation.Nullable + private OffsetDateTime estimatedTimeOfArrival; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode; + + public CourierBySellerShipping() { + this.method = this.getClass().getSimpleName(); + } + + public CourierBySellerShipping method(@javax.annotation.Nullable String method) { + this.method = method; + return this; + } + + /** + * Get method + * @return method + */ + @javax.annotation.Nullable + public String getMethod() { + return method; + } + + public void setMethod(@javax.annotation.Nullable String method) { + this.method = method; + } + + + public CourierBySellerShipping courier(@javax.annotation.Nullable Courier courier) { + this.courier = courier; + return this; + } + + /** + * Get courier + * @return courier + */ + @javax.annotation.Nullable + public Courier getCourier() { + return courier; + } + + public void setCourier(@javax.annotation.Nullable Courier courier) { + this.courier = courier; + } + + + public CourierBySellerShipping estimatedTimeOfArrival(@javax.annotation.Nullable OffsetDateTime estimatedTimeOfArrival) { + this.estimatedTimeOfArrival = estimatedTimeOfArrival; + return this; + } + + /** + * The estimated date and time of Advance Ship Notice arrival in the warehouse. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601). + * @return estimatedTimeOfArrival + */ + @javax.annotation.Nullable + public OffsetDateTime getEstimatedTimeOfArrival() { + return estimatedTimeOfArrival; + } + + public void setEstimatedTimeOfArrival(@javax.annotation.Nullable OffsetDateTime estimatedTimeOfArrival) { + this.estimatedTimeOfArrival = estimatedTimeOfArrival; + } + + + public CourierBySellerShipping countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code in ISO 3166-1 alpha-2 format (two-letter code), which means the country from which Advance Ship Notice is sent. + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CourierBySellerShipping courierBySellerShipping = (CourierBySellerShipping) o; + return Objects.equals(this.method, courierBySellerShipping.method) && + Objects.equals(this.courier, courierBySellerShipping.courier) && + Objects.equals(this.estimatedTimeOfArrival, courierBySellerShipping.estimatedTimeOfArrival) && + Objects.equals(this.countryCode, courierBySellerShipping.countryCode) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(method, courier, estimatedTimeOfArrival, countryCode, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CourierBySellerShipping {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" courier: ").append(toIndentedString(courier)).append("\n"); + sb.append(" estimatedTimeOfArrival: ").append(toIndentedString(estimatedTimeOfArrival)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("method"); + openapiFields.add("courier"); + openapiFields.add("estimatedTimeOfArrival"); + openapiFields.add("countryCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CourierBySellerShipping + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CourierBySellerShipping.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CourierBySellerShipping is not found in the empty JSON string", CourierBySellerShipping.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CourierBySellerShipping.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CourierBySellerShipping` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CourierBySellerShipping.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CourierBySellerShipping' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CourierBySellerShipping.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CourierBySellerShipping value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CourierBySellerShipping read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CourierBySellerShipping given an JSON string + * + * @param jsonString JSON string + * @return An instance of CourierBySellerShipping + * @throws IOException if the JSON string is invalid with respect to CourierBySellerShipping + */ + public static CourierBySellerShipping fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CourierBySellerShipping.class); + } + + /** + * Convert an instance of CourierBySellerShipping to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CreateAdvanceShipNoticeRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/CreateAdvanceShipNoticeRequest.java new file mode 100644 index 0000000..03a8312 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CreateAdvanceShipNoticeRequest.java @@ -0,0 +1,296 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.HandlingUnit; +import pl.wtx.allegro.api.client.model.ProductItem; +import pl.wtx.allegro.api.client.model.Shipping; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CreateAdvanceShipNoticeRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CreateAdvanceShipNoticeRequest { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public static final String SERIALIZED_NAME_HANDLING_UNIT = "handlingUnit"; + @SerializedName(SERIALIZED_NAME_HANDLING_UNIT) + @javax.annotation.Nullable + private HandlingUnit handlingUnit; + + public static final String SERIALIZED_NAME_SHIPPING = "shipping"; + @SerializedName(SERIALIZED_NAME_SHIPPING) + @javax.annotation.Nullable + private Shipping shipping; + + public CreateAdvanceShipNoticeRequest() { + } + + public CreateAdvanceShipNoticeRequest items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public CreateAdvanceShipNoticeRequest addItemsItem(ProductItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of product items. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + + public CreateAdvanceShipNoticeRequest handlingUnit(@javax.annotation.Nullable HandlingUnit handlingUnit) { + this.handlingUnit = handlingUnit; + return this; + } + + /** + * Get handlingUnit + * @return handlingUnit + */ + @javax.annotation.Nullable + public HandlingUnit getHandlingUnit() { + return handlingUnit; + } + + public void setHandlingUnit(@javax.annotation.Nullable HandlingUnit handlingUnit) { + this.handlingUnit = handlingUnit; + } + + + public CreateAdvanceShipNoticeRequest shipping(@javax.annotation.Nullable Shipping shipping) { + this.shipping = shipping; + return this; + } + + /** + * Get shipping + * @return shipping + */ + @javax.annotation.Nullable + public Shipping getShipping() { + return shipping; + } + + public void setShipping(@javax.annotation.Nullable Shipping shipping) { + this.shipping = shipping; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAdvanceShipNoticeRequest createAdvanceShipNoticeRequest = (CreateAdvanceShipNoticeRequest) o; + return Objects.equals(this.items, createAdvanceShipNoticeRequest.items) && + Objects.equals(this.handlingUnit, createAdvanceShipNoticeRequest.handlingUnit) && + Objects.equals(this.shipping, createAdvanceShipNoticeRequest.shipping); + } + + @Override + public int hashCode() { + return Objects.hash(items, handlingUnit, shipping); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAdvanceShipNoticeRequest {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" handlingUnit: ").append(toIndentedString(handlingUnit)).append("\n"); + sb.append(" shipping: ").append(toIndentedString(shipping)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("items"); + openapiFields.add("handlingUnit"); + openapiFields.add("shipping"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("items"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAdvanceShipNoticeRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAdvanceShipNoticeRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAdvanceShipNoticeRequest is not found in the empty JSON string", CreateAdvanceShipNoticeRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAdvanceShipNoticeRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAdvanceShipNoticeRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAdvanceShipNoticeRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + ProductItem.validateJsonElement(jsonArrayitems.get(i)); + }; + // validate the optional field `handlingUnit` + if (jsonObj.get("handlingUnit") != null && !jsonObj.get("handlingUnit").isJsonNull()) { + HandlingUnit.validateJsonElement(jsonObj.get("handlingUnit")); + } + // validate the optional field `shipping` + if (jsonObj.get("shipping") != null && !jsonObj.get("shipping").isJsonNull()) { + Shipping.validateJsonElement(jsonObj.get("shipping")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAdvanceShipNoticeRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAdvanceShipNoticeRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAdvanceShipNoticeRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAdvanceShipNoticeRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAdvanceShipNoticeRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAdvanceShipNoticeRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAdvanceShipNoticeRequest + * @throws IOException if the JSON string is invalid with respect to CreateAdvanceShipNoticeRequest + */ + public static CreateAdvanceShipNoticeRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAdvanceShipNoticeRequest.class); + } + + /** + * Convert an instance of CreateAdvanceShipNoticeRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CreateAdvanceShipNoticeResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CreateAdvanceShipNoticeResponse.java new file mode 100644 index 0000000..8e7b536 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CreateAdvanceShipNoticeResponse.java @@ -0,0 +1,479 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.AdvanceShipNoticeStatus; +import pl.wtx.allegro.api.client.model.HandlingUnit; +import pl.wtx.allegro.api.client.model.Labels; +import pl.wtx.allegro.api.client.model.ProductItem; +import pl.wtx.allegro.api.client.model.ShippingExtended; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CreateAdvanceShipNoticeResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CreateAdvanceShipNoticeResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_DISPLAY_NUMBER = "displayNumber"; + @SerializedName(SERIALIZED_NAME_DISPLAY_NUMBER) + @javax.annotation.Nonnull + private String displayNumber; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private AdvanceShipNoticeStatus status; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public static final String SERIALIZED_NAME_HANDLING_UNIT = "handlingUnit"; + @SerializedName(SERIALIZED_NAME_HANDLING_UNIT) + @javax.annotation.Nullable + private HandlingUnit handlingUnit; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable + private Labels labels; + + public static final String SERIALIZED_NAME_SHIPPING = "shipping"; + @SerializedName(SERIALIZED_NAME_SHIPPING) + @javax.annotation.Nullable + private ShippingExtended shipping; + + public CreateAdvanceShipNoticeResponse() { + } + + public CreateAdvanceShipNoticeResponse id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * An UUID identifier of ASN. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public CreateAdvanceShipNoticeResponse displayNumber(@javax.annotation.Nonnull String displayNumber) { + this.displayNumber = displayNumber; + return this; + } + + /** + * A human friendly identifier of ASN. + * @return displayNumber + */ + @javax.annotation.Nonnull + public String getDisplayNumber() { + return displayNumber; + } + + public void setDisplayNumber(@javax.annotation.Nonnull String displayNumber) { + this.displayNumber = displayNumber; + } + + + public CreateAdvanceShipNoticeResponse status(@javax.annotation.Nonnull AdvanceShipNoticeStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public AdvanceShipNoticeStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull AdvanceShipNoticeStatus status) { + this.status = status; + } + + + public CreateAdvanceShipNoticeResponse createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The date and time of Advance Ship Notice creation. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601). + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public CreateAdvanceShipNoticeResponse updatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The date and time of last Advance Ship Notice update. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601). + * @return updatedAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public CreateAdvanceShipNoticeResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public CreateAdvanceShipNoticeResponse addItemsItem(ProductItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of product items. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + + public CreateAdvanceShipNoticeResponse handlingUnit(@javax.annotation.Nullable HandlingUnit handlingUnit) { + this.handlingUnit = handlingUnit; + return this; + } + + /** + * Get handlingUnit + * @return handlingUnit + */ + @javax.annotation.Nullable + public HandlingUnit getHandlingUnit() { + return handlingUnit; + } + + public void setHandlingUnit(@javax.annotation.Nullable HandlingUnit handlingUnit) { + this.handlingUnit = handlingUnit; + } + + + public CreateAdvanceShipNoticeResponse labels(@javax.annotation.Nullable Labels labels) { + this.labels = labels; + return this; + } + + /** + * Get labels + * @return labels + */ + @javax.annotation.Nullable + public Labels getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Labels labels) { + this.labels = labels; + } + + + public CreateAdvanceShipNoticeResponse shipping(@javax.annotation.Nullable ShippingExtended shipping) { + this.shipping = shipping; + return this; + } + + /** + * Get shipping + * @return shipping + */ + @javax.annotation.Nullable + public ShippingExtended getShipping() { + return shipping; + } + + public void setShipping(@javax.annotation.Nullable ShippingExtended shipping) { + this.shipping = shipping; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAdvanceShipNoticeResponse createAdvanceShipNoticeResponse = (CreateAdvanceShipNoticeResponse) o; + return Objects.equals(this.id, createAdvanceShipNoticeResponse.id) && + Objects.equals(this.displayNumber, createAdvanceShipNoticeResponse.displayNumber) && + Objects.equals(this.status, createAdvanceShipNoticeResponse.status) && + Objects.equals(this.createdAt, createAdvanceShipNoticeResponse.createdAt) && + Objects.equals(this.updatedAt, createAdvanceShipNoticeResponse.updatedAt) && + Objects.equals(this.items, createAdvanceShipNoticeResponse.items) && + Objects.equals(this.handlingUnit, createAdvanceShipNoticeResponse.handlingUnit) && + Objects.equals(this.labels, createAdvanceShipNoticeResponse.labels) && + Objects.equals(this.shipping, createAdvanceShipNoticeResponse.shipping); + } + + @Override + public int hashCode() { + return Objects.hash(id, displayNumber, status, createdAt, updatedAt, items, handlingUnit, labels, shipping); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAdvanceShipNoticeResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" displayNumber: ").append(toIndentedString(displayNumber)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" handlingUnit: ").append(toIndentedString(handlingUnit)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" shipping: ").append(toIndentedString(shipping)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("displayNumber"); + openapiFields.add("status"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("items"); + openapiFields.add("handlingUnit"); + openapiFields.add("labels"); + openapiFields.add("shipping"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("displayNumber"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + openapiRequiredFields.add("items"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAdvanceShipNoticeResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAdvanceShipNoticeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAdvanceShipNoticeResponse is not found in the empty JSON string", CreateAdvanceShipNoticeResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAdvanceShipNoticeResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAdvanceShipNoticeResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAdvanceShipNoticeResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("displayNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `displayNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayNumber").toString())); + } + // validate the required field `status` + AdvanceShipNoticeStatus.validateJsonElement(jsonObj.get("status")); + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + ProductItem.validateJsonElement(jsonArrayitems.get(i)); + }; + // validate the optional field `handlingUnit` + if (jsonObj.get("handlingUnit") != null && !jsonObj.get("handlingUnit").isJsonNull()) { + HandlingUnit.validateJsonElement(jsonObj.get("handlingUnit")); + } + // validate the optional field `labels` + if (jsonObj.get("labels") != null && !jsonObj.get("labels").isJsonNull()) { + Labels.validateJsonElement(jsonObj.get("labels")); + } + // validate the optional field `shipping` + if (jsonObj.get("shipping") != null && !jsonObj.get("shipping").isJsonNull()) { + ShippingExtended.validateJsonElement(jsonObj.get("shipping")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAdvanceShipNoticeResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAdvanceShipNoticeResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAdvanceShipNoticeResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAdvanceShipNoticeResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAdvanceShipNoticeResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAdvanceShipNoticeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAdvanceShipNoticeResponse + * @throws IOException if the JSON string is invalid with respect to CreateAdvanceShipNoticeResponse + */ + public static CreateAdvanceShipNoticeResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAdvanceShipNoticeResponse.class); + } + + /** + * Convert an instance of CreateAdvanceShipNoticeResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest.java new file mode 100644 index 0000000..8416e4b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest() { + } + + public CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest createAfterSalesServiceConditionsAttachmentUsingPOSTRequest = (CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest) o; + return Objects.equals(this.name, createAfterSalesServiceConditionsAttachmentUsingPOSTRequest.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest is not found in the empty JSON string", CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest + * @throws IOException if the JSON string is invalid with respect to CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest + */ + public static CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest.class); + } + + /** + * Convert an instance of CreateAfterSalesServiceConditionsAttachmentUsingPOSTRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CreateOfferBundleDTO.java b/src/main/java/pl/wtx/allegro/api/client/model/CreateOfferBundleDTO.java new file mode 100644 index 0000000..1bbe304 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CreateOfferBundleDTO.java @@ -0,0 +1,294 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.BundleDiscountDTO; +import pl.wtx.allegro.api.client.model.BundledOfferDTO; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CreateOfferBundleDTO + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CreateOfferBundleDTO { + public static final String SERIALIZED_NAME_OFFERS = "offers"; + @SerializedName(SERIALIZED_NAME_OFFERS) + @javax.annotation.Nonnull + private List offers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DISCOUNTS = "discounts"; + @SerializedName(SERIALIZED_NAME_DISCOUNTS) + @javax.annotation.Nullable + private List discounts; + + public CreateOfferBundleDTO() { + } + + public CreateOfferBundleDTO offers(@javax.annotation.Nonnull List offers) { + this.offers = offers; + return this; + } + + public CreateOfferBundleDTO addOffersItem(BundledOfferDTO offersItem) { + if (this.offers == null) { + this.offers = new ArrayList<>(); + } + this.offers.add(offersItem); + return this; + } + + /** + * Offers that will make up the bundle. + * @return offers + */ + @javax.annotation.Nonnull + public List getOffers() { + return offers; + } + + public void setOffers(@javax.annotation.Nonnull List offers) { + this.offers = offers; + } + + + public CreateOfferBundleDTO discounts(@javax.annotation.Nullable List discounts) { + this.discounts = discounts; + return this; + } + + public CreateOfferBundleDTO addDiscountsItem(BundleDiscountDTO discountsItem) { + if (this.discounts == null) { + this.discounts = new ArrayList<>(); + } + this.discounts.add(discountsItem); + return this; + } + + /** + * Discounts on marketplaces. Can be null or empty if bundle shouldn't have discount on any marketplace. + * @return discounts + */ + @javax.annotation.Nullable + public List getDiscounts() { + return discounts; + } + + public void setDiscounts(@javax.annotation.Nullable List discounts) { + this.discounts = discounts; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateOfferBundleDTO createOfferBundleDTO = (CreateOfferBundleDTO) o; + return Objects.equals(this.offers, createOfferBundleDTO.offers) && + Objects.equals(this.discounts, createOfferBundleDTO.discounts); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(offers, discounts); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateOfferBundleDTO {\n"); + sb.append(" offers: ").append(toIndentedString(offers)).append("\n"); + sb.append(" discounts: ").append(toIndentedString(discounts)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offers"); + openapiFields.add("discounts"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offers"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateOfferBundleDTO + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateOfferBundleDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateOfferBundleDTO is not found in the empty JSON string", CreateOfferBundleDTO.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateOfferBundleDTO.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateOfferBundleDTO` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateOfferBundleDTO.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("offers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offers` to be an array in the JSON string but got `%s`", jsonObj.get("offers").toString())); + } + + JsonArray jsonArrayoffers = jsonObj.getAsJsonArray("offers"); + // validate the required field `offers` (array) + for (int i = 0; i < jsonArrayoffers.size(); i++) { + BundledOfferDTO.validateJsonElement(jsonArrayoffers.get(i)); + }; + if (jsonObj.get("discounts") != null && !jsonObj.get("discounts").isJsonNull()) { + JsonArray jsonArraydiscounts = jsonObj.getAsJsonArray("discounts"); + if (jsonArraydiscounts != null) { + // ensure the json data is an array + if (!jsonObj.get("discounts").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `discounts` to be an array in the JSON string but got `%s`", jsonObj.get("discounts").toString())); + } + + // validate the optional field `discounts` (array) + for (int i = 0; i < jsonArraydiscounts.size(); i++) { + BundleDiscountDTO.validateJsonElement(jsonArraydiscounts.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateOfferBundleDTO.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateOfferBundleDTO' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateOfferBundleDTO.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateOfferBundleDTO value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateOfferBundleDTO read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateOfferBundleDTO given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateOfferBundleDTO + * @throws IOException if the JSON string is invalid with respect to CreateOfferBundleDTO + */ + public static CreateOfferBundleDTO fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateOfferBundleDTO.class); + } + + /** + * Convert an instance of CreateOfferBundleDTO to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CreatePickupCommandStatusDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CreatePickupCommandStatusDto.java new file mode 100644 index 0000000..22dbd56 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CreatePickupCommandStatusDto.java @@ -0,0 +1,406 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error400; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CreatePickupCommandStatusDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CreatePickupCommandStatusDto { + public static final String SERIALIZED_NAME_COMMAND_ID = "commandId"; + @SerializedName(SERIALIZED_NAME_COMMAND_ID) + @javax.annotation.Nullable + private String commandId; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + IN_PROGRESS("IN_PROGRESS"), + + SUCCESS("SUCCESS"), + + ERROR("ERROR"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PICKUP_ID = "pickupId"; + @SerializedName(SERIALIZED_NAME_PICKUP_ID) + @javax.annotation.Nullable + private String pickupId; + + public static final String SERIALIZED_NAME_CARRIER_PICKUP_ID = "carrierPickupId"; + @SerializedName(SERIALIZED_NAME_CARRIER_PICKUP_ID) + @javax.annotation.Nullable + private String carrierPickupId; + + public CreatePickupCommandStatusDto() { + } + + public CreatePickupCommandStatusDto commandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + return this; + } + + /** + * Command UUID + * @return commandId + */ + @javax.annotation.Nullable + public String getCommandId() { + return commandId; + } + + public void setCommandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + } + + + public CreatePickupCommandStatusDto status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public CreatePickupCommandStatusDto errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public CreatePickupCommandStatusDto addErrorsItem(Error400 errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * List of errors. Available only, if operation finished with ERROR. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + public CreatePickupCommandStatusDto pickupId(@javax.annotation.Nullable String pickupId) { + this.pickupId = pickupId; + return this; + } + + /** + * Generated internal pickup ID. Available only, if operation finished with SUCCESS. + * @return pickupId + */ + @javax.annotation.Nullable + public String getPickupId() { + return pickupId; + } + + public void setPickupId(@javax.annotation.Nullable String pickupId) { + this.pickupId = pickupId; + } + + + public CreatePickupCommandStatusDto carrierPickupId(@javax.annotation.Nullable String carrierPickupId) { + this.carrierPickupId = carrierPickupId; + return this; + } + + /** + * Generated Carrier Pickup ID. Available only, if operation finished with SUCCESS. + * @return carrierPickupId + */ + @javax.annotation.Nullable + public String getCarrierPickupId() { + return carrierPickupId; + } + + public void setCarrierPickupId(@javax.annotation.Nullable String carrierPickupId) { + this.carrierPickupId = carrierPickupId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePickupCommandStatusDto createPickupCommandStatusDto = (CreatePickupCommandStatusDto) o; + return Objects.equals(this.commandId, createPickupCommandStatusDto.commandId) && + Objects.equals(this.status, createPickupCommandStatusDto.status) && + Objects.equals(this.errors, createPickupCommandStatusDto.errors) && + Objects.equals(this.pickupId, createPickupCommandStatusDto.pickupId) && + Objects.equals(this.carrierPickupId, createPickupCommandStatusDto.carrierPickupId); + } + + @Override + public int hashCode() { + return Objects.hash(commandId, status, errors, pickupId, carrierPickupId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePickupCommandStatusDto {\n"); + sb.append(" commandId: ").append(toIndentedString(commandId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" pickupId: ").append(toIndentedString(pickupId)).append("\n"); + sb.append(" carrierPickupId: ").append(toIndentedString(carrierPickupId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("commandId"); + openapiFields.add("status"); + openapiFields.add("errors"); + openapiFields.add("pickupId"); + openapiFields.add("carrierPickupId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePickupCommandStatusDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePickupCommandStatusDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePickupCommandStatusDto is not found in the empty JSON string", CreatePickupCommandStatusDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePickupCommandStatusDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePickupCommandStatusDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("commandId") != null && !jsonObj.get("commandId").isJsonNull()) && !jsonObj.get("commandId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commandId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commandId").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error400.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + if ((jsonObj.get("pickupId") != null && !jsonObj.get("pickupId").isJsonNull()) && !jsonObj.get("pickupId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `pickupId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pickupId").toString())); + } + if ((jsonObj.get("carrierPickupId") != null && !jsonObj.get("carrierPickupId").isJsonNull()) && !jsonObj.get("carrierPickupId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `carrierPickupId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierPickupId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePickupCommandStatusDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePickupCommandStatusDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePickupCommandStatusDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePickupCommandStatusDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePickupCommandStatusDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePickupCommandStatusDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePickupCommandStatusDto + * @throws IOException if the JSON string is invalid with respect to CreatePickupCommandStatusDto + */ + public static CreatePickupCommandStatusDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePickupCommandStatusDto.class); + } + + /** + * Convert an instance of CreatePickupCommandStatusDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CreateProductOffers422Response.java b/src/main/java/pl/wtx/allegro/api/client/model/CreateProductOffers422Response.java new file mode 100644 index 0000000..fadc84c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CreateProductOffers422Response.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CreateProductOffers422Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CreateProductOffers422Response { + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors; + + public CreateProductOffers422Response() { + } + + public CreateProductOffers422Response errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public CreateProductOffers422Response addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * The list of all the error objects explaining the error. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateProductOffers422Response createProductOffers422Response = (CreateProductOffers422Response) o; + return Objects.equals(this.errors, createProductOffers422Response.errors); + } + + @Override + public int hashCode() { + return Objects.hash(errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateProductOffers422Response {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateProductOffers422Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateProductOffers422Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateProductOffers422Response is not found in the empty JSON string", CreateProductOffers422Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateProductOffers422Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateProductOffers422Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateProductOffers422Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateProductOffers422Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateProductOffers422Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateProductOffers422Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateProductOffers422Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateProductOffers422Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateProductOffers422Response + * @throws IOException if the JSON string is invalid with respect to CreateProductOffers422Response + */ + public static CreateProductOffers422Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateProductOffers422Response.class); + } + + /** + * Convert an instance of CreateProductOffers422Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CreateResponsiblePersonRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/CreateResponsiblePersonRequest.java new file mode 100644 index 0000000..d65f923 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CreateResponsiblePersonRequest.java @@ -0,0 +1,238 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CreateResponsiblePersonRequestPersonalData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CreateResponsiblePersonRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CreateResponsiblePersonRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PERSONAL_DATA = "personalData"; + @SerializedName(SERIALIZED_NAME_PERSONAL_DATA) + @javax.annotation.Nullable + private CreateResponsiblePersonRequestPersonalData personalData; + + public CreateResponsiblePersonRequest() { + } + + public CreateResponsiblePersonRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Internal name of responsible person in dictionary (visible only to you). Can't start or end with whitespace. Can't contain whitespaces other than space. Can't contain multiple spaces in a row. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CreateResponsiblePersonRequest personalData(@javax.annotation.Nullable CreateResponsiblePersonRequestPersonalData personalData) { + this.personalData = personalData; + return this; + } + + /** + * Get personalData + * @return personalData + */ + @javax.annotation.Nullable + public CreateResponsiblePersonRequestPersonalData getPersonalData() { + return personalData; + } + + public void setPersonalData(@javax.annotation.Nullable CreateResponsiblePersonRequestPersonalData personalData) { + this.personalData = personalData; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateResponsiblePersonRequest createResponsiblePersonRequest = (CreateResponsiblePersonRequest) o; + return Objects.equals(this.name, createResponsiblePersonRequest.name) && + Objects.equals(this.personalData, createResponsiblePersonRequest.personalData); + } + + @Override + public int hashCode() { + return Objects.hash(name, personalData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateResponsiblePersonRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" personalData: ").append(toIndentedString(personalData)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("personalData"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateResponsiblePersonRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateResponsiblePersonRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateResponsiblePersonRequest is not found in the empty JSON string", CreateResponsiblePersonRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateResponsiblePersonRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateResponsiblePersonRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `personalData` + if (jsonObj.get("personalData") != null && !jsonObj.get("personalData").isJsonNull()) { + CreateResponsiblePersonRequestPersonalData.validateJsonElement(jsonObj.get("personalData")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateResponsiblePersonRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateResponsiblePersonRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateResponsiblePersonRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateResponsiblePersonRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateResponsiblePersonRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateResponsiblePersonRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateResponsiblePersonRequest + * @throws IOException if the JSON string is invalid with respect to CreateResponsiblePersonRequest + */ + public static CreateResponsiblePersonRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateResponsiblePersonRequest.class); + } + + /** + * Convert an instance of CreateResponsiblePersonRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CreateResponsiblePersonRequestPersonalData.java b/src/main/java/pl/wtx/allegro/api/client/model/CreateResponsiblePersonRequestPersonalData.java new file mode 100644 index 0000000..70394fe --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CreateResponsiblePersonRequestPersonalData.java @@ -0,0 +1,270 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ResponsiblePersonAddress; +import pl.wtx.allegro.api.client.model.ResponsiblePersonContact; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Responsible person personal data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CreateResponsiblePersonRequestPersonalData { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private ResponsiblePersonAddress address; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + @javax.annotation.Nullable + private ResponsiblePersonContact contact; + + public CreateResponsiblePersonRequestPersonalData() { + } + + public CreateResponsiblePersonRequestPersonalData name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of responsible person. Can't start or end with whitespace. Can't contain whitespaces other than space. Can't contain multiple spaces in a row. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CreateResponsiblePersonRequestPersonalData address(@javax.annotation.Nullable ResponsiblePersonAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public ResponsiblePersonAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable ResponsiblePersonAddress address) { + this.address = address; + } + + + public CreateResponsiblePersonRequestPersonalData contact(@javax.annotation.Nullable ResponsiblePersonContact contact) { + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + */ + @javax.annotation.Nullable + public ResponsiblePersonContact getContact() { + return contact; + } + + public void setContact(@javax.annotation.Nullable ResponsiblePersonContact contact) { + this.contact = contact; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateResponsiblePersonRequestPersonalData createResponsiblePersonRequestPersonalData = (CreateResponsiblePersonRequestPersonalData) o; + return Objects.equals(this.name, createResponsiblePersonRequestPersonalData.name) && + Objects.equals(this.address, createResponsiblePersonRequestPersonalData.address) && + Objects.equals(this.contact, createResponsiblePersonRequestPersonalData.contact); + } + + @Override + public int hashCode() { + return Objects.hash(name, address, contact); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateResponsiblePersonRequestPersonalData {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("address"); + openapiFields.add("contact"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateResponsiblePersonRequestPersonalData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateResponsiblePersonRequestPersonalData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateResponsiblePersonRequestPersonalData is not found in the empty JSON string", CreateResponsiblePersonRequestPersonalData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateResponsiblePersonRequestPersonalData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateResponsiblePersonRequestPersonalData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + ResponsiblePersonAddress.validateJsonElement(jsonObj.get("address")); + } + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + ResponsiblePersonContact.validateJsonElement(jsonObj.get("contact")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateResponsiblePersonRequestPersonalData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateResponsiblePersonRequestPersonalData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateResponsiblePersonRequestPersonalData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateResponsiblePersonRequestPersonalData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateResponsiblePersonRequestPersonalData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateResponsiblePersonRequestPersonalData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateResponsiblePersonRequestPersonalData + * @throws IOException if the JSON string is invalid with respect to CreateResponsiblePersonRequestPersonalData + */ + public static CreateResponsiblePersonRequestPersonalData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateResponsiblePersonRequestPersonalData.class); + } + + /** + * Convert an instance of CreateResponsiblePersonRequestPersonalData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CreateResponsibleProducerRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/CreateResponsibleProducerRequest.java new file mode 100644 index 0000000..86b5f95 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CreateResponsibleProducerRequest.java @@ -0,0 +1,238 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ResponsibleProducerResponseProducerData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CreateResponsibleProducerRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CreateResponsibleProducerRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PRODUCER_DATA = "producerData"; + @SerializedName(SERIALIZED_NAME_PRODUCER_DATA) + @javax.annotation.Nullable + private ResponsibleProducerResponseProducerData producerData; + + public CreateResponsibleProducerRequest() { + } + + public CreateResponsibleProducerRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Internal name of responsible producer in dictionary (visible only to you). Can't start or end with whitespace. Can't contain whitespaces other than space. Can't contain multiple spaces in a row. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CreateResponsibleProducerRequest producerData(@javax.annotation.Nullable ResponsibleProducerResponseProducerData producerData) { + this.producerData = producerData; + return this; + } + + /** + * Get producerData + * @return producerData + */ + @javax.annotation.Nullable + public ResponsibleProducerResponseProducerData getProducerData() { + return producerData; + } + + public void setProducerData(@javax.annotation.Nullable ResponsibleProducerResponseProducerData producerData) { + this.producerData = producerData; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateResponsibleProducerRequest createResponsibleProducerRequest = (CreateResponsibleProducerRequest) o; + return Objects.equals(this.name, createResponsibleProducerRequest.name) && + Objects.equals(this.producerData, createResponsibleProducerRequest.producerData); + } + + @Override + public int hashCode() { + return Objects.hash(name, producerData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateResponsibleProducerRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" producerData: ").append(toIndentedString(producerData)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("producerData"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateResponsibleProducerRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateResponsibleProducerRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateResponsibleProducerRequest is not found in the empty JSON string", CreateResponsibleProducerRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateResponsibleProducerRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateResponsibleProducerRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `producerData` + if (jsonObj.get("producerData") != null && !jsonObj.get("producerData").isJsonNull()) { + ResponsibleProducerResponseProducerData.validateJsonElement(jsonObj.get("producerData")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateResponsibleProducerRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateResponsibleProducerRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateResponsibleProducerRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateResponsibleProducerRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateResponsibleProducerRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateResponsibleProducerRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateResponsibleProducerRequest + * @throws IOException if the JSON string is invalid with respect to CreateResponsibleProducerRequest + */ + public static CreateResponsibleProducerRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateResponsibleProducerRequest.class); + } + + /** + * Convert an instance of CreateResponsibleProducerRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CreateShipmentCommandStatusDto.java b/src/main/java/pl/wtx/allegro/api/client/model/CreateShipmentCommandStatusDto.java new file mode 100644 index 0000000..042d541 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CreateShipmentCommandStatusDto.java @@ -0,0 +1,376 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error400; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CreateShipmentCommandStatusDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CreateShipmentCommandStatusDto { + public static final String SERIALIZED_NAME_COMMAND_ID = "commandId"; + @SerializedName(SERIALIZED_NAME_COMMAND_ID) + @javax.annotation.Nullable + private String commandId; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + IN_PROGRESS("IN_PROGRESS"), + + SUCCESS("SUCCESS"), + + ERROR("ERROR"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public static final String SERIALIZED_NAME_SHIPMENT_ID = "shipmentId"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_ID) + @javax.annotation.Nullable + private String shipmentId; + + public CreateShipmentCommandStatusDto() { + } + + public CreateShipmentCommandStatusDto commandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + return this; + } + + /** + * Command UUID + * @return commandId + */ + @javax.annotation.Nullable + public String getCommandId() { + return commandId; + } + + public void setCommandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + } + + + public CreateShipmentCommandStatusDto status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public CreateShipmentCommandStatusDto errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public CreateShipmentCommandStatusDto addErrorsItem(Error400 errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * List of errors. Available only, if operation finished with ERROR. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + public CreateShipmentCommandStatusDto shipmentId(@javax.annotation.Nullable String shipmentId) { + this.shipmentId = shipmentId; + return this; + } + + /** + * Generated shipment ID. Available only, if operation finished with SUCCESS. + * @return shipmentId + */ + @javax.annotation.Nullable + public String getShipmentId() { + return shipmentId; + } + + public void setShipmentId(@javax.annotation.Nullable String shipmentId) { + this.shipmentId = shipmentId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateShipmentCommandStatusDto createShipmentCommandStatusDto = (CreateShipmentCommandStatusDto) o; + return Objects.equals(this.commandId, createShipmentCommandStatusDto.commandId) && + Objects.equals(this.status, createShipmentCommandStatusDto.status) && + Objects.equals(this.errors, createShipmentCommandStatusDto.errors) && + Objects.equals(this.shipmentId, createShipmentCommandStatusDto.shipmentId); + } + + @Override + public int hashCode() { + return Objects.hash(commandId, status, errors, shipmentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateShipmentCommandStatusDto {\n"); + sb.append(" commandId: ").append(toIndentedString(commandId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" shipmentId: ").append(toIndentedString(shipmentId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("commandId"); + openapiFields.add("status"); + openapiFields.add("errors"); + openapiFields.add("shipmentId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateShipmentCommandStatusDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateShipmentCommandStatusDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateShipmentCommandStatusDto is not found in the empty JSON string", CreateShipmentCommandStatusDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateShipmentCommandStatusDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateShipmentCommandStatusDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("commandId") != null && !jsonObj.get("commandId").isJsonNull()) && !jsonObj.get("commandId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commandId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commandId").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error400.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + if ((jsonObj.get("shipmentId") != null && !jsonObj.get("shipmentId").isJsonNull()) && !jsonObj.get("shipmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `shipmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shipmentId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateShipmentCommandStatusDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateShipmentCommandStatusDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateShipmentCommandStatusDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateShipmentCommandStatusDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateShipmentCommandStatusDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateShipmentCommandStatusDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateShipmentCommandStatusDto + * @throws IOException if the JSON string is invalid with respect to CreateShipmentCommandStatusDto + */ + public static CreateShipmentCommandStatusDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateShipmentCommandStatusDto.class); + } + + /** + * Convert an instance of CreateShipmentCommandStatusDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CurrentPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/CurrentPrice.java new file mode 100644 index 0000000..ad50419 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CurrentPrice.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The current highest bid in auction format. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CurrentPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public CurrentPrice() { + } + + public CurrentPrice amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public CurrentPrice currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CurrentPrice currentPrice = (CurrentPrice) o; + return Objects.equals(this.amount, currentPrice.amount) && + Objects.equals(this.currency, currentPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CurrentPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CurrentPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CurrentPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CurrentPrice is not found in the empty JSON string", CurrentPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CurrentPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CurrentPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CurrentPrice.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CurrentPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CurrentPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CurrentPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CurrentPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CurrentPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CurrentPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of CurrentPrice + * @throws IOException if the JSON string is invalid with respect to CurrentPrice + */ + public static CurrentPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CurrentPrice.class); + } + + /** + * Convert an instance of CurrentPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturn.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturn.java new file mode 100644 index 0000000..b461a27 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturn.java @@ -0,0 +1,552 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CustomerReturnBuyer; +import pl.wtx.allegro.api.client.model.CustomerReturnItem; +import pl.wtx.allegro.api.client.model.CustomerReturnRefund; +import pl.wtx.allegro.api.client.model.CustomerReturnRejection; +import pl.wtx.allegro.api.client.model.CustomerReturnReturnParcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CustomerReturn + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturn { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_REFERENCE_NUMBER = "referenceNumber"; + @SerializedName(SERIALIZED_NAME_REFERENCE_NUMBER) + @javax.annotation.Nullable + private String referenceNumber; + + public static final String SERIALIZED_NAME_ORDER_ID = "orderId"; + @SerializedName(SERIALIZED_NAME_ORDER_ID) + @javax.annotation.Nullable + private String orderId; + + public static final String SERIALIZED_NAME_BUYER = "buyer"; + @SerializedName(SERIALIZED_NAME_BUYER) + @javax.annotation.Nullable + private CustomerReturnBuyer buyer; + + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nullable + private List items = new ArrayList<>(); + + public static final String SERIALIZED_NAME_REFUND = "refund"; + @SerializedName(SERIALIZED_NAME_REFUND) + @javax.annotation.Nullable + private CustomerReturnRefund refund; + + public static final String SERIALIZED_NAME_PARCELS = "parcels"; + @SerializedName(SERIALIZED_NAME_PARCELS) + @javax.annotation.Nullable + private List parcels = new ArrayList<>(); + + public static final String SERIALIZED_NAME_REJECTION = "rejection"; + @SerializedName(SERIALIZED_NAME_REJECTION) + @javax.annotation.Nullable + private CustomerReturnRejection rejection; + + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private String status; + + public CustomerReturn() { + } + + public CustomerReturn id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public CustomerReturn createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public CustomerReturn referenceNumber(@javax.annotation.Nullable String referenceNumber) { + this.referenceNumber = referenceNumber; + return this; + } + + /** + * Get referenceNumber + * @return referenceNumber + */ + @javax.annotation.Nullable + public String getReferenceNumber() { + return referenceNumber; + } + + public void setReferenceNumber(@javax.annotation.Nullable String referenceNumber) { + this.referenceNumber = referenceNumber; + } + + + public CustomerReturn orderId(@javax.annotation.Nullable String orderId) { + this.orderId = orderId; + return this; + } + + /** + * Get orderId + * @return orderId + */ + @javax.annotation.Nullable + public String getOrderId() { + return orderId; + } + + public void setOrderId(@javax.annotation.Nullable String orderId) { + this.orderId = orderId; + } + + + public CustomerReturn buyer(@javax.annotation.Nullable CustomerReturnBuyer buyer) { + this.buyer = buyer; + return this; + } + + /** + * Get buyer + * @return buyer + */ + @javax.annotation.Nullable + public CustomerReturnBuyer getBuyer() { + return buyer; + } + + public void setBuyer(@javax.annotation.Nullable CustomerReturnBuyer buyer) { + this.buyer = buyer; + } + + + public CustomerReturn items(@javax.annotation.Nullable List items) { + this.items = items; + return this; + } + + public CustomerReturn addItemsItem(CustomerReturnItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * List of returned items. + * @return items + */ + @javax.annotation.Nullable + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nullable List items) { + this.items = items; + } + + + public CustomerReturn refund(@javax.annotation.Nullable CustomerReturnRefund refund) { + this.refund = refund; + return this; + } + + /** + * Get refund + * @return refund + */ + @javax.annotation.Nullable + public CustomerReturnRefund getRefund() { + return refund; + } + + public void setRefund(@javax.annotation.Nullable CustomerReturnRefund refund) { + this.refund = refund; + } + + + public CustomerReturn parcels(@javax.annotation.Nullable List parcels) { + this.parcels = parcels; + return this; + } + + public CustomerReturn addParcelsItem(CustomerReturnReturnParcel parcelsItem) { + if (this.parcels == null) { + this.parcels = new ArrayList<>(); + } + this.parcels.add(parcelsItem); + return this; + } + + /** + * List of returned parcels. + * @return parcels + */ + @javax.annotation.Nullable + public List getParcels() { + return parcels; + } + + public void setParcels(@javax.annotation.Nullable List parcels) { + this.parcels = parcels; + } + + + public CustomerReturn rejection(@javax.annotation.Nullable CustomerReturnRejection rejection) { + this.rejection = rejection; + return this; + } + + /** + * Get rejection + * @return rejection + */ + @javax.annotation.Nullable + public CustomerReturnRejection getRejection() { + return rejection; + } + + public void setRejection(@javax.annotation.Nullable CustomerReturnRejection rejection) { + this.rejection = rejection; + } + + + public CustomerReturn marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * The marketplace ID where operation was made. + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + public CustomerReturn status(@javax.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Current return timeline statuses. The allowed values are: * CREATED - The return has been declared, * DISPATCHED - The returned items have been dispatched, * IN_TRANSIT - The returned items are in transit, * DELIVERED - The returned items have been delivered, * FINISHED - The payment has been refunded, return process is finished, * FINISHED_APT - The payment has been refunded by Allegro Protect, return process is finished, * REJECTED - The return has been rejected, * COMMISSION_REFUND_CLAIMED - The sales commission refund (transaction rebate) application has been claimed, * COMMISSION_REFUNDED - The sales commission was refunded, * WAREHOUSE_DELIVERED - The returned items have been delivered to Allegro Warehouse, * WAREHOUSE_VERIFICATION - The returned items are under verification. + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable String status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturn customerReturn = (CustomerReturn) o; + return Objects.equals(this.id, customerReturn.id) && + Objects.equals(this.createdAt, customerReturn.createdAt) && + Objects.equals(this.referenceNumber, customerReturn.referenceNumber) && + Objects.equals(this.orderId, customerReturn.orderId) && + Objects.equals(this.buyer, customerReturn.buyer) && + Objects.equals(this.items, customerReturn.items) && + Objects.equals(this.refund, customerReturn.refund) && + Objects.equals(this.parcels, customerReturn.parcels) && + Objects.equals(this.rejection, customerReturn.rejection) && + Objects.equals(this.marketplaceId, customerReturn.marketplaceId) && + Objects.equals(this.status, customerReturn.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, createdAt, referenceNumber, orderId, buyer, items, refund, parcels, rejection, marketplaceId, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturn {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" referenceNumber: ").append(toIndentedString(referenceNumber)).append("\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append(" buyer: ").append(toIndentedString(buyer)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" refund: ").append(toIndentedString(refund)).append("\n"); + sb.append(" parcels: ").append(toIndentedString(parcels)).append("\n"); + sb.append(" rejection: ").append(toIndentedString(rejection)).append("\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("createdAt"); + openapiFields.add("referenceNumber"); + openapiFields.add("orderId"); + openapiFields.add("buyer"); + openapiFields.add("items"); + openapiFields.add("refund"); + openapiFields.add("parcels"); + openapiFields.add("rejection"); + openapiFields.add("marketplaceId"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturn + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturn.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturn is not found in the empty JSON string", CustomerReturn.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturn.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturn` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("referenceNumber") != null && !jsonObj.get("referenceNumber").isJsonNull()) && !jsonObj.get("referenceNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `referenceNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("referenceNumber").toString())); + } + if ((jsonObj.get("orderId") != null && !jsonObj.get("orderId").isJsonNull()) && !jsonObj.get("orderId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orderId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orderId").toString())); + } + // validate the optional field `buyer` + if (jsonObj.get("buyer") != null && !jsonObj.get("buyer").isJsonNull()) { + CustomerReturnBuyer.validateJsonElement(jsonObj.get("buyer")); + } + if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + if (jsonArrayitems != null) { + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + // validate the optional field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + CustomerReturnItem.validateJsonElement(jsonArrayitems.get(i)); + }; + } + } + // validate the optional field `refund` + if (jsonObj.get("refund") != null && !jsonObj.get("refund").isJsonNull()) { + CustomerReturnRefund.validateJsonElement(jsonObj.get("refund")); + } + if (jsonObj.get("parcels") != null && !jsonObj.get("parcels").isJsonNull()) { + JsonArray jsonArrayparcels = jsonObj.getAsJsonArray("parcels"); + if (jsonArrayparcels != null) { + // ensure the json data is an array + if (!jsonObj.get("parcels").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parcels` to be an array in the JSON string but got `%s`", jsonObj.get("parcels").toString())); + } + + // validate the optional field `parcels` (array) + for (int i = 0; i < jsonArrayparcels.size(); i++) { + CustomerReturnReturnParcel.validateJsonElement(jsonArrayparcels.get(i)); + }; + } + } + // validate the optional field `rejection` + if (jsonObj.get("rejection") != null && !jsonObj.get("rejection").isJsonNull()) { + CustomerReturnRejection.validateJsonElement(jsonObj.get("rejection")); + } + if ((jsonObj.get("marketplaceId") != null && !jsonObj.get("marketplaceId").isJsonNull()) && !jsonObj.get("marketplaceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("marketplaceId").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturn.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturn' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturn.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturn value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturn read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturn given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturn + * @throws IOException if the JSON string is invalid with respect to CustomerReturn + */ + public static CustomerReturn fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturn.class); + } + + /** + * Convert an instance of CustomerReturn to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnBuyer.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnBuyer.java new file mode 100644 index 0000000..6160170 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnBuyer.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CustomerReturnBuyer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnBuyer { + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nullable + private String login; + + public CustomerReturnBuyer() { + } + + public CustomerReturnBuyer email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public CustomerReturnBuyer login(@javax.annotation.Nullable String login) { + this.login = login; + return this; + } + + /** + * Get login + * @return login + */ + @javax.annotation.Nullable + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nullable String login) { + this.login = login; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnBuyer customerReturnBuyer = (CustomerReturnBuyer) o; + return Objects.equals(this.email, customerReturnBuyer.email) && + Objects.equals(this.login, customerReturnBuyer.login); + } + + @Override + public int hashCode() { + return Objects.hash(email, login); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnBuyer {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("email"); + openapiFields.add("login"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnBuyer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnBuyer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnBuyer is not found in the empty JSON string", CustomerReturnBuyer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnBuyer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnBuyer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("login") != null && !jsonObj.get("login").isJsonNull()) && !jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnBuyer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnBuyer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnBuyer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnBuyer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnBuyer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnBuyer given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnBuyer + * @throws IOException if the JSON string is invalid with respect to CustomerReturnBuyer + */ + public static CustomerReturnBuyer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnBuyer.class); + } + + /** + * Convert an instance of CustomerReturnBuyer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnItem.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnItem.java new file mode 100644 index 0000000..71ebbff --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnItem.java @@ -0,0 +1,357 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CustomerReturnItemReason; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CustomerReturnItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnItem { + public static final String SERIALIZED_NAME_OFFER_ID = "offerId"; + @SerializedName(SERIALIZED_NAME_OFFER_ID) + @javax.annotation.Nullable + private String offerId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Long quantity; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private Price price; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nullable + private CustomerReturnItemReason reason; + + public CustomerReturnItem() { + } + + public CustomerReturnItem offerId(@javax.annotation.Nullable String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Get offerId + * @return offerId + */ + @javax.annotation.Nullable + public String getOfferId() { + return offerId; + } + + public void setOfferId(@javax.annotation.Nullable String offerId) { + this.offerId = offerId; + } + + + public CustomerReturnItem quantity(@javax.annotation.Nullable Long quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + public Long getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Long quantity) { + this.quantity = quantity; + } + + + public CustomerReturnItem name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public CustomerReturnItem price(@javax.annotation.Nullable Price price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nullable + public Price getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable Price price) { + this.price = price; + } + + + public CustomerReturnItem url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + + public CustomerReturnItem reason(@javax.annotation.Nullable CustomerReturnItemReason reason) { + this.reason = reason; + return this; + } + + /** + * Get reason + * @return reason + */ + @javax.annotation.Nullable + public CustomerReturnItemReason getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nullable CustomerReturnItemReason reason) { + this.reason = reason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnItem customerReturnItem = (CustomerReturnItem) o; + return Objects.equals(this.offerId, customerReturnItem.offerId) && + Objects.equals(this.quantity, customerReturnItem.quantity) && + Objects.equals(this.name, customerReturnItem.name) && + Objects.equals(this.price, customerReturnItem.price) && + Objects.equals(this.url, customerReturnItem.url) && + Objects.equals(this.reason, customerReturnItem.reason); + } + + @Override + public int hashCode() { + return Objects.hash(offerId, quantity, name, price, url, reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnItem {\n"); + sb.append(" offerId: ").append(toIndentedString(offerId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offerId"); + openapiFields.add("quantity"); + openapiFields.add("name"); + openapiFields.add("price"); + openapiFields.add("url"); + openapiFields.add("reason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnItem is not found in the empty JSON string", CustomerReturnItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("offerId") != null && !jsonObj.get("offerId").isJsonNull()) && !jsonObj.get("offerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `offerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("offerId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `price` + if (jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("price")); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + // validate the optional field `reason` + if (jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) { + CustomerReturnItemReason.validateJsonElement(jsonObj.get("reason")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnItem + * @throws IOException if the JSON string is invalid with respect to CustomerReturnItem + */ + public static CustomerReturnItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnItem.class); + } + + /** + * Convert an instance of CustomerReturnItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnItemReason.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnItemReason.java new file mode 100644 index 0000000..1d9e6f9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnItemReason.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CustomerReturnItemReason + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnItemReason { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_USER_COMMENT = "userComment"; + @SerializedName(SERIALIZED_NAME_USER_COMMENT) + @javax.annotation.Nullable + private String userComment; + + public CustomerReturnItemReason() { + } + + public CustomerReturnItemReason type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Possible values: \"NONE\", \"MISTAKE\", \"TRANSPORT\", \"DAMAGED\", \"NOT_AS_DESCRIBED\", \"DONT_LIKE_IT\", \"OVERDUE_DELIVERY\", \"INCOMPLETE\", \"HIDDEN_FLAW\", \"OTHER_FLAW\", \"DIFFERENT\", \"COUNTERFEIT\". + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public CustomerReturnItemReason userComment(@javax.annotation.Nullable String userComment) { + this.userComment = userComment; + return this; + } + + /** + * Get userComment + * @return userComment + */ + @javax.annotation.Nullable + public String getUserComment() { + return userComment; + } + + public void setUserComment(@javax.annotation.Nullable String userComment) { + this.userComment = userComment; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnItemReason customerReturnItemReason = (CustomerReturnItemReason) o; + return Objects.equals(this.type, customerReturnItemReason.type) && + Objects.equals(this.userComment, customerReturnItemReason.userComment); + } + + @Override + public int hashCode() { + return Objects.hash(type, userComment); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnItemReason {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" userComment: ").append(toIndentedString(userComment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("userComment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnItemReason + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnItemReason.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnItemReason is not found in the empty JSON string", CustomerReturnItemReason.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnItemReason.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnItemReason` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("userComment") != null && !jsonObj.get("userComment").isJsonNull()) && !jsonObj.get("userComment").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userComment` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userComment").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnItemReason.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnItemReason' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnItemReason.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnItemReason value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnItemReason read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnItemReason given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnItemReason + * @throws IOException if the JSON string is invalid with respect to CustomerReturnItemReason + */ + public static CustomerReturnItemReason fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnItemReason.class); + } + + /** + * Convert an instance of CustomerReturnItemReason to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnParcelSender.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnParcelSender.java new file mode 100644 index 0000000..ef20566 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnParcelSender.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CustomerReturnParcelSender + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnParcelSender { + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nullable + private String phoneNumber; + + public CustomerReturnParcelSender() { + } + + public CustomerReturnParcelSender phoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get phoneNumber + * @return phoneNumber + */ + @javax.annotation.Nullable + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnParcelSender customerReturnParcelSender = (CustomerReturnParcelSender) o; + return Objects.equals(this.phoneNumber, customerReturnParcelSender.phoneNumber); + } + + @Override + public int hashCode() { + return Objects.hash(phoneNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnParcelSender {\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("phoneNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnParcelSender + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnParcelSender.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnParcelSender is not found in the empty JSON string", CustomerReturnParcelSender.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnParcelSender.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnParcelSender` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("phoneNumber") != null && !jsonObj.get("phoneNumber").isJsonNull()) && !jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnParcelSender.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnParcelSender' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnParcelSender.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnParcelSender value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnParcelSender read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnParcelSender given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnParcelSender + * @throws IOException if the JSON string is invalid with respect to CustomerReturnParcelSender + */ + public static CustomerReturnParcelSender fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnParcelSender.class); + } + + /** + * Convert an instance of CustomerReturnParcelSender to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefund.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefund.java new file mode 100644 index 0000000..c4785e6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefund.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CustomerReturnRefundBankAccount; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * This field is present in the case of cash on delivery, bank transfer, Allegro Pay, and Allegro Pay Business payment options. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnRefund { + public static final String SERIALIZED_NAME_BANK_ACCOUNT = "bankAccount"; + @SerializedName(SERIALIZED_NAME_BANK_ACCOUNT) + @javax.annotation.Nullable + private CustomerReturnRefundBankAccount bankAccount; + + public CustomerReturnRefund() { + } + + public CustomerReturnRefund bankAccount(@javax.annotation.Nullable CustomerReturnRefundBankAccount bankAccount) { + this.bankAccount = bankAccount; + return this; + } + + /** + * Get bankAccount + * @return bankAccount + */ + @javax.annotation.Nullable + public CustomerReturnRefundBankAccount getBankAccount() { + return bankAccount; + } + + public void setBankAccount(@javax.annotation.Nullable CustomerReturnRefundBankAccount bankAccount) { + this.bankAccount = bankAccount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnRefund customerReturnRefund = (CustomerReturnRefund) o; + return Objects.equals(this.bankAccount, customerReturnRefund.bankAccount); + } + + @Override + public int hashCode() { + return Objects.hash(bankAccount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnRefund {\n"); + sb.append(" bankAccount: ").append(toIndentedString(bankAccount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("bankAccount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnRefund + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnRefund.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnRefund is not found in the empty JSON string", CustomerReturnRefund.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnRefund.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnRefund` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `bankAccount` + if (jsonObj.get("bankAccount") != null && !jsonObj.get("bankAccount").isJsonNull()) { + CustomerReturnRefundBankAccount.validateJsonElement(jsonObj.get("bankAccount")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnRefund.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnRefund' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnRefund.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnRefund value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnRefund read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnRefund given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnRefund + * @throws IOException if the JSON string is invalid with respect to CustomerReturnRefund + */ + public static CustomerReturnRefund fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnRefund.class); + } + + /** + * Convert an instance of CustomerReturnRefund to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundBankAccount.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundBankAccount.java new file mode 100644 index 0000000..dec4bd3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundBankAccount.java @@ -0,0 +1,328 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CustomerReturnRefundBankAccountAddress; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CustomerReturnRefundBankAccount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnRefundBankAccount { + public static final String SERIALIZED_NAME_OWNER = "owner"; + @SerializedName(SERIALIZED_NAME_OWNER) + @javax.annotation.Nullable + private String owner; + + public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "accountNumber"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER) + @javax.annotation.Nullable + private String accountNumber; + + public static final String SERIALIZED_NAME_IBAN = "iban"; + @SerializedName(SERIALIZED_NAME_IBAN) + @javax.annotation.Nullable + private String iban; + + public static final String SERIALIZED_NAME_SWIFT = "swift"; + @SerializedName(SERIALIZED_NAME_SWIFT) + @javax.annotation.Nullable + private String swift; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private CustomerReturnRefundBankAccountAddress address; + + public CustomerReturnRefundBankAccount() { + } + + public CustomerReturnRefundBankAccount owner(@javax.annotation.Nullable String owner) { + this.owner = owner; + return this; + } + + /** + * Get owner + * @return owner + */ + @javax.annotation.Nullable + public String getOwner() { + return owner; + } + + public void setOwner(@javax.annotation.Nullable String owner) { + this.owner = owner; + } + + + public CustomerReturnRefundBankAccount accountNumber(@javax.annotation.Nullable String accountNumber) { + this.accountNumber = accountNumber; + return this; + } + + /** + * Get accountNumber + * @return accountNumber + */ + @javax.annotation.Nullable + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(@javax.annotation.Nullable String accountNumber) { + this.accountNumber = accountNumber; + } + + + public CustomerReturnRefundBankAccount iban(@javax.annotation.Nullable String iban) { + this.iban = iban; + return this; + } + + /** + * Get iban + * @return iban + */ + @javax.annotation.Nullable + public String getIban() { + return iban; + } + + public void setIban(@javax.annotation.Nullable String iban) { + this.iban = iban; + } + + + public CustomerReturnRefundBankAccount swift(@javax.annotation.Nullable String swift) { + this.swift = swift; + return this; + } + + /** + * Get swift + * @return swift + */ + @javax.annotation.Nullable + public String getSwift() { + return swift; + } + + public void setSwift(@javax.annotation.Nullable String swift) { + this.swift = swift; + } + + + public CustomerReturnRefundBankAccount address(@javax.annotation.Nullable CustomerReturnRefundBankAccountAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public CustomerReturnRefundBankAccountAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable CustomerReturnRefundBankAccountAddress address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnRefundBankAccount customerReturnRefundBankAccount = (CustomerReturnRefundBankAccount) o; + return Objects.equals(this.owner, customerReturnRefundBankAccount.owner) && + Objects.equals(this.accountNumber, customerReturnRefundBankAccount.accountNumber) && + Objects.equals(this.iban, customerReturnRefundBankAccount.iban) && + Objects.equals(this.swift, customerReturnRefundBankAccount.swift) && + Objects.equals(this.address, customerReturnRefundBankAccount.address); + } + + @Override + public int hashCode() { + return Objects.hash(owner, accountNumber, iban, swift, address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnRefundBankAccount {\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" accountNumber: ").append(toIndentedString(accountNumber)).append("\n"); + sb.append(" iban: ").append(toIndentedString(iban)).append("\n"); + sb.append(" swift: ").append(toIndentedString(swift)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("owner"); + openapiFields.add("accountNumber"); + openapiFields.add("iban"); + openapiFields.add("swift"); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnRefundBankAccount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnRefundBankAccount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnRefundBankAccount is not found in the empty JSON string", CustomerReturnRefundBankAccount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnRefundBankAccount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnRefundBankAccount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("owner") != null && !jsonObj.get("owner").isJsonNull()) && !jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); + } + if ((jsonObj.get("accountNumber") != null && !jsonObj.get("accountNumber").isJsonNull()) && !jsonObj.get("accountNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString())); + } + if ((jsonObj.get("iban") != null && !jsonObj.get("iban").isJsonNull()) && !jsonObj.get("iban").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `iban` to be a primitive type in the JSON string but got `%s`", jsonObj.get("iban").toString())); + } + if ((jsonObj.get("swift") != null && !jsonObj.get("swift").isJsonNull()) && !jsonObj.get("swift").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `swift` to be a primitive type in the JSON string but got `%s`", jsonObj.get("swift").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + CustomerReturnRefundBankAccountAddress.validateJsonElement(jsonObj.get("address")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnRefundBankAccount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnRefundBankAccount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnRefundBankAccount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnRefundBankAccount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnRefundBankAccount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnRefundBankAccount given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnRefundBankAccount + * @throws IOException if the JSON string is invalid with respect to CustomerReturnRefundBankAccount + */ + public static CustomerReturnRefundBankAccount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnRefundBankAccount.class); + } + + /** + * Convert an instance of CustomerReturnRefundBankAccount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundBankAccountAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundBankAccountAddress.java new file mode 100644 index 0000000..a4dbb96 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundBankAccountAddress.java @@ -0,0 +1,296 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CustomerReturnRefundBankAccountAddress + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnRefundBankAccountAddress { + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nullable + private String street; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nullable + private String city; + + public static final String SERIALIZED_NAME_POST_CODE = "postCode"; + @SerializedName(SERIALIZED_NAME_POST_CODE) + @javax.annotation.Nullable + private String postCode; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode; + + public CustomerReturnRefundBankAccountAddress() { + } + + public CustomerReturnRefundBankAccountAddress street(@javax.annotation.Nullable String street) { + this.street = street; + return this; + } + + /** + * Get street + * @return street + */ + @javax.annotation.Nullable + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nullable String street) { + this.street = street; + } + + + public CustomerReturnRefundBankAccountAddress city(@javax.annotation.Nullable String city) { + this.city = city; + return this; + } + + /** + * Get city + * @return city + */ + @javax.annotation.Nullable + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nullable String city) { + this.city = city; + } + + + public CustomerReturnRefundBankAccountAddress postCode(@javax.annotation.Nullable String postCode) { + this.postCode = postCode; + return this; + } + + /** + * Get postCode + * @return postCode + */ + @javax.annotation.Nullable + public String getPostCode() { + return postCode; + } + + public void setPostCode(@javax.annotation.Nullable String postCode) { + this.postCode = postCode; + } + + + public CustomerReturnRefundBankAccountAddress countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get countryCode + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnRefundBankAccountAddress customerReturnRefundBankAccountAddress = (CustomerReturnRefundBankAccountAddress) o; + return Objects.equals(this.street, customerReturnRefundBankAccountAddress.street) && + Objects.equals(this.city, customerReturnRefundBankAccountAddress.city) && + Objects.equals(this.postCode, customerReturnRefundBankAccountAddress.postCode) && + Objects.equals(this.countryCode, customerReturnRefundBankAccountAddress.countryCode); + } + + @Override + public int hashCode() { + return Objects.hash(street, city, postCode, countryCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnRefundBankAccountAddress {\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" postCode: ").append(toIndentedString(postCode)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("street"); + openapiFields.add("city"); + openapiFields.add("postCode"); + openapiFields.add("countryCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnRefundBankAccountAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnRefundBankAccountAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnRefundBankAccountAddress is not found in the empty JSON string", CustomerReturnRefundBankAccountAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnRefundBankAccountAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnRefundBankAccountAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("street") != null && !jsonObj.get("street").isJsonNull()) && !jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if ((jsonObj.get("city") != null && !jsonObj.get("city").isJsonNull()) && !jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if ((jsonObj.get("postCode") != null && !jsonObj.get("postCode").isJsonNull()) && !jsonObj.get("postCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postCode").toString())); + } + if ((jsonObj.get("countryCode") != null && !jsonObj.get("countryCode").isJsonNull()) && !jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnRefundBankAccountAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnRefundBankAccountAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnRefundBankAccountAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnRefundBankAccountAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnRefundBankAccountAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnRefundBankAccountAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnRefundBankAccountAddress + * @throws IOException if the JSON string is invalid with respect to CustomerReturnRefundBankAccountAddress + */ + public static CustomerReturnRefundBankAccountAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnRefundBankAccountAddress.class); + } + + /** + * Convert an instance of CustomerReturnRefundBankAccountAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundRejectionRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundRejectionRequest.java new file mode 100644 index 0000000..69acd31 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundRejectionRequest.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CustomerReturnRefundRejectionRequestRejection; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CustomerReturnRefundRejectionRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnRefundRejectionRequest { + public static final String SERIALIZED_NAME_REJECTION = "rejection"; + @SerializedName(SERIALIZED_NAME_REJECTION) + @javax.annotation.Nonnull + private CustomerReturnRefundRejectionRequestRejection rejection; + + public CustomerReturnRefundRejectionRequest() { + } + + public CustomerReturnRefundRejectionRequest rejection(@javax.annotation.Nonnull CustomerReturnRefundRejectionRequestRejection rejection) { + this.rejection = rejection; + return this; + } + + /** + * Get rejection + * @return rejection + */ + @javax.annotation.Nonnull + public CustomerReturnRefundRejectionRequestRejection getRejection() { + return rejection; + } + + public void setRejection(@javax.annotation.Nonnull CustomerReturnRefundRejectionRequestRejection rejection) { + this.rejection = rejection; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnRefundRejectionRequest customerReturnRefundRejectionRequest = (CustomerReturnRefundRejectionRequest) o; + return Objects.equals(this.rejection, customerReturnRefundRejectionRequest.rejection); + } + + @Override + public int hashCode() { + return Objects.hash(rejection); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnRefundRejectionRequest {\n"); + sb.append(" rejection: ").append(toIndentedString(rejection)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rejection"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("rejection"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnRefundRejectionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnRefundRejectionRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnRefundRejectionRequest is not found in the empty JSON string", CustomerReturnRefundRejectionRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnRefundRejectionRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnRefundRejectionRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CustomerReturnRefundRejectionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `rejection` + CustomerReturnRefundRejectionRequestRejection.validateJsonElement(jsonObj.get("rejection")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnRefundRejectionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnRefundRejectionRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnRefundRejectionRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnRefundRejectionRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnRefundRejectionRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnRefundRejectionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnRefundRejectionRequest + * @throws IOException if the JSON string is invalid with respect to CustomerReturnRefundRejectionRequest + */ + public static CustomerReturnRefundRejectionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnRefundRejectionRequest.class); + } + + /** + * Convert an instance of CustomerReturnRefundRejectionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundRejectionRequestRejection.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundRejectionRequestRejection.java new file mode 100644 index 0000000..51df103 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRefundRejectionRequestRejection.java @@ -0,0 +1,302 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Refund rejection + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnRefundRejectionRequestRejection { + /** + * Refund rejection code + */ + @JsonAdapter(CodeEnum.Adapter.class) + public enum CodeEnum { + REFUND_REJECTED("REFUND_REJECTED"), + + NEW_ITEM_SENT("NEW_ITEM_SENT"), + + ITEM_FIXED("ITEM_FIXED"), + + MISSING_PART_SENT("MISSING_PART_SENT"); + + private String value; + + CodeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CodeEnum fromValue(String value) { + for (CodeEnum b : CodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CodeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CodeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CodeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CodeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private CodeEnum code; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nullable + private String reason; + + public CustomerReturnRefundRejectionRequestRejection() { + } + + public CustomerReturnRefundRejectionRequestRejection code(@javax.annotation.Nonnull CodeEnum code) { + this.code = code; + return this; + } + + /** + * Refund rejection code + * @return code + */ + @javax.annotation.Nonnull + public CodeEnum getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull CodeEnum code) { + this.code = code; + } + + + public CustomerReturnRefundRejectionRequestRejection reason(@javax.annotation.Nullable String reason) { + this.reason = reason; + return this; + } + + /** + * Refund rejection reason, required when code is REFUND_REJECTED + * @return reason + */ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nullable String reason) { + this.reason = reason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnRefundRejectionRequestRejection customerReturnRefundRejectionRequestRejection = (CustomerReturnRefundRejectionRequestRejection) o; + return Objects.equals(this.code, customerReturnRefundRejectionRequestRejection.code) && + Objects.equals(this.reason, customerReturnRefundRejectionRequestRejection.reason); + } + + @Override + public int hashCode() { + return Objects.hash(code, reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnRefundRejectionRequestRejection {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("reason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("code"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnRefundRejectionRequestRejection + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnRefundRejectionRequestRejection.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnRefundRejectionRequestRejection is not found in the empty JSON string", CustomerReturnRefundRejectionRequestRejection.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnRefundRejectionRequestRejection.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnRefundRejectionRequestRejection` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CustomerReturnRefundRejectionRequestRejection.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + // validate the required field `code` + CodeEnum.validateJsonElement(jsonObj.get("code")); + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnRefundRejectionRequestRejection.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnRefundRejectionRequestRejection' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnRefundRejectionRequestRejection.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnRefundRejectionRequestRejection value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnRefundRejectionRequestRejection read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnRefundRejectionRequestRejection given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnRefundRejectionRequestRejection + * @throws IOException if the JSON string is invalid with respect to CustomerReturnRefundRejectionRequestRejection + */ + public static CustomerReturnRefundRejectionRequestRejection fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnRefundRejectionRequestRejection.class); + } + + /** + * Convert an instance of CustomerReturnRefundRejectionRequestRejection to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRejection.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRejection.java new file mode 100644 index 0000000..85d07c2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnRejection.java @@ -0,0 +1,324 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CustomerReturnRejection + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnRejection { + /** + * Refund rejection code + */ + @JsonAdapter(CodeEnum.Adapter.class) + public enum CodeEnum { + REFUND_REJECTED("REFUND_REJECTED"), + + NEW_ITEM_SENT("NEW_ITEM_SENT"), + + ITEM_FIXED("ITEM_FIXED"), + + MISSING_PART_SENT("MISSING_PART_SENT"); + + private String value; + + CodeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CodeEnum fromValue(String value) { + for (CodeEnum b : CodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CodeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CodeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CodeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CodeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private CodeEnum code; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nullable + private String reason; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public CustomerReturnRejection() { + } + + public CustomerReturnRejection code(@javax.annotation.Nullable CodeEnum code) { + this.code = code; + return this; + } + + /** + * Refund rejection code + * @return code + */ + @javax.annotation.Nullable + public CodeEnum getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable CodeEnum code) { + this.code = code; + } + + + public CustomerReturnRejection reason(@javax.annotation.Nullable String reason) { + this.reason = reason; + return this; + } + + /** + * Reason of refund cancellation. + * @return reason + */ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nullable String reason) { + this.reason = reason; + } + + + public CustomerReturnRejection createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnRejection customerReturnRejection = (CustomerReturnRejection) o; + return Objects.equals(this.code, customerReturnRejection.code) && + Objects.equals(this.reason, customerReturnRejection.reason) && + Objects.equals(this.createdAt, customerReturnRejection.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(code, reason, createdAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnRejection {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("reason"); + openapiFields.add("createdAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnRejection + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnRejection.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnRejection is not found in the empty JSON string", CustomerReturnRejection.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnRejection.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnRejection` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + // validate the optional field `code` + if (jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) { + CodeEnum.validateJsonElement(jsonObj.get("code")); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnRejection.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnRejection' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnRejection.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnRejection value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnRejection read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnRejection given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnRejection + * @throws IOException if the JSON string is invalid with respect to CustomerReturnRejection + */ + public static CustomerReturnRejection fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnRejection.class); + } + + /** + * Convert an instance of CustomerReturnRejection to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnResponse.java new file mode 100644 index 0000000..429d981 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnResponse.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CustomerReturn; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CustomerReturnResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnResponse { + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nonnull + private Long count; + + public static final String SERIALIZED_NAME_CUSTOMER_RETURNS = "customerReturns"; + @SerializedName(SERIALIZED_NAME_CUSTOMER_RETURNS) + @javax.annotation.Nonnull + private List customerReturns = new ArrayList<>(); + + public CustomerReturnResponse() { + } + + public CustomerReturnResponse count(@javax.annotation.Nonnull Long count) { + this.count = count; + return this; + } + + /** + * Get count + * @return count + */ + @javax.annotation.Nonnull + public Long getCount() { + return count; + } + + public void setCount(@javax.annotation.Nonnull Long count) { + this.count = count; + } + + + public CustomerReturnResponse customerReturns(@javax.annotation.Nonnull List customerReturns) { + this.customerReturns = customerReturns; + return this; + } + + public CustomerReturnResponse addCustomerReturnsItem(CustomerReturn customerReturnsItem) { + if (this.customerReturns == null) { + this.customerReturns = new ArrayList<>(); + } + this.customerReturns.add(customerReturnsItem); + return this; + } + + /** + * List of matching customer returns. + * @return customerReturns + */ + @javax.annotation.Nonnull + public List getCustomerReturns() { + return customerReturns; + } + + public void setCustomerReturns(@javax.annotation.Nonnull List customerReturns) { + this.customerReturns = customerReturns; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnResponse customerReturnResponse = (CustomerReturnResponse) o; + return Objects.equals(this.count, customerReturnResponse.count) && + Objects.equals(this.customerReturns, customerReturnResponse.customerReturns); + } + + @Override + public int hashCode() { + return Objects.hash(count, customerReturns); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnResponse {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" customerReturns: ").append(toIndentedString(customerReturns)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("count"); + openapiFields.add("customerReturns"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("count"); + openapiRequiredFields.add("customerReturns"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnResponse is not found in the empty JSON string", CustomerReturnResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CustomerReturnResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("customerReturns").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `customerReturns` to be an array in the JSON string but got `%s`", jsonObj.get("customerReturns").toString())); + } + + JsonArray jsonArraycustomerReturns = jsonObj.getAsJsonArray("customerReturns"); + // validate the required field `customerReturns` (array) + for (int i = 0; i < jsonArraycustomerReturns.size(); i++) { + CustomerReturn.validateJsonElement(jsonArraycustomerReturns.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnResponse + * @throws IOException if the JSON string is invalid with respect to CustomerReturnResponse + */ + public static CustomerReturnResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnResponse.class); + } + + /** + * Convert an instance of CustomerReturnResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnReturnParcel.java b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnReturnParcel.java new file mode 100644 index 0000000..e869d0f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/CustomerReturnReturnParcel.java @@ -0,0 +1,368 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.CustomerReturnParcelSender; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * CustomerReturnReturnParcel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class CustomerReturnReturnParcel { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_WAYBILL = "waybill"; + @SerializedName(SERIALIZED_NAME_WAYBILL) + @javax.annotation.Nullable + private String waybill; + + public static final String SERIALIZED_NAME_TRANSPORTING_WAYBILL = "transportingWaybill"; + @SerializedName(SERIALIZED_NAME_TRANSPORTING_WAYBILL) + @javax.annotation.Nullable + private String transportingWaybill; + + public static final String SERIALIZED_NAME_CARRIER_ID = "carrierId"; + @SerializedName(SERIALIZED_NAME_CARRIER_ID) + @javax.annotation.Nullable + private String carrierId; + + public static final String SERIALIZED_NAME_TRANSPORTING_CARRIER_ID = "transportingCarrierId"; + @SerializedName(SERIALIZED_NAME_TRANSPORTING_CARRIER_ID) + @javax.annotation.Nullable + private String transportingCarrierId; + + public static final String SERIALIZED_NAME_SENDER = "sender"; + @SerializedName(SERIALIZED_NAME_SENDER) + @javax.annotation.Nullable + private CustomerReturnParcelSender sender; + + public CustomerReturnReturnParcel() { + } + + public CustomerReturnReturnParcel createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public CustomerReturnReturnParcel waybill(@javax.annotation.Nullable String waybill) { + this.waybill = waybill; + return this; + } + + /** + * Get waybill + * @return waybill + */ + @javax.annotation.Nullable + public String getWaybill() { + return waybill; + } + + public void setWaybill(@javax.annotation.Nullable String waybill) { + this.waybill = waybill; + } + + + public CustomerReturnReturnParcel transportingWaybill(@javax.annotation.Nullable String transportingWaybill) { + this.transportingWaybill = transportingWaybill; + return this; + } + + /** + * Waybill id as generated by carriers physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. + * @return transportingWaybill + */ + @javax.annotation.Nullable + public String getTransportingWaybill() { + return transportingWaybill; + } + + public void setTransportingWaybill(@javax.annotation.Nullable String transportingWaybill) { + this.transportingWaybill = transportingWaybill; + } + + + public CustomerReturnReturnParcel carrierId(@javax.annotation.Nullable String carrierId) { + this.carrierId = carrierId; + return this; + } + + /** + * Get carrierId + * @return carrierId + */ + @javax.annotation.Nullable + public String getCarrierId() { + return carrierId; + } + + public void setCarrierId(@javax.annotation.Nullable String carrierId) { + this.carrierId = carrierId; + } + + + public CustomerReturnReturnParcel transportingCarrierId(@javax.annotation.Nullable String transportingCarrierId) { + this.transportingCarrierId = transportingCarrierId; + return this; + } + + /** + * Carrier id of a carrier physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. + * @return transportingCarrierId + */ + @javax.annotation.Nullable + public String getTransportingCarrierId() { + return transportingCarrierId; + } + + public void setTransportingCarrierId(@javax.annotation.Nullable String transportingCarrierId) { + this.transportingCarrierId = transportingCarrierId; + } + + + public CustomerReturnReturnParcel sender(@javax.annotation.Nullable CustomerReturnParcelSender sender) { + this.sender = sender; + return this; + } + + /** + * Get sender + * @return sender + */ + @javax.annotation.Nullable + public CustomerReturnParcelSender getSender() { + return sender; + } + + public void setSender(@javax.annotation.Nullable CustomerReturnParcelSender sender) { + this.sender = sender; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomerReturnReturnParcel customerReturnReturnParcel = (CustomerReturnReturnParcel) o; + return Objects.equals(this.createdAt, customerReturnReturnParcel.createdAt) && + Objects.equals(this.waybill, customerReturnReturnParcel.waybill) && + Objects.equals(this.transportingWaybill, customerReturnReturnParcel.transportingWaybill) && + Objects.equals(this.carrierId, customerReturnReturnParcel.carrierId) && + Objects.equals(this.transportingCarrierId, customerReturnReturnParcel.transportingCarrierId) && + Objects.equals(this.sender, customerReturnReturnParcel.sender); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, waybill, transportingWaybill, carrierId, transportingCarrierId, sender); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomerReturnReturnParcel {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" waybill: ").append(toIndentedString(waybill)).append("\n"); + sb.append(" transportingWaybill: ").append(toIndentedString(transportingWaybill)).append("\n"); + sb.append(" carrierId: ").append(toIndentedString(carrierId)).append("\n"); + sb.append(" transportingCarrierId: ").append(toIndentedString(transportingCarrierId)).append("\n"); + sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("waybill"); + openapiFields.add("transportingWaybill"); + openapiFields.add("carrierId"); + openapiFields.add("transportingCarrierId"); + openapiFields.add("sender"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CustomerReturnReturnParcel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CustomerReturnReturnParcel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CustomerReturnReturnParcel is not found in the empty JSON string", CustomerReturnReturnParcel.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CustomerReturnReturnParcel.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CustomerReturnReturnParcel` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("waybill") != null && !jsonObj.get("waybill").isJsonNull()) && !jsonObj.get("waybill").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `waybill` to be a primitive type in the JSON string but got `%s`", jsonObj.get("waybill").toString())); + } + if ((jsonObj.get("transportingWaybill") != null && !jsonObj.get("transportingWaybill").isJsonNull()) && !jsonObj.get("transportingWaybill").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transportingWaybill` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transportingWaybill").toString())); + } + if ((jsonObj.get("carrierId") != null && !jsonObj.get("carrierId").isJsonNull()) && !jsonObj.get("carrierId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `carrierId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierId").toString())); + } + if ((jsonObj.get("transportingCarrierId") != null && !jsonObj.get("transportingCarrierId").isJsonNull()) && !jsonObj.get("transportingCarrierId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transportingCarrierId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transportingCarrierId").toString())); + } + // validate the optional field `sender` + if (jsonObj.get("sender") != null && !jsonObj.get("sender").isJsonNull()) { + CustomerReturnParcelSender.validateJsonElement(jsonObj.get("sender")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CustomerReturnReturnParcel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CustomerReturnReturnParcel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CustomerReturnReturnParcel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CustomerReturnReturnParcel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CustomerReturnReturnParcel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CustomerReturnReturnParcel given an JSON string + * + * @param jsonString JSON string + * @return An instance of CustomerReturnReturnParcel + * @throws IOException if the JSON string is invalid with respect to CustomerReturnReturnParcel + */ + public static CustomerReturnReturnParcel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CustomerReturnReturnParcel.class); + } + + /** + * Convert an instance of CustomerReturnReturnParcel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Deduction.java b/src/main/java/pl/wtx/allegro/api/client/model/Deduction.java new file mode 100644 index 0000000..b80ea4b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Deduction.java @@ -0,0 +1,215 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Deduction. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Deduction { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public Deduction() { + } + + public Deduction id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * The deduction ID. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Deduction deduction = (Deduction) o; + return Objects.equals(this.id, deduction.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Deduction {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Deduction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Deduction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Deduction is not found in the empty JSON string", Deduction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Deduction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Deduction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Deduction.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Deduction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Deduction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Deduction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Deduction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Deduction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Deduction given an JSON string + * + * @param jsonString JSON string + * @return An instance of Deduction + * @throws IOException if the JSON string is invalid with respect to Deduction + */ + public static Deduction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Deduction.class); + } + + /** + * Convert an instance of Deduction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeductionChargeOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/DeductionChargeOperation.java new file mode 100644 index 0000000..d2db90c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeductionChargeOperation.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.Deduction; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DeductionChargeOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeductionChargeOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "DEDUCTION_CHARGE"; + + public static final String SERIALIZED_NAME_DEDUCTION = "deduction"; + @SerializedName(SERIALIZED_NAME_DEDUCTION) + @javax.annotation.Nonnull + private Deduction deduction; + + public DeductionChargeOperation() { + this.type = this.getClass().getSimpleName(); + } + + public DeductionChargeOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public DeductionChargeOperation deduction(@javax.annotation.Nonnull Deduction deduction) { + this.deduction = deduction; + return this; + } + + /** + * Get deduction + * @return deduction + */ + @javax.annotation.Nonnull + public Deduction getDeduction() { + return deduction; + } + + public void setDeduction(@javax.annotation.Nonnull Deduction deduction) { + this.deduction = deduction; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeductionChargeOperation deductionChargeOperation = (DeductionChargeOperation) o; + return Objects.equals(this.type, deductionChargeOperation.type) && + Objects.equals(this.deduction, deductionChargeOperation.deduction) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, deduction, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeductionChargeOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" deduction: ").append(toIndentedString(deduction)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("deduction"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("deduction"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeductionChargeOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeductionChargeOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeductionChargeOperation is not found in the empty JSON string", DeductionChargeOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeductionChargeOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeductionChargeOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeductionChargeOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeductionChargeOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeductionChargeOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeductionChargeOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeductionChargeOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeductionChargeOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeductionChargeOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeductionChargeOperation + * @throws IOException if the JSON string is invalid with respect to DeductionChargeOperation + */ + public static DeductionChargeOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeductionChargeOperation.class); + } + + /** + * Convert an instance of DeductionChargeOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeductionIncreaseOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/DeductionIncreaseOperation.java new file mode 100644 index 0000000..a9c88c8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeductionIncreaseOperation.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.Deduction; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DeductionIncreaseOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeductionIncreaseOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "DEDUCTION_INCREASE"; + + public static final String SERIALIZED_NAME_DEDUCTION = "deduction"; + @SerializedName(SERIALIZED_NAME_DEDUCTION) + @javax.annotation.Nonnull + private Deduction deduction; + + public DeductionIncreaseOperation() { + this.type = this.getClass().getSimpleName(); + } + + public DeductionIncreaseOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public DeductionIncreaseOperation deduction(@javax.annotation.Nonnull Deduction deduction) { + this.deduction = deduction; + return this; + } + + /** + * Get deduction + * @return deduction + */ + @javax.annotation.Nonnull + public Deduction getDeduction() { + return deduction; + } + + public void setDeduction(@javax.annotation.Nonnull Deduction deduction) { + this.deduction = deduction; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeductionIncreaseOperation deductionIncreaseOperation = (DeductionIncreaseOperation) o; + return Objects.equals(this.type, deductionIncreaseOperation.type) && + Objects.equals(this.deduction, deductionIncreaseOperation.deduction) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, deduction, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeductionIncreaseOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" deduction: ").append(toIndentedString(deduction)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("deduction"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("deduction"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeductionIncreaseOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeductionIncreaseOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeductionIncreaseOperation is not found in the empty JSON string", DeductionIncreaseOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeductionIncreaseOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeductionIncreaseOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeductionIncreaseOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeductionIncreaseOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeductionIncreaseOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeductionIncreaseOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeductionIncreaseOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeductionIncreaseOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeductionIncreaseOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeductionIncreaseOperation + * @throws IOException if the JSON string is invalid with respect to DeductionIncreaseOperation + */ + public static DeductionIncreaseOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeductionIncreaseOperation.class); + } + + /** + * Convert an instance of DeductionIncreaseOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliveryBasic.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryBasic.java new file mode 100644 index 0000000..0794856 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryBasic.java @@ -0,0 +1,273 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.JustId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DeliveryBasic + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliveryBasic { + public static final String SERIALIZED_NAME_ADDITIONAL_INFO = "additionalInfo"; + @Deprecated + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFO) + @javax.annotation.Nullable + private String additionalInfo; + + public static final String SERIALIZED_NAME_HANDLING_TIME = "handlingTime"; + @SerializedName(SERIALIZED_NAME_HANDLING_TIME) + @javax.annotation.Nullable + private String handlingTime; + + public static final String SERIALIZED_NAME_SHIPPING_RATES = "shippingRates"; + @SerializedName(SERIALIZED_NAME_SHIPPING_RATES) + @javax.annotation.Nullable + private JustId shippingRates; + + public DeliveryBasic() { + } + + @Deprecated + public DeliveryBasic additionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + /** + * Additional information about delivery. Parameter is deprecated and will be removed in the future. Additional information is only visible on marketplace `allegro-pl`. + * @return additionalInfo + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public String getAdditionalInfo() { + return additionalInfo; + } + + @Deprecated + public void setAdditionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + } + + + public DeliveryBasic handlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + return this; + } + + /** + * Handling time, ISO 8601 duration format. This field must be set to one of the following: PT0S for immediately, PT24H, P2D, P3D, P4D, P5D, P7D, P10D, P14D, P21D, P30D, P60D. + * @return handlingTime + */ + @javax.annotation.Nullable + public String getHandlingTime() { + return handlingTime; + } + + public void setHandlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + } + + + public DeliveryBasic shippingRates(@javax.annotation.Nullable JustId shippingRates) { + this.shippingRates = shippingRates; + return this; + } + + /** + * Get shippingRates + * @return shippingRates + */ + @javax.annotation.Nullable + public JustId getShippingRates() { + return shippingRates; + } + + public void setShippingRates(@javax.annotation.Nullable JustId shippingRates) { + this.shippingRates = shippingRates; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryBasic deliveryBasic = (DeliveryBasic) o; + return Objects.equals(this.additionalInfo, deliveryBasic.additionalInfo) && + Objects.equals(this.handlingTime, deliveryBasic.handlingTime) && + Objects.equals(this.shippingRates, deliveryBasic.shippingRates); + } + + @Override + public int hashCode() { + return Objects.hash(additionalInfo, handlingTime, shippingRates); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryBasic {\n"); + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append(" handlingTime: ").append(toIndentedString(handlingTime)).append("\n"); + sb.append(" shippingRates: ").append(toIndentedString(shippingRates)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("additionalInfo"); + openapiFields.add("handlingTime"); + openapiFields.add("shippingRates"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliveryBasic + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryBasic.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliveryBasic is not found in the empty JSON string", DeliveryBasic.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryBasic.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliveryBasic` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("additionalInfo") != null && !jsonObj.get("additionalInfo").isJsonNull()) && !jsonObj.get("additionalInfo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInfo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalInfo").toString())); + } + if ((jsonObj.get("handlingTime") != null && !jsonObj.get("handlingTime").isJsonNull()) && !jsonObj.get("handlingTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `handlingTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("handlingTime").toString())); + } + // validate the optional field `shippingRates` + if (jsonObj.get("shippingRates") != null && !jsonObj.get("shippingRates").isJsonNull()) { + JustId.validateJsonElement(jsonObj.get("shippingRates")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryBasic.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryBasic' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliveryBasic.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryBasic value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryBasic read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryBasic given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryBasic + * @throws IOException if the JSON string is invalid with respect to DeliveryBasic + */ + public static DeliveryBasic fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryBasic.class); + } + + /** + * Convert an instance of DeliveryBasic to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliveryFull.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryFull.java new file mode 100644 index 0000000..fe993ae --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryFull.java @@ -0,0 +1,301 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.JustId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DeliveryFull + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliveryFull { + public static final String SERIALIZED_NAME_ADDITIONAL_INFO = "additionalInfo"; + @Deprecated + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFO) + @javax.annotation.Nullable + private String additionalInfo; + + public static final String SERIALIZED_NAME_HANDLING_TIME = "handlingTime"; + @SerializedName(SERIALIZED_NAME_HANDLING_TIME) + @javax.annotation.Nullable + private String handlingTime; + + public static final String SERIALIZED_NAME_SHIPPING_RATES = "shippingRates"; + @SerializedName(SERIALIZED_NAME_SHIPPING_RATES) + @javax.annotation.Nullable + private JustId shippingRates; + + public static final String SERIALIZED_NAME_SHIPMENT_DATE = "shipmentDate"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipmentDate; + + public DeliveryFull() { + } + + @Deprecated + public DeliveryFull additionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + /** + * Additional information about delivery. Parameter is deprecated and will be removed in the future. Additional information is only visible on marketplace `allegro-pl`. + * @return additionalInfo + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public String getAdditionalInfo() { + return additionalInfo; + } + + @Deprecated + public void setAdditionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + } + + + public DeliveryFull handlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + return this; + } + + /** + * Handling time, ISO 8601 duration format. This field must be set to one of the following: PT0S for immediately, PT24H, P2D, P3D, P4D, P5D, P7D, P10D, P14D, P21D, P30D, P60D. + * @return handlingTime + */ + @javax.annotation.Nullable + public String getHandlingTime() { + return handlingTime; + } + + public void setHandlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + } + + + public DeliveryFull shippingRates(@javax.annotation.Nullable JustId shippingRates) { + this.shippingRates = shippingRates; + return this; + } + + /** + * Get shippingRates + * @return shippingRates + */ + @javax.annotation.Nullable + public JustId getShippingRates() { + return shippingRates; + } + + public void setShippingRates(@javax.annotation.Nullable JustId shippingRates) { + this.shippingRates = shippingRates; + } + + + public DeliveryFull shipmentDate(@javax.annotation.Nullable OffsetDateTime shipmentDate) { + this.shipmentDate = shipmentDate; + return this; + } + + /** + * Shipment date, Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ + * @return shipmentDate + */ + @javax.annotation.Nullable + public OffsetDateTime getShipmentDate() { + return shipmentDate; + } + + public void setShipmentDate(@javax.annotation.Nullable OffsetDateTime shipmentDate) { + this.shipmentDate = shipmentDate; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryFull deliveryFull = (DeliveryFull) o; + return Objects.equals(this.additionalInfo, deliveryFull.additionalInfo) && + Objects.equals(this.handlingTime, deliveryFull.handlingTime) && + Objects.equals(this.shippingRates, deliveryFull.shippingRates) && + Objects.equals(this.shipmentDate, deliveryFull.shipmentDate); + } + + @Override + public int hashCode() { + return Objects.hash(additionalInfo, handlingTime, shippingRates, shipmentDate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryFull {\n"); + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append(" handlingTime: ").append(toIndentedString(handlingTime)).append("\n"); + sb.append(" shippingRates: ").append(toIndentedString(shippingRates)).append("\n"); + sb.append(" shipmentDate: ").append(toIndentedString(shipmentDate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("additionalInfo"); + openapiFields.add("handlingTime"); + openapiFields.add("shippingRates"); + openapiFields.add("shipmentDate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliveryFull + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryFull.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliveryFull is not found in the empty JSON string", DeliveryFull.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryFull.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliveryFull` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("additionalInfo") != null && !jsonObj.get("additionalInfo").isJsonNull()) && !jsonObj.get("additionalInfo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInfo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalInfo").toString())); + } + if ((jsonObj.get("handlingTime") != null && !jsonObj.get("handlingTime").isJsonNull()) && !jsonObj.get("handlingTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `handlingTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("handlingTime").toString())); + } + // validate the optional field `shippingRates` + if (jsonObj.get("shippingRates") != null && !jsonObj.get("shippingRates").isJsonNull()) { + JustId.validateJsonElement(jsonObj.get("shippingRates")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryFull.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryFull' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliveryFull.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryFull value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryFull read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryFull given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryFull + * @throws IOException if the JSON string is invalid with respect to DeliveryFull + */ + public static DeliveryFull fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryFull.class); + } + + /** + * Convert an instance of DeliveryFull to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliveryMethodId.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryMethodId.java new file mode 100644 index 0000000..edb29aa --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryMethodId.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DeliveryMethodId + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliveryMethodId { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public DeliveryMethodId() { + } + + public DeliveryMethodId id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Delivery method id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryMethodId deliveryMethodId = (DeliveryMethodId) o; + return Objects.equals(this.id, deliveryMethodId.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryMethodId {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliveryMethodId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryMethodId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliveryMethodId is not found in the empty JSON string", DeliveryMethodId.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryMethodId.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliveryMethodId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryMethodId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryMethodId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliveryMethodId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryMethodId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryMethodId read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryMethodId given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryMethodId + * @throws IOException if the JSON string is invalid with respect to DeliveryMethodId + */ + public static DeliveryMethodId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryMethodId.class); + } + + /** + * Convert an instance of DeliveryMethodId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferRequest.java new file mode 100644 index 0000000..3f6c38c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferRequest.java @@ -0,0 +1,273 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DeliveryProductOfferRequestShippingRates; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DeliveryProductOfferRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliveryProductOfferRequest { + public static final String SERIALIZED_NAME_HANDLING_TIME = "handlingTime"; + @SerializedName(SERIALIZED_NAME_HANDLING_TIME) + @javax.annotation.Nullable + private String handlingTime; + + public static final String SERIALIZED_NAME_SHIPPING_RATES = "shippingRates"; + @SerializedName(SERIALIZED_NAME_SHIPPING_RATES) + @javax.annotation.Nullable + private DeliveryProductOfferRequestShippingRates shippingRates; + + public static final String SERIALIZED_NAME_ADDITIONAL_INFO = "additionalInfo"; + @Deprecated + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFO) + @javax.annotation.Nullable + private String additionalInfo; + + public DeliveryProductOfferRequest() { + } + + public DeliveryProductOfferRequest handlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + return this; + } + + /** + * Handling time, ISO 8601 duration format. This field must be set to one of the following: PT0S for immediately, PT24H, P2D, P3D, P4D, P5D, P7D, P10D, P14D, P21D, P30D, P60D. + * @return handlingTime + */ + @javax.annotation.Nullable + public String getHandlingTime() { + return handlingTime; + } + + public void setHandlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + } + + + public DeliveryProductOfferRequest shippingRates(@javax.annotation.Nullable DeliveryProductOfferRequestShippingRates shippingRates) { + this.shippingRates = shippingRates; + return this; + } + + /** + * Get shippingRates + * @return shippingRates + */ + @javax.annotation.Nullable + public DeliveryProductOfferRequestShippingRates getShippingRates() { + return shippingRates; + } + + public void setShippingRates(@javax.annotation.Nullable DeliveryProductOfferRequestShippingRates shippingRates) { + this.shippingRates = shippingRates; + } + + + @Deprecated + public DeliveryProductOfferRequest additionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + /** + * Additional information about delivery. Parameter is deprecated and will be removed in the future. Additional information is only visible on marketplace `allegro-pl`. + * @return additionalInfo + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public String getAdditionalInfo() { + return additionalInfo; + } + + @Deprecated + public void setAdditionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryProductOfferRequest deliveryProductOfferRequest = (DeliveryProductOfferRequest) o; + return Objects.equals(this.handlingTime, deliveryProductOfferRequest.handlingTime) && + Objects.equals(this.shippingRates, deliveryProductOfferRequest.shippingRates) && + Objects.equals(this.additionalInfo, deliveryProductOfferRequest.additionalInfo); + } + + @Override + public int hashCode() { + return Objects.hash(handlingTime, shippingRates, additionalInfo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryProductOfferRequest {\n"); + sb.append(" handlingTime: ").append(toIndentedString(handlingTime)).append("\n"); + sb.append(" shippingRates: ").append(toIndentedString(shippingRates)).append("\n"); + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("handlingTime"); + openapiFields.add("shippingRates"); + openapiFields.add("additionalInfo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliveryProductOfferRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryProductOfferRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliveryProductOfferRequest is not found in the empty JSON string", DeliveryProductOfferRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryProductOfferRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliveryProductOfferRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("handlingTime") != null && !jsonObj.get("handlingTime").isJsonNull()) && !jsonObj.get("handlingTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `handlingTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("handlingTime").toString())); + } + // validate the optional field `shippingRates` + if (jsonObj.get("shippingRates") != null && !jsonObj.get("shippingRates").isJsonNull()) { + DeliveryProductOfferRequestShippingRates.validateJsonElement(jsonObj.get("shippingRates")); + } + if ((jsonObj.get("additionalInfo") != null && !jsonObj.get("additionalInfo").isJsonNull()) && !jsonObj.get("additionalInfo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInfo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalInfo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryProductOfferRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryProductOfferRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliveryProductOfferRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryProductOfferRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryProductOfferRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryProductOfferRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryProductOfferRequest + * @throws IOException if the JSON string is invalid with respect to DeliveryProductOfferRequest + */ + public static DeliveryProductOfferRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryProductOfferRequest.class); + } + + /** + * Convert an instance of DeliveryProductOfferRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferRequestShippingRates.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferRequestShippingRates.java new file mode 100644 index 0000000..1cf167c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferRequestShippingRates.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DeliveryProductOfferRequestShippingRates + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliveryProductOfferRequestShippingRates { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public DeliveryProductOfferRequestShippingRates() { + } + + public DeliveryProductOfferRequestShippingRates id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public DeliveryProductOfferRequestShippingRates name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of the shipping rate. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryProductOfferRequestShippingRates deliveryProductOfferRequestShippingRates = (DeliveryProductOfferRequestShippingRates) o; + return Objects.equals(this.id, deliveryProductOfferRequestShippingRates.id) && + Objects.equals(this.name, deliveryProductOfferRequestShippingRates.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryProductOfferRequestShippingRates {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliveryProductOfferRequestShippingRates + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryProductOfferRequestShippingRates.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliveryProductOfferRequestShippingRates is not found in the empty JSON string", DeliveryProductOfferRequestShippingRates.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryProductOfferRequestShippingRates.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliveryProductOfferRequestShippingRates` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryProductOfferRequestShippingRates.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryProductOfferRequestShippingRates' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliveryProductOfferRequestShippingRates.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryProductOfferRequestShippingRates value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryProductOfferRequestShippingRates read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryProductOfferRequestShippingRates given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryProductOfferRequestShippingRates + * @throws IOException if the JSON string is invalid with respect to DeliveryProductOfferRequestShippingRates + */ + public static DeliveryProductOfferRequestShippingRates fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryProductOfferRequestShippingRates.class); + } + + /** + * Convert an instance of DeliveryProductOfferRequestShippingRates to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferResponse.java new file mode 100644 index 0000000..dc5f204 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryProductOfferResponse.java @@ -0,0 +1,301 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.JustId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DeliveryProductOfferResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliveryProductOfferResponse { + public static final String SERIALIZED_NAME_HANDLING_TIME = "handlingTime"; + @SerializedName(SERIALIZED_NAME_HANDLING_TIME) + @javax.annotation.Nullable + private String handlingTime; + + public static final String SERIALIZED_NAME_SHIPPING_RATES = "shippingRates"; + @SerializedName(SERIALIZED_NAME_SHIPPING_RATES) + @javax.annotation.Nullable + private JustId shippingRates; + + public static final String SERIALIZED_NAME_ADDITIONAL_INFO = "additionalInfo"; + @Deprecated + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFO) + @javax.annotation.Nullable + private String additionalInfo; + + public static final String SERIALIZED_NAME_SHIPMENT_DATE = "shipmentDate"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipmentDate; + + public DeliveryProductOfferResponse() { + } + + public DeliveryProductOfferResponse handlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + return this; + } + + /** + * Handling time, ISO 8601 duration format. This field must be set to one of the following: PT0S for immediately, PT24H, P2D, P3D, P4D, P5D, P7D, P10D, P14D, P21D, P30D, P60D. + * @return handlingTime + */ + @javax.annotation.Nullable + public String getHandlingTime() { + return handlingTime; + } + + public void setHandlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + } + + + public DeliveryProductOfferResponse shippingRates(@javax.annotation.Nullable JustId shippingRates) { + this.shippingRates = shippingRates; + return this; + } + + /** + * Get shippingRates + * @return shippingRates + */ + @javax.annotation.Nullable + public JustId getShippingRates() { + return shippingRates; + } + + public void setShippingRates(@javax.annotation.Nullable JustId shippingRates) { + this.shippingRates = shippingRates; + } + + + @Deprecated + public DeliveryProductOfferResponse additionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + /** + * Additional information about delivery. Parameter is deprecated and will be removed in the future. Additional information is only visible on marketplace `allegro-pl`. + * @return additionalInfo + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public String getAdditionalInfo() { + return additionalInfo; + } + + @Deprecated + public void setAdditionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + } + + + public DeliveryProductOfferResponse shipmentDate(@javax.annotation.Nullable OffsetDateTime shipmentDate) { + this.shipmentDate = shipmentDate; + return this; + } + + /** + * Shipment date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + * @return shipmentDate + */ + @javax.annotation.Nullable + public OffsetDateTime getShipmentDate() { + return shipmentDate; + } + + public void setShipmentDate(@javax.annotation.Nullable OffsetDateTime shipmentDate) { + this.shipmentDate = shipmentDate; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryProductOfferResponse deliveryProductOfferResponse = (DeliveryProductOfferResponse) o; + return Objects.equals(this.handlingTime, deliveryProductOfferResponse.handlingTime) && + Objects.equals(this.shippingRates, deliveryProductOfferResponse.shippingRates) && + Objects.equals(this.additionalInfo, deliveryProductOfferResponse.additionalInfo) && + Objects.equals(this.shipmentDate, deliveryProductOfferResponse.shipmentDate); + } + + @Override + public int hashCode() { + return Objects.hash(handlingTime, shippingRates, additionalInfo, shipmentDate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryProductOfferResponse {\n"); + sb.append(" handlingTime: ").append(toIndentedString(handlingTime)).append("\n"); + sb.append(" shippingRates: ").append(toIndentedString(shippingRates)).append("\n"); + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append(" shipmentDate: ").append(toIndentedString(shipmentDate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("handlingTime"); + openapiFields.add("shippingRates"); + openapiFields.add("additionalInfo"); + openapiFields.add("shipmentDate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliveryProductOfferResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryProductOfferResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliveryProductOfferResponse is not found in the empty JSON string", DeliveryProductOfferResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryProductOfferResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliveryProductOfferResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("handlingTime") != null && !jsonObj.get("handlingTime").isJsonNull()) && !jsonObj.get("handlingTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `handlingTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("handlingTime").toString())); + } + // validate the optional field `shippingRates` + if (jsonObj.get("shippingRates") != null && !jsonObj.get("shippingRates").isJsonNull()) { + JustId.validateJsonElement(jsonObj.get("shippingRates")); + } + if ((jsonObj.get("additionalInfo") != null && !jsonObj.get("additionalInfo").isJsonNull()) && !jsonObj.get("additionalInfo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInfo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalInfo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryProductOfferResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryProductOfferResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliveryProductOfferResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryProductOfferResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryProductOfferResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryProductOfferResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryProductOfferResponse + * @throws IOException if the JSON string is invalid with respect to DeliveryProductOfferResponse + */ + public static DeliveryProductOfferResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryProductOfferResponse.class); + } + + /** + * Convert an instance of DeliveryProductOfferResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliveryServiceDto.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryServiceDto.java new file mode 100644 index 0000000..94294a5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryServiceDto.java @@ -0,0 +1,691 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import pl.wtx.allegro.api.client.model.AdditionalPropertyDto; +import pl.wtx.allegro.api.client.model.AdditionalServiceDto; +import pl.wtx.allegro.api.client.model.CashOnDeliveryLimitDto; +import pl.wtx.allegro.api.client.model.DeliveryServiceIdDto; +import pl.wtx.allegro.api.client.model.LimitWithCurrencyDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Primary object for Ship with Allegro. It's strongly related to delivery-method selected by buyer in purchase process and represent how shipment will be delivered. Delivery services contains set of features like cash on delivery support, additional parcel protection, additional services used to shipment creation. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliveryServiceDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private DeliveryServiceIdDto id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_CARRIER_ID = "carrierId"; + @SerializedName(SERIALIZED_NAME_CARRIER_ID) + @javax.annotation.Nullable + private String carrierId; + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private List additionalServices = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ADDITIONAL_PROPERTIES = "additionalProperties"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_PROPERTIES) + @javax.annotation.Nullable + private List additionalProperties = new ArrayList<>(); + + /** + * Define delivery method type. ALLEGRO - Allegro Standard. Client - Merchant carrier agreement + */ + @JsonAdapter(OwnerEnum.Adapter.class) + public enum OwnerEnum { + ALLEGRO("ALLEGRO"), + + CLIENT("CLIENT"); + + private String value; + + OwnerEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OwnerEnum fromValue(String value) { + for (OwnerEnum b : OwnerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OwnerEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OwnerEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OwnerEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OwnerEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_OWNER = "owner"; + @SerializedName(SERIALIZED_NAME_OWNER) + @javax.annotation.Nullable + private OwnerEnum owner; + + public static final String SERIALIZED_NAME_MARKETPLACES = "marketplaces"; + @SerializedName(SERIALIZED_NAME_MARKETPLACES) + @javax.annotation.Nullable + private List marketplaces = new ArrayList<>(); + + /** + * Gets or Sets packageTypes + */ + @JsonAdapter(PackageTypesEnum.Adapter.class) + public enum PackageTypesEnum { + DOX("DOX"), + + PACKAGE("PACKAGE"), + + PALLET("PALLET"), + + OTHER("OTHER"); + + private String value; + + PackageTypesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PackageTypesEnum fromValue(String value) { + for (PackageTypesEnum b : PackageTypesEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PackageTypesEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PackageTypesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PackageTypesEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + PackageTypesEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_PACKAGE_TYPES = "packageTypes"; + @SerializedName(SERIALIZED_NAME_PACKAGE_TYPES) + @javax.annotation.Nullable + private List packageTypes = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CASH_ON_DELIVERY = "cashOnDelivery"; + @SerializedName(SERIALIZED_NAME_CASH_ON_DELIVERY) + @javax.annotation.Nullable + private CashOnDeliveryLimitDto cashOnDelivery; + + public static final String SERIALIZED_NAME_INSURANCE = "insurance"; + @SerializedName(SERIALIZED_NAME_INSURANCE) + @javax.annotation.Nullable + private LimitWithCurrencyDto insurance; + + public static final String SERIALIZED_NAME_FEATURES = "features"; + @SerializedName(SERIALIZED_NAME_FEATURES) + @javax.annotation.Nullable + private Map features = new HashMap<>(); + + public DeliveryServiceDto() { + } + + public DeliveryServiceDto id(@javax.annotation.Nullable DeliveryServiceIdDto id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public DeliveryServiceIdDto getId() { + return id; + } + + public void setId(@javax.annotation.Nullable DeliveryServiceIdDto id) { + this.id = id; + } + + + public DeliveryServiceDto name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of delivery service. <br/> For Allegro Standard method, name of service will be exactly same and occurs only once: eg. 'Allegro Courier DPD'. <br/> For merchant's controlled method, name is concatenation of method name and credential name: eg. 'Courier DPD (My agreement)'. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public DeliveryServiceDto carrierId(@javax.annotation.Nullable String carrierId) { + this.carrierId = carrierId; + return this; + } + + /** + * Get carrierId + * @return carrierId + */ + @javax.annotation.Nullable + public String getCarrierId() { + return carrierId; + } + + public void setCarrierId(@javax.annotation.Nullable String carrierId) { + this.carrierId = carrierId; + } + + + public DeliveryServiceDto additionalServices(@javax.annotation.Nullable List additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + public DeliveryServiceDto addAdditionalServicesItem(AdditionalServiceDto additionalServicesItem) { + if (this.additionalServices == null) { + this.additionalServices = new ArrayList<>(); + } + this.additionalServices.add(additionalServicesItem); + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nullable + public List getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable List additionalServices) { + this.additionalServices = additionalServices; + } + + + public DeliveryServiceDto additionalProperties(@javax.annotation.Nullable List additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + public DeliveryServiceDto addAdditionalPropertiesItem(AdditionalPropertyDto additionalPropertiesItem) { + if (this.additionalProperties == null) { + this.additionalProperties = new ArrayList<>(); + } + this.additionalProperties.add(additionalPropertiesItem); + return this; + } + + /** + * Get additionalProperties + * @return additionalProperties + */ + @javax.annotation.Nullable + public List getAdditionalProperties() { + return additionalProperties; + } + + public void setAdditionalProperties(@javax.annotation.Nullable List additionalProperties) { + this.additionalProperties = additionalProperties; + } + + + public DeliveryServiceDto owner(@javax.annotation.Nullable OwnerEnum owner) { + this.owner = owner; + return this; + } + + /** + * Define delivery method type. ALLEGRO - Allegro Standard. Client - Merchant carrier agreement + * @return owner + */ + @javax.annotation.Nullable + public OwnerEnum getOwner() { + return owner; + } + + public void setOwner(@javax.annotation.Nullable OwnerEnum owner) { + this.owner = owner; + } + + + public DeliveryServiceDto marketplaces(@javax.annotation.Nullable List marketplaces) { + this.marketplaces = marketplaces; + return this; + } + + public DeliveryServiceDto addMarketplacesItem(String marketplacesItem) { + if (this.marketplaces == null) { + this.marketplaces = new ArrayList<>(); + } + this.marketplaces.add(marketplacesItem); + return this; + } + + /** + * List of marketplaces supported by service + * @return marketplaces + */ + @javax.annotation.Nullable + public List getMarketplaces() { + return marketplaces; + } + + public void setMarketplaces(@javax.annotation.Nullable List marketplaces) { + this.marketplaces = marketplaces; + } + + + public DeliveryServiceDto packageTypes(@javax.annotation.Nullable List packageTypes) { + this.packageTypes = packageTypes; + return this; + } + + public DeliveryServiceDto addPackageTypesItem(PackageTypesEnum packageTypesItem) { + if (this.packageTypes == null) { + this.packageTypes = new ArrayList<>(); + } + this.packageTypes.add(packageTypesItem); + return this; + } + + /** + * List of supported package types + * @return packageTypes + */ + @javax.annotation.Nullable + public List getPackageTypes() { + return packageTypes; + } + + public void setPackageTypes(@javax.annotation.Nullable List packageTypes) { + this.packageTypes = packageTypes; + } + + + public DeliveryServiceDto cashOnDelivery(@javax.annotation.Nullable CashOnDeliveryLimitDto cashOnDelivery) { + this.cashOnDelivery = cashOnDelivery; + return this; + } + + /** + * Get cashOnDelivery + * @return cashOnDelivery + */ + @javax.annotation.Nullable + public CashOnDeliveryLimitDto getCashOnDelivery() { + return cashOnDelivery; + } + + public void setCashOnDelivery(@javax.annotation.Nullable CashOnDeliveryLimitDto cashOnDelivery) { + this.cashOnDelivery = cashOnDelivery; + } + + + public DeliveryServiceDto insurance(@javax.annotation.Nullable LimitWithCurrencyDto insurance) { + this.insurance = insurance; + return this; + } + + /** + * Get insurance + * @return insurance + */ + @javax.annotation.Nullable + public LimitWithCurrencyDto getInsurance() { + return insurance; + } + + public void setInsurance(@javax.annotation.Nullable LimitWithCurrencyDto insurance) { + this.insurance = insurance; + } + + + public DeliveryServiceDto features(@javax.annotation.Nullable Map features) { + this.features = features; + return this; + } + + public DeliveryServiceDto putFeaturesItem(String key, String featuresItem) { + if (this.features == null) { + this.features = new HashMap<>(); + } + this.features.put(key, featuresItem); + return this; + } + + /** + * A map of service-specific features. List of key will be builded per services. + * @return features + */ + @javax.annotation.Nullable + public Map getFeatures() { + return features; + } + + public void setFeatures(@javax.annotation.Nullable Map features) { + this.features = features; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryServiceDto deliveryServiceDto = (DeliveryServiceDto) o; + return Objects.equals(this.id, deliveryServiceDto.id) && + Objects.equals(this.name, deliveryServiceDto.name) && + Objects.equals(this.carrierId, deliveryServiceDto.carrierId) && + Objects.equals(this.additionalServices, deliveryServiceDto.additionalServices) && + Objects.equals(this.additionalProperties, deliveryServiceDto.additionalProperties) && + Objects.equals(this.owner, deliveryServiceDto.owner) && + Objects.equals(this.marketplaces, deliveryServiceDto.marketplaces) && + Objects.equals(this.packageTypes, deliveryServiceDto.packageTypes) && + Objects.equals(this.cashOnDelivery, deliveryServiceDto.cashOnDelivery) && + Objects.equals(this.insurance, deliveryServiceDto.insurance) && + Objects.equals(this.features, deliveryServiceDto.features); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, carrierId, additionalServices, additionalProperties, owner, marketplaces, packageTypes, cashOnDelivery, insurance, features); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryServiceDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" carrierId: ").append(toIndentedString(carrierId)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" marketplaces: ").append(toIndentedString(marketplaces)).append("\n"); + sb.append(" packageTypes: ").append(toIndentedString(packageTypes)).append("\n"); + sb.append(" cashOnDelivery: ").append(toIndentedString(cashOnDelivery)).append("\n"); + sb.append(" insurance: ").append(toIndentedString(insurance)).append("\n"); + sb.append(" features: ").append(toIndentedString(features)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("carrierId"); + openapiFields.add("additionalServices"); + openapiFields.add("additionalProperties"); + openapiFields.add("owner"); + openapiFields.add("marketplaces"); + openapiFields.add("packageTypes"); + openapiFields.add("cashOnDelivery"); + openapiFields.add("insurance"); + openapiFields.add("features"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliveryServiceDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryServiceDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliveryServiceDto is not found in the empty JSON string", DeliveryServiceDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryServiceDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliveryServiceDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `id` + if (jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) { + DeliveryServiceIdDto.validateJsonElement(jsonObj.get("id")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("carrierId") != null && !jsonObj.get("carrierId").isJsonNull()) && !jsonObj.get("carrierId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `carrierId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierId").toString())); + } + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull()) { + JsonArray jsonArrayadditionalServices = jsonObj.getAsJsonArray("additionalServices"); + if (jsonArrayadditionalServices != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalServices").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalServices` to be an array in the JSON string but got `%s`", jsonObj.get("additionalServices").toString())); + } + + // validate the optional field `additionalServices` (array) + for (int i = 0; i < jsonArrayadditionalServices.size(); i++) { + AdditionalServiceDto.validateJsonElement(jsonArrayadditionalServices.get(i)); + }; + } + } + if (jsonObj.get("additionalProperties") != null && !jsonObj.get("additionalProperties").isJsonNull()) { + JsonArray jsonArrayadditionalProperties = jsonObj.getAsJsonArray("additionalProperties"); + if (jsonArrayadditionalProperties != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalProperties").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalProperties` to be an array in the JSON string but got `%s`", jsonObj.get("additionalProperties").toString())); + } + + // validate the optional field `additionalProperties` (array) + for (int i = 0; i < jsonArrayadditionalProperties.size(); i++) { + AdditionalPropertyDto.validateJsonElement(jsonArrayadditionalProperties.get(i)); + }; + } + } + if ((jsonObj.get("owner") != null && !jsonObj.get("owner").isJsonNull()) && !jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); + } + // validate the optional field `owner` + if (jsonObj.get("owner") != null && !jsonObj.get("owner").isJsonNull()) { + OwnerEnum.validateJsonElement(jsonObj.get("owner")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("marketplaces") != null && !jsonObj.get("marketplaces").isJsonNull() && !jsonObj.get("marketplaces").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaces` to be an array in the JSON string but got `%s`", jsonObj.get("marketplaces").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("packageTypes") != null && !jsonObj.get("packageTypes").isJsonNull() && !jsonObj.get("packageTypes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `packageTypes` to be an array in the JSON string but got `%s`", jsonObj.get("packageTypes").toString())); + } + // validate the optional field `cashOnDelivery` + if (jsonObj.get("cashOnDelivery") != null && !jsonObj.get("cashOnDelivery").isJsonNull()) { + CashOnDeliveryLimitDto.validateJsonElement(jsonObj.get("cashOnDelivery")); + } + // validate the optional field `insurance` + if (jsonObj.get("insurance") != null && !jsonObj.get("insurance").isJsonNull()) { + LimitWithCurrencyDto.validateJsonElement(jsonObj.get("insurance")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryServiceDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryServiceDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliveryServiceDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryServiceDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryServiceDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryServiceDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryServiceDto + * @throws IOException if the JSON string is invalid with respect to DeliveryServiceDto + */ + public static DeliveryServiceDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryServiceDto.class); + } + + /** + * Convert an instance of DeliveryServiceDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliveryServiceIdDto.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryServiceIdDto.java new file mode 100644 index 0000000..4a20ec0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryServiceIdDto.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DeliveryServiceIdDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliveryServiceIdDto { + public static final String SERIALIZED_NAME_DELIVERY_METHOD_ID = "deliveryMethodId"; + @SerializedName(SERIALIZED_NAME_DELIVERY_METHOD_ID) + @javax.annotation.Nullable + private String deliveryMethodId; + + public static final String SERIALIZED_NAME_CREDENTIALS_ID = "credentialsId"; + @SerializedName(SERIALIZED_NAME_CREDENTIALS_ID) + @javax.annotation.Nullable + private String credentialsId; + + public DeliveryServiceIdDto() { + } + + public DeliveryServiceIdDto deliveryMethodId(@javax.annotation.Nullable String deliveryMethodId) { + this.deliveryMethodId = deliveryMethodId; + return this; + } + + /** + * Id of delivery method, chosen by buyer in order. + * @return deliveryMethodId + */ + @javax.annotation.Nullable + public String getDeliveryMethodId() { + return deliveryMethodId; + } + + public void setDeliveryMethodId(@javax.annotation.Nullable String deliveryMethodId) { + this.deliveryMethodId = deliveryMethodId; + } + + + public DeliveryServiceIdDto credentialsId(@javax.annotation.Nullable String credentialsId) { + this.credentialsId = credentialsId; + return this; + } + + /** + * ID of merchant agreement, registered in WZA. For Allegro Standard methods, this field is null. + * @return credentialsId + */ + @javax.annotation.Nullable + public String getCredentialsId() { + return credentialsId; + } + + public void setCredentialsId(@javax.annotation.Nullable String credentialsId) { + this.credentialsId = credentialsId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryServiceIdDto deliveryServiceIdDto = (DeliveryServiceIdDto) o; + return Objects.equals(this.deliveryMethodId, deliveryServiceIdDto.deliveryMethodId) && + Objects.equals(this.credentialsId, deliveryServiceIdDto.credentialsId); + } + + @Override + public int hashCode() { + return Objects.hash(deliveryMethodId, credentialsId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryServiceIdDto {\n"); + sb.append(" deliveryMethodId: ").append(toIndentedString(deliveryMethodId)).append("\n"); + sb.append(" credentialsId: ").append(toIndentedString(credentialsId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("deliveryMethodId"); + openapiFields.add("credentialsId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliveryServiceIdDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryServiceIdDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliveryServiceIdDto is not found in the empty JSON string", DeliveryServiceIdDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryServiceIdDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliveryServiceIdDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("deliveryMethodId") != null && !jsonObj.get("deliveryMethodId").isJsonNull()) && !jsonObj.get("deliveryMethodId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `deliveryMethodId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deliveryMethodId").toString())); + } + if ((jsonObj.get("credentialsId") != null && !jsonObj.get("credentialsId").isJsonNull()) && !jsonObj.get("credentialsId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `credentialsId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("credentialsId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryServiceIdDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryServiceIdDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliveryServiceIdDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryServiceIdDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryServiceIdDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryServiceIdDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryServiceIdDto + * @throws IOException if the JSON string is invalid with respect to DeliveryServiceIdDto + */ + public static DeliveryServiceIdDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryServiceIdDto.class); + } + + /** + * Convert an instance of DeliveryServiceIdDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliveryServicesDto.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryServicesDto.java new file mode 100644 index 0000000..879395d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliveryServicesDto.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.DeliveryServiceDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * List of all available delivery services for merchant. List will be unique for each merchant. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliveryServicesDto { + public static final String SERIALIZED_NAME_SERVICES = "services"; + @SerializedName(SERIALIZED_NAME_SERVICES) + @javax.annotation.Nullable + private List services = new ArrayList<>(); + + public DeliveryServicesDto() { + } + + public DeliveryServicesDto services(@javax.annotation.Nullable List services) { + this.services = services; + return this; + } + + public DeliveryServicesDto addServicesItem(DeliveryServiceDto servicesItem) { + if (this.services == null) { + this.services = new ArrayList<>(); + } + this.services.add(servicesItem); + return this; + } + + /** + * Get services + * @return services + */ + @javax.annotation.Nullable + public List getServices() { + return services; + } + + public void setServices(@javax.annotation.Nullable List services) { + this.services = services; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliveryServicesDto deliveryServicesDto = (DeliveryServicesDto) o; + return Objects.equals(this.services, deliveryServicesDto.services); + } + + @Override + public int hashCode() { + return Objects.hash(services); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryServicesDto {\n"); + sb.append(" services: ").append(toIndentedString(services)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("services"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliveryServicesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliveryServicesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliveryServicesDto is not found in the empty JSON string", DeliveryServicesDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliveryServicesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliveryServicesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("services") != null && !jsonObj.get("services").isJsonNull()) { + JsonArray jsonArrayservices = jsonObj.getAsJsonArray("services"); + if (jsonArrayservices != null) { + // ensure the json data is an array + if (!jsonObj.get("services").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `services` to be an array in the JSON string but got `%s`", jsonObj.get("services").toString())); + } + + // validate the optional field `services` (array) + for (int i = 0; i < jsonArrayservices.size(); i++) { + DeliveryServiceDto.validateJsonElement(jsonArrayservices.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliveryServicesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliveryServicesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliveryServicesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliveryServicesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliveryServicesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliveryServicesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliveryServicesDto + * @throws IOException if the JSON string is invalid with respect to DeliveryServicesDto + */ + public static DeliveryServicesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliveryServicesDto.class); + } + + /** + * Convert an instance of DeliveryServicesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequest.java new file mode 100644 index 0000000..edf985c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequest.java @@ -0,0 +1,341 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DeliverySettingsRequestAbroadFreeDelivery; +import pl.wtx.allegro.api.client.model.DeliverySettingsRequestFreeDelivery; +import pl.wtx.allegro.api.client.model.DeliverySettingsRequestMarketplace; +import pl.wtx.allegro.api.client.model.DeliverySettingsResponseCustomCost; +import pl.wtx.allegro.api.client.model.DeliverySettingsResponseJoinPolicy; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DeliverySettingsRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliverySettingsRequest { + public static final String SERIALIZED_NAME_MARKETPLACE = "marketplace"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE) + @javax.annotation.Nullable + private DeliverySettingsRequestMarketplace marketplace; + + public static final String SERIALIZED_NAME_FREE_DELIVERY = "freeDelivery"; + @SerializedName(SERIALIZED_NAME_FREE_DELIVERY) + @javax.annotation.Nullable + private DeliverySettingsRequestFreeDelivery freeDelivery; + + public static final String SERIALIZED_NAME_ABROAD_FREE_DELIVERY = "abroadFreeDelivery"; + @SerializedName(SERIALIZED_NAME_ABROAD_FREE_DELIVERY) + @javax.annotation.Nullable + private DeliverySettingsRequestAbroadFreeDelivery abroadFreeDelivery; + + public static final String SERIALIZED_NAME_JOIN_POLICY = "joinPolicy"; + @SerializedName(SERIALIZED_NAME_JOIN_POLICY) + @javax.annotation.Nonnull + private DeliverySettingsResponseJoinPolicy joinPolicy; + + public static final String SERIALIZED_NAME_CUSTOM_COST = "customCost"; + @SerializedName(SERIALIZED_NAME_CUSTOM_COST) + @javax.annotation.Nonnull + private DeliverySettingsResponseCustomCost customCost; + + public DeliverySettingsRequest() { + } + + public DeliverySettingsRequest marketplace(@javax.annotation.Nullable DeliverySettingsRequestMarketplace marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get marketplace + * @return marketplace + */ + @javax.annotation.Nullable + public DeliverySettingsRequestMarketplace getMarketplace() { + return marketplace; + } + + public void setMarketplace(@javax.annotation.Nullable DeliverySettingsRequestMarketplace marketplace) { + this.marketplace = marketplace; + } + + + public DeliverySettingsRequest freeDelivery(@javax.annotation.Nullable DeliverySettingsRequestFreeDelivery freeDelivery) { + this.freeDelivery = freeDelivery; + return this; + } + + /** + * Get freeDelivery + * @return freeDelivery + */ + @javax.annotation.Nullable + public DeliverySettingsRequestFreeDelivery getFreeDelivery() { + return freeDelivery; + } + + public void setFreeDelivery(@javax.annotation.Nullable DeliverySettingsRequestFreeDelivery freeDelivery) { + this.freeDelivery = freeDelivery; + } + + + public DeliverySettingsRequest abroadFreeDelivery(@javax.annotation.Nullable DeliverySettingsRequestAbroadFreeDelivery abroadFreeDelivery) { + this.abroadFreeDelivery = abroadFreeDelivery; + return this; + } + + /** + * Get abroadFreeDelivery + * @return abroadFreeDelivery + */ + @javax.annotation.Nullable + public DeliverySettingsRequestAbroadFreeDelivery getAbroadFreeDelivery() { + return abroadFreeDelivery; + } + + public void setAbroadFreeDelivery(@javax.annotation.Nullable DeliverySettingsRequestAbroadFreeDelivery abroadFreeDelivery) { + this.abroadFreeDelivery = abroadFreeDelivery; + } + + + public DeliverySettingsRequest joinPolicy(@javax.annotation.Nonnull DeliverySettingsResponseJoinPolicy joinPolicy) { + this.joinPolicy = joinPolicy; + return this; + } + + /** + * Get joinPolicy + * @return joinPolicy + */ + @javax.annotation.Nonnull + public DeliverySettingsResponseJoinPolicy getJoinPolicy() { + return joinPolicy; + } + + public void setJoinPolicy(@javax.annotation.Nonnull DeliverySettingsResponseJoinPolicy joinPolicy) { + this.joinPolicy = joinPolicy; + } + + + public DeliverySettingsRequest customCost(@javax.annotation.Nonnull DeliverySettingsResponseCustomCost customCost) { + this.customCost = customCost; + return this; + } + + /** + * Get customCost + * @return customCost + */ + @javax.annotation.Nonnull + public DeliverySettingsResponseCustomCost getCustomCost() { + return customCost; + } + + public void setCustomCost(@javax.annotation.Nonnull DeliverySettingsResponseCustomCost customCost) { + this.customCost = customCost; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliverySettingsRequest deliverySettingsRequest = (DeliverySettingsRequest) o; + return Objects.equals(this.marketplace, deliverySettingsRequest.marketplace) && + Objects.equals(this.freeDelivery, deliverySettingsRequest.freeDelivery) && + Objects.equals(this.abroadFreeDelivery, deliverySettingsRequest.abroadFreeDelivery) && + Objects.equals(this.joinPolicy, deliverySettingsRequest.joinPolicy) && + Objects.equals(this.customCost, deliverySettingsRequest.customCost); + } + + @Override + public int hashCode() { + return Objects.hash(marketplace, freeDelivery, abroadFreeDelivery, joinPolicy, customCost); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliverySettingsRequest {\n"); + sb.append(" marketplace: ").append(toIndentedString(marketplace)).append("\n"); + sb.append(" freeDelivery: ").append(toIndentedString(freeDelivery)).append("\n"); + sb.append(" abroadFreeDelivery: ").append(toIndentedString(abroadFreeDelivery)).append("\n"); + sb.append(" joinPolicy: ").append(toIndentedString(joinPolicy)).append("\n"); + sb.append(" customCost: ").append(toIndentedString(customCost)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplace"); + openapiFields.add("freeDelivery"); + openapiFields.add("abroadFreeDelivery"); + openapiFields.add("joinPolicy"); + openapiFields.add("customCost"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("joinPolicy"); + openapiRequiredFields.add("customCost"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliverySettingsRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliverySettingsRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliverySettingsRequest is not found in the empty JSON string", DeliverySettingsRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliverySettingsRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliverySettingsRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliverySettingsRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `marketplace` + if (jsonObj.get("marketplace") != null && !jsonObj.get("marketplace").isJsonNull()) { + DeliverySettingsRequestMarketplace.validateJsonElement(jsonObj.get("marketplace")); + } + // validate the optional field `freeDelivery` + if (jsonObj.get("freeDelivery") != null && !jsonObj.get("freeDelivery").isJsonNull()) { + DeliverySettingsRequestFreeDelivery.validateJsonElement(jsonObj.get("freeDelivery")); + } + // validate the optional field `abroadFreeDelivery` + if (jsonObj.get("abroadFreeDelivery") != null && !jsonObj.get("abroadFreeDelivery").isJsonNull()) { + DeliverySettingsRequestAbroadFreeDelivery.validateJsonElement(jsonObj.get("abroadFreeDelivery")); + } + // validate the required field `joinPolicy` + DeliverySettingsResponseJoinPolicy.validateJsonElement(jsonObj.get("joinPolicy")); + // validate the required field `customCost` + DeliverySettingsResponseCustomCost.validateJsonElement(jsonObj.get("customCost")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliverySettingsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliverySettingsRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliverySettingsRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliverySettingsRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliverySettingsRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliverySettingsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliverySettingsRequest + * @throws IOException if the JSON string is invalid with respect to DeliverySettingsRequest + */ + public static DeliverySettingsRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliverySettingsRequest.class); + } + + /** + * Convert an instance of DeliverySettingsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestAbroadFreeDelivery.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestAbroadFreeDelivery.java new file mode 100644 index 0000000..577b190 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestAbroadFreeDelivery.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * A minimum total order amount required to qualify for free foreign delivery (for example for allegro-cz marketplace, all delivery countries other than Czechia are treated as foreign). If you do not want to set free foreign delivery threshold, do not set this value. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliverySettingsRequestAbroadFreeDelivery { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public DeliverySettingsRequestAbroadFreeDelivery() { + } + + public DeliverySettingsRequestAbroadFreeDelivery amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public DeliverySettingsRequestAbroadFreeDelivery currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * ISO 4217 currency code. The correct currency code for a given marketplace should be set, e.g. PLN for allegro-pl, CZK for allegro-cz. + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliverySettingsRequestAbroadFreeDelivery deliverySettingsRequestAbroadFreeDelivery = (DeliverySettingsRequestAbroadFreeDelivery) o; + return Objects.equals(this.amount, deliverySettingsRequestAbroadFreeDelivery.amount) && + Objects.equals(this.currency, deliverySettingsRequestAbroadFreeDelivery.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliverySettingsRequestAbroadFreeDelivery {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliverySettingsRequestAbroadFreeDelivery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliverySettingsRequestAbroadFreeDelivery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliverySettingsRequestAbroadFreeDelivery is not found in the empty JSON string", DeliverySettingsRequestAbroadFreeDelivery.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliverySettingsRequestAbroadFreeDelivery.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliverySettingsRequestAbroadFreeDelivery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliverySettingsRequestAbroadFreeDelivery.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliverySettingsRequestAbroadFreeDelivery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliverySettingsRequestAbroadFreeDelivery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliverySettingsRequestAbroadFreeDelivery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliverySettingsRequestAbroadFreeDelivery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliverySettingsRequestAbroadFreeDelivery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliverySettingsRequestAbroadFreeDelivery given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliverySettingsRequestAbroadFreeDelivery + * @throws IOException if the JSON string is invalid with respect to DeliverySettingsRequestAbroadFreeDelivery + */ + public static DeliverySettingsRequestAbroadFreeDelivery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliverySettingsRequestAbroadFreeDelivery.class); + } + + /** + * Convert an instance of DeliverySettingsRequestAbroadFreeDelivery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestFreeDelivery.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestFreeDelivery.java new file mode 100644 index 0000000..ed04b61 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestFreeDelivery.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * A minimum total order amount required to qualify for free domestic delivery (for example for allegro-cz marketplace, only Czechia is treated as domestic). If you do not want to set free domestic delivery threshold, do not set this value. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliverySettingsRequestFreeDelivery { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public DeliverySettingsRequestFreeDelivery() { + } + + public DeliverySettingsRequestFreeDelivery amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public DeliverySettingsRequestFreeDelivery currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * ISO 4217 currency code. The correct currency code for a given marketplace should be set, e.g. PLN for allegro-pl, CZK for allegro-cz. + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliverySettingsRequestFreeDelivery deliverySettingsRequestFreeDelivery = (DeliverySettingsRequestFreeDelivery) o; + return Objects.equals(this.amount, deliverySettingsRequestFreeDelivery.amount) && + Objects.equals(this.currency, deliverySettingsRequestFreeDelivery.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliverySettingsRequestFreeDelivery {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliverySettingsRequestFreeDelivery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliverySettingsRequestFreeDelivery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliverySettingsRequestFreeDelivery is not found in the empty JSON string", DeliverySettingsRequestFreeDelivery.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliverySettingsRequestFreeDelivery.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliverySettingsRequestFreeDelivery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliverySettingsRequestFreeDelivery.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliverySettingsRequestFreeDelivery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliverySettingsRequestFreeDelivery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliverySettingsRequestFreeDelivery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliverySettingsRequestFreeDelivery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliverySettingsRequestFreeDelivery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliverySettingsRequestFreeDelivery given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliverySettingsRequestFreeDelivery + * @throws IOException if the JSON string is invalid with respect to DeliverySettingsRequestFreeDelivery + */ + public static DeliverySettingsRequestFreeDelivery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliverySettingsRequestFreeDelivery.class); + } + + /** + * Convert an instance of DeliverySettingsRequestFreeDelivery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestMarketplace.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestMarketplace.java new file mode 100644 index 0000000..a5166ad --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsRequestMarketplace.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The marketplace for which delivery settings will be modified. By default (if the marketplace parameter is not set) the marketplace on which the seller has registered is used. However, we recommend that the marketplace parameter should always be explicitly set. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliverySettingsRequestMarketplace { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public DeliverySettingsRequestMarketplace() { + } + + public DeliverySettingsRequestMarketplace id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Marketplace id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliverySettingsRequestMarketplace deliverySettingsRequestMarketplace = (DeliverySettingsRequestMarketplace) o; + return Objects.equals(this.id, deliverySettingsRequestMarketplace.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliverySettingsRequestMarketplace {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliverySettingsRequestMarketplace + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliverySettingsRequestMarketplace.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliverySettingsRequestMarketplace is not found in the empty JSON string", DeliverySettingsRequestMarketplace.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliverySettingsRequestMarketplace.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliverySettingsRequestMarketplace` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliverySettingsRequestMarketplace.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliverySettingsRequestMarketplace.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliverySettingsRequestMarketplace' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliverySettingsRequestMarketplace.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliverySettingsRequestMarketplace value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliverySettingsRequestMarketplace read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliverySettingsRequestMarketplace given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliverySettingsRequestMarketplace + * @throws IOException if the JSON string is invalid with respect to DeliverySettingsRequestMarketplace + */ + public static DeliverySettingsRequestMarketplace fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliverySettingsRequestMarketplace.class); + } + + /** + * Convert an instance of DeliverySettingsRequestMarketplace to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponse.java new file mode 100644 index 0000000..da55f59 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponse.java @@ -0,0 +1,371 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DeliverySettingsResponseAbroadFreeDelivery; +import pl.wtx.allegro.api.client.model.DeliverySettingsResponseCustomCost; +import pl.wtx.allegro.api.client.model.DeliverySettingsResponseFreeDelivery; +import pl.wtx.allegro.api.client.model.DeliverySettingsResponseJoinPolicy; +import pl.wtx.allegro.api.client.model.DeliverySettingsResponseMarketplace; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DeliverySettingsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliverySettingsResponse { + public static final String SERIALIZED_NAME_MARKETPLACE = "marketplace"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE) + @javax.annotation.Nonnull + private DeliverySettingsResponseMarketplace marketplace; + + public static final String SERIALIZED_NAME_FREE_DELIVERY = "freeDelivery"; + @SerializedName(SERIALIZED_NAME_FREE_DELIVERY) + @javax.annotation.Nullable + private DeliverySettingsResponseFreeDelivery freeDelivery; + + public static final String SERIALIZED_NAME_ABROAD_FREE_DELIVERY = "abroadFreeDelivery"; + @SerializedName(SERIALIZED_NAME_ABROAD_FREE_DELIVERY) + @javax.annotation.Nullable + private DeliverySettingsResponseAbroadFreeDelivery abroadFreeDelivery; + + public static final String SERIALIZED_NAME_JOIN_POLICY = "joinPolicy"; + @SerializedName(SERIALIZED_NAME_JOIN_POLICY) + @javax.annotation.Nonnull + private DeliverySettingsResponseJoinPolicy joinPolicy; + + public static final String SERIALIZED_NAME_CUSTOM_COST = "customCost"; + @SerializedName(SERIALIZED_NAME_CUSTOM_COST) + @javax.annotation.Nonnull + private DeliverySettingsResponseCustomCost customCost; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nonnull + private String updatedAt; + + public DeliverySettingsResponse() { + } + + public DeliverySettingsResponse marketplace(@javax.annotation.Nonnull DeliverySettingsResponseMarketplace marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get marketplace + * @return marketplace + */ + @javax.annotation.Nonnull + public DeliverySettingsResponseMarketplace getMarketplace() { + return marketplace; + } + + public void setMarketplace(@javax.annotation.Nonnull DeliverySettingsResponseMarketplace marketplace) { + this.marketplace = marketplace; + } + + + public DeliverySettingsResponse freeDelivery(@javax.annotation.Nullable DeliverySettingsResponseFreeDelivery freeDelivery) { + this.freeDelivery = freeDelivery; + return this; + } + + /** + * Get freeDelivery + * @return freeDelivery + */ + @javax.annotation.Nullable + public DeliverySettingsResponseFreeDelivery getFreeDelivery() { + return freeDelivery; + } + + public void setFreeDelivery(@javax.annotation.Nullable DeliverySettingsResponseFreeDelivery freeDelivery) { + this.freeDelivery = freeDelivery; + } + + + public DeliverySettingsResponse abroadFreeDelivery(@javax.annotation.Nullable DeliverySettingsResponseAbroadFreeDelivery abroadFreeDelivery) { + this.abroadFreeDelivery = abroadFreeDelivery; + return this; + } + + /** + * Get abroadFreeDelivery + * @return abroadFreeDelivery + */ + @javax.annotation.Nullable + public DeliverySettingsResponseAbroadFreeDelivery getAbroadFreeDelivery() { + return abroadFreeDelivery; + } + + public void setAbroadFreeDelivery(@javax.annotation.Nullable DeliverySettingsResponseAbroadFreeDelivery abroadFreeDelivery) { + this.abroadFreeDelivery = abroadFreeDelivery; + } + + + public DeliverySettingsResponse joinPolicy(@javax.annotation.Nonnull DeliverySettingsResponseJoinPolicy joinPolicy) { + this.joinPolicy = joinPolicy; + return this; + } + + /** + * Get joinPolicy + * @return joinPolicy + */ + @javax.annotation.Nonnull + public DeliverySettingsResponseJoinPolicy getJoinPolicy() { + return joinPolicy; + } + + public void setJoinPolicy(@javax.annotation.Nonnull DeliverySettingsResponseJoinPolicy joinPolicy) { + this.joinPolicy = joinPolicy; + } + + + public DeliverySettingsResponse customCost(@javax.annotation.Nonnull DeliverySettingsResponseCustomCost customCost) { + this.customCost = customCost; + return this; + } + + /** + * Get customCost + * @return customCost + */ + @javax.annotation.Nonnull + public DeliverySettingsResponseCustomCost getCustomCost() { + return customCost; + } + + public void setCustomCost(@javax.annotation.Nonnull DeliverySettingsResponseCustomCost customCost) { + this.customCost = customCost; + } + + + public DeliverySettingsResponse updatedAt(@javax.annotation.Nonnull String updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Date and time of the last modification of the set in UTC ISO 8601 format. + * @return updatedAt + */ + @javax.annotation.Nonnull + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nonnull String updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliverySettingsResponse deliverySettingsResponse = (DeliverySettingsResponse) o; + return Objects.equals(this.marketplace, deliverySettingsResponse.marketplace) && + Objects.equals(this.freeDelivery, deliverySettingsResponse.freeDelivery) && + Objects.equals(this.abroadFreeDelivery, deliverySettingsResponse.abroadFreeDelivery) && + Objects.equals(this.joinPolicy, deliverySettingsResponse.joinPolicy) && + Objects.equals(this.customCost, deliverySettingsResponse.customCost) && + Objects.equals(this.updatedAt, deliverySettingsResponse.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(marketplace, freeDelivery, abroadFreeDelivery, joinPolicy, customCost, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliverySettingsResponse {\n"); + sb.append(" marketplace: ").append(toIndentedString(marketplace)).append("\n"); + sb.append(" freeDelivery: ").append(toIndentedString(freeDelivery)).append("\n"); + sb.append(" abroadFreeDelivery: ").append(toIndentedString(abroadFreeDelivery)).append("\n"); + sb.append(" joinPolicy: ").append(toIndentedString(joinPolicy)).append("\n"); + sb.append(" customCost: ").append(toIndentedString(customCost)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplace"); + openapiFields.add("freeDelivery"); + openapiFields.add("abroadFreeDelivery"); + openapiFields.add("joinPolicy"); + openapiFields.add("customCost"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("marketplace"); + openapiRequiredFields.add("joinPolicy"); + openapiRequiredFields.add("customCost"); + openapiRequiredFields.add("updatedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliverySettingsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliverySettingsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliverySettingsResponse is not found in the empty JSON string", DeliverySettingsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliverySettingsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliverySettingsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliverySettingsResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `marketplace` + DeliverySettingsResponseMarketplace.validateJsonElement(jsonObj.get("marketplace")); + // validate the optional field `freeDelivery` + if (jsonObj.get("freeDelivery") != null && !jsonObj.get("freeDelivery").isJsonNull()) { + DeliverySettingsResponseFreeDelivery.validateJsonElement(jsonObj.get("freeDelivery")); + } + // validate the optional field `abroadFreeDelivery` + if (jsonObj.get("abroadFreeDelivery") != null && !jsonObj.get("abroadFreeDelivery").isJsonNull()) { + DeliverySettingsResponseAbroadFreeDelivery.validateJsonElement(jsonObj.get("abroadFreeDelivery")); + } + // validate the required field `joinPolicy` + DeliverySettingsResponseJoinPolicy.validateJsonElement(jsonObj.get("joinPolicy")); + // validate the required field `customCost` + DeliverySettingsResponseCustomCost.validateJsonElement(jsonObj.get("customCost")); + if (!jsonObj.get("updatedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `updatedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliverySettingsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliverySettingsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliverySettingsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliverySettingsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliverySettingsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliverySettingsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliverySettingsResponse + * @throws IOException if the JSON string is invalid with respect to DeliverySettingsResponse + */ + public static DeliverySettingsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliverySettingsResponse.class); + } + + /** + * Convert an instance of DeliverySettingsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseAbroadFreeDelivery.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseAbroadFreeDelivery.java new file mode 100644 index 0000000..2d0288a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseAbroadFreeDelivery.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * A minimum total order amount required to qualify for free foreign delivery (for example for allegro-cz marketplace, all delivery countries other than Czechia are treated as foreign). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliverySettingsResponseAbroadFreeDelivery { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public DeliverySettingsResponseAbroadFreeDelivery() { + } + + public DeliverySettingsResponseAbroadFreeDelivery amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public DeliverySettingsResponseAbroadFreeDelivery currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * ISO 4217 currency code. Currency code depends on marketplace, e.g. PLN for allegro-pl, CZK for allegro-cz. + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliverySettingsResponseAbroadFreeDelivery deliverySettingsResponseAbroadFreeDelivery = (DeliverySettingsResponseAbroadFreeDelivery) o; + return Objects.equals(this.amount, deliverySettingsResponseAbroadFreeDelivery.amount) && + Objects.equals(this.currency, deliverySettingsResponseAbroadFreeDelivery.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliverySettingsResponseAbroadFreeDelivery {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliverySettingsResponseAbroadFreeDelivery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliverySettingsResponseAbroadFreeDelivery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliverySettingsResponseAbroadFreeDelivery is not found in the empty JSON string", DeliverySettingsResponseAbroadFreeDelivery.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliverySettingsResponseAbroadFreeDelivery.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliverySettingsResponseAbroadFreeDelivery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliverySettingsResponseAbroadFreeDelivery.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliverySettingsResponseAbroadFreeDelivery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliverySettingsResponseAbroadFreeDelivery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliverySettingsResponseAbroadFreeDelivery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliverySettingsResponseAbroadFreeDelivery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliverySettingsResponseAbroadFreeDelivery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliverySettingsResponseAbroadFreeDelivery given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliverySettingsResponseAbroadFreeDelivery + * @throws IOException if the JSON string is invalid with respect to DeliverySettingsResponseAbroadFreeDelivery + */ + public static DeliverySettingsResponseAbroadFreeDelivery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliverySettingsResponseAbroadFreeDelivery.class); + } + + /** + * Convert an instance of DeliverySettingsResponseAbroadFreeDelivery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseCustomCost.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseCustomCost.java new file mode 100644 index 0000000..6305985 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseCustomCost.java @@ -0,0 +1,211 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Policy of custom delivery cost. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliverySettingsResponseCustomCost { + public static final String SERIALIZED_NAME_ALLOWED = "allowed"; + @SerializedName(SERIALIZED_NAME_ALLOWED) + @javax.annotation.Nonnull + private Boolean allowed; + + public DeliverySettingsResponseCustomCost() { + } + + public DeliverySettingsResponseCustomCost allowed(@javax.annotation.Nonnull Boolean allowed) { + this.allowed = allowed; + return this; + } + + /** + * If true the customer can enter a custom shipping cost. + * @return allowed + */ + @javax.annotation.Nonnull + public Boolean getAllowed() { + return allowed; + } + + public void setAllowed(@javax.annotation.Nonnull Boolean allowed) { + this.allowed = allowed; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliverySettingsResponseCustomCost deliverySettingsResponseCustomCost = (DeliverySettingsResponseCustomCost) o; + return Objects.equals(this.allowed, deliverySettingsResponseCustomCost.allowed); + } + + @Override + public int hashCode() { + return Objects.hash(allowed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliverySettingsResponseCustomCost {\n"); + sb.append(" allowed: ").append(toIndentedString(allowed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("allowed"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("allowed"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliverySettingsResponseCustomCost + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliverySettingsResponseCustomCost.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliverySettingsResponseCustomCost is not found in the empty JSON string", DeliverySettingsResponseCustomCost.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliverySettingsResponseCustomCost.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliverySettingsResponseCustomCost` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliverySettingsResponseCustomCost.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliverySettingsResponseCustomCost.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliverySettingsResponseCustomCost' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliverySettingsResponseCustomCost.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliverySettingsResponseCustomCost value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliverySettingsResponseCustomCost read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliverySettingsResponseCustomCost given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliverySettingsResponseCustomCost + * @throws IOException if the JSON string is invalid with respect to DeliverySettingsResponseCustomCost + */ + public static DeliverySettingsResponseCustomCost fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliverySettingsResponseCustomCost.class); + } + + /** + * Convert an instance of DeliverySettingsResponseCustomCost to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseFreeDelivery.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseFreeDelivery.java new file mode 100644 index 0000000..78e7396 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseFreeDelivery.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * A minimum total order amount required to qualify for free domestic delivery (for example for allegro-cz marketplace, only Czechia is treated as domestic). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliverySettingsResponseFreeDelivery { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public DeliverySettingsResponseFreeDelivery() { + } + + public DeliverySettingsResponseFreeDelivery amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public DeliverySettingsResponseFreeDelivery currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * ISO 4217 currency code. Currency code depends on marketplace, e.g. PLN for allegro-pl, CZK for allegro-cz. + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliverySettingsResponseFreeDelivery deliverySettingsResponseFreeDelivery = (DeliverySettingsResponseFreeDelivery) o; + return Objects.equals(this.amount, deliverySettingsResponseFreeDelivery.amount) && + Objects.equals(this.currency, deliverySettingsResponseFreeDelivery.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliverySettingsResponseFreeDelivery {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliverySettingsResponseFreeDelivery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliverySettingsResponseFreeDelivery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliverySettingsResponseFreeDelivery is not found in the empty JSON string", DeliverySettingsResponseFreeDelivery.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliverySettingsResponseFreeDelivery.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliverySettingsResponseFreeDelivery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliverySettingsResponseFreeDelivery.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliverySettingsResponseFreeDelivery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliverySettingsResponseFreeDelivery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliverySettingsResponseFreeDelivery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliverySettingsResponseFreeDelivery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliverySettingsResponseFreeDelivery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliverySettingsResponseFreeDelivery given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliverySettingsResponseFreeDelivery + * @throws IOException if the JSON string is invalid with respect to DeliverySettingsResponseFreeDelivery + */ + public static DeliverySettingsResponseFreeDelivery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliverySettingsResponseFreeDelivery.class); + } + + /** + * Convert an instance of DeliverySettingsResponseFreeDelivery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseJoinPolicy.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseJoinPolicy.java new file mode 100644 index 0000000..97931b5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseJoinPolicy.java @@ -0,0 +1,270 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Policy of calculating delivery costs. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliverySettingsResponseJoinPolicy { + /** + * Strategy used to calculate delivery cost for items from offers with different delivery costs. The possible values: * `MAX` - The buyer will pay for the most expensive delivery * `MIN` - The buyer will pay for the cheapest delivery * `SUM` - Items will be sent in separate parcels and delivery costs will be sum of delivery costs for each item. + */ + @JsonAdapter(StrategyEnum.Adapter.class) + public enum StrategyEnum { + MIN("MIN"), + + MAX("MAX"), + + SUM("SUM"); + + private String value; + + StrategyEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StrategyEnum fromValue(String value) { + for (StrategyEnum b : StrategyEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StrategyEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StrategyEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StrategyEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StrategyEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STRATEGY = "strategy"; + @SerializedName(SERIALIZED_NAME_STRATEGY) + @javax.annotation.Nonnull + private StrategyEnum strategy; + + public DeliverySettingsResponseJoinPolicy() { + } + + public DeliverySettingsResponseJoinPolicy strategy(@javax.annotation.Nonnull StrategyEnum strategy) { + this.strategy = strategy; + return this; + } + + /** + * Strategy used to calculate delivery cost for items from offers with different delivery costs. The possible values: * `MAX` - The buyer will pay for the most expensive delivery * `MIN` - The buyer will pay for the cheapest delivery * `SUM` - Items will be sent in separate parcels and delivery costs will be sum of delivery costs for each item. + * @return strategy + */ + @javax.annotation.Nonnull + public StrategyEnum getStrategy() { + return strategy; + } + + public void setStrategy(@javax.annotation.Nonnull StrategyEnum strategy) { + this.strategy = strategy; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliverySettingsResponseJoinPolicy deliverySettingsResponseJoinPolicy = (DeliverySettingsResponseJoinPolicy) o; + return Objects.equals(this.strategy, deliverySettingsResponseJoinPolicy.strategy); + } + + @Override + public int hashCode() { + return Objects.hash(strategy); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliverySettingsResponseJoinPolicy {\n"); + sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("strategy"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("strategy"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliverySettingsResponseJoinPolicy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliverySettingsResponseJoinPolicy.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliverySettingsResponseJoinPolicy is not found in the empty JSON string", DeliverySettingsResponseJoinPolicy.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliverySettingsResponseJoinPolicy.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliverySettingsResponseJoinPolicy` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliverySettingsResponseJoinPolicy.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("strategy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `strategy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("strategy").toString())); + } + // validate the required field `strategy` + StrategyEnum.validateJsonElement(jsonObj.get("strategy")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliverySettingsResponseJoinPolicy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliverySettingsResponseJoinPolicy' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliverySettingsResponseJoinPolicy.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliverySettingsResponseJoinPolicy value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliverySettingsResponseJoinPolicy read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliverySettingsResponseJoinPolicy given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliverySettingsResponseJoinPolicy + * @throws IOException if the JSON string is invalid with respect to DeliverySettingsResponseJoinPolicy + */ + public static DeliverySettingsResponseJoinPolicy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliverySettingsResponseJoinPolicy.class); + } + + /** + * Convert an instance of DeliverySettingsResponseJoinPolicy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseMarketplace.java b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseMarketplace.java new file mode 100644 index 0000000..5e88f45 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DeliverySettingsResponseMarketplace.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Marketplace for which delivery settings were returned. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DeliverySettingsResponseMarketplace { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public DeliverySettingsResponseMarketplace() { + } + + public DeliverySettingsResponseMarketplace id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Marketplace id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeliverySettingsResponseMarketplace deliverySettingsResponseMarketplace = (DeliverySettingsResponseMarketplace) o; + return Objects.equals(this.id, deliverySettingsResponseMarketplace.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliverySettingsResponseMarketplace {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeliverySettingsResponseMarketplace + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeliverySettingsResponseMarketplace.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeliverySettingsResponseMarketplace is not found in the empty JSON string", DeliverySettingsResponseMarketplace.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DeliverySettingsResponseMarketplace.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeliverySettingsResponseMarketplace` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeliverySettingsResponseMarketplace.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeliverySettingsResponseMarketplace.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeliverySettingsResponseMarketplace' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeliverySettingsResponseMarketplace.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeliverySettingsResponseMarketplace value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DeliverySettingsResponseMarketplace read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeliverySettingsResponseMarketplace given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeliverySettingsResponseMarketplace + * @throws IOException if the JSON string is invalid with respect to DeliverySettingsResponseMarketplace + */ + public static DeliverySettingsResponseMarketplace fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeliverySettingsResponseMarketplace.class); + } + + /** + * Convert an instance of DeliverySettingsResponseMarketplace to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DescribesListingFee.java b/src/main/java/pl/wtx/allegro/api/client/model/DescribesListingFee.java new file mode 100644 index 0000000..4e0125b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DescribesListingFee.java @@ -0,0 +1,307 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Fee; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DescribesListingFee + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DescribesListingFee { + public static final String SERIALIZED_NAME_FEE = "fee"; + @SerializedName(SERIALIZED_NAME_FEE) + @javax.annotation.Nonnull + private Fee fee; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_CYCLE_DURATION = "cycleDuration"; + @SerializedName(SERIALIZED_NAME_CYCLE_DURATION) + @javax.annotation.Nonnull + private String cycleDuration; + + public DescribesListingFee() { + } + + public DescribesListingFee fee(@javax.annotation.Nonnull Fee fee) { + this.fee = fee; + return this; + } + + /** + * Get fee + * @return fee + */ + @javax.annotation.Nonnull + public Fee getFee() { + return fee; + } + + public void setFee(@javax.annotation.Nonnull Fee fee) { + this.fee = fee; + } + + + public DescribesListingFee name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public DescribesListingFee type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public DescribesListingFee cycleDuration(@javax.annotation.Nonnull String cycleDuration) { + this.cycleDuration = cycleDuration; + return this; + } + + /** + * Pricing cycle duration, ISO 8601 duration format + * @return cycleDuration + */ + @javax.annotation.Nonnull + public String getCycleDuration() { + return cycleDuration; + } + + public void setCycleDuration(@javax.annotation.Nonnull String cycleDuration) { + this.cycleDuration = cycleDuration; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DescribesListingFee describesListingFee = (DescribesListingFee) o; + return Objects.equals(this.fee, describesListingFee.fee) && + Objects.equals(this.name, describesListingFee.name) && + Objects.equals(this.type, describesListingFee.type) && + Objects.equals(this.cycleDuration, describesListingFee.cycleDuration); + } + + @Override + public int hashCode() { + return Objects.hash(fee, name, type, cycleDuration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DescribesListingFee {\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" cycleDuration: ").append(toIndentedString(cycleDuration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fee"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("cycleDuration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fee"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("cycleDuration"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DescribesListingFee + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DescribesListingFee.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DescribesListingFee is not found in the empty JSON string", DescribesListingFee.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DescribesListingFee.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DescribesListingFee` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DescribesListingFee.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fee` + Fee.validateJsonElement(jsonObj.get("fee")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("cycleDuration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cycleDuration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cycleDuration").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DescribesListingFee.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DescribesListingFee' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DescribesListingFee.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DescribesListingFee value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DescribesListingFee read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DescribesListingFee given an JSON string + * + * @param jsonString JSON string + * @return An instance of DescribesListingFee + * @throws IOException if the JSON string is invalid with respect to DescribesListingFee + */ + public static DescribesListingFee fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DescribesListingFee.class); + } + + /** + * Convert an instance of DescribesListingFee to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DescribesSuccessCommissionFee.java b/src/main/java/pl/wtx/allegro/api/client/model/DescribesSuccessCommissionFee.java new file mode 100644 index 0000000..3e1d2ec --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DescribesSuccessCommissionFee.java @@ -0,0 +1,276 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Fee; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DescribesSuccessCommissionFee + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DescribesSuccessCommissionFee { + public static final String SERIALIZED_NAME_FEE = "fee"; + @SerializedName(SERIALIZED_NAME_FEE) + @javax.annotation.Nonnull + private Fee fee; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public DescribesSuccessCommissionFee() { + } + + public DescribesSuccessCommissionFee fee(@javax.annotation.Nonnull Fee fee) { + this.fee = fee; + return this; + } + + /** + * Get fee + * @return fee + */ + @javax.annotation.Nonnull + public Fee getFee() { + return fee; + } + + public void setFee(@javax.annotation.Nonnull Fee fee) { + this.fee = fee; + } + + + public DescribesSuccessCommissionFee name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public DescribesSuccessCommissionFee type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DescribesSuccessCommissionFee describesSuccessCommissionFee = (DescribesSuccessCommissionFee) o; + return Objects.equals(this.fee, describesSuccessCommissionFee.fee) && + Objects.equals(this.name, describesSuccessCommissionFee.name) && + Objects.equals(this.type, describesSuccessCommissionFee.type); + } + + @Override + public int hashCode() { + return Objects.hash(fee, name, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DescribesSuccessCommissionFee {\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fee"); + openapiFields.add("name"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fee"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DescribesSuccessCommissionFee + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DescribesSuccessCommissionFee.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DescribesSuccessCommissionFee is not found in the empty JSON string", DescribesSuccessCommissionFee.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DescribesSuccessCommissionFee.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DescribesSuccessCommissionFee` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DescribesSuccessCommissionFee.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `fee` + Fee.validateJsonElement(jsonObj.get("fee")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DescribesSuccessCommissionFee.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DescribesSuccessCommissionFee' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DescribesSuccessCommissionFee.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DescribesSuccessCommissionFee value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DescribesSuccessCommissionFee read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DescribesSuccessCommissionFee given an JSON string + * + * @param jsonString JSON string + * @return An instance of DescribesSuccessCommissionFee + * @throws IOException if the JSON string is invalid with respect to DescribesSuccessCommissionFee + */ + public static DescribesSuccessCommissionFee fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DescribesSuccessCommissionFee.class); + } + + /** + * Convert an instance of DescribesSuccessCommissionFee to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSection.java b/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSection.java new file mode 100644 index 0000000..5242694 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSection.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.DescriptionSectionItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DescriptionSection + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DescriptionSection { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nullable + private List items = new ArrayList<>(); + + public DescriptionSection() { + } + + public DescriptionSection items(@javax.annotation.Nullable List items) { + this.items = items; + return this; + } + + public DescriptionSection addItemsItem(DescriptionSectionItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Get items + * @return items + */ + @javax.annotation.Nullable + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nullable List items) { + this.items = items; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DescriptionSection descriptionSection = (DescriptionSection) o; + return Objects.equals(this.items, descriptionSection.items); + } + + @Override + public int hashCode() { + return Objects.hash(items); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DescriptionSection {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DescriptionSection + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DescriptionSection.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DescriptionSection is not found in the empty JSON string", DescriptionSection.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DescriptionSection.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DescriptionSection` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + if (jsonArrayitems != null) { + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + // validate the optional field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + DescriptionSectionItem.validateJsonElement(jsonArrayitems.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DescriptionSection.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DescriptionSection' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DescriptionSection.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DescriptionSection value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DescriptionSection read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DescriptionSection given an JSON string + * + * @param jsonString JSON string + * @return An instance of DescriptionSection + * @throws IOException if the JSON string is invalid with respect to DescriptionSection + */ + public static DescriptionSection fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DescriptionSection.class); + } + + /** + * Convert an instance of DescriptionSection to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItem.java b/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItem.java new file mode 100644 index 0000000..23fea04 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItem.java @@ -0,0 +1,180 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * One of: TextItem, ImageItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DescriptionSectionItem { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + public DescriptionSectionItem() { + this.type = this.getClass().getSimpleName(); + } + + public DescriptionSectionItem type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DescriptionSectionItem descriptionSectionItem = (DescriptionSectionItem) o; + return Objects.equals(this.type, descriptionSectionItem.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DescriptionSectionItem {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DescriptionSectionItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DescriptionSectionItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DescriptionSectionItem is not found in the empty JSON string", DescriptionSectionItem.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "IMAGE": + DescriptionSectionItemImage.validateJsonElement(jsonElement); + break; + case "TEXT": + DescriptionSectionItemText.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of DescriptionSectionItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of DescriptionSectionItem + * @throws IOException if the JSON string is invalid with respect to DescriptionSectionItem + */ + public static DescriptionSectionItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DescriptionSectionItem.class); + } + + /** + * Convert an instance of DescriptionSectionItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItemImage.java b/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItemImage.java new file mode 100644 index 0000000..752b9a1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItemImage.java @@ -0,0 +1,233 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DescriptionSectionItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DescriptionSectionItemImage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DescriptionSectionItemImage extends DescriptionSectionItem { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "IMAGE"; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public DescriptionSectionItemImage() { + this.type = this.getClass().getSimpleName(); + } + + public DescriptionSectionItemImage type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public DescriptionSectionItemImage url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DescriptionSectionItemImage descriptionSectionItemImage = (DescriptionSectionItemImage) o; + return Objects.equals(this.type, descriptionSectionItemImage.type) && + Objects.equals(this.url, descriptionSectionItemImage.url) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, url, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DescriptionSectionItemImage {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DescriptionSectionItemImage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DescriptionSectionItemImage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DescriptionSectionItemImage is not found in the empty JSON string", DescriptionSectionItemImage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DescriptionSectionItemImage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DescriptionSectionItemImage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DescriptionSectionItemImage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DescriptionSectionItemImage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DescriptionSectionItemImage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DescriptionSectionItemImage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DescriptionSectionItemImage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DescriptionSectionItemImage given an JSON string + * + * @param jsonString JSON string + * @return An instance of DescriptionSectionItemImage + * @throws IOException if the JSON string is invalid with respect to DescriptionSectionItemImage + */ + public static DescriptionSectionItemImage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DescriptionSectionItemImage.class); + } + + /** + * Convert an instance of DescriptionSectionItemImage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItemText.java b/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItemText.java new file mode 100644 index 0000000..0409c32 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DescriptionSectionItemText.java @@ -0,0 +1,233 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DescriptionSectionItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DescriptionSectionItemText + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DescriptionSectionItemText extends DescriptionSectionItem { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "TEXT"; + + public static final String SERIALIZED_NAME_CONTENT = "content"; + @SerializedName(SERIALIZED_NAME_CONTENT) + @javax.annotation.Nullable + private String content; + + public DescriptionSectionItemText() { + this.type = this.getClass().getSimpleName(); + } + + public DescriptionSectionItemText type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public DescriptionSectionItemText content(@javax.annotation.Nullable String content) { + this.content = content; + return this; + } + + /** + * Get content + * @return content + */ + @javax.annotation.Nullable + public String getContent() { + return content; + } + + public void setContent(@javax.annotation.Nullable String content) { + this.content = content; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DescriptionSectionItemText descriptionSectionItemText = (DescriptionSectionItemText) o; + return Objects.equals(this.type, descriptionSectionItemText.type) && + Objects.equals(this.content, descriptionSectionItemText.content) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, content, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DescriptionSectionItemText {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("content"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DescriptionSectionItemText + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DescriptionSectionItemText.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DescriptionSectionItemText is not found in the empty JSON string", DescriptionSectionItemText.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DescriptionSectionItemText.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DescriptionSectionItemText` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DescriptionSectionItemText.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DescriptionSectionItemText' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DescriptionSectionItemText.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DescriptionSectionItemText value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DescriptionSectionItemText read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DescriptionSectionItemText given an JSON string + * + * @param jsonString JSON string + * @return An instance of DescriptionSectionItemText + * @throws IOException if the JSON string is invalid with respect to DescriptionSectionItemText + */ + public static DescriptionSectionItemText fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DescriptionSectionItemText.class); + } + + /** + * Convert an instance of DescriptionSectionItemText to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryParameter.java new file mode 100644 index 0000000..3c9a59d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryParameter.java @@ -0,0 +1,295 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.CategoryParameter; +import pl.wtx.allegro.api.client.model.CategoryParameterDisplayConditions; +import pl.wtx.allegro.api.client.model.CategoryParameterOptions; +import pl.wtx.allegro.api.client.model.CategoryParameterRequirementConditions; +import pl.wtx.allegro.api.client.model.DictionaryCategoryParameterAllOfDictionary; +import pl.wtx.allegro.api.client.model.DictionaryCategoryProductParameterAllOfRestrictions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DictionaryCategoryParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DictionaryCategoryParameter extends CategoryParameter { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "dictionary"; + + public static final String SERIALIZED_NAME_RESTRICTIONS = "restrictions"; + @SerializedName(SERIALIZED_NAME_RESTRICTIONS) + @javax.annotation.Nullable + private DictionaryCategoryProductParameterAllOfRestrictions restrictions; + + public static final String SERIALIZED_NAME_DICTIONARY = "dictionary"; + @SerializedName(SERIALIZED_NAME_DICTIONARY) + @javax.annotation.Nullable + private List dictionary = new ArrayList<>(); + + public DictionaryCategoryParameter() { + this.type = this.getClass().getSimpleName(); + } + + public DictionaryCategoryParameter type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public DictionaryCategoryParameter restrictions(@javax.annotation.Nullable DictionaryCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + * Get restrictions + * @return restrictions + */ + @javax.annotation.Nullable + public DictionaryCategoryProductParameterAllOfRestrictions getRestrictions() { + return restrictions; + } + + public void setRestrictions(@javax.annotation.Nullable DictionaryCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + } + + + public DictionaryCategoryParameter dictionary(@javax.annotation.Nullable List dictionary) { + this.dictionary = dictionary; + return this; + } + + public DictionaryCategoryParameter addDictionaryItem(DictionaryCategoryParameterAllOfDictionary dictionaryItem) { + if (this.dictionary == null) { + this.dictionary = new ArrayList<>(); + } + this.dictionary.add(dictionaryItem); + return this; + } + + /** + * Defines the values accepted for this parameter. + * @return dictionary + */ + @javax.annotation.Nullable + public List getDictionary() { + return dictionary; + } + + public void setDictionary(@javax.annotation.Nullable List dictionary) { + this.dictionary = dictionary; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DictionaryCategoryParameter dictionaryCategoryParameter = (DictionaryCategoryParameter) o; + return Objects.equals(this.type, dictionaryCategoryParameter.type) && + Objects.equals(this.restrictions, dictionaryCategoryParameter.restrictions) && + Objects.equals(this.dictionary, dictionaryCategoryParameter.dictionary) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, restrictions, dictionary, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DictionaryCategoryParameter {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" restrictions: ").append(toIndentedString(restrictions)).append("\n"); + sb.append(" dictionary: ").append(toIndentedString(dictionary)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("required"); + openapiFields.add("requiredForProduct"); + openapiFields.add("requiredIf"); + openapiFields.add("displayedIf"); + openapiFields.add("unit"); + openapiFields.add("options"); + openapiFields.add("restrictions"); + openapiFields.add("dictionary"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DictionaryCategoryParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DictionaryCategoryParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DictionaryCategoryParameter is not found in the empty JSON string", DictionaryCategoryParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DictionaryCategoryParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DictionaryCategoryParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DictionaryCategoryParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DictionaryCategoryParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DictionaryCategoryParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DictionaryCategoryParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DictionaryCategoryParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DictionaryCategoryParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of DictionaryCategoryParameter + * @throws IOException if the JSON string is invalid with respect to DictionaryCategoryParameter + */ + public static DictionaryCategoryParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DictionaryCategoryParameter.class); + } + + /** + * Convert an instance of DictionaryCategoryParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryParameterAllOfDictionary.java b/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryParameterAllOfDictionary.java new file mode 100644 index 0000000..db0b214 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryParameterAllOfDictionary.java @@ -0,0 +1,277 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DictionaryCategoryParameterAllOfDictionary + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DictionaryCategoryParameterAllOfDictionary { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_DEPENDS_ON_VALUE_IDS = "dependsOnValueIds"; + @SerializedName(SERIALIZED_NAME_DEPENDS_ON_VALUE_IDS) + @javax.annotation.Nullable + private List dependsOnValueIds = new ArrayList<>(); + + public DictionaryCategoryParameterAllOfDictionary() { + } + + public DictionaryCategoryParameterAllOfDictionary id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the dictionary value. Use it to set the value in an offer or in a product. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public DictionaryCategoryParameterAllOfDictionary value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * The label of the dictionary value in Polish. + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public DictionaryCategoryParameterAllOfDictionary dependsOnValueIds(@javax.annotation.Nullable List dependsOnValueIds) { + this.dependsOnValueIds = dependsOnValueIds; + return this; + } + + public DictionaryCategoryParameterAllOfDictionary addDependsOnValueIdsItem(String dependsOnValueIdsItem) { + if (this.dependsOnValueIds == null) { + this.dependsOnValueIds = new ArrayList<>(); + } + this.dependsOnValueIds.add(dependsOnValueIdsItem); + return this; + } + + /** + * The IDs of dictionary values from another parameter that this parameter value can be combined with. The other parameter has the id from `options.dependsOnParameterId`. Empty if this parameter value can be combined with any value from other parameters. Otherwise, this value might be set in the offer only when one of the given values of `dependsOnValueIds` is set as well. + * @return dependsOnValueIds + */ + @javax.annotation.Nullable + public List getDependsOnValueIds() { + return dependsOnValueIds; + } + + public void setDependsOnValueIds(@javax.annotation.Nullable List dependsOnValueIds) { + this.dependsOnValueIds = dependsOnValueIds; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DictionaryCategoryParameterAllOfDictionary dictionaryCategoryParameterAllOfDictionary = (DictionaryCategoryParameterAllOfDictionary) o; + return Objects.equals(this.id, dictionaryCategoryParameterAllOfDictionary.id) && + Objects.equals(this.value, dictionaryCategoryParameterAllOfDictionary.value) && + Objects.equals(this.dependsOnValueIds, dictionaryCategoryParameterAllOfDictionary.dependsOnValueIds); + } + + @Override + public int hashCode() { + return Objects.hash(id, value, dependsOnValueIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DictionaryCategoryParameterAllOfDictionary {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" dependsOnValueIds: ").append(toIndentedString(dependsOnValueIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("value"); + openapiFields.add("dependsOnValueIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DictionaryCategoryParameterAllOfDictionary + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DictionaryCategoryParameterAllOfDictionary.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DictionaryCategoryParameterAllOfDictionary is not found in the empty JSON string", DictionaryCategoryParameterAllOfDictionary.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DictionaryCategoryParameterAllOfDictionary.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DictionaryCategoryParameterAllOfDictionary` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("dependsOnValueIds") != null && !jsonObj.get("dependsOnValueIds").isJsonNull() && !jsonObj.get("dependsOnValueIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `dependsOnValueIds` to be an array in the JSON string but got `%s`", jsonObj.get("dependsOnValueIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DictionaryCategoryParameterAllOfDictionary.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DictionaryCategoryParameterAllOfDictionary' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DictionaryCategoryParameterAllOfDictionary.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DictionaryCategoryParameterAllOfDictionary value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DictionaryCategoryParameterAllOfDictionary read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DictionaryCategoryParameterAllOfDictionary given an JSON string + * + * @param jsonString JSON string + * @return An instance of DictionaryCategoryParameterAllOfDictionary + * @throws IOException if the JSON string is invalid with respect to DictionaryCategoryParameterAllOfDictionary + */ + public static DictionaryCategoryParameterAllOfDictionary fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DictionaryCategoryParameterAllOfDictionary.class); + } + + /** + * Convert an instance of DictionaryCategoryParameterAllOfDictionary to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameter.java new file mode 100644 index 0000000..720ef56 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameter.java @@ -0,0 +1,292 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.CategoryParameterDisplayConditions; +import pl.wtx.allegro.api.client.model.CategoryParameterRequirementConditions; +import pl.wtx.allegro.api.client.model.CategoryProductParameter; +import pl.wtx.allegro.api.client.model.DictionaryCategoryProductParameterAllOfDictionary; +import pl.wtx.allegro.api.client.model.DictionaryCategoryProductParameterAllOfRestrictions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DictionaryCategoryProductParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DictionaryCategoryProductParameter extends CategoryProductParameter { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "dictionary"; + + public static final String SERIALIZED_NAME_RESTRICTIONS = "restrictions"; + @SerializedName(SERIALIZED_NAME_RESTRICTIONS) + @javax.annotation.Nullable + private DictionaryCategoryProductParameterAllOfRestrictions restrictions; + + public static final String SERIALIZED_NAME_DICTIONARY = "dictionary"; + @SerializedName(SERIALIZED_NAME_DICTIONARY) + @javax.annotation.Nullable + private List dictionary = new ArrayList<>(); + + public DictionaryCategoryProductParameter() { + this.type = this.getClass().getSimpleName(); + } + + public DictionaryCategoryProductParameter type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public DictionaryCategoryProductParameter restrictions(@javax.annotation.Nullable DictionaryCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + * Get restrictions + * @return restrictions + */ + @javax.annotation.Nullable + public DictionaryCategoryProductParameterAllOfRestrictions getRestrictions() { + return restrictions; + } + + public void setRestrictions(@javax.annotation.Nullable DictionaryCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + } + + + public DictionaryCategoryProductParameter dictionary(@javax.annotation.Nullable List dictionary) { + this.dictionary = dictionary; + return this; + } + + public DictionaryCategoryProductParameter addDictionaryItem(DictionaryCategoryProductParameterAllOfDictionary dictionaryItem) { + if (this.dictionary == null) { + this.dictionary = new ArrayList<>(); + } + this.dictionary.add(dictionaryItem); + return this; + } + + /** + * Defines the values accepted for this parameter. + * @return dictionary + */ + @javax.annotation.Nullable + public List getDictionary() { + return dictionary; + } + + public void setDictionary(@javax.annotation.Nullable List dictionary) { + this.dictionary = dictionary; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DictionaryCategoryProductParameter dictionaryCategoryProductParameter = (DictionaryCategoryProductParameter) o; + return Objects.equals(this.type, dictionaryCategoryProductParameter.type) && + Objects.equals(this.restrictions, dictionaryCategoryProductParameter.restrictions) && + Objects.equals(this.dictionary, dictionaryCategoryProductParameter.dictionary) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, restrictions, dictionary, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DictionaryCategoryProductParameter {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" restrictions: ").append(toIndentedString(restrictions)).append("\n"); + sb.append(" dictionary: ").append(toIndentedString(dictionary)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("required"); + openapiFields.add("requiredIf"); + openapiFields.add("displayedIf"); + openapiFields.add("unit"); + openapiFields.add("restrictions"); + openapiFields.add("dictionary"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DictionaryCategoryProductParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DictionaryCategoryProductParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DictionaryCategoryProductParameter is not found in the empty JSON string", DictionaryCategoryProductParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DictionaryCategoryProductParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DictionaryCategoryProductParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DictionaryCategoryProductParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DictionaryCategoryProductParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DictionaryCategoryProductParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DictionaryCategoryProductParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DictionaryCategoryProductParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DictionaryCategoryProductParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of DictionaryCategoryProductParameter + * @throws IOException if the JSON string is invalid with respect to DictionaryCategoryProductParameter + */ + public static DictionaryCategoryProductParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DictionaryCategoryProductParameter.class); + } + + /** + * Convert an instance of DictionaryCategoryProductParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameterAllOfDictionary.java b/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameterAllOfDictionary.java new file mode 100644 index 0000000..05ca1f6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameterAllOfDictionary.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DictionaryCategoryProductParameterAllOfDictionary + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DictionaryCategoryProductParameterAllOfDictionary { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public DictionaryCategoryProductParameterAllOfDictionary() { + } + + public DictionaryCategoryProductParameterAllOfDictionary id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the dictionary value. Use it to set the value in an offer or in a product. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public DictionaryCategoryProductParameterAllOfDictionary value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * The label of the dictionary value in Polish. + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DictionaryCategoryProductParameterAllOfDictionary dictionaryCategoryProductParameterAllOfDictionary = (DictionaryCategoryProductParameterAllOfDictionary) o; + return Objects.equals(this.id, dictionaryCategoryProductParameterAllOfDictionary.id) && + Objects.equals(this.value, dictionaryCategoryProductParameterAllOfDictionary.value); + } + + @Override + public int hashCode() { + return Objects.hash(id, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DictionaryCategoryProductParameterAllOfDictionary {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DictionaryCategoryProductParameterAllOfDictionary + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DictionaryCategoryProductParameterAllOfDictionary.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DictionaryCategoryProductParameterAllOfDictionary is not found in the empty JSON string", DictionaryCategoryProductParameterAllOfDictionary.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DictionaryCategoryProductParameterAllOfDictionary.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DictionaryCategoryProductParameterAllOfDictionary` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DictionaryCategoryProductParameterAllOfDictionary.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DictionaryCategoryProductParameterAllOfDictionary' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DictionaryCategoryProductParameterAllOfDictionary.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DictionaryCategoryProductParameterAllOfDictionary value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DictionaryCategoryProductParameterAllOfDictionary read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DictionaryCategoryProductParameterAllOfDictionary given an JSON string + * + * @param jsonString JSON string + * @return An instance of DictionaryCategoryProductParameterAllOfDictionary + * @throws IOException if the JSON string is invalid with respect to DictionaryCategoryProductParameterAllOfDictionary + */ + public static DictionaryCategoryProductParameterAllOfDictionary fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DictionaryCategoryProductParameterAllOfDictionary.class); + } + + /** + * Convert an instance of DictionaryCategoryProductParameterAllOfDictionary to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameterAllOfRestrictions.java b/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameterAllOfRestrictions.java new file mode 100644 index 0000000..2cfc027 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DictionaryCategoryProductParameterAllOfRestrictions.java @@ -0,0 +1,203 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The restrictions on values of this parameter. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DictionaryCategoryProductParameterAllOfRestrictions { + public static final String SERIALIZED_NAME_MULTIPLE_CHOICES = "multipleChoices"; + @SerializedName(SERIALIZED_NAME_MULTIPLE_CHOICES) + @javax.annotation.Nullable + private Boolean multipleChoices; + + public DictionaryCategoryProductParameterAllOfRestrictions() { + } + + public DictionaryCategoryProductParameterAllOfRestrictions multipleChoices(@javax.annotation.Nullable Boolean multipleChoices) { + this.multipleChoices = multipleChoices; + return this; + } + + /** + * Indicates whether this parameter can have more than one value. + * @return multipleChoices + */ + @javax.annotation.Nullable + public Boolean getMultipleChoices() { + return multipleChoices; + } + + public void setMultipleChoices(@javax.annotation.Nullable Boolean multipleChoices) { + this.multipleChoices = multipleChoices; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DictionaryCategoryProductParameterAllOfRestrictions dictionaryCategoryProductParameterAllOfRestrictions = (DictionaryCategoryProductParameterAllOfRestrictions) o; + return Objects.equals(this.multipleChoices, dictionaryCategoryProductParameterAllOfRestrictions.multipleChoices); + } + + @Override + public int hashCode() { + return Objects.hash(multipleChoices); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DictionaryCategoryProductParameterAllOfRestrictions {\n"); + sb.append(" multipleChoices: ").append(toIndentedString(multipleChoices)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("multipleChoices"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DictionaryCategoryProductParameterAllOfRestrictions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DictionaryCategoryProductParameterAllOfRestrictions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DictionaryCategoryProductParameterAllOfRestrictions is not found in the empty JSON string", DictionaryCategoryProductParameterAllOfRestrictions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DictionaryCategoryProductParameterAllOfRestrictions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DictionaryCategoryProductParameterAllOfRestrictions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DictionaryCategoryProductParameterAllOfRestrictions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DictionaryCategoryProductParameterAllOfRestrictions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DictionaryCategoryProductParameterAllOfRestrictions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DictionaryCategoryProductParameterAllOfRestrictions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DictionaryCategoryProductParameterAllOfRestrictions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DictionaryCategoryProductParameterAllOfRestrictions given an JSON string + * + * @param jsonString JSON string + * @return An instance of DictionaryCategoryProductParameterAllOfRestrictions + * @throws IOException if the JSON string is invalid with respect to DictionaryCategoryProductParameterAllOfRestrictions + */ + public static DictionaryCategoryProductParameterAllOfRestrictions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DictionaryCategoryProductParameterAllOfRestrictions.class); + } + + /** + * Convert an instance of DictionaryCategoryProductParameterAllOfRestrictions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DimensionValue.java b/src/main/java/pl/wtx/allegro/api/client/model/DimensionValue.java new file mode 100644 index 0000000..b7bb682 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DimensionValue.java @@ -0,0 +1,295 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DimensionValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DimensionValue { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private BigDecimal value; + + /** + * Dimension unit. Currently only `CENTIMETER` is accepted. + */ + @JsonAdapter(UnitEnum.Adapter.class) + public enum UnitEnum { + CENTIMETER("CENTIMETER"); + + private String value; + + UnitEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static UnitEnum fromValue(String value) { + for (UnitEnum b : UnitEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final UnitEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public UnitEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return UnitEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + UnitEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private UnitEnum unit; + + public DimensionValue() { + } + + public DimensionValue value(@javax.annotation.Nonnull BigDecimal value) { + this.value = value; + return this; + } + + /** + * Dimension value. + * @return value + */ + @javax.annotation.Nonnull + public BigDecimal getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull BigDecimal value) { + this.value = value; + } + + + public DimensionValue unit(@javax.annotation.Nullable UnitEnum unit) { + this.unit = unit; + return this; + } + + /** + * Dimension unit. Currently only `CENTIMETER` is accepted. + * @return unit + */ + @javax.annotation.Nullable + public UnitEnum getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable UnitEnum unit) { + this.unit = unit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DimensionValue dimensionValue = (DimensionValue) o; + return Objects.equals(this.value, dimensionValue.value) && + Objects.equals(this.unit, dimensionValue.unit); + } + + @Override + public int hashCode() { + return Objects.hash(value, unit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DimensionValue {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + openapiFields.add("unit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("unit"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DimensionValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DimensionValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DimensionValue is not found in the empty JSON string", DimensionValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DimensionValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DimensionValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DimensionValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) && !jsonObj.get("unit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unit").toString())); + } + // validate the required field `unit` + UnitEnum.validateJsonElement(jsonObj.get("unit")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DimensionValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DimensionValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DimensionValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DimensionValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DimensionValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DimensionValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of DimensionValue + * @throws IOException if the JSON string is invalid with respect to DimensionValue + */ + public static DimensionValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DimensionValue.class); + } + + /** + * Convert an instance of DimensionValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Discounts.java b/src/main/java/pl/wtx/allegro/api/client/model/Discounts.java new file mode 100644 index 0000000..5216911 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Discounts.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DiscountsWholesalePriceList; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Discounts + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Discounts { + public static final String SERIALIZED_NAME_WHOLESALE_PRICE_LIST = "wholesalePriceList"; + @SerializedName(SERIALIZED_NAME_WHOLESALE_PRICE_LIST) + @javax.annotation.Nullable + private DiscountsWholesalePriceList wholesalePriceList; + + public Discounts() { + } + + public Discounts wholesalePriceList(@javax.annotation.Nullable DiscountsWholesalePriceList wholesalePriceList) { + this.wholesalePriceList = wholesalePriceList; + return this; + } + + /** + * Get wholesalePriceList + * @return wholesalePriceList + */ + @javax.annotation.Nullable + public DiscountsWholesalePriceList getWholesalePriceList() { + return wholesalePriceList; + } + + public void setWholesalePriceList(@javax.annotation.Nullable DiscountsWholesalePriceList wholesalePriceList) { + this.wholesalePriceList = wholesalePriceList; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Discounts discounts = (Discounts) o; + return Objects.equals(this.wholesalePriceList, discounts.wholesalePriceList); + } + + @Override + public int hashCode() { + return Objects.hash(wholesalePriceList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Discounts {\n"); + sb.append(" wholesalePriceList: ").append(toIndentedString(wholesalePriceList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("wholesalePriceList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Discounts + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Discounts.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Discounts is not found in the empty JSON string", Discounts.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Discounts.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Discounts` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `wholesalePriceList` + if (jsonObj.get("wholesalePriceList") != null && !jsonObj.get("wholesalePriceList").isJsonNull()) { + DiscountsWholesalePriceList.validateJsonElement(jsonObj.get("wholesalePriceList")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Discounts.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Discounts' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Discounts.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Discounts value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Discounts read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Discounts given an JSON string + * + * @param jsonString JSON string + * @return An instance of Discounts + * @throws IOException if the JSON string is invalid with respect to Discounts + */ + public static Discounts fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Discounts.class); + } + + /** + * Convert an instance of Discounts to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferRequest.java new file mode 100644 index 0000000..d73c816 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferRequest.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DiscountsProductOfferRequestWholesalePriceList; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DiscountsProductOfferRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DiscountsProductOfferRequest { + public static final String SERIALIZED_NAME_WHOLESALE_PRICE_LIST = "wholesalePriceList"; + @SerializedName(SERIALIZED_NAME_WHOLESALE_PRICE_LIST) + @javax.annotation.Nullable + private DiscountsProductOfferRequestWholesalePriceList wholesalePriceList; + + public DiscountsProductOfferRequest() { + } + + public DiscountsProductOfferRequest wholesalePriceList(@javax.annotation.Nullable DiscountsProductOfferRequestWholesalePriceList wholesalePriceList) { + this.wholesalePriceList = wholesalePriceList; + return this; + } + + /** + * Get wholesalePriceList + * @return wholesalePriceList + */ + @javax.annotation.Nullable + public DiscountsProductOfferRequestWholesalePriceList getWholesalePriceList() { + return wholesalePriceList; + } + + public void setWholesalePriceList(@javax.annotation.Nullable DiscountsProductOfferRequestWholesalePriceList wholesalePriceList) { + this.wholesalePriceList = wholesalePriceList; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DiscountsProductOfferRequest discountsProductOfferRequest = (DiscountsProductOfferRequest) o; + return Objects.equals(this.wholesalePriceList, discountsProductOfferRequest.wholesalePriceList); + } + + @Override + public int hashCode() { + return Objects.hash(wholesalePriceList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscountsProductOfferRequest {\n"); + sb.append(" wholesalePriceList: ").append(toIndentedString(wholesalePriceList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("wholesalePriceList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DiscountsProductOfferRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DiscountsProductOfferRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DiscountsProductOfferRequest is not found in the empty JSON string", DiscountsProductOfferRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DiscountsProductOfferRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DiscountsProductOfferRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `wholesalePriceList` + if (jsonObj.get("wholesalePriceList") != null && !jsonObj.get("wholesalePriceList").isJsonNull()) { + DiscountsProductOfferRequestWholesalePriceList.validateJsonElement(jsonObj.get("wholesalePriceList")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DiscountsProductOfferRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DiscountsProductOfferRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DiscountsProductOfferRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DiscountsProductOfferRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DiscountsProductOfferRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DiscountsProductOfferRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of DiscountsProductOfferRequest + * @throws IOException if the JSON string is invalid with respect to DiscountsProductOfferRequest + */ + public static DiscountsProductOfferRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DiscountsProductOfferRequest.class); + } + + /** + * Convert an instance of DiscountsProductOfferRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferRequestWholesalePriceList.java b/src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferRequestWholesalePriceList.java new file mode 100644 index 0000000..10c4211 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferRequestWholesalePriceList.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DiscountsProductOfferRequestWholesalePriceList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DiscountsProductOfferRequestWholesalePriceList { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public DiscountsProductOfferRequestWholesalePriceList() { + } + + public DiscountsProductOfferRequestWholesalePriceList id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Wholesale price list id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public DiscountsProductOfferRequestWholesalePriceList name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of the wholesale price list definition. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DiscountsProductOfferRequestWholesalePriceList discountsProductOfferRequestWholesalePriceList = (DiscountsProductOfferRequestWholesalePriceList) o; + return Objects.equals(this.id, discountsProductOfferRequestWholesalePriceList.id) && + Objects.equals(this.name, discountsProductOfferRequestWholesalePriceList.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscountsProductOfferRequestWholesalePriceList {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DiscountsProductOfferRequestWholesalePriceList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DiscountsProductOfferRequestWholesalePriceList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DiscountsProductOfferRequestWholesalePriceList is not found in the empty JSON string", DiscountsProductOfferRequestWholesalePriceList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DiscountsProductOfferRequestWholesalePriceList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DiscountsProductOfferRequestWholesalePriceList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DiscountsProductOfferRequestWholesalePriceList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DiscountsProductOfferRequestWholesalePriceList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DiscountsProductOfferRequestWholesalePriceList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DiscountsProductOfferRequestWholesalePriceList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DiscountsProductOfferRequestWholesalePriceList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DiscountsProductOfferRequestWholesalePriceList given an JSON string + * + * @param jsonString JSON string + * @return An instance of DiscountsProductOfferRequestWholesalePriceList + * @throws IOException if the JSON string is invalid with respect to DiscountsProductOfferRequestWholesalePriceList + */ + public static DiscountsProductOfferRequestWholesalePriceList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DiscountsProductOfferRequestWholesalePriceList.class); + } + + /** + * Convert an instance of DiscountsProductOfferRequestWholesalePriceList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferResponse.java new file mode 100644 index 0000000..5c4a61f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DiscountsProductOfferResponse.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.JustId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DiscountsProductOfferResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DiscountsProductOfferResponse { + public static final String SERIALIZED_NAME_WHOLESALE_PRICE_LIST = "wholesalePriceList"; + @SerializedName(SERIALIZED_NAME_WHOLESALE_PRICE_LIST) + @javax.annotation.Nullable + private JustId wholesalePriceList; + + public DiscountsProductOfferResponse() { + } + + public DiscountsProductOfferResponse wholesalePriceList(@javax.annotation.Nullable JustId wholesalePriceList) { + this.wholesalePriceList = wholesalePriceList; + return this; + } + + /** + * Get wholesalePriceList + * @return wholesalePriceList + */ + @javax.annotation.Nullable + public JustId getWholesalePriceList() { + return wholesalePriceList; + } + + public void setWholesalePriceList(@javax.annotation.Nullable JustId wholesalePriceList) { + this.wholesalePriceList = wholesalePriceList; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DiscountsProductOfferResponse discountsProductOfferResponse = (DiscountsProductOfferResponse) o; + return Objects.equals(this.wholesalePriceList, discountsProductOfferResponse.wholesalePriceList); + } + + @Override + public int hashCode() { + return Objects.hash(wholesalePriceList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscountsProductOfferResponse {\n"); + sb.append(" wholesalePriceList: ").append(toIndentedString(wholesalePriceList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("wholesalePriceList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DiscountsProductOfferResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DiscountsProductOfferResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DiscountsProductOfferResponse is not found in the empty JSON string", DiscountsProductOfferResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DiscountsProductOfferResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DiscountsProductOfferResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `wholesalePriceList` + if (jsonObj.get("wholesalePriceList") != null && !jsonObj.get("wholesalePriceList").isJsonNull()) { + JustId.validateJsonElement(jsonObj.get("wholesalePriceList")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DiscountsProductOfferResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DiscountsProductOfferResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DiscountsProductOfferResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DiscountsProductOfferResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DiscountsProductOfferResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DiscountsProductOfferResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DiscountsProductOfferResponse + * @throws IOException if the JSON string is invalid with respect to DiscountsProductOfferResponse + */ + public static DiscountsProductOfferResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DiscountsProductOfferResponse.class); + } + + /** + * Convert an instance of DiscountsProductOfferResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DiscountsWholesalePriceList.java b/src/main/java/pl/wtx/allegro/api/client/model/DiscountsWholesalePriceList.java new file mode 100644 index 0000000..3868dbd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DiscountsWholesalePriceList.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DiscountsWholesalePriceList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DiscountsWholesalePriceList { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public DiscountsWholesalePriceList() { + } + + public DiscountsWholesalePriceList id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Wholesale price list id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DiscountsWholesalePriceList discountsWholesalePriceList = (DiscountsWholesalePriceList) o; + return Objects.equals(this.id, discountsWholesalePriceList.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscountsWholesalePriceList {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DiscountsWholesalePriceList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DiscountsWholesalePriceList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DiscountsWholesalePriceList is not found in the empty JSON string", DiscountsWholesalePriceList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DiscountsWholesalePriceList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DiscountsWholesalePriceList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DiscountsWholesalePriceList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DiscountsWholesalePriceList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DiscountsWholesalePriceList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DiscountsWholesalePriceList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DiscountsWholesalePriceList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DiscountsWholesalePriceList given an JSON string + * + * @param jsonString JSON string + * @return An instance of DiscountsWholesalePriceList + * @throws IOException if the JSON string is invalid with respect to DiscountsWholesalePriceList + */ + public static DiscountsWholesalePriceList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DiscountsWholesalePriceList.class); + } + + /** + * Convert an instance of DiscountsWholesalePriceList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Dispute.java b/src/main/java/pl/wtx/allegro/api/client/model/Dispute.java new file mode 100644 index 0000000..9770718 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Dispute.java @@ -0,0 +1,631 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DisputeCheckoutForm; +import pl.wtx.allegro.api.client.model.DisputeClaim; +import pl.wtx.allegro.api.client.model.DisputeFirstMessage; +import pl.wtx.allegro.api.client.model.DisputeUser; +import pl.wtx.allegro.api.client.model.Subject; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Dispute + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Dispute { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_SUBJECT = "subject"; + @SerializedName(SERIALIZED_NAME_SUBJECT) + @javax.annotation.Nonnull + private Subject subject; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + CLOSED("CLOSED"), + + ONGOING("ONGOING"), + + UNRESOLVED("UNRESOLVED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + /** + * Gets or Sets messagesStatus + */ + @JsonAdapter(MessagesStatusEnum.Adapter.class) + public enum MessagesStatusEnum { + NEW("NEW"), + + SELLER_REPLIED("SELLER_REPLIED"), + + BUYER_REPLIED("BUYER_REPLIED"), + + ALLEGRO_ADVISOR_REPLIED("ALLEGRO_ADVISOR_REPLIED"); + + private String value; + + MessagesStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MessagesStatusEnum fromValue(String value) { + for (MessagesStatusEnum b : MessagesStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MessagesStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MessagesStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MessagesStatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + MessagesStatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_MESSAGES_STATUS = "messagesStatus"; + @SerializedName(SERIALIZED_NAME_MESSAGES_STATUS) + @javax.annotation.Nonnull + private MessagesStatusEnum messagesStatus; + + public static final String SERIALIZED_NAME_BUYER = "buyer"; + @SerializedName(SERIALIZED_NAME_BUYER) + @javax.annotation.Nonnull + private DisputeUser buyer; + + public static final String SERIALIZED_NAME_CHECKOUT_FORM = "checkoutForm"; + @SerializedName(SERIALIZED_NAME_CHECKOUT_FORM) + @javax.annotation.Nonnull + private DisputeCheckoutForm checkoutForm; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nonnull + private DisputeFirstMessage message; + + public static final String SERIALIZED_NAME_MESSAGES_COUNT = "messagesCount"; + @SerializedName(SERIALIZED_NAME_MESSAGES_COUNT) + @javax.annotation.Nonnull + private Integer messagesCount; + + public static final String SERIALIZED_NAME_OPENED_DATE = "openedDate"; + @SerializedName(SERIALIZED_NAME_OPENED_DATE) + @javax.annotation.Nullable + private OffsetDateTime openedDate; + + public static final String SERIALIZED_NAME_LAST_MESSAGE_CREATION_DATE = "lastMessageCreationDate"; + @SerializedName(SERIALIZED_NAME_LAST_MESSAGE_CREATION_DATE) + @javax.annotation.Nonnull + private OffsetDateTime lastMessageCreationDate; + + public static final String SERIALIZED_NAME_CLAIM = "claim"; + @SerializedName(SERIALIZED_NAME_CLAIM) + @javax.annotation.Nullable + private DisputeClaim claim; + + public Dispute() { + } + + public Dispute id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Identifier of the dispute + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public Dispute subject(@javax.annotation.Nonnull Subject subject) { + this.subject = subject; + return this; + } + + /** + * Get subject + * @return subject + */ + @javax.annotation.Nonnull + public Subject getSubject() { + return subject; + } + + public void setSubject(@javax.annotation.Nonnull Subject subject) { + this.subject = subject; + } + + + public Dispute status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + public Dispute messagesStatus(@javax.annotation.Nonnull MessagesStatusEnum messagesStatus) { + this.messagesStatus = messagesStatus; + return this; + } + + /** + * Get messagesStatus + * @return messagesStatus + */ + @javax.annotation.Nonnull + public MessagesStatusEnum getMessagesStatus() { + return messagesStatus; + } + + public void setMessagesStatus(@javax.annotation.Nonnull MessagesStatusEnum messagesStatus) { + this.messagesStatus = messagesStatus; + } + + + public Dispute buyer(@javax.annotation.Nonnull DisputeUser buyer) { + this.buyer = buyer; + return this; + } + + /** + * Get buyer + * @return buyer + */ + @javax.annotation.Nonnull + public DisputeUser getBuyer() { + return buyer; + } + + public void setBuyer(@javax.annotation.Nonnull DisputeUser buyer) { + this.buyer = buyer; + } + + + public Dispute checkoutForm(@javax.annotation.Nonnull DisputeCheckoutForm checkoutForm) { + this.checkoutForm = checkoutForm; + return this; + } + + /** + * Get checkoutForm + * @return checkoutForm + */ + @javax.annotation.Nonnull + public DisputeCheckoutForm getCheckoutForm() { + return checkoutForm; + } + + public void setCheckoutForm(@javax.annotation.Nonnull DisputeCheckoutForm checkoutForm) { + this.checkoutForm = checkoutForm; + } + + + public Dispute message(@javax.annotation.Nonnull DisputeFirstMessage message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nonnull + public DisputeFirstMessage getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nonnull DisputeFirstMessage message) { + this.message = message; + } + + + public Dispute messagesCount(@javax.annotation.Nonnull Integer messagesCount) { + this.messagesCount = messagesCount; + return this; + } + + /** + * Get messagesCount + * minimum: 0 + * @return messagesCount + */ + @javax.annotation.Nonnull + public Integer getMessagesCount() { + return messagesCount; + } + + public void setMessagesCount(@javax.annotation.Nonnull Integer messagesCount) { + this.messagesCount = messagesCount; + } + + + public Dispute openedDate(@javax.annotation.Nullable OffsetDateTime openedDate) { + this.openedDate = openedDate; + return this; + } + + /** + * Recent date when the dispute has been opened or reopened + * @return openedDate + */ + @javax.annotation.Nullable + public OffsetDateTime getOpenedDate() { + return openedDate; + } + + public void setOpenedDate(@javax.annotation.Nullable OffsetDateTime openedDate) { + this.openedDate = openedDate; + } + + + public Dispute lastMessageCreationDate(@javax.annotation.Nonnull OffsetDateTime lastMessageCreationDate) { + this.lastMessageCreationDate = lastMessageCreationDate; + return this; + } + + /** + * Get lastMessageCreationDate + * @return lastMessageCreationDate + */ + @javax.annotation.Nonnull + public OffsetDateTime getLastMessageCreationDate() { + return lastMessageCreationDate; + } + + public void setLastMessageCreationDate(@javax.annotation.Nonnull OffsetDateTime lastMessageCreationDate) { + this.lastMessageCreationDate = lastMessageCreationDate; + } + + + public Dispute claim(@javax.annotation.Nullable DisputeClaim claim) { + this.claim = claim; + return this; + } + + /** + * Get claim + * @return claim + */ + @javax.annotation.Nullable + public DisputeClaim getClaim() { + return claim; + } + + public void setClaim(@javax.annotation.Nullable DisputeClaim claim) { + this.claim = claim; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dispute dispute = (Dispute) o; + return Objects.equals(this.id, dispute.id) && + Objects.equals(this.subject, dispute.subject) && + Objects.equals(this.status, dispute.status) && + Objects.equals(this.messagesStatus, dispute.messagesStatus) && + Objects.equals(this.buyer, dispute.buyer) && + Objects.equals(this.checkoutForm, dispute.checkoutForm) && + Objects.equals(this.message, dispute.message) && + Objects.equals(this.messagesCount, dispute.messagesCount) && + Objects.equals(this.openedDate, dispute.openedDate) && + Objects.equals(this.lastMessageCreationDate, dispute.lastMessageCreationDate) && + Objects.equals(this.claim, dispute.claim); + } + + @Override + public int hashCode() { + return Objects.hash(id, subject, status, messagesStatus, buyer, checkoutForm, message, messagesCount, openedDate, lastMessageCreationDate, claim); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dispute {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" subject: ").append(toIndentedString(subject)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" messagesStatus: ").append(toIndentedString(messagesStatus)).append("\n"); + sb.append(" buyer: ").append(toIndentedString(buyer)).append("\n"); + sb.append(" checkoutForm: ").append(toIndentedString(checkoutForm)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" messagesCount: ").append(toIndentedString(messagesCount)).append("\n"); + sb.append(" openedDate: ").append(toIndentedString(openedDate)).append("\n"); + sb.append(" lastMessageCreationDate: ").append(toIndentedString(lastMessageCreationDate)).append("\n"); + sb.append(" claim: ").append(toIndentedString(claim)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("subject"); + openapiFields.add("status"); + openapiFields.add("messagesStatus"); + openapiFields.add("buyer"); + openapiFields.add("checkoutForm"); + openapiFields.add("message"); + openapiFields.add("messagesCount"); + openapiFields.add("openedDate"); + openapiFields.add("lastMessageCreationDate"); + openapiFields.add("claim"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("subject"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("messagesStatus"); + openapiRequiredFields.add("buyer"); + openapiRequiredFields.add("checkoutForm"); + openapiRequiredFields.add("message"); + openapiRequiredFields.add("messagesCount"); + openapiRequiredFields.add("lastMessageCreationDate"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Dispute + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Dispute.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Dispute is not found in the empty JSON string", Dispute.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Dispute.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Dispute` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Dispute.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `subject` + Subject.validateJsonElement(jsonObj.get("subject")); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + if (!jsonObj.get("messagesStatus").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `messagesStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("messagesStatus").toString())); + } + // validate the required field `messagesStatus` + MessagesStatusEnum.validateJsonElement(jsonObj.get("messagesStatus")); + // validate the required field `buyer` + DisputeUser.validateJsonElement(jsonObj.get("buyer")); + // validate the required field `checkoutForm` + DisputeCheckoutForm.validateJsonElement(jsonObj.get("checkoutForm")); + // validate the required field `message` + DisputeFirstMessage.validateJsonElement(jsonObj.get("message")); + // validate the optional field `claim` + if (jsonObj.get("claim") != null && !jsonObj.get("claim").isJsonNull()) { + DisputeClaim.validateJsonElement(jsonObj.get("claim")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Dispute.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Dispute' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Dispute.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Dispute value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Dispute read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Dispute given an JSON string + * + * @param jsonString JSON string + * @return An instance of Dispute + * @throws IOException if the JSON string is invalid with respect to Dispute + */ + public static Dispute fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Dispute.class); + } + + /** + * Convert an instance of Dispute to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeAttachment.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeAttachment.java new file mode 100644 index 0000000..546e251 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeAttachment.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DisputeAttachment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DisputeAttachment { + public static final String SERIALIZED_NAME_FILE_NAME = "fileName"; + @SerializedName(SERIALIZED_NAME_FILE_NAME) + @javax.annotation.Nonnull + private String fileName; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nonnull + private String url; + + public DisputeAttachment() { + } + + public DisputeAttachment fileName(@javax.annotation.Nonnull String fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get fileName + * @return fileName + */ + @javax.annotation.Nonnull + public String getFileName() { + return fileName; + } + + public void setFileName(@javax.annotation.Nonnull String fileName) { + this.fileName = fileName; + } + + + public DisputeAttachment url(@javax.annotation.Nonnull String url) { + this.url = url; + return this; + } + + /** + * Direct link to the attachment + * @return url + */ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nonnull String url) { + this.url = url; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeAttachment disputeAttachment = (DisputeAttachment) o; + return Objects.equals(this.fileName, disputeAttachment.fileName) && + Objects.equals(this.url, disputeAttachment.url); + } + + @Override + public int hashCode() { + return Objects.hash(fileName, url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeAttachment {\n"); + sb.append(" fileName: ").append(toIndentedString(fileName)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fileName"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fileName"); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeAttachment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeAttachment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeAttachment is not found in the empty JSON string", DisputeAttachment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeAttachment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeAttachment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeAttachment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("fileName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fileName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fileName").toString())); + } + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeAttachment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeAttachment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeAttachment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeAttachment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeAttachment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeAttachment given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeAttachment + * @throws IOException if the JSON string is invalid with respect to DisputeAttachment + */ + public static DisputeAttachment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeAttachment.class); + } + + /** + * Convert an instance of DisputeAttachment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeAttachmentId.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeAttachmentId.java new file mode 100644 index 0000000..84aa622 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeAttachmentId.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DisputeAttachmentId + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DisputeAttachmentId { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public DisputeAttachmentId() { + } + + public DisputeAttachmentId id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeAttachmentId disputeAttachmentId = (DisputeAttachmentId) o; + return Objects.equals(this.id, disputeAttachmentId.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeAttachmentId {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeAttachmentId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeAttachmentId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeAttachmentId is not found in the empty JSON string", DisputeAttachmentId.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeAttachmentId.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeAttachmentId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeAttachmentId.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeAttachmentId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeAttachmentId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeAttachmentId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeAttachmentId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeAttachmentId read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeAttachmentId given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeAttachmentId + * @throws IOException if the JSON string is invalid with respect to DisputeAttachmentId + */ + public static DisputeAttachmentId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeAttachmentId.class); + } + + /** + * Convert an instance of DisputeAttachmentId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeAuthor.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeAuthor.java new file mode 100644 index 0000000..f1d0711 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeAuthor.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DisputeAuthorRole; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DisputeAuthor + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DisputeAuthor { + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nullable + private String login; + + public static final String SERIALIZED_NAME_ROLE = "role"; + @SerializedName(SERIALIZED_NAME_ROLE) + @javax.annotation.Nonnull + private DisputeAuthorRole role; + + public DisputeAuthor() { + } + + public DisputeAuthor login(@javax.annotation.Nullable String login) { + this.login = login; + return this; + } + + /** + * Not present if role is ADMIN or FULFILLMENT + * @return login + */ + @javax.annotation.Nullable + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nullable String login) { + this.login = login; + } + + + public DisputeAuthor role(@javax.annotation.Nonnull DisputeAuthorRole role) { + this.role = role; + return this; + } + + /** + * Get role + * @return role + */ + @javax.annotation.Nonnull + public DisputeAuthorRole getRole() { + return role; + } + + public void setRole(@javax.annotation.Nonnull DisputeAuthorRole role) { + this.role = role; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeAuthor disputeAuthor = (DisputeAuthor) o; + return Objects.equals(this.login, disputeAuthor.login) && + Objects.equals(this.role, disputeAuthor.role); + } + + @Override + public int hashCode() { + return Objects.hash(login, role); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeAuthor {\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("login"); + openapiFields.add("role"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("role"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeAuthor + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeAuthor.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeAuthor is not found in the empty JSON string", DisputeAuthor.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeAuthor.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeAuthor` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeAuthor.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("login") != null && !jsonObj.get("login").isJsonNull()) && !jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + // validate the required field `role` + DisputeAuthorRole.validateJsonElement(jsonObj.get("role")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeAuthor.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeAuthor' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeAuthor.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeAuthor value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeAuthor read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeAuthor given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeAuthor + * @throws IOException if the JSON string is invalid with respect to DisputeAuthor + */ + public static DisputeAuthor fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeAuthor.class); + } + + /** + * Convert an instance of DisputeAuthor to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeAuthorRole.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeAuthorRole.java new file mode 100644 index 0000000..fa1970b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeAuthorRole.java @@ -0,0 +1,82 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets DisputeAuthorRole + */ +@JsonAdapter(DisputeAuthorRole.Adapter.class) +public enum DisputeAuthorRole { + + BUYER("BUYER"), + + SELLER("SELLER"), + + ADMIN("ADMIN"), + + FULFILLMENT("FULFILLMENT"); + + private String value; + + DisputeAuthorRole(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DisputeAuthorRole fromValue(String value) { + for (DisputeAuthorRole b : DisputeAuthorRole.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DisputeAuthorRole enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DisputeAuthorRole read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DisputeAuthorRole.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + DisputeAuthorRole.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeCheckoutForm.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeCheckoutForm.java new file mode 100644 index 0000000..5b4109f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeCheckoutForm.java @@ -0,0 +1,243 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DisputeCheckoutForm + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DisputeCheckoutForm { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public DisputeCheckoutForm() { + } + + public DisputeCheckoutForm id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public DisputeCheckoutForm createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeCheckoutForm disputeCheckoutForm = (DisputeCheckoutForm) o; + return Objects.equals(this.id, disputeCheckoutForm.id) && + Objects.equals(this.createdAt, disputeCheckoutForm.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, createdAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeCheckoutForm {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("createdAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("createdAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeCheckoutForm + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeCheckoutForm.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeCheckoutForm is not found in the empty JSON string", DisputeCheckoutForm.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeCheckoutForm.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeCheckoutForm` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeCheckoutForm.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeCheckoutForm.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeCheckoutForm' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeCheckoutForm.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeCheckoutForm value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeCheckoutForm read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeCheckoutForm given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeCheckoutForm + * @throws IOException if the JSON string is invalid with respect to DisputeCheckoutForm + */ + public static DisputeCheckoutForm fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeCheckoutForm.class); + } + + /** + * Convert an instance of DisputeCheckoutForm to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeClaim.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeClaim.java new file mode 100644 index 0000000..d768910 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeClaim.java @@ -0,0 +1,248 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Buyer's claim data for the dispute. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DisputeClaim { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public DisputeClaim() { + } + + public DisputeClaim name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Type of the buyer's expectations for the dispute outcome. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public DisputeClaim description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Details of the buyer's expectations for the dispute. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeClaim disputeClaim = (DisputeClaim) o; + return Objects.equals(this.name, disputeClaim.name) && + Objects.equals(this.description, disputeClaim.description); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, description); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeClaim {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeClaim + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeClaim.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeClaim is not found in the empty JSON string", DisputeClaim.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeClaim.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeClaim` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeClaim.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeClaim' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeClaim.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeClaim value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeClaim read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeClaim given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeClaim + * @throws IOException if the JSON string is invalid with respect to DisputeClaim + */ + public static DisputeClaim fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeClaim.class); + } + + /** + * Convert an instance of DisputeClaim to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeFirstMessage.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeFirstMessage.java new file mode 100644 index 0000000..7cfeea8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeFirstMessage.java @@ -0,0 +1,336 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DisputeAttachment; +import pl.wtx.allegro.api.client.model.DisputeAuthor; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Initial dispute message with text OR attachment OR both + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DisputeFirstMessage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public static final String SERIALIZED_NAME_ATTACHMENT = "attachment"; + @SerializedName(SERIALIZED_NAME_ATTACHMENT) + @javax.annotation.Nullable + private DisputeAttachment attachment; + + public static final String SERIALIZED_NAME_AUTHOR = "author"; + @SerializedName(SERIALIZED_NAME_AUTHOR) + @javax.annotation.Nonnull + private DisputeAuthor author; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public DisputeFirstMessage() { + } + + public DisputeFirstMessage id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public DisputeFirstMessage text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Get text + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + public DisputeFirstMessage attachment(@javax.annotation.Nullable DisputeAttachment attachment) { + this.attachment = attachment; + return this; + } + + /** + * Get attachment + * @return attachment + */ + @javax.annotation.Nullable + public DisputeAttachment getAttachment() { + return attachment; + } + + public void setAttachment(@javax.annotation.Nullable DisputeAttachment attachment) { + this.attachment = attachment; + } + + + public DisputeFirstMessage author(@javax.annotation.Nonnull DisputeAuthor author) { + this.author = author; + return this; + } + + /** + * Get author + * @return author + */ + @javax.annotation.Nonnull + public DisputeAuthor getAuthor() { + return author; + } + + public void setAuthor(@javax.annotation.Nonnull DisputeAuthor author) { + this.author = author; + } + + + public DisputeFirstMessage createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeFirstMessage disputeFirstMessage = (DisputeFirstMessage) o; + return Objects.equals(this.id, disputeFirstMessage.id) && + Objects.equals(this.text, disputeFirstMessage.text) && + Objects.equals(this.attachment, disputeFirstMessage.attachment) && + Objects.equals(this.author, disputeFirstMessage.author) && + Objects.equals(this.createdAt, disputeFirstMessage.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, text, attachment, author, createdAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeFirstMessage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" attachment: ").append(toIndentedString(attachment)).append("\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("text"); + openapiFields.add("attachment"); + openapiFields.add("author"); + openapiFields.add("createdAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("author"); + openapiRequiredFields.add("createdAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeFirstMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeFirstMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeFirstMessage is not found in the empty JSON string", DisputeFirstMessage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeFirstMessage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeFirstMessage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeFirstMessage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + // validate the optional field `attachment` + if (jsonObj.get("attachment") != null && !jsonObj.get("attachment").isJsonNull()) { + DisputeAttachment.validateJsonElement(jsonObj.get("attachment")); + } + // validate the required field `author` + DisputeAuthor.validateJsonElement(jsonObj.get("author")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeFirstMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeFirstMessage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeFirstMessage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeFirstMessage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeFirstMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeFirstMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeFirstMessage + * @throws IOException if the JSON string is invalid with respect to DisputeFirstMessage + */ + public static DisputeFirstMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeFirstMessage.class); + } + + /** + * Convert an instance of DisputeFirstMessage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeListResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeListResponse.java new file mode 100644 index 0000000..63b4925 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeListResponse.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Dispute; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DisputeListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DisputeListResponse { + public static final String SERIALIZED_NAME_DISPUTES = "disputes"; + @SerializedName(SERIALIZED_NAME_DISPUTES) + @javax.annotation.Nullable + private List disputes = new ArrayList<>(); + + public DisputeListResponse() { + } + + public DisputeListResponse disputes(@javax.annotation.Nullable List disputes) { + this.disputes = disputes; + return this; + } + + public DisputeListResponse addDisputesItem(Dispute disputesItem) { + if (this.disputes == null) { + this.disputes = new ArrayList<>(); + } + this.disputes.add(disputesItem); + return this; + } + + /** + * Get disputes + * @return disputes + */ + @javax.annotation.Nullable + public List getDisputes() { + return disputes; + } + + public void setDisputes(@javax.annotation.Nullable List disputes) { + this.disputes = disputes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeListResponse disputeListResponse = (DisputeListResponse) o; + return Objects.equals(this.disputes, disputeListResponse.disputes); + } + + @Override + public int hashCode() { + return Objects.hash(disputes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeListResponse {\n"); + sb.append(" disputes: ").append(toIndentedString(disputes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("disputes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeListResponse is not found in the empty JSON string", DisputeListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("disputes") != null && !jsonObj.get("disputes").isJsonNull()) { + JsonArray jsonArraydisputes = jsonObj.getAsJsonArray("disputes"); + if (jsonArraydisputes != null) { + // ensure the json data is an array + if (!jsonObj.get("disputes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `disputes` to be an array in the JSON string but got `%s`", jsonObj.get("disputes").toString())); + } + + // validate the optional field `disputes` (array) + for (int i = 0; i < jsonArraydisputes.size(); i++) { + Dispute.validateJsonElement(jsonArraydisputes.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeListResponse + * @throws IOException if the JSON string is invalid with respect to DisputeListResponse + */ + public static DisputeListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeListResponse.class); + } + + /** + * Convert an instance of DisputeListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeMessage.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeMessage.java new file mode 100644 index 0000000..98e926e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeMessage.java @@ -0,0 +1,336 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DisputeAttachment; +import pl.wtx.allegro.api.client.model.DisputeMessageAuthor; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Initial dispute message with text OR attachment OR both + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DisputeMessage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public static final String SERIALIZED_NAME_ATTACHMENT = "attachment"; + @SerializedName(SERIALIZED_NAME_ATTACHMENT) + @javax.annotation.Nullable + private DisputeAttachment attachment; + + public static final String SERIALIZED_NAME_AUTHOR = "author"; + @SerializedName(SERIALIZED_NAME_AUTHOR) + @javax.annotation.Nonnull + private DisputeMessageAuthor author; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public DisputeMessage() { + } + + public DisputeMessage id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public DisputeMessage text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Get text + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + public DisputeMessage attachment(@javax.annotation.Nullable DisputeAttachment attachment) { + this.attachment = attachment; + return this; + } + + /** + * Get attachment + * @return attachment + */ + @javax.annotation.Nullable + public DisputeAttachment getAttachment() { + return attachment; + } + + public void setAttachment(@javax.annotation.Nullable DisputeAttachment attachment) { + this.attachment = attachment; + } + + + public DisputeMessage author(@javax.annotation.Nonnull DisputeMessageAuthor author) { + this.author = author; + return this; + } + + /** + * Get author + * @return author + */ + @javax.annotation.Nonnull + public DisputeMessageAuthor getAuthor() { + return author; + } + + public void setAuthor(@javax.annotation.Nonnull DisputeMessageAuthor author) { + this.author = author; + } + + + public DisputeMessage createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeMessage disputeMessage = (DisputeMessage) o; + return Objects.equals(this.id, disputeMessage.id) && + Objects.equals(this.text, disputeMessage.text) && + Objects.equals(this.attachment, disputeMessage.attachment) && + Objects.equals(this.author, disputeMessage.author) && + Objects.equals(this.createdAt, disputeMessage.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, text, attachment, author, createdAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeMessage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" attachment: ").append(toIndentedString(attachment)).append("\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("text"); + openapiFields.add("attachment"); + openapiFields.add("author"); + openapiFields.add("createdAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("author"); + openapiRequiredFields.add("createdAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeMessage is not found in the empty JSON string", DisputeMessage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeMessage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeMessage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeMessage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + // validate the optional field `attachment` + if (jsonObj.get("attachment") != null && !jsonObj.get("attachment").isJsonNull()) { + DisputeAttachment.validateJsonElement(jsonObj.get("attachment")); + } + // validate the required field `author` + DisputeMessageAuthor.validateJsonElement(jsonObj.get("author")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeMessage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeMessage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeMessage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeMessage + * @throws IOException if the JSON string is invalid with respect to DisputeMessage + */ + public static DisputeMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeMessage.class); + } + + /** + * Convert an instance of DisputeMessage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeMessageAuthor.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeMessageAuthor.java new file mode 100644 index 0000000..7aa3dea --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeMessageAuthor.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.MessageAuthorRole; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Author of the message + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DisputeMessageAuthor { + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nullable + private String login; + + public static final String SERIALIZED_NAME_ROLE = "role"; + @SerializedName(SERIALIZED_NAME_ROLE) + @javax.annotation.Nonnull + private MessageAuthorRole role; + + public DisputeMessageAuthor() { + } + + public DisputeMessageAuthor login(@javax.annotation.Nullable String login) { + this.login = login; + return this; + } + + /** + * Not present if role is ADMIN, SYSTEM or FULFILLMENT + * @return login + */ + @javax.annotation.Nullable + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nullable String login) { + this.login = login; + } + + + public DisputeMessageAuthor role(@javax.annotation.Nonnull MessageAuthorRole role) { + this.role = role; + return this; + } + + /** + * Get role + * @return role + */ + @javax.annotation.Nonnull + public MessageAuthorRole getRole() { + return role; + } + + public void setRole(@javax.annotation.Nonnull MessageAuthorRole role) { + this.role = role; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeMessageAuthor disputeMessageAuthor = (DisputeMessageAuthor) o; + return Objects.equals(this.login, disputeMessageAuthor.login) && + Objects.equals(this.role, disputeMessageAuthor.role); + } + + @Override + public int hashCode() { + return Objects.hash(login, role); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeMessageAuthor {\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("login"); + openapiFields.add("role"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("role"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeMessageAuthor + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeMessageAuthor.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeMessageAuthor is not found in the empty JSON string", DisputeMessageAuthor.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeMessageAuthor.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeMessageAuthor` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DisputeMessageAuthor.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("login") != null && !jsonObj.get("login").isJsonNull()) && !jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + // validate the required field `role` + MessageAuthorRole.validateJsonElement(jsonObj.get("role")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeMessageAuthor.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeMessageAuthor' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeMessageAuthor.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeMessageAuthor value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeMessageAuthor read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeMessageAuthor given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeMessageAuthor + * @throws IOException if the JSON string is invalid with respect to DisputeMessageAuthor + */ + public static DisputeMessageAuthor fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeMessageAuthor.class); + } + + /** + * Convert an instance of DisputeMessageAuthor to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeMessageList.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeMessageList.java new file mode 100644 index 0000000..4cc57bf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeMessageList.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.DisputeMessage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DisputeMessageList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DisputeMessageList { + public static final String SERIALIZED_NAME_MESSAGES = "messages"; + @SerializedName(SERIALIZED_NAME_MESSAGES) + @javax.annotation.Nullable + private List messages = new ArrayList<>(); + + public DisputeMessageList() { + } + + public DisputeMessageList messages(@javax.annotation.Nullable List messages) { + this.messages = messages; + return this; + } + + public DisputeMessageList addMessagesItem(DisputeMessage messagesItem) { + if (this.messages == null) { + this.messages = new ArrayList<>(); + } + this.messages.add(messagesItem); + return this; + } + + /** + * Get messages + * @return messages + */ + @javax.annotation.Nullable + public List getMessages() { + return messages; + } + + public void setMessages(@javax.annotation.Nullable List messages) { + this.messages = messages; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeMessageList disputeMessageList = (DisputeMessageList) o; + return Objects.equals(this.messages, disputeMessageList.messages); + } + + @Override + public int hashCode() { + return Objects.hash(messages); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeMessageList {\n"); + sb.append(" messages: ").append(toIndentedString(messages)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("messages"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeMessageList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeMessageList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeMessageList is not found in the empty JSON string", DisputeMessageList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeMessageList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeMessageList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("messages") != null && !jsonObj.get("messages").isJsonNull()) { + JsonArray jsonArraymessages = jsonObj.getAsJsonArray("messages"); + if (jsonArraymessages != null) { + // ensure the json data is an array + if (!jsonObj.get("messages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `messages` to be an array in the JSON string but got `%s`", jsonObj.get("messages").toString())); + } + + // validate the optional field `messages` (array) + for (int i = 0; i < jsonArraymessages.size(); i++) { + DisputeMessage.validateJsonElement(jsonArraymessages.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeMessageList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeMessageList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeMessageList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeMessageList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeMessageList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeMessageList given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeMessageList + * @throws IOException if the JSON string is invalid with respect to DisputeMessageList + */ + public static DisputeMessageList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeMessageList.class); + } + + /** + * Convert an instance of DisputeMessageList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/DisputeUser.java b/src/main/java/pl/wtx/allegro/api/client/model/DisputeUser.java new file mode 100644 index 0000000..1c52529 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/DisputeUser.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * DisputeUser + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class DisputeUser { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nullable + private String login; + + public DisputeUser() { + } + + public DisputeUser id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public DisputeUser login(@javax.annotation.Nullable String login) { + this.login = login; + return this; + } + + /** + * Get login + * @return login + */ + @javax.annotation.Nullable + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nullable String login) { + this.login = login; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisputeUser disputeUser = (DisputeUser) o; + return Objects.equals(this.id, disputeUser.id) && + Objects.equals(this.login, disputeUser.login); + } + + @Override + public int hashCode() { + return Objects.hash(id, login); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisputeUser {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("login"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisputeUser + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisputeUser.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisputeUser is not found in the empty JSON string", DisputeUser.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DisputeUser.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DisputeUser` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("login") != null && !jsonObj.get("login").isJsonNull()) && !jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisputeUser.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisputeUser' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisputeUser.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisputeUser value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DisputeUser read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisputeUser given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisputeUser + * @throws IOException if the JSON string is invalid with respect to DisputeUser + */ + public static DisputeUser fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisputeUser.class); + } + + /** + * Convert an instance of DisputeUser to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/EmailRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/EmailRequest.java new file mode 100644 index 0000000..d4b4e7e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/EmailRequest.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * EmailRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class EmailRequest { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private String address; + + public EmailRequest() { + } + + public EmailRequest address(@javax.annotation.Nullable String address) { + this.address = address; + return this; + } + + /** + * The contact's email address. The user part (before `@`) cannot be longer than 64 characters. + * @return address + */ + @javax.annotation.Nullable + public String getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable String address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailRequest emailRequest = (EmailRequest) o; + return Objects.equals(this.address, emailRequest.address); + } + + @Override + public int hashCode() { + return Objects.hash(address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailRequest {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EmailRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EmailRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EmailRequest is not found in the empty JSON string", EmailRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EmailRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EmailRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) && !jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `address` to be a primitive type in the JSON string but got `%s`", jsonObj.get("address").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EmailRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EmailRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EmailRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EmailRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EmailRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EmailRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of EmailRequest + * @throws IOException if the JSON string is invalid with respect to EmailRequest + */ + public static EmailRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EmailRequest.class); + } + + /** + * Convert an instance of EmailRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/EmailResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/EmailResponse.java new file mode 100644 index 0000000..22c812b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/EmailResponse.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * EmailResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class EmailResponse { + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private String address; + + public EmailResponse() { + } + + public EmailResponse address(@javax.annotation.Nullable String address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public String getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable String address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailResponse emailResponse = (EmailResponse) o; + return Objects.equals(this.address, emailResponse.address); + } + + @Override + public int hashCode() { + return Objects.hash(address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailResponse {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EmailResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EmailResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EmailResponse is not found in the empty JSON string", EmailResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EmailResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EmailResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) && !jsonObj.get("address").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `address` to be a primitive type in the JSON string but got `%s`", jsonObj.get("address").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EmailResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EmailResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EmailResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EmailResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EmailResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EmailResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of EmailResponse + * @throws IOException if the JSON string is invalid with respect to EmailResponse + */ + public static EmailResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EmailResponse.class); + } + + /** + * Convert an instance of EmailResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Error.java b/src/main/java/pl/wtx/allegro/api/client/model/Error.java new file mode 100644 index 0000000..6696197 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Error.java @@ -0,0 +1,375 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Error + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Error { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable + private String details; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private String path; + + public static final String SERIALIZED_NAME_USER_MESSAGE = "userMessage"; + @SerializedName(SERIALIZED_NAME_USER_MESSAGE) + @javax.annotation.Nullable + private String userMessage; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); + + public Error() { + } + + public Error code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * The error code. You can use this code when contacting us about any problems with our systems. + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public Error details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * For some cases, this field provides more details regarding the error. This field can be empty. + * @return details + */ + @javax.annotation.Nullable + public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + + public Error message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * A message directed to the developer of the program. This message will always be in English and give you some more technical details on what exactly has happened. + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + public Error path(@javax.annotation.Nullable String path) { + this.path = path; + return this; + } + + /** + * This field will point to a specific field in object if the error is connected to a problem with such specific field. This field can be empty + * @return path + */ + @javax.annotation.Nullable + public String getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable String path) { + this.path = path; + } + + + public Error userMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + return this; + } + + /** + * The message that can be presented directly to your user. It will not contain any technical information. This message is translated based on the value of the \"Accept-Language\" header. By default message in English is returned. + * @return userMessage + */ + @javax.annotation.Nullable + public String getUserMessage() { + return userMessage; + } + + public void setUserMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + } + + + public Error metadata(@javax.annotation.Nullable Map metadata) { + this.metadata = metadata; + return this; + } + + public Error putMetadataItem(String key, String metadataItem) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.put(key, metadataItem); + return this; + } + + /** + * Additional technical properties of this error. Set of possible keys depends on the specific error. + * @return metadata + */ + @javax.annotation.Nullable + public Map getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable Map metadata) { + this.metadata = metadata; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) && + Objects.equals(this.details, error.details) && + Objects.equals(this.message, error.message) && + Objects.equals(this.path, error.path) && + Objects.equals(this.userMessage, error.userMessage) && + Objects.equals(this.metadata, error.metadata); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(code, details, message, path, userMessage, metadata); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" userMessage: ").append(toIndentedString(userMessage)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("details"); + openapiFields.add("message"); + openapiFields.add("path"); + openapiFields.add("userMessage"); + openapiFields.add("metadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Error + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Error.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Error is not found in the empty JSON string", Error.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Error.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be a primitive type in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) && !jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + if ((jsonObj.get("userMessage") != null && !jsonObj.get("userMessage").isJsonNull()) && !jsonObj.get("userMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Error.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Error' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Error.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Error value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Error read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Error given an JSON string + * + * @param jsonString JSON string + * @return An instance of Error + * @throws IOException if the JSON string is invalid with respect to Error + */ + public static Error fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Error.class); + } + + /** + * Convert an instance of Error to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Error200.java b/src/main/java/pl/wtx/allegro/api/client/model/Error200.java new file mode 100644 index 0000000..f82094c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Error200.java @@ -0,0 +1,338 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Error200 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Error200 { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable + private String details; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private String path; + + public static final String SERIALIZED_NAME_USER_MESSAGE = "userMessage"; + @SerializedName(SERIALIZED_NAME_USER_MESSAGE) + @javax.annotation.Nullable + private String userMessage; + + public Error200() { + } + + public Error200 code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * The error code. You can use this code when contacting us about any problems with our systems. + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public Error200 details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * For some cases, this field provides more details regarding the error. This field can not be null. + * @return details + */ + @javax.annotation.Nullable + public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + + public Error200 message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * A message directed to the developer of the program. This message give you some more technical details on what exactly has happened. + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + public Error200 path(@javax.annotation.Nullable String path) { + this.path = path; + return this; + } + + /** + * This field will point to a specific field in object if the error is connected to a problem with such specific field. This field can be empty + * @return path + */ + @javax.annotation.Nullable + public String getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable String path) { + this.path = path; + } + + + public Error200 userMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + return this; + } + + /** + * The message that can be presented directly to your user. It will not contain any technical information. This message is translated based on the value of the `Accept-Language` header. By default message in Polish is returned. + * @return userMessage + */ + @javax.annotation.Nullable + public String getUserMessage() { + return userMessage; + } + + public void setUserMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error200 error200 = (Error200) o; + return Objects.equals(this.code, error200.code) && + Objects.equals(this.details, error200.details) && + Objects.equals(this.message, error200.message) && + Objects.equals(this.path, error200.path) && + Objects.equals(this.userMessage, error200.userMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(code, details, message, path, userMessage); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error200 {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" userMessage: ").append(toIndentedString(userMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("details"); + openapiFields.add("message"); + openapiFields.add("path"); + openapiFields.add("userMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Error200 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Error200.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Error200 is not found in the empty JSON string", Error200.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Error200.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error200` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be a primitive type in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) && !jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + if ((jsonObj.get("userMessage") != null && !jsonObj.get("userMessage").isJsonNull()) && !jsonObj.get("userMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Error200.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Error200' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Error200.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Error200 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Error200 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Error200 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Error200 + * @throws IOException if the JSON string is invalid with respect to Error200 + */ + public static Error200 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Error200.class); + } + + /** + * Convert an instance of Error200 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Error400.java b/src/main/java/pl/wtx/allegro/api/client/model/Error400.java new file mode 100644 index 0000000..61f00cc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Error400.java @@ -0,0 +1,338 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Error400 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Error400 { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable + private String details; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private String path; + + public static final String SERIALIZED_NAME_USER_MESSAGE = "userMessage"; + @SerializedName(SERIALIZED_NAME_USER_MESSAGE) + @javax.annotation.Nullable + private String userMessage; + + public Error400() { + } + + public Error400 code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * The error code. You can use this code when contacting us about any problems with our systems. + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public Error400 details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * For some cases, this field provides more details regarding the error. This field can not be null. + * @return details + */ + @javax.annotation.Nullable + public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + + public Error400 message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * A message directed to the developer of the program. This message give you some more technical details on what exactly has happened. + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + public Error400 path(@javax.annotation.Nullable String path) { + this.path = path; + return this; + } + + /** + * This field will point to a specific field in object if the error is connected to a problem with such specific field. This field can be empty + * @return path + */ + @javax.annotation.Nullable + public String getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable String path) { + this.path = path; + } + + + public Error400 userMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + return this; + } + + /** + * The message that can be presented directly to your user. It will not contain any technical information. This message is translated based on the value of the `Accept-Language` header. By default message in Polish is returned. + * @return userMessage + */ + @javax.annotation.Nullable + public String getUserMessage() { + return userMessage; + } + + public void setUserMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error400 error400 = (Error400) o; + return Objects.equals(this.code, error400.code) && + Objects.equals(this.details, error400.details) && + Objects.equals(this.message, error400.message) && + Objects.equals(this.path, error400.path) && + Objects.equals(this.userMessage, error400.userMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(code, details, message, path, userMessage); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error400 {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" userMessage: ").append(toIndentedString(userMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("details"); + openapiFields.add("message"); + openapiFields.add("path"); + openapiFields.add("userMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Error400 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Error400.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Error400 is not found in the empty JSON string", Error400.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Error400.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error400` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be a primitive type in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) && !jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + if ((jsonObj.get("userMessage") != null && !jsonObj.get("userMessage").isJsonNull()) && !jsonObj.get("userMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Error400.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Error400' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Error400.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Error400 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Error400 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Error400 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Error400 + * @throws IOException if the JSON string is invalid with respect to Error400 + */ + public static Error400 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Error400.class); + } + + /** + * Convert an instance of Error400 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Error403.java b/src/main/java/pl/wtx/allegro/api/client/model/Error403.java new file mode 100644 index 0000000..218d287 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Error403.java @@ -0,0 +1,338 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Error403 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Error403 { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable + private String details; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private String path; + + public static final String SERIALIZED_NAME_USER_MESSAGE = "userMessage"; + @SerializedName(SERIALIZED_NAME_USER_MESSAGE) + @javax.annotation.Nullable + private String userMessage; + + public Error403() { + } + + public Error403 code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * The error code. You can use this code when contacting us about any problems with our systems. + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public Error403 details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * For some cases, this field provides more details regarding the error. + * @return details + */ + @javax.annotation.Nullable + public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + + public Error403 message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * A message directed to the developer of the program. This message give you some more technical details on what exactly has happened. + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + public Error403 path(@javax.annotation.Nullable String path) { + this.path = path; + return this; + } + + /** + * This field will point to a specific field in object if the error is connected to a problem with such specific field. + * @return path + */ + @javax.annotation.Nullable + public String getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable String path) { + this.path = path; + } + + + public Error403 userMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + return this; + } + + /** + * The message that can be presented directly to your user. It will not contain any technical information. This message is translated based on the value of the 'Accept-Language' header. By default message in Polish is returned. + * @return userMessage + */ + @javax.annotation.Nullable + public String getUserMessage() { + return userMessage; + } + + public void setUserMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error403 error403 = (Error403) o; + return Objects.equals(this.code, error403.code) && + Objects.equals(this.details, error403.details) && + Objects.equals(this.message, error403.message) && + Objects.equals(this.path, error403.path) && + Objects.equals(this.userMessage, error403.userMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(code, details, message, path, userMessage); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error403 {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" userMessage: ").append(toIndentedString(userMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("details"); + openapiFields.add("message"); + openapiFields.add("path"); + openapiFields.add("userMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Error403 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Error403.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Error403 is not found in the empty JSON string", Error403.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Error403.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error403` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be a primitive type in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) && !jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + if ((jsonObj.get("userMessage") != null && !jsonObj.get("userMessage").isJsonNull()) && !jsonObj.get("userMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Error403.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Error403' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Error403.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Error403 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Error403 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Error403 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Error403 + * @throws IOException if the JSON string is invalid with respect to Error403 + */ + public static Error403 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Error403.class); + } + + /** + * Convert an instance of Error403 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Error404.java b/src/main/java/pl/wtx/allegro/api/client/model/Error404.java new file mode 100644 index 0000000..8123950 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Error404.java @@ -0,0 +1,338 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Error404 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Error404 { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable + private String details; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private String path; + + public static final String SERIALIZED_NAME_USER_MESSAGE = "userMessage"; + @SerializedName(SERIALIZED_NAME_USER_MESSAGE) + @javax.annotation.Nullable + private String userMessage; + + public Error404() { + } + + public Error404 code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * The error code. You can use this code when contacting us about any problems with our systems. + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public Error404 details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * For some cases, this field provides more details regarding the error. This field can not be null. + * @return details + */ + @javax.annotation.Nullable + public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + + public Error404 message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * A message directed to the developer of the program. This message give you some more technical details on what exactly has happened. + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + public Error404 path(@javax.annotation.Nullable String path) { + this.path = path; + return this; + } + + /** + * This field will point to a specific field in object if the error is connected to a problem with such specific field. This field can be empty + * @return path + */ + @javax.annotation.Nullable + public String getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable String path) { + this.path = path; + } + + + public Error404 userMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + return this; + } + + /** + * The message that can be presented directly to your user. It will not contain any technical information. This message is translated based on the value of the `Accept-Language` header. By default message in Polish is returned. + * @return userMessage + */ + @javax.annotation.Nullable + public String getUserMessage() { + return userMessage; + } + + public void setUserMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error404 error404 = (Error404) o; + return Objects.equals(this.code, error404.code) && + Objects.equals(this.details, error404.details) && + Objects.equals(this.message, error404.message) && + Objects.equals(this.path, error404.path) && + Objects.equals(this.userMessage, error404.userMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(code, details, message, path, userMessage); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error404 {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" userMessage: ").append(toIndentedString(userMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("details"); + openapiFields.add("message"); + openapiFields.add("path"); + openapiFields.add("userMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Error404 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Error404.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Error404 is not found in the empty JSON string", Error404.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Error404.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error404` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be a primitive type in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) && !jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + if ((jsonObj.get("userMessage") != null && !jsonObj.get("userMessage").isJsonNull()) && !jsonObj.get("userMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Error404.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Error404' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Error404.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Error404 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Error404 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Error404 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Error404 + * @throws IOException if the JSON string is invalid with respect to Error404 + */ + public static Error404 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Error404.class); + } + + /** + * Convert an instance of Error404 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Error504.java b/src/main/java/pl/wtx/allegro/api/client/model/Error504.java new file mode 100644 index 0000000..72f74e0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Error504.java @@ -0,0 +1,338 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Error504 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Error504 { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable + private String details; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private String path; + + public static final String SERIALIZED_NAME_USER_MESSAGE = "userMessage"; + @SerializedName(SERIALIZED_NAME_USER_MESSAGE) + @javax.annotation.Nullable + private String userMessage; + + public Error504() { + } + + public Error504 code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * The error code. You can use this code when contacting us about any problems with our systems. + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public Error504 details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * For some cases, this field provides more details regarding the error. + * @return details + */ + @javax.annotation.Nullable + public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + + public Error504 message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * A message directed to the developer of the program. This message give you some more technical details on what exactly has happened. + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + public Error504 path(@javax.annotation.Nullable String path) { + this.path = path; + return this; + } + + /** + * This field will point to a specific field in object if the error is connected to a problem with such specific field. + * @return path + */ + @javax.annotation.Nullable + public String getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable String path) { + this.path = path; + } + + + public Error504 userMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + return this; + } + + /** + * The message that can be presented directly to your user. It will not contain any technical information. This message is translated based on the value of the 'Accept-Language' header. By default message in Polish is returned. + * @return userMessage + */ + @javax.annotation.Nullable + public String getUserMessage() { + return userMessage; + } + + public void setUserMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error504 error504 = (Error504) o; + return Objects.equals(this.code, error504.code) && + Objects.equals(this.details, error504.details) && + Objects.equals(this.message, error504.message) && + Objects.equals(this.path, error504.path) && + Objects.equals(this.userMessage, error504.userMessage); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(code, details, message, path, userMessage); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error504 {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" userMessage: ").append(toIndentedString(userMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("details"); + openapiFields.add("message"); + openapiFields.add("path"); + openapiFields.add("userMessage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Error504 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Error504.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Error504 is not found in the empty JSON string", Error504.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Error504.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error504` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be a primitive type in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) && !jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + if ((jsonObj.get("userMessage") != null && !jsonObj.get("userMessage").isJsonNull()) && !jsonObj.get("userMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Error504.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Error504' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Error504.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Error504 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Error504 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Error504 given an JSON string + * + * @param jsonString JSON string + * @return An instance of Error504 + * @throws IOException if the JSON string is invalid with respect to Error504 + */ + public static Error504 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Error504.class); + } + + /** + * Convert an instance of Error504 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ErrorsHolder.java b/src/main/java/pl/wtx/allegro/api/client/model/ErrorsHolder.java new file mode 100644 index 0000000..a9f5eda --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ErrorsHolder.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ErrorsHolder + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ErrorsHolder { + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public ErrorsHolder() { + } + + public ErrorsHolder errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public ErrorsHolder addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * The list of all the error objects explaining the error. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorsHolder errorsHolder = (ErrorsHolder) o; + return Objects.equals(this.errors, errorsHolder.errors); + } + + @Override + public int hashCode() { + return Objects.hash(errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorsHolder {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ErrorsHolder + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ErrorsHolder.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ErrorsHolder is not found in the empty JSON string", ErrorsHolder.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ErrorsHolder.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ErrorsHolder` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ErrorsHolder.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ErrorsHolder' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ErrorsHolder.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ErrorsHolder value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ErrorsHolder read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ErrorsHolder given an JSON string + * + * @param jsonString JSON string + * @return An instance of ErrorsHolder + * @throws IOException if the JSON string is invalid with respect to ErrorsHolder + */ + public static ErrorsHolder fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ErrorsHolder.class); + } + + /** + * Convert an instance of ErrorsHolder to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Exclusion.java b/src/main/java/pl/wtx/allegro/api/client/model/Exclusion.java new file mode 100644 index 0000000..360c51d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Exclusion.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Exclusion + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Exclusion { + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nullable + private String reason; + + public Exclusion() { + } + + public Exclusion reason(@javax.annotation.Nullable String reason) { + this.reason = reason; + return this; + } + + /** + * The reason why the rating was excluded from calculating average user rates. The message is translated based on the value of the \"Accept-Language\" header and exists only when the rating was excluded. + * @return reason + */ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nullable String reason) { + this.reason = reason; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Exclusion exclusion = (Exclusion) o; + return Objects.equals(this.reason, exclusion.reason); + } + + @Override + public int hashCode() { + return Objects.hash(reason); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Exclusion {\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reason"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Exclusion + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Exclusion.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Exclusion is not found in the empty JSON string", Exclusion.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Exclusion.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Exclusion` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Exclusion.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Exclusion' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Exclusion.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Exclusion value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Exclusion read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Exclusion given an JSON string + * + * @param jsonString JSON string + * @return An instance of Exclusion + * @throws IOException if the JSON string is invalid with respect to Exclusion + */ + public static Exclusion fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Exclusion.class); + } + + /** + * Convert an instance of Exclusion to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ExternalId.java b/src/main/java/pl/wtx/allegro/api/client/model/ExternalId.java new file mode 100644 index 0000000..86dfa32 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ExternalId.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The information on the offer in an external system. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ExternalId { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ExternalId() { + } + + public ExternalId id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of the offer in the external system. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExternalId externalId = (ExternalId) o; + return Objects.equals(this.id, externalId.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExternalId {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ExternalId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExternalId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ExternalId is not found in the empty JSON string", ExternalId.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ExternalId.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ExternalId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExternalId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExternalId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExternalId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExternalId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ExternalId read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExternalId given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExternalId + * @throws IOException if the JSON string is invalid with respect to ExternalId + */ + public static ExternalId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExternalId.class); + } + + /** + * Convert an instance of ExternalId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Fee.java b/src/main/java/pl/wtx/allegro/api/client/model/Fee.java new file mode 100644 index 0000000..5127c7a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Fee.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Fee + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Fee { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public Fee() { + } + + public Fee amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Get amount + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public Fee currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Get currency + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Fee fee = (Fee) o; + return Objects.equals(this.amount, fee.amount) && + Objects.equals(this.currency, fee.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Fee {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Fee + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Fee.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Fee is not found in the empty JSON string", Fee.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Fee.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Fee` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Fee.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Fee' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Fee.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Fee value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Fee read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Fee given an JSON string + * + * @param jsonString JSON string + * @return An instance of Fee + * @throws IOException if the JSON string is invalid with respect to Fee + */ + public static Fee fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Fee.class); + } + + /** + * Convert an instance of Fee to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/FeePreviewResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/FeePreviewResponse.java new file mode 100644 index 0000000..03e3a26 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/FeePreviewResponse.java @@ -0,0 +1,278 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CommissionResponse; +import pl.wtx.allegro.api.client.model.QuoteResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * FeePreviewResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class FeePreviewResponse { + public static final String SERIALIZED_NAME_COMMISSIONS = "commissions"; + @SerializedName(SERIALIZED_NAME_COMMISSIONS) + @javax.annotation.Nullable + private List commissions = new ArrayList<>(); + + public static final String SERIALIZED_NAME_QUOTES = "quotes"; + @SerializedName(SERIALIZED_NAME_QUOTES) + @javax.annotation.Nullable + private List quotes = new ArrayList<>(); + + public FeePreviewResponse() { + } + + public FeePreviewResponse commissions(@javax.annotation.Nullable List commissions) { + this.commissions = commissions; + return this; + } + + public FeePreviewResponse addCommissionsItem(CommissionResponse commissionsItem) { + if (this.commissions == null) { + this.commissions = new ArrayList<>(); + } + this.commissions.add(commissionsItem); + return this; + } + + /** + * An array of commissions. + * @return commissions + */ + @javax.annotation.Nullable + public List getCommissions() { + return commissions; + } + + public void setCommissions(@javax.annotation.Nullable List commissions) { + this.commissions = commissions; + } + + + public FeePreviewResponse quotes(@javax.annotation.Nullable List quotes) { + this.quotes = quotes; + return this; + } + + public FeePreviewResponse addQuotesItem(QuoteResponse quotesItem) { + if (this.quotes == null) { + this.quotes = new ArrayList<>(); + } + this.quotes.add(quotesItem); + return this; + } + + /** + * An array of quotes. + * @return quotes + */ + @javax.annotation.Nullable + public List getQuotes() { + return quotes; + } + + public void setQuotes(@javax.annotation.Nullable List quotes) { + this.quotes = quotes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeePreviewResponse feePreviewResponse = (FeePreviewResponse) o; + return Objects.equals(this.commissions, feePreviewResponse.commissions) && + Objects.equals(this.quotes, feePreviewResponse.quotes); + } + + @Override + public int hashCode() { + return Objects.hash(commissions, quotes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeePreviewResponse {\n"); + sb.append(" commissions: ").append(toIndentedString(commissions)).append("\n"); + sb.append(" quotes: ").append(toIndentedString(quotes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("commissions"); + openapiFields.add("quotes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FeePreviewResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FeePreviewResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FeePreviewResponse is not found in the empty JSON string", FeePreviewResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FeePreviewResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FeePreviewResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("commissions") != null && !jsonObj.get("commissions").isJsonNull()) { + JsonArray jsonArraycommissions = jsonObj.getAsJsonArray("commissions"); + if (jsonArraycommissions != null) { + // ensure the json data is an array + if (!jsonObj.get("commissions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `commissions` to be an array in the JSON string but got `%s`", jsonObj.get("commissions").toString())); + } + + // validate the optional field `commissions` (array) + for (int i = 0; i < jsonArraycommissions.size(); i++) { + CommissionResponse.validateJsonElement(jsonArraycommissions.get(i)); + }; + } + } + if (jsonObj.get("quotes") != null && !jsonObj.get("quotes").isJsonNull()) { + JsonArray jsonArrayquotes = jsonObj.getAsJsonArray("quotes"); + if (jsonArrayquotes != null) { + // ensure the json data is an array + if (!jsonObj.get("quotes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `quotes` to be an array in the JSON string but got `%s`", jsonObj.get("quotes").toString())); + } + + // validate the optional field `quotes` (array) + for (int i = 0; i < jsonArrayquotes.size(); i++) { + QuoteResponse.validateJsonElement(jsonArrayquotes.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FeePreviewResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FeePreviewResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FeePreviewResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FeePreviewResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FeePreviewResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FeePreviewResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of FeePreviewResponse + * @throws IOException if the JSON string is invalid with respect to FeePreviewResponse + */ + public static FeePreviewResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FeePreviewResponse.class); + } + + /** + * Convert an instance of FeePreviewResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryParameter.java new file mode 100644 index 0000000..98e236c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryParameter.java @@ -0,0 +1,257 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.CategoryParameter; +import pl.wtx.allegro.api.client.model.CategoryParameterDisplayConditions; +import pl.wtx.allegro.api.client.model.CategoryParameterOptions; +import pl.wtx.allegro.api.client.model.CategoryParameterRequirementConditions; +import pl.wtx.allegro.api.client.model.FloatCategoryProductParameterAllOfRestrictions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * FloatCategoryParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class FloatCategoryParameter extends CategoryParameter { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "float"; + + public static final String SERIALIZED_NAME_RESTRICTIONS = "restrictions"; + @SerializedName(SERIALIZED_NAME_RESTRICTIONS) + @javax.annotation.Nullable + private FloatCategoryProductParameterAllOfRestrictions restrictions; + + public FloatCategoryParameter() { + this.type = this.getClass().getSimpleName(); + } + + public FloatCategoryParameter type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public FloatCategoryParameter restrictions(@javax.annotation.Nullable FloatCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + * Get restrictions + * @return restrictions + */ + @javax.annotation.Nullable + public FloatCategoryProductParameterAllOfRestrictions getRestrictions() { + return restrictions; + } + + public void setRestrictions(@javax.annotation.Nullable FloatCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FloatCategoryParameter floatCategoryParameter = (FloatCategoryParameter) o; + return Objects.equals(this.type, floatCategoryParameter.type) && + Objects.equals(this.restrictions, floatCategoryParameter.restrictions) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, restrictions, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FloatCategoryParameter {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" restrictions: ").append(toIndentedString(restrictions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("required"); + openapiFields.add("requiredForProduct"); + openapiFields.add("requiredIf"); + openapiFields.add("displayedIf"); + openapiFields.add("unit"); + openapiFields.add("options"); + openapiFields.add("restrictions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FloatCategoryParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FloatCategoryParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FloatCategoryParameter is not found in the empty JSON string", FloatCategoryParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FloatCategoryParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FloatCategoryParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FloatCategoryParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FloatCategoryParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FloatCategoryParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FloatCategoryParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FloatCategoryParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FloatCategoryParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of FloatCategoryParameter + * @throws IOException if the JSON string is invalid with respect to FloatCategoryParameter + */ + public static FloatCategoryParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FloatCategoryParameter.class); + } + + /** + * Convert an instance of FloatCategoryParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryProductParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryProductParameter.java new file mode 100644 index 0000000..5f5f6c1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryProductParameter.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.CategoryParameterDisplayConditions; +import pl.wtx.allegro.api.client.model.CategoryParameterRequirementConditions; +import pl.wtx.allegro.api.client.model.CategoryProductParameter; +import pl.wtx.allegro.api.client.model.FloatCategoryProductParameterAllOfRestrictions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * FloatCategoryProductParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class FloatCategoryProductParameter extends CategoryProductParameter { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "float"; + + public static final String SERIALIZED_NAME_RESTRICTIONS = "restrictions"; + @SerializedName(SERIALIZED_NAME_RESTRICTIONS) + @javax.annotation.Nullable + private FloatCategoryProductParameterAllOfRestrictions restrictions; + + public FloatCategoryProductParameter() { + this.type = this.getClass().getSimpleName(); + } + + public FloatCategoryProductParameter type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public FloatCategoryProductParameter restrictions(@javax.annotation.Nullable FloatCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + * Get restrictions + * @return restrictions + */ + @javax.annotation.Nullable + public FloatCategoryProductParameterAllOfRestrictions getRestrictions() { + return restrictions; + } + + public void setRestrictions(@javax.annotation.Nullable FloatCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FloatCategoryProductParameter floatCategoryProductParameter = (FloatCategoryProductParameter) o; + return Objects.equals(this.type, floatCategoryProductParameter.type) && + Objects.equals(this.restrictions, floatCategoryProductParameter.restrictions) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, restrictions, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FloatCategoryProductParameter {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" restrictions: ").append(toIndentedString(restrictions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("required"); + openapiFields.add("requiredIf"); + openapiFields.add("displayedIf"); + openapiFields.add("unit"); + openapiFields.add("restrictions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FloatCategoryProductParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FloatCategoryProductParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FloatCategoryProductParameter is not found in the empty JSON string", FloatCategoryProductParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FloatCategoryProductParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FloatCategoryProductParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FloatCategoryProductParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FloatCategoryProductParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FloatCategoryProductParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FloatCategoryProductParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FloatCategoryProductParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FloatCategoryProductParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of FloatCategoryProductParameter + * @throws IOException if the JSON string is invalid with respect to FloatCategoryProductParameter + */ + public static FloatCategoryProductParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FloatCategoryProductParameter.class); + } + + /** + * Convert an instance of FloatCategoryProductParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryProductParameterAllOfRestrictions.java b/src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryProductParameterAllOfRestrictions.java new file mode 100644 index 0000000..edced39 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/FloatCategoryProductParameterAllOfRestrictions.java @@ -0,0 +1,286 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The restrictions on values of this parameter. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class FloatCategoryProductParameterAllOfRestrictions { + public static final String SERIALIZED_NAME_MIN = "min"; + @SerializedName(SERIALIZED_NAME_MIN) + @javax.annotation.Nullable + private BigDecimal min; + + public static final String SERIALIZED_NAME_MAX = "max"; + @SerializedName(SERIALIZED_NAME_MAX) + @javax.annotation.Nullable + private BigDecimal max; + + public static final String SERIALIZED_NAME_RANGE = "range"; + @SerializedName(SERIALIZED_NAME_RANGE) + @javax.annotation.Nullable + private Boolean range; + + public static final String SERIALIZED_NAME_PRECISION = "precision"; + @SerializedName(SERIALIZED_NAME_PRECISION) + @javax.annotation.Nullable + private Integer precision; + + public FloatCategoryProductParameterAllOfRestrictions() { + } + + public FloatCategoryProductParameterAllOfRestrictions min(@javax.annotation.Nullable BigDecimal min) { + this.min = min; + return this; + } + + /** + * The minimum value of this parameter. Lower than or equal to `max`. + * @return min + */ + @javax.annotation.Nullable + public BigDecimal getMin() { + return min; + } + + public void setMin(@javax.annotation.Nullable BigDecimal min) { + this.min = min; + } + + + public FloatCategoryProductParameterAllOfRestrictions max(@javax.annotation.Nullable BigDecimal max) { + this.max = max; + return this; + } + + /** + * The maximum value of this parameter. Greater than or equal to `min`. + * @return max + */ + @javax.annotation.Nullable + public BigDecimal getMax() { + return max; + } + + public void setMax(@javax.annotation.Nullable BigDecimal max) { + this.max = max; + } + + + public FloatCategoryProductParameterAllOfRestrictions range(@javax.annotation.Nullable Boolean range) { + this.range = range; + return this; + } + + /** + * Indicates whether this is a range parameter. If this is `true`, then you have to provide two values for this parameter - `from` and `to`. Both these values have to be between the `min` and `max`. + * @return range + */ + @javax.annotation.Nullable + public Boolean getRange() { + return range; + } + + public void setRange(@javax.annotation.Nullable Boolean range) { + this.range = range; + } + + + public FloatCategoryProductParameterAllOfRestrictions precision(@javax.annotation.Nullable Integer precision) { + this.precision = precision; + return this; + } + + /** + * Number of digits you can provide after a comma that can be transferred in the parameter value. + * minimum: 0 + * @return precision + */ + @javax.annotation.Nullable + public Integer getPrecision() { + return precision; + } + + public void setPrecision(@javax.annotation.Nullable Integer precision) { + this.precision = precision; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FloatCategoryProductParameterAllOfRestrictions floatCategoryProductParameterAllOfRestrictions = (FloatCategoryProductParameterAllOfRestrictions) o; + return Objects.equals(this.min, floatCategoryProductParameterAllOfRestrictions.min) && + Objects.equals(this.max, floatCategoryProductParameterAllOfRestrictions.max) && + Objects.equals(this.range, floatCategoryProductParameterAllOfRestrictions.range) && + Objects.equals(this.precision, floatCategoryProductParameterAllOfRestrictions.precision); + } + + @Override + public int hashCode() { + return Objects.hash(min, max, range, precision); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FloatCategoryProductParameterAllOfRestrictions {\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" range: ").append(toIndentedString(range)).append("\n"); + sb.append(" precision: ").append(toIndentedString(precision)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("min"); + openapiFields.add("max"); + openapiFields.add("range"); + openapiFields.add("precision"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FloatCategoryProductParameterAllOfRestrictions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FloatCategoryProductParameterAllOfRestrictions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FloatCategoryProductParameterAllOfRestrictions is not found in the empty JSON string", FloatCategoryProductParameterAllOfRestrictions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FloatCategoryProductParameterAllOfRestrictions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FloatCategoryProductParameterAllOfRestrictions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FloatCategoryProductParameterAllOfRestrictions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FloatCategoryProductParameterAllOfRestrictions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FloatCategoryProductParameterAllOfRestrictions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FloatCategoryProductParameterAllOfRestrictions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FloatCategoryProductParameterAllOfRestrictions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FloatCategoryProductParameterAllOfRestrictions given an JSON string + * + * @param jsonString JSON string + * @return An instance of FloatCategoryProductParameterAllOfRestrictions + * @throws IOException if the JSON string is invalid with respect to FloatCategoryProductParameterAllOfRestrictions + */ + public static FloatCategoryProductParameterAllOfRestrictions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FloatCategoryProductParameterAllOfRestrictions.class); + } + + /** + * Convert an instance of FloatCategoryProductParameterAllOfRestrictions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrder.java b/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrder.java new file mode 100644 index 0000000..dd9da21 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrder.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.FulfillmentOrderParcel; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * FulfillmentOrder + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class FulfillmentOrder { + public static final String SERIALIZED_NAME_ORDER_ID = "orderId"; + @SerializedName(SERIALIZED_NAME_ORDER_ID) + @javax.annotation.Nullable + private String orderId; + + public static final String SERIALIZED_NAME_PARCELS = "parcels"; + @SerializedName(SERIALIZED_NAME_PARCELS) + @javax.annotation.Nullable + private List parcels = new ArrayList<>(); + + public FulfillmentOrder() { + } + + public FulfillmentOrder orderId(@javax.annotation.Nullable String orderId) { + this.orderId = orderId; + return this; + } + + /** + * order identifier + * @return orderId + */ + @javax.annotation.Nullable + public String getOrderId() { + return orderId; + } + + public void setOrderId(@javax.annotation.Nullable String orderId) { + this.orderId = orderId; + } + + + public FulfillmentOrder parcels(@javax.annotation.Nullable List parcels) { + this.parcels = parcels; + return this; + } + + public FulfillmentOrder addParcelsItem(FulfillmentOrderParcel parcelsItem) { + if (this.parcels == null) { + this.parcels = new ArrayList<>(); + } + this.parcels.add(parcelsItem); + return this; + } + + /** + * Get parcels + * @return parcels + */ + @javax.annotation.Nullable + public List getParcels() { + return parcels; + } + + public void setParcels(@javax.annotation.Nullable List parcels) { + this.parcels = parcels; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FulfillmentOrder fulfillmentOrder = (FulfillmentOrder) o; + return Objects.equals(this.orderId, fulfillmentOrder.orderId) && + Objects.equals(this.parcels, fulfillmentOrder.parcels); + } + + @Override + public int hashCode() { + return Objects.hash(orderId, parcels); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FulfillmentOrder {\n"); + sb.append(" orderId: ").append(toIndentedString(orderId)).append("\n"); + sb.append(" parcels: ").append(toIndentedString(parcels)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("orderId"); + openapiFields.add("parcels"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FulfillmentOrder + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FulfillmentOrder.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FulfillmentOrder is not found in the empty JSON string", FulfillmentOrder.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FulfillmentOrder.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FulfillmentOrder` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("orderId") != null && !jsonObj.get("orderId").isJsonNull()) && !jsonObj.get("orderId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orderId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orderId").toString())); + } + if (jsonObj.get("parcels") != null && !jsonObj.get("parcels").isJsonNull()) { + JsonArray jsonArrayparcels = jsonObj.getAsJsonArray("parcels"); + if (jsonArrayparcels != null) { + // ensure the json data is an array + if (!jsonObj.get("parcels").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parcels` to be an array in the JSON string but got `%s`", jsonObj.get("parcels").toString())); + } + + // validate the optional field `parcels` (array) + for (int i = 0; i < jsonArrayparcels.size(); i++) { + FulfillmentOrderParcel.validateJsonElement(jsonArrayparcels.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FulfillmentOrder.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FulfillmentOrder' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FulfillmentOrder.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FulfillmentOrder value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FulfillmentOrder read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FulfillmentOrder given an JSON string + * + * @param jsonString JSON string + * @return An instance of FulfillmentOrder + * @throws IOException if the JSON string is invalid with respect to FulfillmentOrder + */ + public static FulfillmentOrder fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FulfillmentOrder.class); + } + + /** + * Convert an instance of FulfillmentOrder to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrderParcel.java b/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrderParcel.java new file mode 100644 index 0000000..c7f8dc1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrderParcel.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.FulfillmentOrderParcelItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * FulfillmentOrderParcel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class FulfillmentOrderParcel { + public static final String SERIALIZED_NAME_WAYBILL = "waybill"; + @SerializedName(SERIALIZED_NAME_WAYBILL) + @javax.annotation.Nullable + private String waybill; + + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nullable + private List items = new ArrayList<>(); + + public FulfillmentOrderParcel() { + } + + public FulfillmentOrderParcel waybill(@javax.annotation.Nullable String waybill) { + this.waybill = waybill; + return this; + } + + /** + * Waybill number (parcel tracking number). + * @return waybill + */ + @javax.annotation.Nullable + public String getWaybill() { + return waybill; + } + + public void setWaybill(@javax.annotation.Nullable String waybill) { + this.waybill = waybill; + } + + + public FulfillmentOrderParcel items(@javax.annotation.Nullable List items) { + this.items = items; + return this; + } + + public FulfillmentOrderParcel addItemsItem(FulfillmentOrderParcelItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * List of parcels' items + * @return items + */ + @javax.annotation.Nullable + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nullable List items) { + this.items = items; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FulfillmentOrderParcel fulfillmentOrderParcel = (FulfillmentOrderParcel) o; + return Objects.equals(this.waybill, fulfillmentOrderParcel.waybill) && + Objects.equals(this.items, fulfillmentOrderParcel.items); + } + + @Override + public int hashCode() { + return Objects.hash(waybill, items); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FulfillmentOrderParcel {\n"); + sb.append(" waybill: ").append(toIndentedString(waybill)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("waybill"); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FulfillmentOrderParcel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FulfillmentOrderParcel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FulfillmentOrderParcel is not found in the empty JSON string", FulfillmentOrderParcel.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FulfillmentOrderParcel.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FulfillmentOrderParcel` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("waybill") != null && !jsonObj.get("waybill").isJsonNull()) && !jsonObj.get("waybill").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `waybill` to be a primitive type in the JSON string but got `%s`", jsonObj.get("waybill").toString())); + } + if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + if (jsonArrayitems != null) { + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + // validate the optional field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + FulfillmentOrderParcelItem.validateJsonElement(jsonArrayitems.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FulfillmentOrderParcel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FulfillmentOrderParcel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FulfillmentOrderParcel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FulfillmentOrderParcel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FulfillmentOrderParcel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FulfillmentOrderParcel given an JSON string + * + * @param jsonString JSON string + * @return An instance of FulfillmentOrderParcel + * @throws IOException if the JSON string is invalid with respect to FulfillmentOrderParcel + */ + public static FulfillmentOrderParcel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FulfillmentOrderParcel.class); + } + + /** + * Convert an instance of FulfillmentOrderParcel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrderParcelItem.java b/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrderParcelItem.java new file mode 100644 index 0000000..5d376bc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentOrderParcelItem.java @@ -0,0 +1,332 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * FulfillmentOrderParcelItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class FulfillmentOrderParcelItem { + public static final String SERIALIZED_NAME_PRODUCT_ID = "productId"; + @SerializedName(SERIALIZED_NAME_PRODUCT_ID) + @javax.annotation.Nullable + private String productId; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SERIAL_NUMBERS = "serialNumbers"; + @SerializedName(SERIALIZED_NAME_SERIAL_NUMBERS) + @javax.annotation.Nullable + private List serialNumbers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_EXPIRATION_DATE = "expirationDate"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_DATE) + @javax.annotation.Nullable + private LocalDate expirationDate; + + public static final String SERIALIZED_NAME_OFFER_ID = "offerId"; + @SerializedName(SERIALIZED_NAME_OFFER_ID) + @javax.annotation.Nullable + private String offerId; + + public FulfillmentOrderParcelItem() { + } + + public FulfillmentOrderParcelItem productId(@javax.annotation.Nullable String productId) { + this.productId = productId; + return this; + } + + /** + * Product identifier + * @return productId + */ + @javax.annotation.Nullable + public String getProductId() { + return productId; + } + + public void setProductId(@javax.annotation.Nullable String productId) { + this.productId = productId; + } + + + public FulfillmentOrderParcelItem quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Number of items placed in a parcel + * @return quantity + */ + @javax.annotation.Nullable + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public FulfillmentOrderParcelItem serialNumbers(@javax.annotation.Nullable List serialNumbers) { + this.serialNumbers = serialNumbers; + return this; + } + + public FulfillmentOrderParcelItem addSerialNumbersItem(String serialNumbersItem) { + if (this.serialNumbers == null) { + this.serialNumbers = new ArrayList<>(); + } + this.serialNumbers.add(serialNumbersItem); + return this; + } + + /** + * List of serial numbers of included items + * @return serialNumbers + */ + @javax.annotation.Nullable + public List getSerialNumbers() { + return serialNumbers; + } + + public void setSerialNumbers(@javax.annotation.Nullable List serialNumbers) { + this.serialNumbers = serialNumbers; + } + + + public FulfillmentOrderParcelItem expirationDate(@javax.annotation.Nullable LocalDate expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + /** + * Expiration date of all items associated by quantity + * @return expirationDate + */ + @javax.annotation.Nullable + public LocalDate getExpirationDate() { + return expirationDate; + } + + public void setExpirationDate(@javax.annotation.Nullable LocalDate expirationDate) { + this.expirationDate = expirationDate; + } + + + public FulfillmentOrderParcelItem offerId(@javax.annotation.Nullable String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Offer identifier + * @return offerId + */ + @javax.annotation.Nullable + public String getOfferId() { + return offerId; + } + + public void setOfferId(@javax.annotation.Nullable String offerId) { + this.offerId = offerId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FulfillmentOrderParcelItem fulfillmentOrderParcelItem = (FulfillmentOrderParcelItem) o; + return Objects.equals(this.productId, fulfillmentOrderParcelItem.productId) && + Objects.equals(this.quantity, fulfillmentOrderParcelItem.quantity) && + Objects.equals(this.serialNumbers, fulfillmentOrderParcelItem.serialNumbers) && + Objects.equals(this.expirationDate, fulfillmentOrderParcelItem.expirationDate) && + Objects.equals(this.offerId, fulfillmentOrderParcelItem.offerId); + } + + @Override + public int hashCode() { + return Objects.hash(productId, quantity, serialNumbers, expirationDate, offerId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FulfillmentOrderParcelItem {\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" serialNumbers: ").append(toIndentedString(serialNumbers)).append("\n"); + sb.append(" expirationDate: ").append(toIndentedString(expirationDate)).append("\n"); + sb.append(" offerId: ").append(toIndentedString(offerId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("productId"); + openapiFields.add("quantity"); + openapiFields.add("serialNumbers"); + openapiFields.add("expirationDate"); + openapiFields.add("offerId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FulfillmentOrderParcelItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FulfillmentOrderParcelItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FulfillmentOrderParcelItem is not found in the empty JSON string", FulfillmentOrderParcelItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FulfillmentOrderParcelItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FulfillmentOrderParcelItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("productId") != null && !jsonObj.get("productId").isJsonNull()) && !jsonObj.get("productId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `productId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("productId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("serialNumbers") != null && !jsonObj.get("serialNumbers").isJsonNull() && !jsonObj.get("serialNumbers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `serialNumbers` to be an array in the JSON string but got `%s`", jsonObj.get("serialNumbers").toString())); + } + if ((jsonObj.get("offerId") != null && !jsonObj.get("offerId").isJsonNull()) && !jsonObj.get("offerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `offerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("offerId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FulfillmentOrderParcelItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FulfillmentOrderParcelItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FulfillmentOrderParcelItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FulfillmentOrderParcelItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FulfillmentOrderParcelItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FulfillmentOrderParcelItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of FulfillmentOrderParcelItem + * @throws IOException if the JSON string is invalid with respect to FulfillmentOrderParcelItem + */ + public static FulfillmentOrderParcelItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FulfillmentOrderParcelItem.class); + } + + /** + * Convert an instance of FulfillmentOrderParcelItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentRemovalPreference.java b/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentRemovalPreference.java new file mode 100644 index 0000000..e7fbec4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentRemovalPreference.java @@ -0,0 +1,300 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.FulfillmentWithdrawalAddress; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents seller preference how to handle goods that should be removed from 1F warehouse. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class FulfillmentRemovalPreference { + /** + * Preference what kind of operation to execute on undesirable items WITHDRAWAL/DISPOSAL (required). + */ + @JsonAdapter(OperationEnum.Adapter.class) + public enum OperationEnum { + WITHDRAWAL("WITHDRAWAL"), + + DISPOSAL("DISPOSAL"); + + private String value; + + OperationEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OperationEnum fromValue(String value) { + for (OperationEnum b : OperationEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OperationEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OperationEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OperationEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OperationEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_OPERATION = "operation"; + @SerializedName(SERIALIZED_NAME_OPERATION) + @javax.annotation.Nonnull + private OperationEnum operation; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private FulfillmentWithdrawalAddress address; + + public FulfillmentRemovalPreference() { + } + + public FulfillmentRemovalPreference operation(@javax.annotation.Nonnull OperationEnum operation) { + this.operation = operation; + return this; + } + + /** + * Preference what kind of operation to execute on undesirable items WITHDRAWAL/DISPOSAL (required). + * @return operation + */ + @javax.annotation.Nonnull + public OperationEnum getOperation() { + return operation; + } + + public void setOperation(@javax.annotation.Nonnull OperationEnum operation) { + this.operation = operation; + } + + + public FulfillmentRemovalPreference address(@javax.annotation.Nullable FulfillmentWithdrawalAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public FulfillmentWithdrawalAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable FulfillmentWithdrawalAddress address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FulfillmentRemovalPreference fulfillmentRemovalPreference = (FulfillmentRemovalPreference) o; + return Objects.equals(this.operation, fulfillmentRemovalPreference.operation) && + Objects.equals(this.address, fulfillmentRemovalPreference.address); + } + + @Override + public int hashCode() { + return Objects.hash(operation, address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FulfillmentRemovalPreference {\n"); + sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("operation"); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("operation"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FulfillmentRemovalPreference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FulfillmentRemovalPreference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FulfillmentRemovalPreference is not found in the empty JSON string", FulfillmentRemovalPreference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FulfillmentRemovalPreference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FulfillmentRemovalPreference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FulfillmentRemovalPreference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("operation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `operation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("operation").toString())); + } + // validate the required field `operation` + OperationEnum.validateJsonElement(jsonObj.get("operation")); + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + FulfillmentWithdrawalAddress.validateJsonElement(jsonObj.get("address")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FulfillmentRemovalPreference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FulfillmentRemovalPreference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FulfillmentRemovalPreference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FulfillmentRemovalPreference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FulfillmentRemovalPreference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FulfillmentRemovalPreference given an JSON string + * + * @param jsonString JSON string + * @return An instance of FulfillmentRemovalPreference + * @throws IOException if the JSON string is invalid with respect to FulfillmentRemovalPreference + */ + public static FulfillmentRemovalPreference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FulfillmentRemovalPreference.class); + } + + /** + * Convert an instance of FulfillmentRemovalPreference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentWithdrawalAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentWithdrawalAddress.java new file mode 100644 index 0000000..2c94feb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/FulfillmentWithdrawalAddress.java @@ -0,0 +1,399 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.PhoneNumberWithCountryCode; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents information about address passed for withdrawal purpose. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class FulfillmentWithdrawalAddress { + public static final String SERIALIZED_NAME_COMPANY = "company"; + @SerializedName(SERIALIZED_NAME_COMPANY) + @javax.annotation.Nonnull + private String company; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_POSTAL_CODE = "postalCode"; + @SerializedName(SERIALIZED_NAME_POSTAL_CODE) + @javax.annotation.Nonnull + private String postalCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nonnull + private PhoneNumberWithCountryCode phone; + + public static final String SERIALIZED_NAME_ADDITIONAL_INFO = "additionalInfo"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFO) + @javax.annotation.Nullable + private String additionalInfo; + + public FulfillmentWithdrawalAddress() { + } + + public FulfillmentWithdrawalAddress company(@javax.annotation.Nonnull String company) { + this.company = company; + return this; + } + + /** + * Delivery recipient name (required). + * @return company + */ + @javax.annotation.Nonnull + public String getCompany() { + return company; + } + + public void setCompany(@javax.annotation.Nonnull String company) { + this.company = company; + } + + + public FulfillmentWithdrawalAddress street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * The name of the street, building number and so on, where the building is located (required). + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public FulfillmentWithdrawalAddress postalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * The code used for postal delivery purposes (required). + * @return postalCode + */ + @javax.annotation.Nonnull + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + } + + + public FulfillmentWithdrawalAddress city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * The name of the city or town (required). + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public FulfillmentWithdrawalAddress countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * The country code where the address is located (required). + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + public FulfillmentWithdrawalAddress phone(@javax.annotation.Nonnull PhoneNumberWithCountryCode phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + */ + @javax.annotation.Nonnull + public PhoneNumberWithCountryCode getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nonnull PhoneNumberWithCountryCode phone) { + this.phone = phone; + } + + + public FulfillmentWithdrawalAddress additionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + /** + * Additional info which can be passed on courier label but only for parcels with larger dimensions sent not by WzA (SwA). + * @return additionalInfo + */ + @javax.annotation.Nullable + public String getAdditionalInfo() { + return additionalInfo; + } + + public void setAdditionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FulfillmentWithdrawalAddress fulfillmentWithdrawalAddress = (FulfillmentWithdrawalAddress) o; + return Objects.equals(this.company, fulfillmentWithdrawalAddress.company) && + Objects.equals(this.street, fulfillmentWithdrawalAddress.street) && + Objects.equals(this.postalCode, fulfillmentWithdrawalAddress.postalCode) && + Objects.equals(this.city, fulfillmentWithdrawalAddress.city) && + Objects.equals(this.countryCode, fulfillmentWithdrawalAddress.countryCode) && + Objects.equals(this.phone, fulfillmentWithdrawalAddress.phone) && + Objects.equals(this.additionalInfo, fulfillmentWithdrawalAddress.additionalInfo); + } + + @Override + public int hashCode() { + return Objects.hash(company, street, postalCode, city, countryCode, phone, additionalInfo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FulfillmentWithdrawalAddress {\n"); + sb.append(" company: ").append(toIndentedString(company)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("company"); + openapiFields.add("street"); + openapiFields.add("postalCode"); + openapiFields.add("city"); + openapiFields.add("countryCode"); + openapiFields.add("phone"); + openapiFields.add("additionalInfo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("company"); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("postalCode"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("countryCode"); + openapiRequiredFields.add("phone"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FulfillmentWithdrawalAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FulfillmentWithdrawalAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FulfillmentWithdrawalAddress is not found in the empty JSON string", FulfillmentWithdrawalAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FulfillmentWithdrawalAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FulfillmentWithdrawalAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FulfillmentWithdrawalAddress.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("company").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `company` to be a primitive type in the JSON string but got `%s`", jsonObj.get("company").toString())); + } + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("postalCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postalCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postalCode").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + // validate the required field `phone` + PhoneNumberWithCountryCode.validateJsonElement(jsonObj.get("phone")); + if ((jsonObj.get("additionalInfo") != null && !jsonObj.get("additionalInfo").isJsonNull()) && !jsonObj.get("additionalInfo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInfo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalInfo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FulfillmentWithdrawalAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FulfillmentWithdrawalAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FulfillmentWithdrawalAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FulfillmentWithdrawalAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FulfillmentWithdrawalAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FulfillmentWithdrawalAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of FulfillmentWithdrawalAddress + * @throws IOException if the JSON string is invalid with respect to FulfillmentWithdrawalAddress + */ + public static FulfillmentWithdrawalAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FulfillmentWithdrawalAddress.class); + } + + /** + * Convert an instance of FulfillmentWithdrawalAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/FundraisingCampaign.java b/src/main/java/pl/wtx/allegro/api/client/model/FundraisingCampaign.java new file mode 100644 index 0000000..d618079 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/FundraisingCampaign.java @@ -0,0 +1,268 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CharityOrganization; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * FundraisingCampaign + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class FundraisingCampaign { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ORGANIZATION = "organization"; + @SerializedName(SERIALIZED_NAME_ORGANIZATION) + @javax.annotation.Nullable + private CharityOrganization organization; + + public FundraisingCampaign() { + } + + public FundraisingCampaign id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * unique campaign identifier + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public FundraisingCampaign name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * campaign name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public FundraisingCampaign organization(@javax.annotation.Nullable CharityOrganization organization) { + this.organization = organization; + return this; + } + + /** + * Get organization + * @return organization + */ + @javax.annotation.Nullable + public CharityOrganization getOrganization() { + return organization; + } + + public void setOrganization(@javax.annotation.Nullable CharityOrganization organization) { + this.organization = organization; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FundraisingCampaign fundraisingCampaign = (FundraisingCampaign) o; + return Objects.equals(this.id, fundraisingCampaign.id) && + Objects.equals(this.name, fundraisingCampaign.name) && + Objects.equals(this.organization, fundraisingCampaign.organization); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, organization); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FundraisingCampaign {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" organization: ").append(toIndentedString(organization)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("organization"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FundraisingCampaign + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FundraisingCampaign.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FundraisingCampaign is not found in the empty JSON string", FundraisingCampaign.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FundraisingCampaign.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FundraisingCampaign` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `organization` + if (jsonObj.get("organization") != null && !jsonObj.get("organization").isJsonNull()) { + CharityOrganization.validateJsonElement(jsonObj.get("organization")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FundraisingCampaign.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FundraisingCampaign' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FundraisingCampaign.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FundraisingCampaign value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FundraisingCampaign read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FundraisingCampaign given an JSON string + * + * @param jsonString JSON string + * @return An instance of FundraisingCampaign + * @throws IOException if the JSON string is invalid with respect to FundraisingCampaign + */ + public static FundraisingCampaign fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FundraisingCampaign.class); + } + + /** + * Convert an instance of FundraisingCampaign to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/FundraisingCampaigns.java b/src/main/java/pl/wtx/allegro/api/client/model/FundraisingCampaigns.java new file mode 100644 index 0000000..fc7a5aa --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/FundraisingCampaigns.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.FundraisingCampaign; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * FundraisingCampaigns + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class FundraisingCampaigns { + public static final String SERIALIZED_NAME_CAMPAIGNS = "campaigns"; + @SerializedName(SERIALIZED_NAME_CAMPAIGNS) + @javax.annotation.Nullable + private List campaigns = new ArrayList<>(); + + public FundraisingCampaigns() { + } + + public FundraisingCampaigns campaigns(@javax.annotation.Nullable List campaigns) { + this.campaigns = campaigns; + return this; + } + + public FundraisingCampaigns addCampaignsItem(FundraisingCampaign campaignsItem) { + if (this.campaigns == null) { + this.campaigns = new ArrayList<>(); + } + this.campaigns.add(campaignsItem); + return this; + } + + /** + * search results + * @return campaigns + */ + @javax.annotation.Nullable + public List getCampaigns() { + return campaigns; + } + + public void setCampaigns(@javax.annotation.Nullable List campaigns) { + this.campaigns = campaigns; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FundraisingCampaigns fundraisingCampaigns = (FundraisingCampaigns) o; + return Objects.equals(this.campaigns, fundraisingCampaigns.campaigns); + } + + @Override + public int hashCode() { + return Objects.hash(campaigns); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FundraisingCampaigns {\n"); + sb.append(" campaigns: ").append(toIndentedString(campaigns)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("campaigns"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FundraisingCampaigns + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FundraisingCampaigns.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FundraisingCampaigns is not found in the empty JSON string", FundraisingCampaigns.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FundraisingCampaigns.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FundraisingCampaigns` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("campaigns") != null && !jsonObj.get("campaigns").isJsonNull()) { + JsonArray jsonArraycampaigns = jsonObj.getAsJsonArray("campaigns"); + if (jsonArraycampaigns != null) { + // ensure the json data is an array + if (!jsonObj.get("campaigns").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `campaigns` to be an array in the JSON string but got `%s`", jsonObj.get("campaigns").toString())); + } + + // validate the optional field `campaigns` (array) + for (int i = 0; i < jsonArraycampaigns.size(); i++) { + FundraisingCampaign.validateJsonElement(jsonArraycampaigns.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FundraisingCampaigns.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FundraisingCampaigns' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FundraisingCampaigns.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FundraisingCampaigns value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FundraisingCampaigns read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FundraisingCampaigns given an JSON string + * + * @param jsonString JSON string + * @return An instance of FundraisingCampaigns + * @throws IOException if the JSON string is invalid with respect to FundraisingCampaigns + */ + public static FundraisingCampaigns fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FundraisingCampaigns.class); + } + + /** + * Convert an instance of FundraisingCampaigns to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GeneralReport.java b/src/main/java/pl/wtx/allegro/api/client/model/GeneralReport.java new file mode 100644 index 0000000..8d74cd9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GeneralReport.java @@ -0,0 +1,305 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.TaskCount; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Command execution summary + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GeneralReport { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_COMPLETED_AT = "completedAt"; + @SerializedName(SERIALIZED_NAME_COMPLETED_AT) + @javax.annotation.Nullable + private OffsetDateTime completedAt; + + public static final String SERIALIZED_NAME_TASK_COUNT = "taskCount"; + @SerializedName(SERIALIZED_NAME_TASK_COUNT) + @javax.annotation.Nullable + private TaskCount taskCount; + + public GeneralReport() { + } + + public GeneralReport id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Command ID + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public GeneralReport createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Date of command creation. Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public GeneralReport completedAt(@javax.annotation.Nullable OffsetDateTime completedAt) { + this.completedAt = completedAt; + return this; + } + + /** + * Date of command completion. Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ + * @return completedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCompletedAt() { + return completedAt; + } + + public void setCompletedAt(@javax.annotation.Nullable OffsetDateTime completedAt) { + this.completedAt = completedAt; + } + + + public GeneralReport taskCount(@javax.annotation.Nullable TaskCount taskCount) { + this.taskCount = taskCount; + return this; + } + + /** + * Get taskCount + * @return taskCount + */ + @javax.annotation.Nullable + public TaskCount getTaskCount() { + return taskCount; + } + + public void setTaskCount(@javax.annotation.Nullable TaskCount taskCount) { + this.taskCount = taskCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GeneralReport generalReport = (GeneralReport) o; + return Objects.equals(this.id, generalReport.id) && + Objects.equals(this.createdAt, generalReport.createdAt) && + Objects.equals(this.completedAt, generalReport.completedAt) && + Objects.equals(this.taskCount, generalReport.taskCount); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, createdAt, completedAt, taskCount); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GeneralReport {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" completedAt: ").append(toIndentedString(completedAt)).append("\n"); + sb.append(" taskCount: ").append(toIndentedString(taskCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("createdAt"); + openapiFields.add("completedAt"); + openapiFields.add("taskCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GeneralReport + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GeneralReport.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GeneralReport is not found in the empty JSON string", GeneralReport.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GeneralReport.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GeneralReport` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `taskCount` + if (jsonObj.get("taskCount") != null && !jsonObj.get("taskCount").isJsonNull()) { + TaskCount.validateJsonElement(jsonObj.get("taskCount")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GeneralReport.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GeneralReport' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GeneralReport.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GeneralReport value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GeneralReport read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GeneralReport given an JSON string + * + * @param jsonString JSON string + * @return An instance of GeneralReport + * @throws IOException if the JSON string is invalid with respect to GeneralReport + */ + public static GeneralReport fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GeneralReport.class); + } + + /** + * Convert an instance of GeneralReport to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetBadgeCampaignsList.java b/src/main/java/pl/wtx/allegro/api/client/model/GetBadgeCampaignsList.java new file mode 100644 index 0000000..64f09e9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetBadgeCampaignsList.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BadgeCampaign; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetBadgeCampaignsList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetBadgeCampaignsList { + public static final String SERIALIZED_NAME_BADGE_CAMPAIGNS = "badgeCampaigns"; + @SerializedName(SERIALIZED_NAME_BADGE_CAMPAIGNS) + @javax.annotation.Nonnull + private List badgeCampaigns = new ArrayList<>(); + + public GetBadgeCampaignsList() { + } + + public GetBadgeCampaignsList badgeCampaigns(@javax.annotation.Nonnull List badgeCampaigns) { + this.badgeCampaigns = badgeCampaigns; + return this; + } + + public GetBadgeCampaignsList addBadgeCampaignsItem(BadgeCampaign badgeCampaignsItem) { + if (this.badgeCampaigns == null) { + this.badgeCampaigns = new ArrayList<>(); + } + this.badgeCampaigns.add(badgeCampaignsItem); + return this; + } + + /** + * List of badge campaigns. + * @return badgeCampaigns + */ + @javax.annotation.Nonnull + public List getBadgeCampaigns() { + return badgeCampaigns; + } + + public void setBadgeCampaigns(@javax.annotation.Nonnull List badgeCampaigns) { + this.badgeCampaigns = badgeCampaigns; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetBadgeCampaignsList getBadgeCampaignsList = (GetBadgeCampaignsList) o; + return Objects.equals(this.badgeCampaigns, getBadgeCampaignsList.badgeCampaigns); + } + + @Override + public int hashCode() { + return Objects.hash(badgeCampaigns); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetBadgeCampaignsList {\n"); + sb.append(" badgeCampaigns: ").append(toIndentedString(badgeCampaigns)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("badgeCampaigns"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("badgeCampaigns"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetBadgeCampaignsList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetBadgeCampaignsList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetBadgeCampaignsList is not found in the empty JSON string", GetBadgeCampaignsList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetBadgeCampaignsList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetBadgeCampaignsList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetBadgeCampaignsList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("badgeCampaigns").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `badgeCampaigns` to be an array in the JSON string but got `%s`", jsonObj.get("badgeCampaigns").toString())); + } + + JsonArray jsonArraybadgeCampaigns = jsonObj.getAsJsonArray("badgeCampaigns"); + // validate the required field `badgeCampaigns` (array) + for (int i = 0; i < jsonArraybadgeCampaigns.size(); i++) { + BadgeCampaign.validateJsonElement(jsonArraybadgeCampaigns.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetBadgeCampaignsList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetBadgeCampaignsList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetBadgeCampaignsList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetBadgeCampaignsList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetBadgeCampaignsList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetBadgeCampaignsList given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetBadgeCampaignsList + * @throws IOException if the JSON string is invalid with respect to GetBadgeCampaignsList + */ + public static GetBadgeCampaignsList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetBadgeCampaignsList.class); + } + + /** + * Convert an instance of GetBadgeCampaignsList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetDeliveryServices504Response.java b/src/main/java/pl/wtx/allegro/api/client/model/GetDeliveryServices504Response.java new file mode 100644 index 0000000..740e0ec --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetDeliveryServices504Response.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error504; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetDeliveryServices504Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetDeliveryServices504Response { + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public GetDeliveryServices504Response() { + } + + public GetDeliveryServices504Response errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public GetDeliveryServices504Response addErrorsItem(Error504 errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Array of errors. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeliveryServices504Response getDeliveryServices504Response = (GetDeliveryServices504Response) o; + return Objects.equals(this.errors, getDeliveryServices504Response.errors); + } + + @Override + public int hashCode() { + return Objects.hash(errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDeliveryServices504Response {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetDeliveryServices504Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDeliveryServices504Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetDeliveryServices504Response is not found in the empty JSON string", GetDeliveryServices504Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDeliveryServices504Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetDeliveryServices504Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error504.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDeliveryServices504Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDeliveryServices504Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetDeliveryServices504Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDeliveryServices504Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDeliveryServices504Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetDeliveryServices504Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDeliveryServices504Response + * @throws IOException if the JSON string is invalid with respect to GetDeliveryServices504Response + */ + public static GetDeliveryServices504Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDeliveryServices504Response.class); + } + + /** + * Convert an instance of GetDeliveryServices504Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200Response.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200Response.java new file mode 100644 index 0000000..b218ab4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200Response.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetListOfDeliveryMethodsUsingGET200Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfDeliveryMethodsUsingGET200Response { + public static final String SERIALIZED_NAME_DELIVERY_METHODS = "deliveryMethods"; + @SerializedName(SERIALIZED_NAME_DELIVERY_METHODS) + @javax.annotation.Nullable + private List deliveryMethods = new ArrayList<>(); + + public GetListOfDeliveryMethodsUsingGET200Response() { + } + + public GetListOfDeliveryMethodsUsingGET200Response deliveryMethods(@javax.annotation.Nullable List deliveryMethods) { + this.deliveryMethods = deliveryMethods; + return this; + } + + public GetListOfDeliveryMethodsUsingGET200Response addDeliveryMethodsItem(GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner deliveryMethodsItem) { + if (this.deliveryMethods == null) { + this.deliveryMethods = new ArrayList<>(); + } + this.deliveryMethods.add(deliveryMethodsItem); + return this; + } + + /** + * Get deliveryMethods + * @return deliveryMethods + */ + @javax.annotation.Nullable + public List getDeliveryMethods() { + return deliveryMethods; + } + + public void setDeliveryMethods(@javax.annotation.Nullable List deliveryMethods) { + this.deliveryMethods = deliveryMethods; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfDeliveryMethodsUsingGET200Response getListOfDeliveryMethodsUsingGET200Response = (GetListOfDeliveryMethodsUsingGET200Response) o; + return Objects.equals(this.deliveryMethods, getListOfDeliveryMethodsUsingGET200Response.deliveryMethods); + } + + @Override + public int hashCode() { + return Objects.hash(deliveryMethods); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfDeliveryMethodsUsingGET200Response {\n"); + sb.append(" deliveryMethods: ").append(toIndentedString(deliveryMethods)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("deliveryMethods"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfDeliveryMethodsUsingGET200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfDeliveryMethodsUsingGET200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfDeliveryMethodsUsingGET200Response is not found in the empty JSON string", GetListOfDeliveryMethodsUsingGET200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfDeliveryMethodsUsingGET200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfDeliveryMethodsUsingGET200Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("deliveryMethods") != null && !jsonObj.get("deliveryMethods").isJsonNull()) { + JsonArray jsonArraydeliveryMethods = jsonObj.getAsJsonArray("deliveryMethods"); + if (jsonArraydeliveryMethods != null) { + // ensure the json data is an array + if (!jsonObj.get("deliveryMethods").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `deliveryMethods` to be an array in the JSON string but got `%s`", jsonObj.get("deliveryMethods").toString())); + } + + // validate the optional field `deliveryMethods` (array) + for (int i = 0; i < jsonArraydeliveryMethods.size(); i++) { + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.validateJsonElement(jsonArraydeliveryMethods.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfDeliveryMethodsUsingGET200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfDeliveryMethodsUsingGET200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfDeliveryMethodsUsingGET200Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfDeliveryMethodsUsingGET200Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfDeliveryMethodsUsingGET200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfDeliveryMethodsUsingGET200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfDeliveryMethodsUsingGET200Response + * @throws IOException if the JSON string is invalid with respect to GetListOfDeliveryMethodsUsingGET200Response + */ + public static GetListOfDeliveryMethodsUsingGET200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfDeliveryMethodsUsingGET200Response.class); + } + + /** + * Convert an instance of GetListOfDeliveryMethodsUsingGET200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.java new file mode 100644 index 0000000..c547d30 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.java @@ -0,0 +1,494 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_MARKETPLACES = "marketplaces"; + @SerializedName(SERIALIZED_NAME_MARKETPLACES) + @javax.annotation.Nullable + private List marketplaces = new ArrayList<>(); + + /** + * Whether the payment is to be collected in advance or on delivery. + */ + @JsonAdapter(PaymentPolicyEnum.Adapter.class) + public enum PaymentPolicyEnum { + IN_ADVANCE("IN_ADVANCE"), + + CASH_ON_DELIVERY("CASH_ON_DELIVERY"); + + private String value; + + PaymentPolicyEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PaymentPolicyEnum fromValue(String value) { + for (PaymentPolicyEnum b : PaymentPolicyEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PaymentPolicyEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PaymentPolicyEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PaymentPolicyEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + PaymentPolicyEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_PAYMENT_POLICY = "paymentPolicy"; + @SerializedName(SERIALIZED_NAME_PAYMENT_POLICY) + @javax.annotation.Nullable + private PaymentPolicyEnum paymentPolicy; + + public static final String SERIALIZED_NAME_ALLEGRO_ENDORSED = "allegroEndorsed"; + @SerializedName(SERIALIZED_NAME_ALLEGRO_ENDORSED) + @javax.annotation.Nullable + private Boolean allegroEndorsed; + + public static final String SERIALIZED_NAME_DISPATCH_COUNTRY = "dispatchCountry"; + @SerializedName(SERIALIZED_NAME_DISPATCH_COUNTRY) + @javax.annotation.Nullable + private String dispatchCountry; + + public static final String SERIALIZED_NAME_DESTINATION_COUNTRY = "destinationCountry"; + @SerializedName(SERIALIZED_NAME_DESTINATION_COUNTRY) + @javax.annotation.Nullable + private String destinationCountry; + + public static final String SERIALIZED_NAME_SHIPPING_RATES_CONSTRAINTS = "shippingRatesConstraints"; + @SerializedName(SERIALIZED_NAME_SHIPPING_RATES_CONSTRAINTS) + @javax.annotation.Nullable + private GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints shippingRatesConstraints; + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner() { + } + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Delivery method id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Delivery method name. Please note that only method ids are unique, not method names. For duplicate names, check the marketplaces, paymentPolicy and allegroEndorsed properties as well. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner marketplaces(@javax.annotation.Nullable List marketplaces) { + this.marketplaces = marketplaces; + return this; + } + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner addMarketplacesItem(String marketplacesItem) { + if (this.marketplaces == null) { + this.marketplaces = new ArrayList<>(); + } + this.marketplaces.add(marketplacesItem); + return this; + } + + /** + * List of marketplace ids where this delivery method is available for buyers. + * @return marketplaces + */ + @javax.annotation.Nullable + public List getMarketplaces() { + return marketplaces; + } + + public void setMarketplaces(@javax.annotation.Nullable List marketplaces) { + this.marketplaces = marketplaces; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner paymentPolicy(@javax.annotation.Nullable PaymentPolicyEnum paymentPolicy) { + this.paymentPolicy = paymentPolicy; + return this; + } + + /** + * Whether the payment is to be collected in advance or on delivery. + * @return paymentPolicy + */ + @javax.annotation.Nullable + public PaymentPolicyEnum getPaymentPolicy() { + return paymentPolicy; + } + + public void setPaymentPolicy(@javax.annotation.Nullable PaymentPolicyEnum paymentPolicy) { + this.paymentPolicy = paymentPolicy; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner allegroEndorsed(@javax.annotation.Nullable Boolean allegroEndorsed) { + this.allegroEndorsed = allegroEndorsed; + return this; + } + + /** + * Indicates Allegro signed delivery method, which allows to easily distinguish similar delivery methods with various restrictions, e.g. Allegro Paczkomaty 24/7 InPost from Paczkomaty 24/7. + * @return allegroEndorsed + */ + @javax.annotation.Nullable + public Boolean getAllegroEndorsed() { + return allegroEndorsed; + } + + public void setAllegroEndorsed(@javax.annotation.Nullable Boolean allegroEndorsed) { + this.allegroEndorsed = allegroEndorsed; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner dispatchCountry(@javax.annotation.Nullable String dispatchCountry) { + this.dispatchCountry = dispatchCountry; + return this; + } + + /** + * Country code from which the shipment is dispatched, if null the country is undefined and the shipment can be dispatched from any country. + * @return dispatchCountry + */ + @javax.annotation.Nullable + public String getDispatchCountry() { + return dispatchCountry; + } + + public void setDispatchCountry(@javax.annotation.Nullable String dispatchCountry) { + this.dispatchCountry = dispatchCountry; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner destinationCountry(@javax.annotation.Nullable String destinationCountry) { + this.destinationCountry = destinationCountry; + return this; + } + + /** + * Country code to which the shipment is being sent. + * @return destinationCountry + */ + @javax.annotation.Nullable + public String getDestinationCountry() { + return destinationCountry; + } + + public void setDestinationCountry(@javax.annotation.Nullable String destinationCountry) { + this.destinationCountry = destinationCountry; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner shippingRatesConstraints(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints shippingRatesConstraints) { + this.shippingRatesConstraints = shippingRatesConstraints; + return this; + } + + /** + * Get shippingRatesConstraints + * @return shippingRatesConstraints + */ + @javax.annotation.Nullable + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints getShippingRatesConstraints() { + return shippingRatesConstraints; + } + + public void setShippingRatesConstraints(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints shippingRatesConstraints) { + this.shippingRatesConstraints = shippingRatesConstraints; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner = (GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner) o; + return Objects.equals(this.id, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.id) && + Objects.equals(this.name, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.name) && + Objects.equals(this.marketplaces, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.marketplaces) && + Objects.equals(this.paymentPolicy, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.paymentPolicy) && + Objects.equals(this.allegroEndorsed, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.allegroEndorsed) && + Objects.equals(this.dispatchCountry, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.dispatchCountry) && + Objects.equals(this.destinationCountry, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.destinationCountry) && + Objects.equals(this.shippingRatesConstraints, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.shippingRatesConstraints); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, marketplaces, paymentPolicy, allegroEndorsed, dispatchCountry, destinationCountry, shippingRatesConstraints); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" marketplaces: ").append(toIndentedString(marketplaces)).append("\n"); + sb.append(" paymentPolicy: ").append(toIndentedString(paymentPolicy)).append("\n"); + sb.append(" allegroEndorsed: ").append(toIndentedString(allegroEndorsed)).append("\n"); + sb.append(" dispatchCountry: ").append(toIndentedString(dispatchCountry)).append("\n"); + sb.append(" destinationCountry: ").append(toIndentedString(destinationCountry)).append("\n"); + sb.append(" shippingRatesConstraints: ").append(toIndentedString(shippingRatesConstraints)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("marketplaces"); + openapiFields.add("paymentPolicy"); + openapiFields.add("allegroEndorsed"); + openapiFields.add("dispatchCountry"); + openapiFields.add("destinationCountry"); + openapiFields.add("shippingRatesConstraints"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner is not found in the empty JSON string", GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("marketplaces") != null && !jsonObj.get("marketplaces").isJsonNull() && !jsonObj.get("marketplaces").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaces` to be an array in the JSON string but got `%s`", jsonObj.get("marketplaces").toString())); + } + if ((jsonObj.get("paymentPolicy") != null && !jsonObj.get("paymentPolicy").isJsonNull()) && !jsonObj.get("paymentPolicy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `paymentPolicy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paymentPolicy").toString())); + } + // validate the optional field `paymentPolicy` + if (jsonObj.get("paymentPolicy") != null && !jsonObj.get("paymentPolicy").isJsonNull()) { + PaymentPolicyEnum.validateJsonElement(jsonObj.get("paymentPolicy")); + } + if ((jsonObj.get("dispatchCountry") != null && !jsonObj.get("dispatchCountry").isJsonNull()) && !jsonObj.get("dispatchCountry").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dispatchCountry` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dispatchCountry").toString())); + } + if ((jsonObj.get("destinationCountry") != null && !jsonObj.get("destinationCountry").isJsonNull()) && !jsonObj.get("destinationCountry").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `destinationCountry` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationCountry").toString())); + } + // validate the optional field `shippingRatesConstraints` + if (jsonObj.get("shippingRatesConstraints") != null && !jsonObj.get("shippingRatesConstraints").isJsonNull()) { + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.validateJsonElement(jsonObj.get("shippingRatesConstraints")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner + * @throws IOException if the JSON string is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner + */ + public static GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner.class); + } + + /** + * Convert an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.java new file mode 100644 index 0000000..988ed34 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.java @@ -0,0 +1,363 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate; +import pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight; +import pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage; +import pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate; +import pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Rules for the delivery method, i.e. price, quantity, shipping time, etc. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints { + public static final String SERIALIZED_NAME_ALLOWED = "allowed"; + @SerializedName(SERIALIZED_NAME_ALLOWED) + @javax.annotation.Nullable + private Boolean allowed; + + public static final String SERIALIZED_NAME_MAX_QUANTITY_PER_PACKAGE = "maxQuantityPerPackage"; + @SerializedName(SERIALIZED_NAME_MAX_QUANTITY_PER_PACKAGE) + @javax.annotation.Nullable + private GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage maxQuantityPerPackage; + + public static final String SERIALIZED_NAME_MAX_PACKAGE_WEIGHT = "maxPackageWeight"; + @SerializedName(SERIALIZED_NAME_MAX_PACKAGE_WEIGHT) + @javax.annotation.Nullable + private GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight maxPackageWeight; + + public static final String SERIALIZED_NAME_FIRST_ITEM_RATE = "firstItemRate"; + @SerializedName(SERIALIZED_NAME_FIRST_ITEM_RATE) + @javax.annotation.Nullable + private GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate firstItemRate; + + public static final String SERIALIZED_NAME_NEXT_ITEM_RATE = "nextItemRate"; + @SerializedName(SERIALIZED_NAME_NEXT_ITEM_RATE) + @javax.annotation.Nullable + private GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate nextItemRate; + + public static final String SERIALIZED_NAME_SHIPPING_TIME = "shippingTime"; + @SerializedName(SERIALIZED_NAME_SHIPPING_TIME) + @javax.annotation.Nullable + private GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime shippingTime; + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints() { + } + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints allowed(@javax.annotation.Nullable Boolean allowed) { + this.allowed = allowed; + return this; + } + + /** + * Indicates whether delivery method can be used when adding or modifying shipping rates. + * @return allowed + */ + @javax.annotation.Nullable + public Boolean getAllowed() { + return allowed; + } + + public void setAllowed(@javax.annotation.Nullable Boolean allowed) { + this.allowed = allowed; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints maxQuantityPerPackage(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage maxQuantityPerPackage) { + this.maxQuantityPerPackage = maxQuantityPerPackage; + return this; + } + + /** + * Get maxQuantityPerPackage + * @return maxQuantityPerPackage + */ + @javax.annotation.Nullable + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage getMaxQuantityPerPackage() { + return maxQuantityPerPackage; + } + + public void setMaxQuantityPerPackage(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage maxQuantityPerPackage) { + this.maxQuantityPerPackage = maxQuantityPerPackage; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints maxPackageWeight(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight maxPackageWeight) { + this.maxPackageWeight = maxPackageWeight; + return this; + } + + /** + * Get maxPackageWeight + * @return maxPackageWeight + */ + @javax.annotation.Nullable + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight getMaxPackageWeight() { + return maxPackageWeight; + } + + public void setMaxPackageWeight(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight maxPackageWeight) { + this.maxPackageWeight = maxPackageWeight; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints firstItemRate(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate firstItemRate) { + this.firstItemRate = firstItemRate; + return this; + } + + /** + * Get firstItemRate + * @return firstItemRate + */ + @javax.annotation.Nullable + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate getFirstItemRate() { + return firstItemRate; + } + + public void setFirstItemRate(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate firstItemRate) { + this.firstItemRate = firstItemRate; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints nextItemRate(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate nextItemRate) { + this.nextItemRate = nextItemRate; + return this; + } + + /** + * Get nextItemRate + * @return nextItemRate + */ + @javax.annotation.Nullable + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate getNextItemRate() { + return nextItemRate; + } + + public void setNextItemRate(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate nextItemRate) { + this.nextItemRate = nextItemRate; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints shippingTime(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime shippingTime) { + this.shippingTime = shippingTime; + return this; + } + + /** + * Get shippingTime + * @return shippingTime + */ + @javax.annotation.Nullable + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime getShippingTime() { + return shippingTime; + } + + public void setShippingTime(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime shippingTime) { + this.shippingTime = shippingTime; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints = (GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints) o; + return Objects.equals(this.allowed, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.allowed) && + Objects.equals(this.maxQuantityPerPackage, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.maxQuantityPerPackage) && + Objects.equals(this.maxPackageWeight, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.maxPackageWeight) && + Objects.equals(this.firstItemRate, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.firstItemRate) && + Objects.equals(this.nextItemRate, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.nextItemRate) && + Objects.equals(this.shippingTime, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.shippingTime); + } + + @Override + public int hashCode() { + return Objects.hash(allowed, maxQuantityPerPackage, maxPackageWeight, firstItemRate, nextItemRate, shippingTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints {\n"); + sb.append(" allowed: ").append(toIndentedString(allowed)).append("\n"); + sb.append(" maxQuantityPerPackage: ").append(toIndentedString(maxQuantityPerPackage)).append("\n"); + sb.append(" maxPackageWeight: ").append(toIndentedString(maxPackageWeight)).append("\n"); + sb.append(" firstItemRate: ").append(toIndentedString(firstItemRate)).append("\n"); + sb.append(" nextItemRate: ").append(toIndentedString(nextItemRate)).append("\n"); + sb.append(" shippingTime: ").append(toIndentedString(shippingTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("allowed"); + openapiFields.add("maxQuantityPerPackage"); + openapiFields.add("maxPackageWeight"); + openapiFields.add("firstItemRate"); + openapiFields.add("nextItemRate"); + openapiFields.add("shippingTime"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints is not found in the empty JSON string", GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `maxQuantityPerPackage` + if (jsonObj.get("maxQuantityPerPackage") != null && !jsonObj.get("maxQuantityPerPackage").isJsonNull()) { + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.validateJsonElement(jsonObj.get("maxQuantityPerPackage")); + } + // validate the optional field `maxPackageWeight` + if (jsonObj.get("maxPackageWeight") != null && !jsonObj.get("maxPackageWeight").isJsonNull()) { + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.validateJsonElement(jsonObj.get("maxPackageWeight")); + } + // validate the optional field `firstItemRate` + if (jsonObj.get("firstItemRate") != null && !jsonObj.get("firstItemRate").isJsonNull()) { + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.validateJsonElement(jsonObj.get("firstItemRate")); + } + // validate the optional field `nextItemRate` + if (jsonObj.get("nextItemRate") != null && !jsonObj.get("nextItemRate").isJsonNull()) { + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.validateJsonElement(jsonObj.get("nextItemRate")); + } + // validate the optional field `shippingTime` + if (jsonObj.get("shippingTime") != null && !jsonObj.get("shippingTime").isJsonNull()) { + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.validateJsonElement(jsonObj.get("shippingTime")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints + * @throws IOException if the JSON string is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints + */ + public static GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints.class); + } + + /** + * Convert an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraints to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.java new file mode 100644 index 0000000..cd7ed91 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Rules for the shipping cost for the first item in the parcel. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate { + public static final String SERIALIZED_NAME_MIN = "min"; + @SerializedName(SERIALIZED_NAME_MIN) + @javax.annotation.Nullable + private String min; + + public static final String SERIALIZED_NAME_MAX = "max"; + @SerializedName(SERIALIZED_NAME_MAX) + @javax.annotation.Nullable + private String max; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate() { + } + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate min(@javax.annotation.Nullable String min) { + this.min = min; + return this; + } + + /** + * Lower limit for the rate. + * @return min + */ + @javax.annotation.Nullable + public String getMin() { + return min; + } + + public void setMin(@javax.annotation.Nullable String min) { + this.min = min; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate max(@javax.annotation.Nullable String max) { + this.max = max; + return this; + } + + /** + * Upper limit for the rate. + * @return max + */ + @javax.annotation.Nullable + public String getMax() { + return max; + } + + public void setMax(@javax.annotation.Nullable String max) { + this.max = max; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * ISO 4217 currency code. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate = (GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate) o; + return Objects.equals(this.min, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.min) && + Objects.equals(this.max, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.max) && + Objects.equals(this.currency, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.currency); + } + + @Override + public int hashCode() { + return Objects.hash(min, max, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate {\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("min"); + openapiFields.add("max"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate is not found in the empty JSON string", GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("min") != null && !jsonObj.get("min").isJsonNull()) && !jsonObj.get("min").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `min` to be a primitive type in the JSON string but got `%s`", jsonObj.get("min").toString())); + } + if ((jsonObj.get("max") != null && !jsonObj.get("max").isJsonNull()) && !jsonObj.get("max").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `max` to be a primitive type in the JSON string but got `%s`", jsonObj.get("max").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate + * @throws IOException if the JSON string is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate + */ + public static GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate.class); + } + + /** + * Convert an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsFirstItemRate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.java new file mode 100644 index 0000000..f8bc74b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.java @@ -0,0 +1,305 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Rules for the maximum weight of a package. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight { + public static final String SERIALIZED_NAME_SUPPORTED = "supported"; + @SerializedName(SERIALIZED_NAME_SUPPORTED) + @javax.annotation.Nullable + private Boolean supported; + + public static final String SERIALIZED_NAME_MIN = "min"; + @SerializedName(SERIALIZED_NAME_MIN) + @javax.annotation.Nullable + private String min; + + public static final String SERIALIZED_NAME_MAX = "max"; + @SerializedName(SERIALIZED_NAME_MAX) + @javax.annotation.Nullable + private String max; + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private String unit; + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight() { + } + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight supported(@javax.annotation.Nullable Boolean supported) { + this.supported = supported; + return this; + } + + /** + * Indicates whether the maximum package weight can be set in shipping rates for the delivery method. + * @return supported + */ + @javax.annotation.Nullable + public Boolean getSupported() { + return supported; + } + + public void setSupported(@javax.annotation.Nullable Boolean supported) { + this.supported = supported; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight min(@javax.annotation.Nullable String min) { + this.min = min; + return this; + } + + /** + * Lower limit for the maximum package weight, provided in a string format to avoid rounding errors. + * @return min + */ + @javax.annotation.Nullable + public String getMin() { + return min; + } + + public void setMin(@javax.annotation.Nullable String min) { + this.min = min; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight max(@javax.annotation.Nullable String max) { + this.max = max; + return this; + } + + /** + * Upper limit for the maximum package weight, provided in a string format to avoid rounding errors. + * @return max + */ + @javax.annotation.Nullable + public String getMax() { + return max; + } + + public void setMax(@javax.annotation.Nullable String max) { + this.max = max; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight unit(@javax.annotation.Nullable String unit) { + this.unit = unit; + return this; + } + + /** + * Weight unit. Currently only `KILOGRAM` is supported. + * @return unit + */ + @javax.annotation.Nullable + public String getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable String unit) { + this.unit = unit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight = (GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight) o; + return Objects.equals(this.supported, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.supported) && + Objects.equals(this.min, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.min) && + Objects.equals(this.max, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.max) && + Objects.equals(this.unit, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.unit); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(supported, min, max, unit); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight {\n"); + sb.append(" supported: ").append(toIndentedString(supported)).append("\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("supported"); + openapiFields.add("min"); + openapiFields.add("max"); + openapiFields.add("unit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight is not found in the empty JSON string", GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("min") != null && !jsonObj.get("min").isJsonNull()) && !jsonObj.get("min").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `min` to be a primitive type in the JSON string but got `%s`", jsonObj.get("min").toString())); + } + if ((jsonObj.get("max") != null && !jsonObj.get("max").isJsonNull()) && !jsonObj.get("max").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `max` to be a primitive type in the JSON string but got `%s`", jsonObj.get("max").toString())); + } + if ((jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) && !jsonObj.get("unit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unit").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight + * @throws IOException if the JSON string is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight + */ + public static GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight.class); + } + + /** + * Convert an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxPackageWeight to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.java new file mode 100644 index 0000000..52f4fe9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.java @@ -0,0 +1,205 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Rules for the quantity per parcel. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage { + public static final String SERIALIZED_NAME_MAX = "max"; + @SerializedName(SERIALIZED_NAME_MAX) + @javax.annotation.Nullable + private Integer max; + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage() { + } + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage max(@javax.annotation.Nullable Integer max) { + this.max = max; + return this; + } + + /** + * Upper limit for quantity per package. + * minimum: 1 + * maximum: 999999 + * @return max + */ + @javax.annotation.Nullable + public Integer getMax() { + return max; + } + + public void setMax(@javax.annotation.Nullable Integer max) { + this.max = max; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage = (GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage) o; + return Objects.equals(this.max, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.max); + } + + @Override + public int hashCode() { + return Objects.hash(max); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage {\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("max"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage is not found in the empty JSON string", GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage + * @throws IOException if the JSON string is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage + */ + public static GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage.class); + } + + /** + * Convert an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsMaxQuantityPerPackage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.java new file mode 100644 index 0000000..0b602ce --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Rules for the shipping cost of another item in the parcel. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate { + public static final String SERIALIZED_NAME_MIN = "min"; + @SerializedName(SERIALIZED_NAME_MIN) + @javax.annotation.Nullable + private String min; + + public static final String SERIALIZED_NAME_MAX = "max"; + @SerializedName(SERIALIZED_NAME_MAX) + @javax.annotation.Nullable + private String max; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate() { + } + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate min(@javax.annotation.Nullable String min) { + this.min = min; + return this; + } + + /** + * Lower limit for the rate. + * @return min + */ + @javax.annotation.Nullable + public String getMin() { + return min; + } + + public void setMin(@javax.annotation.Nullable String min) { + this.min = min; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate max(@javax.annotation.Nullable String max) { + this.max = max; + return this; + } + + /** + * Upper limit for the rate. + * @return max + */ + @javax.annotation.Nullable + public String getMax() { + return max; + } + + public void setMax(@javax.annotation.Nullable String max) { + this.max = max; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * ISO 4217 currency code. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate = (GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate) o; + return Objects.equals(this.min, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.min) && + Objects.equals(this.max, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.max) && + Objects.equals(this.currency, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.currency); + } + + @Override + public int hashCode() { + return Objects.hash(min, max, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate {\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("min"); + openapiFields.add("max"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate is not found in the empty JSON string", GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("min") != null && !jsonObj.get("min").isJsonNull()) && !jsonObj.get("min").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `min` to be a primitive type in the JSON string but got `%s`", jsonObj.get("min").toString())); + } + if ((jsonObj.get("max") != null && !jsonObj.get("max").isJsonNull()) && !jsonObj.get("max").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `max` to be a primitive type in the JSON string but got `%s`", jsonObj.get("max").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate + * @throws IOException if the JSON string is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate + */ + public static GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate.class); + } + + /** + * Convert an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsNextItemRate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.java new file mode 100644 index 0000000..7b805d6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.java @@ -0,0 +1,235 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Rules for the shipping time. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime { + public static final String SERIALIZED_NAME_DEFAULT = "default"; + @SerializedName(SERIALIZED_NAME_DEFAULT) + @javax.annotation.Nullable + private GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault _default; + + public static final String SERIALIZED_NAME_CUSTOMIZABLE = "customizable"; + @SerializedName(SERIALIZED_NAME_CUSTOMIZABLE) + @javax.annotation.Nullable + private Boolean customizable; + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime() { + } + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime _default(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault _default) { + this._default = _default; + return this; + } + + /** + * Get _default + * @return _default + */ + @javax.annotation.Nullable + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault getDefault() { + return _default; + } + + public void setDefault(@javax.annotation.Nullable GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault _default) { + this._default = _default; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime customizable(@javax.annotation.Nullable Boolean customizable) { + this.customizable = customizable; + return this; + } + + /** + * Indicates if custom shipping time can be set when adding or modifying shipping rates. + * @return customizable + */ + @javax.annotation.Nullable + public Boolean getCustomizable() { + return customizable; + } + + public void setCustomizable(@javax.annotation.Nullable Boolean customizable) { + this.customizable = customizable; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime = (GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime) o; + return Objects.equals(this._default, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime._default) && + Objects.equals(this.customizable, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.customizable); + } + + @Override + public int hashCode() { + return Objects.hash(_default, customizable); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime {\n"); + sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); + sb.append(" customizable: ").append(toIndentedString(customizable)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("default"); + openapiFields.add("customizable"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime is not found in the empty JSON string", GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `default` + if (jsonObj.get("default") != null && !jsonObj.get("default").isJsonNull()) { + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.validateJsonElement(jsonObj.get("default")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime + * @throws IOException if the JSON string is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime + */ + public static GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime.class); + } + + /** + * Convert an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTime to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.java new file mode 100644 index 0000000..55cec99 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Default shipping time. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault { + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private String to; + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault() { + } + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault from(@javax.annotation.Nullable String from) { + this.from = from; + return this; + } + + /** + * ISO 8601 duration format. + * @return from + */ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable String from) { + this.from = from; + } + + + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault to(@javax.annotation.Nullable String to) { + this.to = to; + return this; + } + + /** + * ISO 8601 duration format. + * @return to + */ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable String to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault = (GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault) o; + return Objects.equals(this.from, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.from) && + Objects.equals(this.to, getListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.to); + } + + @Override + public int hashCode() { + return Objects.hash(from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault {\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault is not found in the empty JSON string", GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault + * @throws IOException if the JSON string is invalid with respect to GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault + */ + public static GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault.class); + } + + /** + * Convert an instance of GetListOfDeliveryMethodsUsingGET200ResponseDeliveryMethodsInnerShippingRatesConstraintsShippingTimeDefault to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200Response.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200Response.java new file mode 100644 index 0000000..c0de02d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200Response.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.GetListOfShippingRatestUsingGET200ResponseShippingRatesInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetListOfShippingRatestUsingGET200Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfShippingRatestUsingGET200Response { + public static final String SERIALIZED_NAME_SHIPPING_RATES = "shippingRates"; + @SerializedName(SERIALIZED_NAME_SHIPPING_RATES) + @javax.annotation.Nullable + private List shippingRates = new ArrayList<>(); + + public GetListOfShippingRatestUsingGET200Response() { + } + + public GetListOfShippingRatestUsingGET200Response shippingRates(@javax.annotation.Nullable List shippingRates) { + this.shippingRates = shippingRates; + return this; + } + + public GetListOfShippingRatestUsingGET200Response addShippingRatesItem(GetListOfShippingRatestUsingGET200ResponseShippingRatesInner shippingRatesItem) { + if (this.shippingRates == null) { + this.shippingRates = new ArrayList<>(); + } + this.shippingRates.add(shippingRatesItem); + return this; + } + + /** + * Get shippingRates + * @return shippingRates + */ + @javax.annotation.Nullable + public List getShippingRates() { + return shippingRates; + } + + public void setShippingRates(@javax.annotation.Nullable List shippingRates) { + this.shippingRates = shippingRates; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfShippingRatestUsingGET200Response getListOfShippingRatestUsingGET200Response = (GetListOfShippingRatestUsingGET200Response) o; + return Objects.equals(this.shippingRates, getListOfShippingRatestUsingGET200Response.shippingRates); + } + + @Override + public int hashCode() { + return Objects.hash(shippingRates); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfShippingRatestUsingGET200Response {\n"); + sb.append(" shippingRates: ").append(toIndentedString(shippingRates)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shippingRates"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfShippingRatestUsingGET200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfShippingRatestUsingGET200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfShippingRatestUsingGET200Response is not found in the empty JSON string", GetListOfShippingRatestUsingGET200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfShippingRatestUsingGET200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfShippingRatestUsingGET200Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("shippingRates") != null && !jsonObj.get("shippingRates").isJsonNull()) { + JsonArray jsonArrayshippingRates = jsonObj.getAsJsonArray("shippingRates"); + if (jsonArrayshippingRates != null) { + // ensure the json data is an array + if (!jsonObj.get("shippingRates").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `shippingRates` to be an array in the JSON string but got `%s`", jsonObj.get("shippingRates").toString())); + } + + // validate the optional field `shippingRates` (array) + for (int i = 0; i < jsonArrayshippingRates.size(); i++) { + GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.validateJsonElement(jsonArrayshippingRates.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfShippingRatestUsingGET200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfShippingRatestUsingGET200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfShippingRatestUsingGET200Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfShippingRatestUsingGET200Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfShippingRatestUsingGET200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfShippingRatestUsingGET200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfShippingRatestUsingGET200Response + * @throws IOException if the JSON string is invalid with respect to GetListOfShippingRatestUsingGET200Response + */ + public static GetListOfShippingRatestUsingGET200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfShippingRatestUsingGET200Response.class); + } + + /** + * Convert an instance of GetListOfShippingRatestUsingGET200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.java new file mode 100644 index 0000000..2acad50 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.java @@ -0,0 +1,288 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetListOfShippingRatestUsingGET200ResponseShippingRatesInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfShippingRatestUsingGET200ResponseShippingRatesInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_MARKETPLACES = "marketplaces"; + @SerializedName(SERIALIZED_NAME_MARKETPLACES) + @javax.annotation.Nullable + private List marketplaces = new ArrayList<>(); + + public GetListOfShippingRatestUsingGET200ResponseShippingRatesInner() { + } + + public GetListOfShippingRatestUsingGET200ResponseShippingRatesInner id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Shipping rate ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public GetListOfShippingRatestUsingGET200ResponseShippingRatesInner name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * User defined name of the shipping rates set. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public GetListOfShippingRatestUsingGET200ResponseShippingRatesInner marketplaces(@javax.annotation.Nullable List marketplaces) { + this.marketplaces = marketplaces; + return this; + } + + public GetListOfShippingRatestUsingGET200ResponseShippingRatesInner addMarketplacesItem(GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner marketplacesItem) { + if (this.marketplaces == null) { + this.marketplaces = new ArrayList<>(); + } + this.marketplaces.add(marketplacesItem); + return this; + } + + /** + * List of marketplace ids where these shipping rates are qualified for. The list is calculated based on the delivery methods added to the shipping rates. + * @return marketplaces + */ + @javax.annotation.Nullable + public List getMarketplaces() { + return marketplaces; + } + + public void setMarketplaces(@javax.annotation.Nullable List marketplaces) { + this.marketplaces = marketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfShippingRatestUsingGET200ResponseShippingRatesInner getListOfShippingRatestUsingGET200ResponseShippingRatesInner = (GetListOfShippingRatestUsingGET200ResponseShippingRatesInner) o; + return Objects.equals(this.id, getListOfShippingRatestUsingGET200ResponseShippingRatesInner.id) && + Objects.equals(this.name, getListOfShippingRatestUsingGET200ResponseShippingRatesInner.name) && + Objects.equals(this.marketplaces, getListOfShippingRatestUsingGET200ResponseShippingRatesInner.marketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, marketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfShippingRatestUsingGET200ResponseShippingRatesInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" marketplaces: ").append(toIndentedString(marketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("marketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfShippingRatestUsingGET200ResponseShippingRatesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfShippingRatestUsingGET200ResponseShippingRatesInner is not found in the empty JSON string", GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfShippingRatestUsingGET200ResponseShippingRatesInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (jsonObj.get("marketplaces") != null && !jsonObj.get("marketplaces").isJsonNull()) { + JsonArray jsonArraymarketplaces = jsonObj.getAsJsonArray("marketplaces"); + if (jsonArraymarketplaces != null) { + // ensure the json data is an array + if (!jsonObj.get("marketplaces").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaces` to be an array in the JSON string but got `%s`", jsonObj.get("marketplaces").toString())); + } + + // validate the optional field `marketplaces` (array) + for (int i = 0; i < jsonArraymarketplaces.size(); i++) { + GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.validateJsonElement(jsonArraymarketplaces.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfShippingRatestUsingGET200ResponseShippingRatesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfShippingRatestUsingGET200ResponseShippingRatesInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfShippingRatestUsingGET200ResponseShippingRatesInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfShippingRatestUsingGET200ResponseShippingRatesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfShippingRatestUsingGET200ResponseShippingRatesInner + * @throws IOException if the JSON string is invalid with respect to GetListOfShippingRatestUsingGET200ResponseShippingRatesInner + */ + public static GetListOfShippingRatestUsingGET200ResponseShippingRatesInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfShippingRatestUsingGET200ResponseShippingRatesInner.class); + } + + /** + * Convert an instance of GetListOfShippingRatestUsingGET200ResponseShippingRatesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.java b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.java new file mode 100644 index 0000000..52e41ea --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner() { + } + + public GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Marketplace ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner getListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner = (GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner) o; + return Objects.equals(this.id, getListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner is not found in the empty JSON string", GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner + * @throws IOException if the JSON string is invalid with respect to GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner + */ + public static GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner.class); + } + + /** + * Convert an instance of GetListOfShippingRatestUsingGET200ResponseShippingRatesInnerMarketplacesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetOfferSmartClassificationGET400Response.java b/src/main/java/pl/wtx/allegro/api/client/model/GetOfferSmartClassificationGET400Response.java new file mode 100644 index 0000000..1564256 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetOfferSmartClassificationGET400Response.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error400; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetOfferSmartClassificationGET400Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetOfferSmartClassificationGET400Response { + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public GetOfferSmartClassificationGET400Response() { + } + + public GetOfferSmartClassificationGET400Response errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public GetOfferSmartClassificationGET400Response addErrorsItem(Error400 errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Array of errors. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetOfferSmartClassificationGET400Response getOfferSmartClassificationGET400Response = (GetOfferSmartClassificationGET400Response) o; + return Objects.equals(this.errors, getOfferSmartClassificationGET400Response.errors); + } + + @Override + public int hashCode() { + return Objects.hash(errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetOfferSmartClassificationGET400Response {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetOfferSmartClassificationGET400Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetOfferSmartClassificationGET400Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetOfferSmartClassificationGET400Response is not found in the empty JSON string", GetOfferSmartClassificationGET400Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetOfferSmartClassificationGET400Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetOfferSmartClassificationGET400Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error400.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetOfferSmartClassificationGET400Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetOfferSmartClassificationGET400Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetOfferSmartClassificationGET400Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetOfferSmartClassificationGET400Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetOfferSmartClassificationGET400Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetOfferSmartClassificationGET400Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetOfferSmartClassificationGET400Response + * @throws IOException if the JSON string is invalid with respect to GetOfferSmartClassificationGET400Response + */ + public static GetOfferSmartClassificationGET400Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetOfferSmartClassificationGET400Response.class); + } + + /** + * Convert an instance of GetOfferSmartClassificationGET400Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetOfferSmartClassificationGET403Response.java b/src/main/java/pl/wtx/allegro/api/client/model/GetOfferSmartClassificationGET403Response.java new file mode 100644 index 0000000..1eebf79 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetOfferSmartClassificationGET403Response.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error403; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetOfferSmartClassificationGET403Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetOfferSmartClassificationGET403Response { + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public GetOfferSmartClassificationGET403Response() { + } + + public GetOfferSmartClassificationGET403Response errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public GetOfferSmartClassificationGET403Response addErrorsItem(Error403 errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Array of errors. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetOfferSmartClassificationGET403Response getOfferSmartClassificationGET403Response = (GetOfferSmartClassificationGET403Response) o; + return Objects.equals(this.errors, getOfferSmartClassificationGET403Response.errors); + } + + @Override + public int hashCode() { + return Objects.hash(errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetOfferSmartClassificationGET403Response {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetOfferSmartClassificationGET403Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetOfferSmartClassificationGET403Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetOfferSmartClassificationGET403Response is not found in the empty JSON string", GetOfferSmartClassificationGET403Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetOfferSmartClassificationGET403Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetOfferSmartClassificationGET403Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error403.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetOfferSmartClassificationGET403Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetOfferSmartClassificationGET403Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetOfferSmartClassificationGET403Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetOfferSmartClassificationGET403Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetOfferSmartClassificationGET403Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetOfferSmartClassificationGET403Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetOfferSmartClassificationGET403Response + * @throws IOException if the JSON string is invalid with respect to GetOfferSmartClassificationGET403Response + */ + public static GetOfferSmartClassificationGET403Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetOfferSmartClassificationGET403Response.class); + } + + /** + * Convert an instance of GetOfferSmartClassificationGET403Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetRefundApplications200Response.java b/src/main/java/pl/wtx/allegro/api/client/model/GetRefundApplications200Response.java new file mode 100644 index 0000000..c9fdbcf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetRefundApplications200Response.java @@ -0,0 +1,256 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.RefundClaim; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetRefundApplications200Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetRefundApplications200Response { + public static final String SERIALIZED_NAME_REFUND_CLAIMS = "refundClaims"; + @SerializedName(SERIALIZED_NAME_REFUND_CLAIMS) + @javax.annotation.Nullable + private List refundClaims = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public GetRefundApplications200Response() { + } + + public GetRefundApplications200Response refundClaims(@javax.annotation.Nullable List refundClaims) { + this.refundClaims = refundClaims; + return this; + } + + public GetRefundApplications200Response addRefundClaimsItem(RefundClaim refundClaimsItem) { + if (this.refundClaims == null) { + this.refundClaims = new ArrayList<>(); + } + this.refundClaims.add(refundClaimsItem); + return this; + } + + /** + * Collection of refund applications. + * @return refundClaims + */ + @javax.annotation.Nullable + public List getRefundClaims() { + return refundClaims; + } + + public void setRefundClaims(@javax.annotation.Nullable List refundClaims) { + this.refundClaims = refundClaims; + } + + + public GetRefundApplications200Response count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Count of refund applications returned. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetRefundApplications200Response getRefundApplications200Response = (GetRefundApplications200Response) o; + return Objects.equals(this.refundClaims, getRefundApplications200Response.refundClaims) && + Objects.equals(this.count, getRefundApplications200Response.count); + } + + @Override + public int hashCode() { + return Objects.hash(refundClaims, count); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetRefundApplications200Response {\n"); + sb.append(" refundClaims: ").append(toIndentedString(refundClaims)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("refundClaims"); + openapiFields.add("count"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetRefundApplications200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetRefundApplications200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetRefundApplications200Response is not found in the empty JSON string", GetRefundApplications200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetRefundApplications200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetRefundApplications200Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("refundClaims") != null && !jsonObj.get("refundClaims").isJsonNull()) { + JsonArray jsonArrayrefundClaims = jsonObj.getAsJsonArray("refundClaims"); + if (jsonArrayrefundClaims != null) { + // ensure the json data is an array + if (!jsonObj.get("refundClaims").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `refundClaims` to be an array in the JSON string but got `%s`", jsonObj.get("refundClaims").toString())); + } + + // validate the optional field `refundClaims` (array) + for (int i = 0; i < jsonArrayrefundClaims.size(); i++) { + RefundClaim.validateJsonElement(jsonArrayrefundClaims.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetRefundApplications200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetRefundApplications200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetRefundApplications200Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetRefundApplications200Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetRefundApplications200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetRefundApplications200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetRefundApplications200Response + * @throws IOException if the JSON string is invalid with respect to GetRefundApplications200Response + */ + public static GetRefundApplications200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetRefundApplications200Response.class); + } + + /** + * Convert an instance of GetRefundApplications200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetRefundedPayments200Response.java b/src/main/java/pl/wtx/allegro/api/client/model/GetRefundedPayments200Response.java new file mode 100644 index 0000000..e4f82f7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetRefundedPayments200Response.java @@ -0,0 +1,284 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.RefundDetails; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetRefundedPayments200Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetRefundedPayments200Response { + public static final String SERIALIZED_NAME_REFUNDS = "refunds"; + @SerializedName(SERIALIZED_NAME_REFUNDS) + @javax.annotation.Nullable + private List refunds = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private Integer totalCount; + + public GetRefundedPayments200Response() { + } + + public GetRefundedPayments200Response refunds(@javax.annotation.Nullable List refunds) { + this.refunds = refunds; + return this; + } + + public GetRefundedPayments200Response addRefundsItem(RefundDetails refundsItem) { + if (this.refunds == null) { + this.refunds = new ArrayList<>(); + } + this.refunds.add(refundsItem); + return this; + } + + /** + * Collection of payments refunds. + * @return refunds + */ + @javax.annotation.Nullable + public List getRefunds() { + return refunds; + } + + public void setRefunds(@javax.annotation.Nullable List refunds) { + this.refunds = refunds; + } + + + public GetRefundedPayments200Response count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Number of payment operations returned in search result for the given parameters. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public GetRefundedPayments200Response totalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of payment operations for the given parameters. + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetRefundedPayments200Response getRefundedPayments200Response = (GetRefundedPayments200Response) o; + return Objects.equals(this.refunds, getRefundedPayments200Response.refunds) && + Objects.equals(this.count, getRefundedPayments200Response.count) && + Objects.equals(this.totalCount, getRefundedPayments200Response.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(refunds, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetRefundedPayments200Response {\n"); + sb.append(" refunds: ").append(toIndentedString(refunds)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("refunds"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetRefundedPayments200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetRefundedPayments200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetRefundedPayments200Response is not found in the empty JSON string", GetRefundedPayments200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetRefundedPayments200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetRefundedPayments200Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("refunds") != null && !jsonObj.get("refunds").isJsonNull()) { + JsonArray jsonArrayrefunds = jsonObj.getAsJsonArray("refunds"); + if (jsonArrayrefunds != null) { + // ensure the json data is an array + if (!jsonObj.get("refunds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `refunds` to be an array in the JSON string but got `%s`", jsonObj.get("refunds").toString())); + } + + // validate the optional field `refunds` (array) + for (int i = 0; i < jsonArrayrefunds.size(); i++) { + RefundDetails.validateJsonElement(jsonArrayrefunds.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetRefundedPayments200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetRefundedPayments200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetRefundedPayments200Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetRefundedPayments200Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetRefundedPayments200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetRefundedPayments200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetRefundedPayments200Response + * @throws IOException if the JSON string is invalid with respect to GetRefundedPayments200Response + */ + public static GetRefundedPayments200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetRefundedPayments200Response.class); + } + + /** + * Convert an instance of GetRefundedPayments200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetSaleProductsResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/GetSaleProductsResponse.java new file mode 100644 index 0000000..b5400fb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetSaleProductsResponse.java @@ -0,0 +1,346 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BaseSaleProductResponseDto; +import pl.wtx.allegro.api.client.model.GetSaleProductsResponseNextPage; +import pl.wtx.allegro.api.client.model.ListingResponseFilters; +import pl.wtx.allegro.api.client.model.SaleProductResponseCategoriesDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetSaleProductsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetSaleProductsResponse { + public static final String SERIALIZED_NAME_PRODUCTS = "products"; + @SerializedName(SERIALIZED_NAME_PRODUCTS) + @javax.annotation.Nonnull + private List products = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CATEGORIES = "categories"; + @SerializedName(SERIALIZED_NAME_CATEGORIES) + @javax.annotation.Nullable + private SaleProductResponseCategoriesDto categories; + + public static final String SERIALIZED_NAME_FILTERS = "filters"; + @SerializedName(SERIALIZED_NAME_FILTERS) + @javax.annotation.Nullable + private List filters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NEXT_PAGE = "nextPage"; + @SerializedName(SERIALIZED_NAME_NEXT_PAGE) + @javax.annotation.Nullable + private GetSaleProductsResponseNextPage nextPage; + + public GetSaleProductsResponse() { + } + + public GetSaleProductsResponse products(@javax.annotation.Nonnull List products) { + this.products = products; + return this; + } + + public GetSaleProductsResponse addProductsItem(BaseSaleProductResponseDto productsItem) { + if (this.products == null) { + this.products = new ArrayList<>(); + } + this.products.add(productsItem); + return this; + } + + /** + * Get products + * @return products + */ + @javax.annotation.Nonnull + public List getProducts() { + return products; + } + + public void setProducts(@javax.annotation.Nonnull List products) { + this.products = products; + } + + + public GetSaleProductsResponse categories(@javax.annotation.Nullable SaleProductResponseCategoriesDto categories) { + this.categories = categories; + return this; + } + + /** + * Get categories + * @return categories + */ + @javax.annotation.Nullable + public SaleProductResponseCategoriesDto getCategories() { + return categories; + } + + public void setCategories(@javax.annotation.Nullable SaleProductResponseCategoriesDto categories) { + this.categories = categories; + } + + + public GetSaleProductsResponse filters(@javax.annotation.Nullable List filters) { + this.filters = filters; + return this; + } + + public GetSaleProductsResponse addFiltersItem(ListingResponseFilters filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Get filters + * @return filters + */ + @javax.annotation.Nullable + public List getFilters() { + return filters; + } + + public void setFilters(@javax.annotation.Nullable List filters) { + this.filters = filters; + } + + + public GetSaleProductsResponse nextPage(@javax.annotation.Nullable GetSaleProductsResponseNextPage nextPage) { + this.nextPage = nextPage; + return this; + } + + /** + * Get nextPage + * @return nextPage + */ + @javax.annotation.Nullable + public GetSaleProductsResponseNextPage getNextPage() { + return nextPage; + } + + public void setNextPage(@javax.annotation.Nullable GetSaleProductsResponseNextPage nextPage) { + this.nextPage = nextPage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSaleProductsResponse getSaleProductsResponse = (GetSaleProductsResponse) o; + return Objects.equals(this.products, getSaleProductsResponse.products) && + Objects.equals(this.categories, getSaleProductsResponse.categories) && + Objects.equals(this.filters, getSaleProductsResponse.filters) && + Objects.equals(this.nextPage, getSaleProductsResponse.nextPage); + } + + @Override + public int hashCode() { + return Objects.hash(products, categories, filters, nextPage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSaleProductsResponse {\n"); + sb.append(" products: ").append(toIndentedString(products)).append("\n"); + sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" nextPage: ").append(toIndentedString(nextPage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("products"); + openapiFields.add("categories"); + openapiFields.add("filters"); + openapiFields.add("nextPage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("products"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetSaleProductsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSaleProductsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetSaleProductsResponse is not found in the empty JSON string", GetSaleProductsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSaleProductsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSaleProductsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetSaleProductsResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("products").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `products` to be an array in the JSON string but got `%s`", jsonObj.get("products").toString())); + } + + JsonArray jsonArrayproducts = jsonObj.getAsJsonArray("products"); + // validate the required field `products` (array) + for (int i = 0; i < jsonArrayproducts.size(); i++) { + BaseSaleProductResponseDto.validateJsonElement(jsonArrayproducts.get(i)); + }; + // validate the optional field `categories` + if (jsonObj.get("categories") != null && !jsonObj.get("categories").isJsonNull()) { + SaleProductResponseCategoriesDto.validateJsonElement(jsonObj.get("categories")); + } + if (jsonObj.get("filters") != null && !jsonObj.get("filters").isJsonNull()) { + JsonArray jsonArrayfilters = jsonObj.getAsJsonArray("filters"); + if (jsonArrayfilters != null) { + // ensure the json data is an array + if (!jsonObj.get("filters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `filters` to be an array in the JSON string but got `%s`", jsonObj.get("filters").toString())); + } + + // validate the optional field `filters` (array) + for (int i = 0; i < jsonArrayfilters.size(); i++) { + ListingResponseFilters.validateJsonElement(jsonArrayfilters.get(i)); + }; + } + } + // validate the optional field `nextPage` + if (jsonObj.get("nextPage") != null && !jsonObj.get("nextPage").isJsonNull()) { + GetSaleProductsResponseNextPage.validateJsonElement(jsonObj.get("nextPage")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSaleProductsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSaleProductsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetSaleProductsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSaleProductsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSaleProductsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetSaleProductsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSaleProductsResponse + * @throws IOException if the JSON string is invalid with respect to GetSaleProductsResponse + */ + public static GetSaleProductsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSaleProductsResponse.class); + } + + /** + * Convert an instance of GetSaleProductsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetSaleProductsResponseNextPage.java b/src/main/java/pl/wtx/allegro/api/client/model/GetSaleProductsResponseNextPage.java new file mode 100644 index 0000000..92e7bb5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetSaleProductsResponseNextPage.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetSaleProductsResponseNextPage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetSaleProductsResponseNextPage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public GetSaleProductsResponseNextPage() { + } + + public GetSaleProductsResponseNextPage id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * A \"cursor\" to the next set of results. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSaleProductsResponseNextPage getSaleProductsResponseNextPage = (GetSaleProductsResponseNextPage) o; + return Objects.equals(this.id, getSaleProductsResponseNextPage.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetSaleProductsResponseNextPage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetSaleProductsResponseNextPage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetSaleProductsResponseNextPage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetSaleProductsResponseNextPage is not found in the empty JSON string", GetSaleProductsResponseNextPage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetSaleProductsResponseNextPage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetSaleProductsResponseNextPage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetSaleProductsResponseNextPage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetSaleProductsResponseNextPage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetSaleProductsResponseNextPage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetSaleProductsResponseNextPage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetSaleProductsResponseNextPage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetSaleProductsResponseNextPage given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetSaleProductsResponseNextPage + * @throws IOException if the JSON string is invalid with respect to GetSaleProductsResponseNextPage + */ + public static GetSaleProductsResponseNextPage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetSaleProductsResponseNextPage.class); + } + + /** + * Convert an instance of GetSaleProductsResponseNextPage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/GetShipmentDetails404Response.java b/src/main/java/pl/wtx/allegro/api/client/model/GetShipmentDetails404Response.java new file mode 100644 index 0000000..17ea91d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/GetShipmentDetails404Response.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error404; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * GetShipmentDetails404Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class GetShipmentDetails404Response { + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public GetShipmentDetails404Response() { + } + + public GetShipmentDetails404Response errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public GetShipmentDetails404Response addErrorsItem(Error404 errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Array of errors. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetShipmentDetails404Response getShipmentDetails404Response = (GetShipmentDetails404Response) o; + return Objects.equals(this.errors, getShipmentDetails404Response.errors); + } + + @Override + public int hashCode() { + return Objects.hash(errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetShipmentDetails404Response {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GetShipmentDetails404Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetShipmentDetails404Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GetShipmentDetails404Response is not found in the empty JSON string", GetShipmentDetails404Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetShipmentDetails404Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetShipmentDetails404Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error404.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetShipmentDetails404Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetShipmentDetails404Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetShipmentDetails404Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetShipmentDetails404Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetShipmentDetails404Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetShipmentDetails404Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetShipmentDetails404Response + * @throws IOException if the JSON string is invalid with respect to GetShipmentDetails404Response + */ + public static GetShipmentDetails404Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetShipmentDetails404Response.class); + } + + /** + * Convert an instance of GetShipmentDetails404Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/HandlingUnit.java b/src/main/java/pl/wtx/allegro/api/client/model/HandlingUnit.java new file mode 100644 index 0000000..5b14fcb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/HandlingUnit.java @@ -0,0 +1,264 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents information about handling unit. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class HandlingUnit { + public static final String SERIALIZED_NAME_UNIT_TYPE = "unitType"; + @SerializedName(SERIALIZED_NAME_UNIT_TYPE) + @javax.annotation.Nullable + private String unitType; + + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private BigDecimal amount; + + public static final String SERIALIZED_NAME_LABELS_TYPE = "labelsType"; + @SerializedName(SERIALIZED_NAME_LABELS_TYPE) + @javax.annotation.Nullable + private String labelsType; + + public HandlingUnit() { + } + + public HandlingUnit unitType(@javax.annotation.Nullable String unitType) { + this.unitType = unitType; + return this; + } + + /** + * The unit type of Advance Ship Notice. Available values - BOX, PALLET, CONTAINER. + * @return unitType + */ + @javax.annotation.Nullable + public String getUnitType() { + return unitType; + } + + public void setUnitType(@javax.annotation.Nullable String unitType) { + this.unitType = unitType; + } + + + public HandlingUnit amount(@javax.annotation.Nullable BigDecimal amount) { + this.amount = amount; + return this; + } + + /** + * Amount of unit type. Not required when ASN status is DRAFT. When unit type is BOX or PALLET then it means how many handling units will be sent. When unit type is CONTAINER then it means how many handling units inside a container will be sent. + * @return amount + */ + @javax.annotation.Nullable + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable BigDecimal amount) { + this.amount = amount; + } + + + public HandlingUnit labelsType(@javax.annotation.Nullable String labelsType) { + this.labelsType = labelsType; + return this; + } + + /** + * Not required when ASN status is DRAFT. Available values - ONE_FULFILMENT, NONE. When unit type is CONTAINER labelsType can not be set to ONE_FULFILMENT. + * @return labelsType + */ + @javax.annotation.Nullable + public String getLabelsType() { + return labelsType; + } + + public void setLabelsType(@javax.annotation.Nullable String labelsType) { + this.labelsType = labelsType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HandlingUnit handlingUnit = (HandlingUnit) o; + return Objects.equals(this.unitType, handlingUnit.unitType) && + Objects.equals(this.amount, handlingUnit.amount) && + Objects.equals(this.labelsType, handlingUnit.labelsType); + } + + @Override + public int hashCode() { + return Objects.hash(unitType, amount, labelsType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HandlingUnit {\n"); + sb.append(" unitType: ").append(toIndentedString(unitType)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" labelsType: ").append(toIndentedString(labelsType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("unitType"); + openapiFields.add("amount"); + openapiFields.add("labelsType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HandlingUnit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HandlingUnit.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in HandlingUnit is not found in the empty JSON string", HandlingUnit.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HandlingUnit.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HandlingUnit` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("unitType") != null && !jsonObj.get("unitType").isJsonNull()) && !jsonObj.get("unitType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unitType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unitType").toString())); + } + if ((jsonObj.get("labelsType") != null && !jsonObj.get("labelsType").isJsonNull()) && !jsonObj.get("labelsType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `labelsType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("labelsType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HandlingUnit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HandlingUnit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HandlingUnit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HandlingUnit value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HandlingUnit read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of HandlingUnit given an JSON string + * + * @param jsonString JSON string + * @return An instance of HandlingUnit + * @throws IOException if the JSON string is invalid with respect to HandlingUnit + */ + public static HandlingUnit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HandlingUnit.class); + } + + /** + * Convert an instance of HandlingUnit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Header.java b/src/main/java/pl/wtx/allegro/api/client/model/Header.java new file mode 100644 index 0000000..a87c138 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Header.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Header + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Header { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public Header() { + } + + public Header name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Header header = (Header) o; + return Objects.equals(this.name, header.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Header {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Header + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Header.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Header is not found in the empty JSON string", Header.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Header.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Header` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Header.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Header.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Header' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter
thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Header.class)); + + return (TypeAdapter) new TypeAdapter
() { + @Override + public void write(JsonWriter out, Header value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Header read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Header given an JSON string + * + * @param jsonString JSON string + * @return An instance of Header + * @throws IOException if the JSON string is invalid with respect to Header + */ + public static Header fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Header.class); + } + + /** + * Convert an instance of Header to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ImageUrl.java b/src/main/java/pl/wtx/allegro/api/client/model/ImageUrl.java new file mode 100644 index 0000000..e4ba260 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ImageUrl.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Image url + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ImageUrl { + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public ImageUrl() { + } + + public ImageUrl url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImageUrl imageUrl = (ImageUrl) o; + return Objects.equals(this.url, imageUrl.url); + } + + @Override + public int hashCode() { + return Objects.hash(url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageUrl {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ImageUrl + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageUrl.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ImageUrl is not found in the empty JSON string", ImageUrl.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ImageUrl.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ImageUrl` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageUrl.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageUrl' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ImageUrl.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageUrl value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ImageUrl read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ImageUrl given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageUrl + * @throws IOException if the JSON string is invalid with respect to ImageUrl + */ + public static ImageUrl fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageUrl.class); + } + + /** + * Convert an instance of ImageUrl to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantiesListImpliedWarrantyBasic.java b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantiesListImpliedWarrantyBasic.java new file mode 100644 index 0000000..a22d8b3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantiesListImpliedWarrantyBasic.java @@ -0,0 +1,256 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ImpliedWarrantyBasic; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ImpliedWarrantiesListImpliedWarrantyBasic + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ImpliedWarrantiesListImpliedWarrantyBasic { + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_IMPLIED_WARRANTIES = "impliedWarranties"; + @SerializedName(SERIALIZED_NAME_IMPLIED_WARRANTIES) + @javax.annotation.Nullable + private List impliedWarranties = new ArrayList<>(); + + public ImpliedWarrantiesListImpliedWarrantyBasic() { + } + + public ImpliedWarrantiesListImpliedWarrantyBasic count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public ImpliedWarrantiesListImpliedWarrantyBasic impliedWarranties(@javax.annotation.Nullable List impliedWarranties) { + this.impliedWarranties = impliedWarranties; + return this; + } + + public ImpliedWarrantiesListImpliedWarrantyBasic addImpliedWarrantiesItem(ImpliedWarrantyBasic impliedWarrantiesItem) { + if (this.impliedWarranties == null) { + this.impliedWarranties = new ArrayList<>(); + } + this.impliedWarranties.add(impliedWarrantiesItem); + return this; + } + + /** + * Get impliedWarranties + * @return impliedWarranties + */ + @javax.annotation.Nullable + public List getImpliedWarranties() { + return impliedWarranties; + } + + public void setImpliedWarranties(@javax.annotation.Nullable List impliedWarranties) { + this.impliedWarranties = impliedWarranties; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImpliedWarrantiesListImpliedWarrantyBasic impliedWarrantiesListImpliedWarrantyBasic = (ImpliedWarrantiesListImpliedWarrantyBasic) o; + return Objects.equals(this.count, impliedWarrantiesListImpliedWarrantyBasic.count) && + Objects.equals(this.impliedWarranties, impliedWarrantiesListImpliedWarrantyBasic.impliedWarranties); + } + + @Override + public int hashCode() { + return Objects.hash(count, impliedWarranties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImpliedWarrantiesListImpliedWarrantyBasic {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" impliedWarranties: ").append(toIndentedString(impliedWarranties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("count"); + openapiFields.add("impliedWarranties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ImpliedWarrantiesListImpliedWarrantyBasic + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImpliedWarrantiesListImpliedWarrantyBasic.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ImpliedWarrantiesListImpliedWarrantyBasic is not found in the empty JSON string", ImpliedWarrantiesListImpliedWarrantyBasic.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ImpliedWarrantiesListImpliedWarrantyBasic.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ImpliedWarrantiesListImpliedWarrantyBasic` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("impliedWarranties") != null && !jsonObj.get("impliedWarranties").isJsonNull()) { + JsonArray jsonArrayimpliedWarranties = jsonObj.getAsJsonArray("impliedWarranties"); + if (jsonArrayimpliedWarranties != null) { + // ensure the json data is an array + if (!jsonObj.get("impliedWarranties").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `impliedWarranties` to be an array in the JSON string but got `%s`", jsonObj.get("impliedWarranties").toString())); + } + + // validate the optional field `impliedWarranties` (array) + for (int i = 0; i < jsonArrayimpliedWarranties.size(); i++) { + ImpliedWarrantyBasic.validateJsonElement(jsonArrayimpliedWarranties.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImpliedWarrantiesListImpliedWarrantyBasic.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImpliedWarrantiesListImpliedWarrantyBasic' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ImpliedWarrantiesListImpliedWarrantyBasic.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ImpliedWarrantiesListImpliedWarrantyBasic value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ImpliedWarrantiesListImpliedWarrantyBasic read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ImpliedWarrantiesListImpliedWarrantyBasic given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImpliedWarrantiesListImpliedWarrantyBasic + * @throws IOException if the JSON string is invalid with respect to ImpliedWarrantiesListImpliedWarrantyBasic + */ + public static ImpliedWarrantiesListImpliedWarrantyBasic fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImpliedWarrantiesListImpliedWarrantyBasic.class); + } + + /** + * Convert an instance of ImpliedWarrantiesListImpliedWarrantyBasic to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarranty.java b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarranty.java new file mode 100644 index 0000000..65c1785 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarranty.java @@ -0,0 +1,207 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The implied warranty information. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ImpliedWarranty { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public ImpliedWarranty() { + } + + public ImpliedWarranty id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the implied warranty definition. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImpliedWarranty impliedWarranty = (ImpliedWarranty) o; + return Objects.equals(this.id, impliedWarranty.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImpliedWarranty {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ImpliedWarranty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImpliedWarranty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ImpliedWarranty is not found in the empty JSON string", ImpliedWarranty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ImpliedWarranty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ImpliedWarranty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImpliedWarranty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImpliedWarranty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ImpliedWarranty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ImpliedWarranty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ImpliedWarranty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ImpliedWarranty given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImpliedWarranty + * @throws IOException if the JSON string is invalid with respect to ImpliedWarranty + */ + public static ImpliedWarranty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImpliedWarranty.class); + } + + /** + * Convert an instance of ImpliedWarranty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyBasic.java b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyBasic.java new file mode 100644 index 0000000..4545a7d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyBasic.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ImpliedWarrantyBasic + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ImpliedWarrantyBasic { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public ImpliedWarrantyBasic() { + } + + public ImpliedWarrantyBasic id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ImpliedWarrantyBasic name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImpliedWarrantyBasic impliedWarrantyBasic = (ImpliedWarrantyBasic) o; + return Objects.equals(this.id, impliedWarrantyBasic.id) && + Objects.equals(this.name, impliedWarrantyBasic.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImpliedWarrantyBasic {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ImpliedWarrantyBasic + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImpliedWarrantyBasic.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ImpliedWarrantyBasic is not found in the empty JSON string", ImpliedWarrantyBasic.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ImpliedWarrantyBasic.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ImpliedWarrantyBasic` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImpliedWarrantyBasic.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImpliedWarrantyBasic' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ImpliedWarrantyBasic.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ImpliedWarrantyBasic value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ImpliedWarrantyBasic read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ImpliedWarrantyBasic given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImpliedWarrantyBasic + * @throws IOException if the JSON string is invalid with respect to ImpliedWarrantyBasic + */ + public static ImpliedWarrantyBasic fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImpliedWarrantyBasic.class); + } + + /** + * Convert an instance of ImpliedWarrantyBasic to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyPeriod.java b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyPeriod.java new file mode 100644 index 0000000..6c80545 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyPeriod.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ImpliedWarrantyPeriod + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ImpliedWarrantyPeriod { + public static final String SERIALIZED_NAME_PERIOD = "period"; + @SerializedName(SERIALIZED_NAME_PERIOD) + @javax.annotation.Nullable + private String period; + + public ImpliedWarrantyPeriod() { + } + + public ImpliedWarrantyPeriod period(@javax.annotation.Nullable String period) { + this.period = period; + return this; + } + + /** + * Period in ISO 8601 format. Only periods in full years are accepted. + * @return period + */ + @javax.annotation.Nullable + public String getPeriod() { + return period; + } + + public void setPeriod(@javax.annotation.Nullable String period) { + this.period = period; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImpliedWarrantyPeriod impliedWarrantyPeriod = (ImpliedWarrantyPeriod) o; + return Objects.equals(this.period, impliedWarrantyPeriod.period); + } + + @Override + public int hashCode() { + return Objects.hash(period); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImpliedWarrantyPeriod {\n"); + sb.append(" period: ").append(toIndentedString(period)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("period"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ImpliedWarrantyPeriod + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImpliedWarrantyPeriod.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ImpliedWarrantyPeriod is not found in the empty JSON string", ImpliedWarrantyPeriod.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ImpliedWarrantyPeriod.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ImpliedWarrantyPeriod` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("period") != null && !jsonObj.get("period").isJsonNull()) && !jsonObj.get("period").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `period` to be a primitive type in the JSON string but got `%s`", jsonObj.get("period").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImpliedWarrantyPeriod.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImpliedWarrantyPeriod' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ImpliedWarrantyPeriod.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ImpliedWarrantyPeriod value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ImpliedWarrantyPeriod read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ImpliedWarrantyPeriod given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImpliedWarrantyPeriod + * @throws IOException if the JSON string is invalid with respect to ImpliedWarrantyPeriod + */ + public static ImpliedWarrantyPeriod fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImpliedWarrantyPeriod.class); + } + + /** + * Convert an instance of ImpliedWarrantyPeriod to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyRequest.java new file mode 100644 index 0000000..04bc538 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyRequest.java @@ -0,0 +1,331 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AfterSalesServicesAddress; +import pl.wtx.allegro.api.client.model.ImpliedWarrantyPeriod; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ImpliedWarrantyRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ImpliedWarrantyRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_INDIVIDUAL = "individual"; + @SerializedName(SERIALIZED_NAME_INDIVIDUAL) + @javax.annotation.Nullable + private ImpliedWarrantyPeriod individual; + + public static final String SERIALIZED_NAME_CORPORATE = "corporate"; + @SerializedName(SERIALIZED_NAME_CORPORATE) + @javax.annotation.Nullable + private ImpliedWarrantyPeriod corporate; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private AfterSalesServicesAddress address; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public ImpliedWarrantyRequest() { + } + + public ImpliedWarrantyRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Warranty name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ImpliedWarrantyRequest individual(@javax.annotation.Nullable ImpliedWarrantyPeriod individual) { + this.individual = individual; + return this; + } + + /** + * Get individual + * @return individual + */ + @javax.annotation.Nullable + public ImpliedWarrantyPeriod getIndividual() { + return individual; + } + + public void setIndividual(@javax.annotation.Nullable ImpliedWarrantyPeriod individual) { + this.individual = individual; + } + + + public ImpliedWarrantyRequest corporate(@javax.annotation.Nullable ImpliedWarrantyPeriod corporate) { + this.corporate = corporate; + return this; + } + + /** + * Get corporate + * @return corporate + */ + @javax.annotation.Nullable + public ImpliedWarrantyPeriod getCorporate() { + return corporate; + } + + public void setCorporate(@javax.annotation.Nullable ImpliedWarrantyPeriod corporate) { + this.corporate = corporate; + } + + + public ImpliedWarrantyRequest address(@javax.annotation.Nullable AfterSalesServicesAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public AfterSalesServicesAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable AfterSalesServicesAddress address) { + this.address = address; + } + + + public ImpliedWarrantyRequest description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Implied warranty description. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImpliedWarrantyRequest impliedWarrantyRequest = (ImpliedWarrantyRequest) o; + return Objects.equals(this.name, impliedWarrantyRequest.name) && + Objects.equals(this.individual, impliedWarrantyRequest.individual) && + Objects.equals(this.corporate, impliedWarrantyRequest.corporate) && + Objects.equals(this.address, impliedWarrantyRequest.address) && + Objects.equals(this.description, impliedWarrantyRequest.description); + } + + @Override + public int hashCode() { + return Objects.hash(name, individual, corporate, address, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImpliedWarrantyRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" individual: ").append(toIndentedString(individual)).append("\n"); + sb.append(" corporate: ").append(toIndentedString(corporate)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("individual"); + openapiFields.add("corporate"); + openapiFields.add("address"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ImpliedWarrantyRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImpliedWarrantyRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ImpliedWarrantyRequest is not found in the empty JSON string", ImpliedWarrantyRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ImpliedWarrantyRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ImpliedWarrantyRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `individual` + if (jsonObj.get("individual") != null && !jsonObj.get("individual").isJsonNull()) { + ImpliedWarrantyPeriod.validateJsonElement(jsonObj.get("individual")); + } + // validate the optional field `corporate` + if (jsonObj.get("corporate") != null && !jsonObj.get("corporate").isJsonNull()) { + ImpliedWarrantyPeriod.validateJsonElement(jsonObj.get("corporate")); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + AfterSalesServicesAddress.validateJsonElement(jsonObj.get("address")); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImpliedWarrantyRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImpliedWarrantyRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ImpliedWarrantyRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ImpliedWarrantyRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ImpliedWarrantyRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ImpliedWarrantyRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImpliedWarrantyRequest + * @throws IOException if the JSON string is invalid with respect to ImpliedWarrantyRequest + */ + public static ImpliedWarrantyRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImpliedWarrantyRequest.class); + } + + /** + * Convert an instance of ImpliedWarrantyRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyResponse.java new file mode 100644 index 0000000..04979b2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ImpliedWarrantyResponse.java @@ -0,0 +1,394 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.AfterSalesServicesAddress; +import pl.wtx.allegro.api.client.model.ImpliedWarrantyPeriod; +import pl.wtx.allegro.api.client.model.Seller; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ImpliedWarrantyResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ImpliedWarrantyResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_SELLER = "seller"; + @SerializedName(SERIALIZED_NAME_SELLER) + @javax.annotation.Nullable + private Seller seller; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_INDIVIDUAL = "individual"; + @SerializedName(SERIALIZED_NAME_INDIVIDUAL) + @javax.annotation.Nullable + private ImpliedWarrantyPeriod individual; + + public static final String SERIALIZED_NAME_CORPORATE = "corporate"; + @SerializedName(SERIALIZED_NAME_CORPORATE) + @javax.annotation.Nullable + private ImpliedWarrantyPeriod corporate; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private AfterSalesServicesAddress address; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public ImpliedWarrantyResponse() { + } + + public ImpliedWarrantyResponse id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the implied warranty definition. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public ImpliedWarrantyResponse seller(@javax.annotation.Nullable Seller seller) { + this.seller = seller; + return this; + } + + /** + * Get seller + * @return seller + */ + @javax.annotation.Nullable + public Seller getSeller() { + return seller; + } + + public void setSeller(@javax.annotation.Nullable Seller seller) { + this.seller = seller; + } + + + public ImpliedWarrantyResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Implied warranty name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ImpliedWarrantyResponse individual(@javax.annotation.Nullable ImpliedWarrantyPeriod individual) { + this.individual = individual; + return this; + } + + /** + * Get individual + * @return individual + */ + @javax.annotation.Nullable + public ImpliedWarrantyPeriod getIndividual() { + return individual; + } + + public void setIndividual(@javax.annotation.Nullable ImpliedWarrantyPeriod individual) { + this.individual = individual; + } + + + public ImpliedWarrantyResponse corporate(@javax.annotation.Nullable ImpliedWarrantyPeriod corporate) { + this.corporate = corporate; + return this; + } + + /** + * Get corporate + * @return corporate + */ + @javax.annotation.Nullable + public ImpliedWarrantyPeriod getCorporate() { + return corporate; + } + + public void setCorporate(@javax.annotation.Nullable ImpliedWarrantyPeriod corporate) { + this.corporate = corporate; + } + + + public ImpliedWarrantyResponse address(@javax.annotation.Nullable AfterSalesServicesAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public AfterSalesServicesAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable AfterSalesServicesAddress address) { + this.address = address; + } + + + public ImpliedWarrantyResponse description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Implied warranty description. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImpliedWarrantyResponse impliedWarrantyResponse = (ImpliedWarrantyResponse) o; + return Objects.equals(this.id, impliedWarrantyResponse.id) && + Objects.equals(this.seller, impliedWarrantyResponse.seller) && + Objects.equals(this.name, impliedWarrantyResponse.name) && + Objects.equals(this.individual, impliedWarrantyResponse.individual) && + Objects.equals(this.corporate, impliedWarrantyResponse.corporate) && + Objects.equals(this.address, impliedWarrantyResponse.address) && + Objects.equals(this.description, impliedWarrantyResponse.description); + } + + @Override + public int hashCode() { + return Objects.hash(id, seller, name, individual, corporate, address, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImpliedWarrantyResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" seller: ").append(toIndentedString(seller)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" individual: ").append(toIndentedString(individual)).append("\n"); + sb.append(" corporate: ").append(toIndentedString(corporate)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("seller"); + openapiFields.add("name"); + openapiFields.add("individual"); + openapiFields.add("corporate"); + openapiFields.add("address"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ImpliedWarrantyResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImpliedWarrantyResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ImpliedWarrantyResponse is not found in the empty JSON string", ImpliedWarrantyResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ImpliedWarrantyResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ImpliedWarrantyResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `seller` + if (jsonObj.get("seller") != null && !jsonObj.get("seller").isJsonNull()) { + Seller.validateJsonElement(jsonObj.get("seller")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `individual` + if (jsonObj.get("individual") != null && !jsonObj.get("individual").isJsonNull()) { + ImpliedWarrantyPeriod.validateJsonElement(jsonObj.get("individual")); + } + // validate the optional field `corporate` + if (jsonObj.get("corporate") != null && !jsonObj.get("corporate").isJsonNull()) { + ImpliedWarrantyPeriod.validateJsonElement(jsonObj.get("corporate")); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + AfterSalesServicesAddress.validateJsonElement(jsonObj.get("address")); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImpliedWarrantyResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImpliedWarrantyResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ImpliedWarrantyResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ImpliedWarrantyResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ImpliedWarrantyResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ImpliedWarrantyResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImpliedWarrantyResponse + * @throws IOException if the JSON string is invalid with respect to ImpliedWarrantyResponse + */ + public static ImpliedWarrantyResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImpliedWarrantyResponse.class); + } + + /** + * Convert an instance of ImpliedWarrantyResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefund.java b/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefund.java new file mode 100644 index 0000000..8b2fef5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefund.java @@ -0,0 +1,599 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.InitializeRefundAdditionalServices; +import pl.wtx.allegro.api.client.model.InitializeRefundDelivery; +import pl.wtx.allegro.api.client.model.InitializeRefundOverpaid; +import pl.wtx.allegro.api.client.model.PaymentsSurcharge; +import pl.wtx.allegro.api.client.model.RefundLineItem; +import pl.wtx.allegro.api.client.model.RefundOrder; +import pl.wtx.allegro.api.client.model.RefundPayment; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * InitializeRefund + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class InitializeRefund { + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nonnull + private RefundPayment payment; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + @javax.annotation.Nullable + private RefundOrder order; + + public static final String SERIALIZED_NAME_COMMAND_ID = "commandId"; + @SerializedName(SERIALIZED_NAME_COMMAND_ID) + @javax.annotation.Nullable + private String commandId; + + /** + * Reason for a payment refund. + */ + @JsonAdapter(ReasonEnum.Adapter.class) + public enum ReasonEnum { + REFUND("REFUND"), + + COMPLAINT("COMPLAINT"), + + PRODUCT_NOT_AVAILABLE("PRODUCT_NOT_AVAILABLE"), + + PAID_VALUE_TOO_LOW("PAID_VALUE_TOO_LOW"), + + OVERPAID("OVERPAID"), + + CANCELLED_BY_BUYER("CANCELLED_BY_BUYER"), + + NOT_COLLECTED("NOT_COLLECTED"); + + private String value; + + ReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ReasonEnum fromValue(String value) { + for (ReasonEnum b : ReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReasonEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ReasonEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nonnull + private ReasonEnum reason; + + public static final String SERIALIZED_NAME_LINE_ITEMS = "lineItems"; + @SerializedName(SERIALIZED_NAME_LINE_ITEMS) + @javax.annotation.Nullable + private List lineItems = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private InitializeRefundDelivery delivery; + + public static final String SERIALIZED_NAME_OVERPAID = "overpaid"; + @SerializedName(SERIALIZED_NAME_OVERPAID) + @javax.annotation.Nullable + private InitializeRefundOverpaid overpaid; + + public static final String SERIALIZED_NAME_SURCHARGES = "surcharges"; + @SerializedName(SERIALIZED_NAME_SURCHARGES) + @javax.annotation.Nullable + private List surcharges = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private InitializeRefundAdditionalServices additionalServices; + + public static final String SERIALIZED_NAME_SELLER_COMMENT = "sellerComment"; + @SerializedName(SERIALIZED_NAME_SELLER_COMMENT) + @javax.annotation.Nullable + private String sellerComment; + + public InitializeRefund() { + } + + public InitializeRefund payment(@javax.annotation.Nonnull RefundPayment payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nonnull + public RefundPayment getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nonnull RefundPayment payment) { + this.payment = payment; + } + + + public InitializeRefund order(@javax.annotation.Nullable RefundOrder order) { + this.order = order; + return this; + } + + /** + * Get order + * @return order + */ + @javax.annotation.Nullable + public RefundOrder getOrder() { + return order; + } + + public void setOrder(@javax.annotation.Nullable RefundOrder order) { + this.order = order; + } + + + public InitializeRefund commandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + return this; + } + + /** + * Command UUID. If empty, idempotency will not be supported. + * @return commandId + */ + @javax.annotation.Nullable + public String getCommandId() { + return commandId; + } + + public void setCommandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + } + + + public InitializeRefund reason(@javax.annotation.Nonnull ReasonEnum reason) { + this.reason = reason; + return this; + } + + /** + * Reason for a payment refund. + * @return reason + */ + @javax.annotation.Nonnull + public ReasonEnum getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nonnull ReasonEnum reason) { + this.reason = reason; + } + + + public InitializeRefund lineItems(@javax.annotation.Nullable List lineItems) { + this.lineItems = lineItems; + return this; + } + + public InitializeRefund addLineItemsItem(RefundLineItem lineItemsItem) { + if (this.lineItems == null) { + this.lineItems = new ArrayList<>(); + } + this.lineItems.add(lineItemsItem); + return this; + } + + /** + * List of order's line items which can be refunded. + * @return lineItems + */ + @javax.annotation.Nullable + public List getLineItems() { + return lineItems; + } + + public void setLineItems(@javax.annotation.Nullable List lineItems) { + this.lineItems = lineItems; + } + + + public InitializeRefund delivery(@javax.annotation.Nullable InitializeRefundDelivery delivery) { + this.delivery = delivery; + return this; + } + + /** + * Get delivery + * @return delivery + */ + @javax.annotation.Nullable + public InitializeRefundDelivery getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable InitializeRefundDelivery delivery) { + this.delivery = delivery; + } + + + public InitializeRefund overpaid(@javax.annotation.Nullable InitializeRefundOverpaid overpaid) { + this.overpaid = overpaid; + return this; + } + + /** + * Get overpaid + * @return overpaid + */ + @javax.annotation.Nullable + public InitializeRefundOverpaid getOverpaid() { + return overpaid; + } + + public void setOverpaid(@javax.annotation.Nullable InitializeRefundOverpaid overpaid) { + this.overpaid = overpaid; + } + + + public InitializeRefund surcharges(@javax.annotation.Nullable List surcharges) { + this.surcharges = surcharges; + return this; + } + + public InitializeRefund addSurchargesItem(PaymentsSurcharge surchargesItem) { + if (this.surcharges == null) { + this.surcharges = new ArrayList<>(); + } + this.surcharges.add(surchargesItem); + return this; + } + + /** + * List of surcharges for payment which can be refunded. + * @return surcharges + */ + @javax.annotation.Nullable + public List getSurcharges() { + return surcharges; + } + + public void setSurcharges(@javax.annotation.Nullable List surcharges) { + this.surcharges = surcharges; + } + + + public InitializeRefund additionalServices(@javax.annotation.Nullable InitializeRefundAdditionalServices additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nullable + public InitializeRefundAdditionalServices getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable InitializeRefundAdditionalServices additionalServices) { + this.additionalServices = additionalServices; + } + + + public InitializeRefund sellerComment(@javax.annotation.Nullable String sellerComment) { + this.sellerComment = sellerComment; + return this; + } + + /** + * Sellers optional justification for refund. + * @return sellerComment + */ + @javax.annotation.Nullable + public String getSellerComment() { + return sellerComment; + } + + public void setSellerComment(@javax.annotation.Nullable String sellerComment) { + this.sellerComment = sellerComment; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InitializeRefund initializeRefund = (InitializeRefund) o; + return Objects.equals(this.payment, initializeRefund.payment) && + Objects.equals(this.order, initializeRefund.order) && + Objects.equals(this.commandId, initializeRefund.commandId) && + Objects.equals(this.reason, initializeRefund.reason) && + Objects.equals(this.lineItems, initializeRefund.lineItems) && + Objects.equals(this.delivery, initializeRefund.delivery) && + Objects.equals(this.overpaid, initializeRefund.overpaid) && + Objects.equals(this.surcharges, initializeRefund.surcharges) && + Objects.equals(this.additionalServices, initializeRefund.additionalServices) && + Objects.equals(this.sellerComment, initializeRefund.sellerComment); + } + + @Override + public int hashCode() { + return Objects.hash(payment, order, commandId, reason, lineItems, delivery, overpaid, surcharges, additionalServices, sellerComment); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InitializeRefund {\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" commandId: ").append(toIndentedString(commandId)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" overpaid: ").append(toIndentedString(overpaid)).append("\n"); + sb.append(" surcharges: ").append(toIndentedString(surcharges)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append(" sellerComment: ").append(toIndentedString(sellerComment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("payment"); + openapiFields.add("order"); + openapiFields.add("commandId"); + openapiFields.add("reason"); + openapiFields.add("lineItems"); + openapiFields.add("delivery"); + openapiFields.add("overpaid"); + openapiFields.add("surcharges"); + openapiFields.add("additionalServices"); + openapiFields.add("sellerComment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payment"); + openapiRequiredFields.add("reason"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InitializeRefund + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InitializeRefund.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InitializeRefund is not found in the empty JSON string", InitializeRefund.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InitializeRefund.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InitializeRefund` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InitializeRefund.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `payment` + RefundPayment.validateJsonElement(jsonObj.get("payment")); + // validate the optional field `order` + if (jsonObj.get("order") != null && !jsonObj.get("order").isJsonNull()) { + RefundOrder.validateJsonElement(jsonObj.get("order")); + } + if ((jsonObj.get("commandId") != null && !jsonObj.get("commandId").isJsonNull()) && !jsonObj.get("commandId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commandId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commandId").toString())); + } + if (!jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + // validate the required field `reason` + ReasonEnum.validateJsonElement(jsonObj.get("reason")); + if (jsonObj.get("lineItems") != null && !jsonObj.get("lineItems").isJsonNull()) { + JsonArray jsonArraylineItems = jsonObj.getAsJsonArray("lineItems"); + if (jsonArraylineItems != null) { + // ensure the json data is an array + if (!jsonObj.get("lineItems").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `lineItems` to be an array in the JSON string but got `%s`", jsonObj.get("lineItems").toString())); + } + + // validate the optional field `lineItems` (array) + for (int i = 0; i < jsonArraylineItems.size(); i++) { + RefundLineItem.validateJsonElement(jsonArraylineItems.get(i)); + }; + } + } + // validate the optional field `delivery` + if (jsonObj.get("delivery") != null && !jsonObj.get("delivery").isJsonNull()) { + InitializeRefundDelivery.validateJsonElement(jsonObj.get("delivery")); + } + // validate the optional field `overpaid` + if (jsonObj.get("overpaid") != null && !jsonObj.get("overpaid").isJsonNull()) { + InitializeRefundOverpaid.validateJsonElement(jsonObj.get("overpaid")); + } + if (jsonObj.get("surcharges") != null && !jsonObj.get("surcharges").isJsonNull()) { + JsonArray jsonArraysurcharges = jsonObj.getAsJsonArray("surcharges"); + if (jsonArraysurcharges != null) { + // ensure the json data is an array + if (!jsonObj.get("surcharges").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `surcharges` to be an array in the JSON string but got `%s`", jsonObj.get("surcharges").toString())); + } + + // validate the optional field `surcharges` (array) + for (int i = 0; i < jsonArraysurcharges.size(); i++) { + PaymentsSurcharge.validateJsonElement(jsonArraysurcharges.get(i)); + }; + } + } + // validate the optional field `additionalServices` + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull()) { + InitializeRefundAdditionalServices.validateJsonElement(jsonObj.get("additionalServices")); + } + if ((jsonObj.get("sellerComment") != null && !jsonObj.get("sellerComment").isJsonNull()) && !jsonObj.get("sellerComment").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sellerComment` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sellerComment").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InitializeRefund.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InitializeRefund' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InitializeRefund.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InitializeRefund value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InitializeRefund read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InitializeRefund given an JSON string + * + * @param jsonString JSON string + * @return An instance of InitializeRefund + * @throws IOException if the JSON string is invalid with respect to InitializeRefund + */ + public static InitializeRefund fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InitializeRefund.class); + } + + /** + * Convert an instance of InitializeRefund to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundAdditionalServices.java b/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundAdditionalServices.java new file mode 100644 index 0000000..c4199b6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundAdditionalServices.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.RefundAdditionalServicesValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Payment refund for additional services. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class InitializeRefundAdditionalServices { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private RefundAdditionalServicesValue value; + + public InitializeRefundAdditionalServices() { + } + + public InitializeRefundAdditionalServices value(@javax.annotation.Nullable RefundAdditionalServicesValue value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public RefundAdditionalServicesValue getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable RefundAdditionalServicesValue value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InitializeRefundAdditionalServices initializeRefundAdditionalServices = (InitializeRefundAdditionalServices) o; + return Objects.equals(this.value, initializeRefundAdditionalServices.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InitializeRefundAdditionalServices {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InitializeRefundAdditionalServices + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InitializeRefundAdditionalServices.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InitializeRefundAdditionalServices is not found in the empty JSON string", InitializeRefundAdditionalServices.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InitializeRefundAdditionalServices.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InitializeRefundAdditionalServices` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `value` + if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { + RefundAdditionalServicesValue.validateJsonElement(jsonObj.get("value")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InitializeRefundAdditionalServices.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InitializeRefundAdditionalServices' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InitializeRefundAdditionalServices.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InitializeRefundAdditionalServices value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InitializeRefundAdditionalServices read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InitializeRefundAdditionalServices given an JSON string + * + * @param jsonString JSON string + * @return An instance of InitializeRefundAdditionalServices + * @throws IOException if the JSON string is invalid with respect to InitializeRefundAdditionalServices + */ + public static InitializeRefundAdditionalServices fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InitializeRefundAdditionalServices.class); + } + + /** + * Convert an instance of InitializeRefundAdditionalServices to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundDelivery.java b/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundDelivery.java new file mode 100644 index 0000000..50a26fd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundDelivery.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.RefundDeliveryValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Payment refund for delivery. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class InitializeRefundDelivery { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private RefundDeliveryValue value; + + public InitializeRefundDelivery() { + } + + public InitializeRefundDelivery value(@javax.annotation.Nullable RefundDeliveryValue value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public RefundDeliveryValue getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable RefundDeliveryValue value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InitializeRefundDelivery initializeRefundDelivery = (InitializeRefundDelivery) o; + return Objects.equals(this.value, initializeRefundDelivery.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InitializeRefundDelivery {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InitializeRefundDelivery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InitializeRefundDelivery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InitializeRefundDelivery is not found in the empty JSON string", InitializeRefundDelivery.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InitializeRefundDelivery.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InitializeRefundDelivery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `value` + if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { + RefundDeliveryValue.validateJsonElement(jsonObj.get("value")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InitializeRefundDelivery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InitializeRefundDelivery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InitializeRefundDelivery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InitializeRefundDelivery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InitializeRefundDelivery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InitializeRefundDelivery given an JSON string + * + * @param jsonString JSON string + * @return An instance of InitializeRefundDelivery + * @throws IOException if the JSON string is invalid with respect to InitializeRefundDelivery + */ + public static InitializeRefundDelivery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InitializeRefundDelivery.class); + } + + /** + * Convert an instance of InitializeRefundDelivery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundOverpaid.java b/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundOverpaid.java new file mode 100644 index 0000000..975e366 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/InitializeRefundOverpaid.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.RefundOverpaidValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Payment refund for overpaid. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class InitializeRefundOverpaid { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private RefundOverpaidValue value; + + public InitializeRefundOverpaid() { + } + + public InitializeRefundOverpaid value(@javax.annotation.Nullable RefundOverpaidValue value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public RefundOverpaidValue getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable RefundOverpaidValue value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InitializeRefundOverpaid initializeRefundOverpaid = (InitializeRefundOverpaid) o; + return Objects.equals(this.value, initializeRefundOverpaid.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InitializeRefundOverpaid {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InitializeRefundOverpaid + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InitializeRefundOverpaid.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InitializeRefundOverpaid is not found in the empty JSON string", InitializeRefundOverpaid.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InitializeRefundOverpaid.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InitializeRefundOverpaid` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `value` + if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { + RefundOverpaidValue.validateJsonElement(jsonObj.get("value")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InitializeRefundOverpaid.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InitializeRefundOverpaid' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InitializeRefundOverpaid.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InitializeRefundOverpaid value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InitializeRefundOverpaid read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InitializeRefundOverpaid given an JSON string + * + * @param jsonString JSON string + * @return An instance of InitializeRefundOverpaid + * @throws IOException if the JSON string is invalid with respect to InitializeRefundOverpaid + */ + public static InitializeRefundOverpaid fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InitializeRefundOverpaid.class); + } + + /** + * Convert an instance of InitializeRefundOverpaid to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/InsuranceDto.java b/src/main/java/pl/wtx/allegro/api/client/model/InsuranceDto.java new file mode 100644 index 0000000..210b93c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/InsuranceDto.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * InsuranceDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class InsuranceDto { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public InsuranceDto() { + } + + public InsuranceDto amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * Additional parcel protection value + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public InsuranceDto currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * ISO 4217 currency code. + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InsuranceDto insuranceDto = (InsuranceDto) o; + return Objects.equals(this.amount, insuranceDto.amount) && + Objects.equals(this.currency, insuranceDto.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InsuranceDto {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InsuranceDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InsuranceDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InsuranceDto is not found in the empty JSON string", InsuranceDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!InsuranceDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `InsuranceDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InsuranceDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InsuranceDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InsuranceDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InsuranceDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InsuranceDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public InsuranceDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InsuranceDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of InsuranceDto + * @throws IOException if the JSON string is invalid with respect to InsuranceDto + */ + public static InsuranceDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InsuranceDto.class); + } + + /** + * Convert an instance of InsuranceDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryParameter.java new file mode 100644 index 0000000..98a71a2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryParameter.java @@ -0,0 +1,257 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.CategoryParameter; +import pl.wtx.allegro.api.client.model.CategoryParameterDisplayConditions; +import pl.wtx.allegro.api.client.model.CategoryParameterOptions; +import pl.wtx.allegro.api.client.model.CategoryParameterRequirementConditions; +import pl.wtx.allegro.api.client.model.IntegerCategoryProductParameterAllOfRestrictions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * IntegerCategoryParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class IntegerCategoryParameter extends CategoryParameter { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "integer"; + + public static final String SERIALIZED_NAME_RESTRICTIONS = "restrictions"; + @SerializedName(SERIALIZED_NAME_RESTRICTIONS) + @javax.annotation.Nullable + private IntegerCategoryProductParameterAllOfRestrictions restrictions; + + public IntegerCategoryParameter() { + this.type = this.getClass().getSimpleName(); + } + + public IntegerCategoryParameter type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public IntegerCategoryParameter restrictions(@javax.annotation.Nullable IntegerCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + * Get restrictions + * @return restrictions + */ + @javax.annotation.Nullable + public IntegerCategoryProductParameterAllOfRestrictions getRestrictions() { + return restrictions; + } + + public void setRestrictions(@javax.annotation.Nullable IntegerCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegerCategoryParameter integerCategoryParameter = (IntegerCategoryParameter) o; + return Objects.equals(this.type, integerCategoryParameter.type) && + Objects.equals(this.restrictions, integerCategoryParameter.restrictions) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, restrictions, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegerCategoryParameter {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" restrictions: ").append(toIndentedString(restrictions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("required"); + openapiFields.add("requiredForProduct"); + openapiFields.add("requiredIf"); + openapiFields.add("displayedIf"); + openapiFields.add("unit"); + openapiFields.add("options"); + openapiFields.add("restrictions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IntegerCategoryParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IntegerCategoryParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IntegerCategoryParameter is not found in the empty JSON string", IntegerCategoryParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IntegerCategoryParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IntegerCategoryParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IntegerCategoryParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IntegerCategoryParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IntegerCategoryParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IntegerCategoryParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IntegerCategoryParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IntegerCategoryParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of IntegerCategoryParameter + * @throws IOException if the JSON string is invalid with respect to IntegerCategoryParameter + */ + public static IntegerCategoryParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IntegerCategoryParameter.class); + } + + /** + * Convert an instance of IntegerCategoryParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryProductParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryProductParameter.java new file mode 100644 index 0000000..c4512ff --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryProductParameter.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.CategoryParameterDisplayConditions; +import pl.wtx.allegro.api.client.model.CategoryParameterRequirementConditions; +import pl.wtx.allegro.api.client.model.CategoryProductParameter; +import pl.wtx.allegro.api.client.model.IntegerCategoryProductParameterAllOfRestrictions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * IntegerCategoryProductParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class IntegerCategoryProductParameter extends CategoryProductParameter { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "integer"; + + public static final String SERIALIZED_NAME_RESTRICTIONS = "restrictions"; + @SerializedName(SERIALIZED_NAME_RESTRICTIONS) + @javax.annotation.Nullable + private IntegerCategoryProductParameterAllOfRestrictions restrictions; + + public IntegerCategoryProductParameter() { + this.type = this.getClass().getSimpleName(); + } + + public IntegerCategoryProductParameter type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public IntegerCategoryProductParameter restrictions(@javax.annotation.Nullable IntegerCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + * Get restrictions + * @return restrictions + */ + @javax.annotation.Nullable + public IntegerCategoryProductParameterAllOfRestrictions getRestrictions() { + return restrictions; + } + + public void setRestrictions(@javax.annotation.Nullable IntegerCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegerCategoryProductParameter integerCategoryProductParameter = (IntegerCategoryProductParameter) o; + return Objects.equals(this.type, integerCategoryProductParameter.type) && + Objects.equals(this.restrictions, integerCategoryProductParameter.restrictions) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, restrictions, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegerCategoryProductParameter {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" restrictions: ").append(toIndentedString(restrictions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("required"); + openapiFields.add("requiredIf"); + openapiFields.add("displayedIf"); + openapiFields.add("unit"); + openapiFields.add("restrictions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IntegerCategoryProductParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IntegerCategoryProductParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IntegerCategoryProductParameter is not found in the empty JSON string", IntegerCategoryProductParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IntegerCategoryProductParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IntegerCategoryProductParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IntegerCategoryProductParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IntegerCategoryProductParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IntegerCategoryProductParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IntegerCategoryProductParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IntegerCategoryProductParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IntegerCategoryProductParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of IntegerCategoryProductParameter + * @throws IOException if the JSON string is invalid with respect to IntegerCategoryProductParameter + */ + public static IntegerCategoryProductParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IntegerCategoryProductParameter.class); + } + + /** + * Convert an instance of IntegerCategoryProductParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryProductParameterAllOfRestrictions.java b/src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryProductParameterAllOfRestrictions.java new file mode 100644 index 0000000..d4b7f4c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/IntegerCategoryProductParameterAllOfRestrictions.java @@ -0,0 +1,257 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The restrictions on values of this parameter. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class IntegerCategoryProductParameterAllOfRestrictions { + public static final String SERIALIZED_NAME_MIN = "min"; + @SerializedName(SERIALIZED_NAME_MIN) + @javax.annotation.Nullable + private Integer min; + + public static final String SERIALIZED_NAME_MAX = "max"; + @SerializedName(SERIALIZED_NAME_MAX) + @javax.annotation.Nullable + private Integer max; + + public static final String SERIALIZED_NAME_RANGE = "range"; + @SerializedName(SERIALIZED_NAME_RANGE) + @javax.annotation.Nullable + private Boolean range; + + public IntegerCategoryProductParameterAllOfRestrictions() { + } + + public IntegerCategoryProductParameterAllOfRestrictions min(@javax.annotation.Nullable Integer min) { + this.min = min; + return this; + } + + /** + * The minimum value of this parameter. Lower than or equal to `max`. + * @return min + */ + @javax.annotation.Nullable + public Integer getMin() { + return min; + } + + public void setMin(@javax.annotation.Nullable Integer min) { + this.min = min; + } + + + public IntegerCategoryProductParameterAllOfRestrictions max(@javax.annotation.Nullable Integer max) { + this.max = max; + return this; + } + + /** + * The maximum value of this parameter. Greater than or equal to `min`. + * @return max + */ + @javax.annotation.Nullable + public Integer getMax() { + return max; + } + + public void setMax(@javax.annotation.Nullable Integer max) { + this.max = max; + } + + + public IntegerCategoryProductParameterAllOfRestrictions range(@javax.annotation.Nullable Boolean range) { + this.range = range; + return this; + } + + /** + * Indicates whether this is a range parameter. If this is `true`, then you have to provide two values for this parameter - `from` and `to`. Both these values have to be between the `min` and `max`. + * @return range + */ + @javax.annotation.Nullable + public Boolean getRange() { + return range; + } + + public void setRange(@javax.annotation.Nullable Boolean range) { + this.range = range; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegerCategoryProductParameterAllOfRestrictions integerCategoryProductParameterAllOfRestrictions = (IntegerCategoryProductParameterAllOfRestrictions) o; + return Objects.equals(this.min, integerCategoryProductParameterAllOfRestrictions.min) && + Objects.equals(this.max, integerCategoryProductParameterAllOfRestrictions.max) && + Objects.equals(this.range, integerCategoryProductParameterAllOfRestrictions.range); + } + + @Override + public int hashCode() { + return Objects.hash(min, max, range); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegerCategoryProductParameterAllOfRestrictions {\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" range: ").append(toIndentedString(range)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("min"); + openapiFields.add("max"); + openapiFields.add("range"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IntegerCategoryProductParameterAllOfRestrictions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IntegerCategoryProductParameterAllOfRestrictions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IntegerCategoryProductParameterAllOfRestrictions is not found in the empty JSON string", IntegerCategoryProductParameterAllOfRestrictions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!IntegerCategoryProductParameterAllOfRestrictions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IntegerCategoryProductParameterAllOfRestrictions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IntegerCategoryProductParameterAllOfRestrictions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IntegerCategoryProductParameterAllOfRestrictions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IntegerCategoryProductParameterAllOfRestrictions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IntegerCategoryProductParameterAllOfRestrictions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public IntegerCategoryProductParameterAllOfRestrictions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IntegerCategoryProductParameterAllOfRestrictions given an JSON string + * + * @param jsonString JSON string + * @return An instance of IntegerCategoryProductParameterAllOfRestrictions + * @throws IOException if the JSON string is invalid with respect to IntegerCategoryProductParameterAllOfRestrictions + */ + public static IntegerCategoryProductParameterAllOfRestrictions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IntegerCategoryProductParameterAllOfRestrictions.class); + } + + /** + * Convert an instance of IntegerCategoryProductParameterAllOfRestrictions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Interlocutor.java b/src/main/java/pl/wtx/allegro/api/client/model/Interlocutor.java new file mode 100644 index 0000000..b423f0d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Interlocutor.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Interlocutor + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Interlocutor { + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nonnull + private String login; + + public static final String SERIALIZED_NAME_AVATAR_URL = "avatarUrl"; + @SerializedName(SERIALIZED_NAME_AVATAR_URL) + @javax.annotation.Nonnull + private String avatarUrl; + + public Interlocutor() { + } + + public Interlocutor login(@javax.annotation.Nonnull String login) { + this.login = login; + return this; + } + + /** + * Get login + * @return login + */ + @javax.annotation.Nonnull + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nonnull String login) { + this.login = login; + } + + + public Interlocutor avatarUrl(@javax.annotation.Nonnull String avatarUrl) { + this.avatarUrl = avatarUrl; + return this; + } + + /** + * Get avatarUrl + * @return avatarUrl + */ + @javax.annotation.Nonnull + public String getAvatarUrl() { + return avatarUrl; + } + + public void setAvatarUrl(@javax.annotation.Nonnull String avatarUrl) { + this.avatarUrl = avatarUrl; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Interlocutor interlocutor = (Interlocutor) o; + return Objects.equals(this.login, interlocutor.login) && + Objects.equals(this.avatarUrl, interlocutor.avatarUrl); + } + + @Override + public int hashCode() { + return Objects.hash(login, avatarUrl); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Interlocutor {\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" avatarUrl: ").append(toIndentedString(avatarUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("login"); + openapiFields.add("avatarUrl"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("login"); + openapiRequiredFields.add("avatarUrl"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Interlocutor + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Interlocutor.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Interlocutor is not found in the empty JSON string", Interlocutor.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Interlocutor.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Interlocutor` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Interlocutor.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + if (!jsonObj.get("avatarUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `avatarUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("avatarUrl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Interlocutor.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Interlocutor' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Interlocutor.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Interlocutor value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Interlocutor read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Interlocutor given an JSON string + * + * @param jsonString JSON string + * @return An instance of Interlocutor + * @throws IOException if the JSON string is invalid with respect to Interlocutor + */ + public static Interlocutor fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Interlocutor.class); + } + + /** + * Convert an instance of Interlocutor to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/JustId.java b/src/main/java/pl/wtx/allegro/api/client/model/JustId.java new file mode 100644 index 0000000..65a1e41 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/JustId.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * JustId + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class JustId { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public JustId() { + } + + public JustId id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + JustId justId = (JustId) o; + return Objects.equals(this.id, justId.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class JustId {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to JustId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!JustId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in JustId is not found in the empty JSON string", JustId.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!JustId.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `JustId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!JustId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'JustId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(JustId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, JustId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public JustId read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of JustId given an JSON string + * + * @param jsonString JSON string + * @return An instance of JustId + * @throws IOException if the JSON string is invalid with respect to JustId + */ + public static JustId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, JustId.class); + } + + /** + * Convert an instance of JustId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Justification.java b/src/main/java/pl/wtx/allegro/api/client/model/Justification.java new file mode 100644 index 0000000..329910c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Justification.java @@ -0,0 +1,233 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Justification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Justification { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public static final String SERIALIZED_NAME_VISIBLE_FOR_BUYER = "visibleForBuyer"; + @SerializedName(SERIALIZED_NAME_VISIBLE_FOR_BUYER) + @javax.annotation.Nullable + private Boolean visibleForBuyer; + + public Justification() { + } + + public Justification text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * Text of justification. + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + public Justification visibleForBuyer(@javax.annotation.Nullable Boolean visibleForBuyer) { + this.visibleForBuyer = visibleForBuyer; + return this; + } + + /** + * When set to false, given justification is visible only for the seller and not for the buyer. + * @return visibleForBuyer + */ + @javax.annotation.Nullable + public Boolean getVisibleForBuyer() { + return visibleForBuyer; + } + + public void setVisibleForBuyer(@javax.annotation.Nullable Boolean visibleForBuyer) { + this.visibleForBuyer = visibleForBuyer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Justification justification = (Justification) o; + return Objects.equals(this.text, justification.text) && + Objects.equals(this.visibleForBuyer, justification.visibleForBuyer); + } + + @Override + public int hashCode() { + return Objects.hash(text, visibleForBuyer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Justification {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" visibleForBuyer: ").append(toIndentedString(visibleForBuyer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("text"); + openapiFields.add("visibleForBuyer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Justification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Justification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Justification is not found in the empty JSON string", Justification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Justification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Justification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Justification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Justification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Justification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Justification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Justification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Justification given an JSON string + * + * @param jsonString JSON string + * @return An instance of Justification + * @throws IOException if the JSON string is invalid with respect to Justification + */ + public static Justification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Justification.class); + } + + /** + * Convert an instance of Justification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/LabelRequestDto.java b/src/main/java/pl/wtx/allegro/api/client/model/LabelRequestDto.java new file mode 100644 index 0000000..82aaa36 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/LabelRequestDto.java @@ -0,0 +1,340 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * LabelRequestDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class LabelRequestDto { + public static final String SERIALIZED_NAME_SHIPMENT_IDS = "shipmentIds"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_IDS) + @javax.annotation.Nonnull + private List shipmentIds = new ArrayList<>(); + + /** + * Label page format. Only for PDF file. + */ + @JsonAdapter(PageSizeEnum.Adapter.class) + public enum PageSizeEnum { + A4("A4"), + + A6("A6"); + + private String value; + + PageSizeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PageSizeEnum fromValue(String value) { + for (PageSizeEnum b : PageSizeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PageSizeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PageSizeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PageSizeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + PageSizeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_PAGE_SIZE = "pageSize"; + @SerializedName(SERIALIZED_NAME_PAGE_SIZE) + @javax.annotation.Nullable + private PageSizeEnum pageSize; + + public static final String SERIALIZED_NAME_CUT_LINE = "cutLine"; + @SerializedName(SERIALIZED_NAME_CUT_LINE) + @javax.annotation.Nullable + private Boolean cutLine; + + public LabelRequestDto() { + } + + public LabelRequestDto shipmentIds(@javax.annotation.Nonnull List shipmentIds) { + this.shipmentIds = shipmentIds; + return this; + } + + public LabelRequestDto addShipmentIdsItem(String shipmentIdsItem) { + if (this.shipmentIds == null) { + this.shipmentIds = new ArrayList<>(); + } + this.shipmentIds.add(shipmentIdsItem); + return this; + } + + /** + * Get shipmentIds + * @return shipmentIds + */ + @javax.annotation.Nonnull + public List getShipmentIds() { + return shipmentIds; + } + + public void setShipmentIds(@javax.annotation.Nonnull List shipmentIds) { + this.shipmentIds = shipmentIds; + } + + + public LabelRequestDto pageSize(@javax.annotation.Nullable PageSizeEnum pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Label page format. Only for PDF file. + * @return pageSize + */ + @javax.annotation.Nullable + public PageSizeEnum getPageSize() { + return pageSize; + } + + public void setPageSize(@javax.annotation.Nullable PageSizeEnum pageSize) { + this.pageSize = pageSize; + } + + + public LabelRequestDto cutLine(@javax.annotation.Nullable Boolean cutLine) { + this.cutLine = cutLine; + return this; + } + + /** + * Put additional cut lines. Only for PDF file with A4 size. + * @return cutLine + */ + @javax.annotation.Nullable + public Boolean getCutLine() { + return cutLine; + } + + public void setCutLine(@javax.annotation.Nullable Boolean cutLine) { + this.cutLine = cutLine; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LabelRequestDto labelRequestDto = (LabelRequestDto) o; + return Objects.equals(this.shipmentIds, labelRequestDto.shipmentIds) && + Objects.equals(this.pageSize, labelRequestDto.pageSize) && + Objects.equals(this.cutLine, labelRequestDto.cutLine); + } + + @Override + public int hashCode() { + return Objects.hash(shipmentIds, pageSize, cutLine); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LabelRequestDto {\n"); + sb.append(" shipmentIds: ").append(toIndentedString(shipmentIds)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" cutLine: ").append(toIndentedString(cutLine)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shipmentIds"); + openapiFields.add("pageSize"); + openapiFields.add("cutLine"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("shipmentIds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LabelRequestDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LabelRequestDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LabelRequestDto is not found in the empty JSON string", LabelRequestDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LabelRequestDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LabelRequestDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : LabelRequestDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("shipmentIds") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("shipmentIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `shipmentIds` to be an array in the JSON string but got `%s`", jsonObj.get("shipmentIds").toString())); + } + if ((jsonObj.get("pageSize") != null && !jsonObj.get("pageSize").isJsonNull()) && !jsonObj.get("pageSize").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `pageSize` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pageSize").toString())); + } + // validate the optional field `pageSize` + if (jsonObj.get("pageSize") != null && !jsonObj.get("pageSize").isJsonNull()) { + PageSizeEnum.validateJsonElement(jsonObj.get("pageSize")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LabelRequestDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LabelRequestDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LabelRequestDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LabelRequestDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LabelRequestDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LabelRequestDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of LabelRequestDto + * @throws IOException if the JSON string is invalid with respect to LabelRequestDto + */ + public static LabelRequestDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LabelRequestDto.class); + } + + /** + * Convert an instance of LabelRequestDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Labels.java b/src/main/java/pl/wtx/allegro/api/client/model/Labels.java new file mode 100644 index 0000000..fe9a2a2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Labels.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents created labels. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Labels { + public static final String SERIALIZED_NAME_FILE_URL = "fileUrl"; + @SerializedName(SERIALIZED_NAME_FILE_URL) + @javax.annotation.Nullable + private String fileUrl; + + public Labels() { + } + + public Labels fileUrl(@javax.annotation.Nullable String fileUrl) { + this.fileUrl = fileUrl; + return this; + } + + /** + * An URI to file containing labels. + * @return fileUrl + */ + @javax.annotation.Nullable + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(@javax.annotation.Nullable String fileUrl) { + this.fileUrl = fileUrl; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Labels labels = (Labels) o; + return Objects.equals(this.fileUrl, labels.fileUrl); + } + + @Override + public int hashCode() { + return Objects.hash(fileUrl); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Labels {\n"); + sb.append(" fileUrl: ").append(toIndentedString(fileUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fileUrl"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Labels + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Labels.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Labels is not found in the empty JSON string", Labels.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Labels.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Labels` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("fileUrl") != null && !jsonObj.get("fileUrl").isJsonNull()) && !jsonObj.get("fileUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fileUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fileUrl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Labels.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Labels' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Labels.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Labels value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Labels read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Labels given an JSON string + * + * @param jsonString JSON string + * @return An instance of Labels + * @throws IOException if the JSON string is invalid with respect to Labels + */ + public static Labels fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Labels.class); + } + + /** + * Convert an instance of Labels to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecification.java b/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecification.java new file mode 100644 index 0000000..ab72686 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecification.java @@ -0,0 +1,252 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BenefitSpecification; +import pl.wtx.allegro.api.client.model.LargeOrderDiscountBenefitSpecificationAllOfThresholds; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * LargeOrderDiscountBenefitSpecification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class LargeOrderDiscountBenefitSpecification extends BenefitSpecification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "LARGE_ORDER_DISCOUNT"; + + public static final String SERIALIZED_NAME_THRESHOLDS = "thresholds"; + @SerializedName(SERIALIZED_NAME_THRESHOLDS) + @javax.annotation.Nonnull + private List thresholds = new ArrayList<>(); + + public LargeOrderDiscountBenefitSpecification() { + this.type = this.getClass().getSimpleName(); + } + + public LargeOrderDiscountBenefitSpecification type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public LargeOrderDiscountBenefitSpecification thresholds(@javax.annotation.Nonnull List thresholds) { + this.thresholds = thresholds; + return this; + } + + public LargeOrderDiscountBenefitSpecification addThresholdsItem(LargeOrderDiscountBenefitSpecificationAllOfThresholds thresholdsItem) { + if (this.thresholds == null) { + this.thresholds = new ArrayList<>(); + } + this.thresholds.add(thresholdsItem); + return this; + } + + /** + * List of order discount thresholds. A threshold with a higher orderValue.lowerBound.amount than another one must also have a higher discount.percentage. + * @return thresholds + */ + @javax.annotation.Nonnull + public List getThresholds() { + return thresholds; + } + + public void setThresholds(@javax.annotation.Nonnull List thresholds) { + this.thresholds = thresholds; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LargeOrderDiscountBenefitSpecification largeOrderDiscountBenefitSpecification = (LargeOrderDiscountBenefitSpecification) o; + return Objects.equals(this.type, largeOrderDiscountBenefitSpecification.type) && + Objects.equals(this.thresholds, largeOrderDiscountBenefitSpecification.thresholds) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, thresholds, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LargeOrderDiscountBenefitSpecification {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" thresholds: ").append(toIndentedString(thresholds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("thresholds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("thresholds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LargeOrderDiscountBenefitSpecification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LargeOrderDiscountBenefitSpecification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LargeOrderDiscountBenefitSpecification is not found in the empty JSON string", LargeOrderDiscountBenefitSpecification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LargeOrderDiscountBenefitSpecification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LargeOrderDiscountBenefitSpecification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : LargeOrderDiscountBenefitSpecification.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LargeOrderDiscountBenefitSpecification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LargeOrderDiscountBenefitSpecification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LargeOrderDiscountBenefitSpecification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LargeOrderDiscountBenefitSpecification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LargeOrderDiscountBenefitSpecification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LargeOrderDiscountBenefitSpecification given an JSON string + * + * @param jsonString JSON string + * @return An instance of LargeOrderDiscountBenefitSpecification + * @throws IOException if the JSON string is invalid with respect to LargeOrderDiscountBenefitSpecification + */ + public static LargeOrderDiscountBenefitSpecification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LargeOrderDiscountBenefitSpecification.class); + } + + /** + * Convert an instance of LargeOrderDiscountBenefitSpecification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfDiscount.java b/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfDiscount.java new file mode 100644 index 0000000..05d12db --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfDiscount.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * LargeOrderDiscountBenefitSpecificationAllOfDiscount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class LargeOrderDiscountBenefitSpecificationAllOfDiscount { + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + @javax.annotation.Nonnull + private String percentage; + + public LargeOrderDiscountBenefitSpecificationAllOfDiscount() { + } + + public LargeOrderDiscountBenefitSpecificationAllOfDiscount percentage(@javax.annotation.Nonnull String percentage) { + this.percentage = percentage; + return this; + } + + /** + * Discount percentage applied when the threshold is applied. The fractional part must be equal to 0. + * @return percentage + */ + @javax.annotation.Nonnull + public String getPercentage() { + return percentage; + } + + public void setPercentage(@javax.annotation.Nonnull String percentage) { + this.percentage = percentage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LargeOrderDiscountBenefitSpecificationAllOfDiscount largeOrderDiscountBenefitSpecificationAllOfDiscount = (LargeOrderDiscountBenefitSpecificationAllOfDiscount) o; + return Objects.equals(this.percentage, largeOrderDiscountBenefitSpecificationAllOfDiscount.percentage); + } + + @Override + public int hashCode() { + return Objects.hash(percentage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LargeOrderDiscountBenefitSpecificationAllOfDiscount {\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("percentage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("percentage"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LargeOrderDiscountBenefitSpecificationAllOfDiscount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LargeOrderDiscountBenefitSpecificationAllOfDiscount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LargeOrderDiscountBenefitSpecificationAllOfDiscount is not found in the empty JSON string", LargeOrderDiscountBenefitSpecificationAllOfDiscount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LargeOrderDiscountBenefitSpecificationAllOfDiscount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LargeOrderDiscountBenefitSpecificationAllOfDiscount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : LargeOrderDiscountBenefitSpecificationAllOfDiscount.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("percentage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `percentage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("percentage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LargeOrderDiscountBenefitSpecificationAllOfDiscount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LargeOrderDiscountBenefitSpecificationAllOfDiscount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LargeOrderDiscountBenefitSpecificationAllOfDiscount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LargeOrderDiscountBenefitSpecificationAllOfDiscount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LargeOrderDiscountBenefitSpecificationAllOfDiscount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LargeOrderDiscountBenefitSpecificationAllOfDiscount given an JSON string + * + * @param jsonString JSON string + * @return An instance of LargeOrderDiscountBenefitSpecificationAllOfDiscount + * @throws IOException if the JSON string is invalid with respect to LargeOrderDiscountBenefitSpecificationAllOfDiscount + */ + public static LargeOrderDiscountBenefitSpecificationAllOfDiscount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LargeOrderDiscountBenefitSpecificationAllOfDiscount.class); + } + + /** + * Convert an instance of LargeOrderDiscountBenefitSpecificationAllOfDiscount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfOrderValue.java b/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfOrderValue.java new file mode 100644 index 0000000..df6ba68 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfOrderValue.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * LargeOrderDiscountBenefitSpecificationAllOfOrderValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class LargeOrderDiscountBenefitSpecificationAllOfOrderValue { + public static final String SERIALIZED_NAME_LOWER_BOUND = "lowerBound"; + @SerializedName(SERIALIZED_NAME_LOWER_BOUND) + @javax.annotation.Nonnull + private Price lowerBound; + + public LargeOrderDiscountBenefitSpecificationAllOfOrderValue() { + } + + public LargeOrderDiscountBenefitSpecificationAllOfOrderValue lowerBound(@javax.annotation.Nonnull Price lowerBound) { + this.lowerBound = lowerBound; + return this; + } + + /** + * Get lowerBound + * @return lowerBound + */ + @javax.annotation.Nonnull + public Price getLowerBound() { + return lowerBound; + } + + public void setLowerBound(@javax.annotation.Nonnull Price lowerBound) { + this.lowerBound = lowerBound; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LargeOrderDiscountBenefitSpecificationAllOfOrderValue largeOrderDiscountBenefitSpecificationAllOfOrderValue = (LargeOrderDiscountBenefitSpecificationAllOfOrderValue) o; + return Objects.equals(this.lowerBound, largeOrderDiscountBenefitSpecificationAllOfOrderValue.lowerBound); + } + + @Override + public int hashCode() { + return Objects.hash(lowerBound); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LargeOrderDiscountBenefitSpecificationAllOfOrderValue {\n"); + sb.append(" lowerBound: ").append(toIndentedString(lowerBound)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("lowerBound"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("lowerBound"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LargeOrderDiscountBenefitSpecificationAllOfOrderValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LargeOrderDiscountBenefitSpecificationAllOfOrderValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LargeOrderDiscountBenefitSpecificationAllOfOrderValue is not found in the empty JSON string", LargeOrderDiscountBenefitSpecificationAllOfOrderValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LargeOrderDiscountBenefitSpecificationAllOfOrderValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LargeOrderDiscountBenefitSpecificationAllOfOrderValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : LargeOrderDiscountBenefitSpecificationAllOfOrderValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `lowerBound` + Price.validateJsonElement(jsonObj.get("lowerBound")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LargeOrderDiscountBenefitSpecificationAllOfOrderValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LargeOrderDiscountBenefitSpecificationAllOfOrderValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LargeOrderDiscountBenefitSpecificationAllOfOrderValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LargeOrderDiscountBenefitSpecificationAllOfOrderValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LargeOrderDiscountBenefitSpecificationAllOfOrderValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LargeOrderDiscountBenefitSpecificationAllOfOrderValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of LargeOrderDiscountBenefitSpecificationAllOfOrderValue + * @throws IOException if the JSON string is invalid with respect to LargeOrderDiscountBenefitSpecificationAllOfOrderValue + */ + public static LargeOrderDiscountBenefitSpecificationAllOfOrderValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LargeOrderDiscountBenefitSpecificationAllOfOrderValue.class); + } + + /** + * Convert an instance of LargeOrderDiscountBenefitSpecificationAllOfOrderValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfThresholds.java b/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfThresholds.java new file mode 100644 index 0000000..5cd0198 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/LargeOrderDiscountBenefitSpecificationAllOfThresholds.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.LargeOrderDiscountBenefitSpecificationAllOfDiscount; +import pl.wtx.allegro.api.client.model.LargeOrderDiscountBenefitSpecificationAllOfOrderValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * LargeOrderDiscountBenefitSpecificationAllOfThresholds + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class LargeOrderDiscountBenefitSpecificationAllOfThresholds { + public static final String SERIALIZED_NAME_ORDER_VALUE = "orderValue"; + @SerializedName(SERIALIZED_NAME_ORDER_VALUE) + @javax.annotation.Nonnull + private LargeOrderDiscountBenefitSpecificationAllOfOrderValue orderValue; + + public static final String SERIALIZED_NAME_DISCOUNT = "discount"; + @SerializedName(SERIALIZED_NAME_DISCOUNT) + @javax.annotation.Nonnull + private LargeOrderDiscountBenefitSpecificationAllOfDiscount discount; + + public LargeOrderDiscountBenefitSpecificationAllOfThresholds() { + } + + public LargeOrderDiscountBenefitSpecificationAllOfThresholds orderValue(@javax.annotation.Nonnull LargeOrderDiscountBenefitSpecificationAllOfOrderValue orderValue) { + this.orderValue = orderValue; + return this; + } + + /** + * Get orderValue + * @return orderValue + */ + @javax.annotation.Nonnull + public LargeOrderDiscountBenefitSpecificationAllOfOrderValue getOrderValue() { + return orderValue; + } + + public void setOrderValue(@javax.annotation.Nonnull LargeOrderDiscountBenefitSpecificationAllOfOrderValue orderValue) { + this.orderValue = orderValue; + } + + + public LargeOrderDiscountBenefitSpecificationAllOfThresholds discount(@javax.annotation.Nonnull LargeOrderDiscountBenefitSpecificationAllOfDiscount discount) { + this.discount = discount; + return this; + } + + /** + * Get discount + * @return discount + */ + @javax.annotation.Nonnull + public LargeOrderDiscountBenefitSpecificationAllOfDiscount getDiscount() { + return discount; + } + + public void setDiscount(@javax.annotation.Nonnull LargeOrderDiscountBenefitSpecificationAllOfDiscount discount) { + this.discount = discount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LargeOrderDiscountBenefitSpecificationAllOfThresholds largeOrderDiscountBenefitSpecificationAllOfThresholds = (LargeOrderDiscountBenefitSpecificationAllOfThresholds) o; + return Objects.equals(this.orderValue, largeOrderDiscountBenefitSpecificationAllOfThresholds.orderValue) && + Objects.equals(this.discount, largeOrderDiscountBenefitSpecificationAllOfThresholds.discount); + } + + @Override + public int hashCode() { + return Objects.hash(orderValue, discount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LargeOrderDiscountBenefitSpecificationAllOfThresholds {\n"); + sb.append(" orderValue: ").append(toIndentedString(orderValue)).append("\n"); + sb.append(" discount: ").append(toIndentedString(discount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("orderValue"); + openapiFields.add("discount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("orderValue"); + openapiRequiredFields.add("discount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LargeOrderDiscountBenefitSpecificationAllOfThresholds + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LargeOrderDiscountBenefitSpecificationAllOfThresholds.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LargeOrderDiscountBenefitSpecificationAllOfThresholds is not found in the empty JSON string", LargeOrderDiscountBenefitSpecificationAllOfThresholds.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LargeOrderDiscountBenefitSpecificationAllOfThresholds.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LargeOrderDiscountBenefitSpecificationAllOfThresholds` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : LargeOrderDiscountBenefitSpecificationAllOfThresholds.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `orderValue` + LargeOrderDiscountBenefitSpecificationAllOfOrderValue.validateJsonElement(jsonObj.get("orderValue")); + // validate the required field `discount` + LargeOrderDiscountBenefitSpecificationAllOfDiscount.validateJsonElement(jsonObj.get("discount")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LargeOrderDiscountBenefitSpecificationAllOfThresholds.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LargeOrderDiscountBenefitSpecificationAllOfThresholds' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LargeOrderDiscountBenefitSpecificationAllOfThresholds.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LargeOrderDiscountBenefitSpecificationAllOfThresholds value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LargeOrderDiscountBenefitSpecificationAllOfThresholds read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LargeOrderDiscountBenefitSpecificationAllOfThresholds given an JSON string + * + * @param jsonString JSON string + * @return An instance of LargeOrderDiscountBenefitSpecificationAllOfThresholds + * @throws IOException if the JSON string is invalid with respect to LargeOrderDiscountBenefitSpecificationAllOfThresholds + */ + public static LargeOrderDiscountBenefitSpecificationAllOfThresholds fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LargeOrderDiscountBenefitSpecificationAllOfThresholds.class); + } + + /** + * Convert an instance of LargeOrderDiscountBenefitSpecificationAllOfThresholds to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/LatestOrderEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/LatestOrderEvent.java new file mode 100644 index 0000000..d3e0012 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/LatestOrderEvent.java @@ -0,0 +1,243 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Basic information about the latest order event. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class LatestOrderEvent { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_OCCURRED_AT = "occurredAt"; + @SerializedName(SERIALIZED_NAME_OCCURRED_AT) + @javax.annotation.Nonnull + private OffsetDateTime occurredAt; + + public LatestOrderEvent() { + } + + public LatestOrderEvent id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * event id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public LatestOrderEvent occurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + /** + * Date when the event occurred + * @return occurredAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getOccurredAt() { + return occurredAt; + } + + public void setOccurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LatestOrderEvent latestOrderEvent = (LatestOrderEvent) o; + return Objects.equals(this.id, latestOrderEvent.id) && + Objects.equals(this.occurredAt, latestOrderEvent.occurredAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, occurredAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LatestOrderEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" occurredAt: ").append(toIndentedString(occurredAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LatestOrderEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LatestOrderEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LatestOrderEvent is not found in the empty JSON string", LatestOrderEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LatestOrderEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LatestOrderEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : LatestOrderEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LatestOrderEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LatestOrderEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LatestOrderEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LatestOrderEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LatestOrderEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LatestOrderEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of LatestOrderEvent + * @throws IOException if the JSON string is invalid with respect to LatestOrderEvent + */ + public static LatestOrderEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LatestOrderEvent.class); + } + + /** + * Convert an instance of LatestOrderEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/LimitWithCurrencyDto.java b/src/main/java/pl/wtx/allegro/api/client/model/LimitWithCurrencyDto.java new file mode 100644 index 0000000..bd84066 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/LimitWithCurrencyDto.java @@ -0,0 +1,234 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * LimitWithCurrencyDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class LimitWithCurrencyDto { + public static final String SERIALIZED_NAME_LIMIT = "limit"; + @SerializedName(SERIALIZED_NAME_LIMIT) + @javax.annotation.Nullable + private BigDecimal limit; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public LimitWithCurrencyDto() { + } + + public LimitWithCurrencyDto limit(@javax.annotation.Nullable BigDecimal limit) { + this.limit = limit; + return this; + } + + /** + * Maximum value + * @return limit + */ + @javax.annotation.Nullable + public BigDecimal getLimit() { + return limit; + } + + public void setLimit(@javax.annotation.Nullable BigDecimal limit) { + this.limit = limit; + } + + + public LimitWithCurrencyDto currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * ISO 4217 currency code. Currency code depends on marketplace, e.g. PLN for allegro-pl, CZK for allegro-cz. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LimitWithCurrencyDto limitWithCurrencyDto = (LimitWithCurrencyDto) o; + return Objects.equals(this.limit, limitWithCurrencyDto.limit) && + Objects.equals(this.currency, limitWithCurrencyDto.currency); + } + + @Override + public int hashCode() { + return Objects.hash(limit, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LimitWithCurrencyDto {\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("limit"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LimitWithCurrencyDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LimitWithCurrencyDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LimitWithCurrencyDto is not found in the empty JSON string", LimitWithCurrencyDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LimitWithCurrencyDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LimitWithCurrencyDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LimitWithCurrencyDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LimitWithCurrencyDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LimitWithCurrencyDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LimitWithCurrencyDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LimitWithCurrencyDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LimitWithCurrencyDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of LimitWithCurrencyDto + * @throws IOException if the JSON string is invalid with respect to LimitWithCurrencyDto + */ + public static LimitWithCurrencyDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LimitWithCurrencyDto.class); + } + + /** + * Convert an instance of LimitWithCurrencyDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/LineItemDiscount.java b/src/main/java/pl/wtx/allegro/api/client/model/LineItemDiscount.java new file mode 100644 index 0000000..478b99d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/LineItemDiscount.java @@ -0,0 +1,272 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * LineItemDiscount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class LineItemDiscount { + /** + * Describes the types of discounts used in the lineItems. The types of discounts can be as follows: - `BUNDLE` - a bundle discount (used also for bundles with no price change) - `UNIT_PERCENTAGE_DISCOUNT` - a MULTIPACK or CROSS_MULTIPACK discount - `WHOLESALE_PRICE_LIST` - a wholesale price list discount (a discount for company users only) - `LARGE_ORDER_DISCOUNT` - a large order discount (a discount for company users only) - `TURNOVER_DISCOUNT` - a turnover discount (a discount for company users only) - `COUPON` - a coupon discount - `CAMPAIGN` - a campaign discount + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BUNDLE("BUNDLE"), + + UNIT_PERCENTAGE_DISCOUNT("UNIT_PERCENTAGE_DISCOUNT"), + + WHOLESALE_PRICE_LIST("WHOLESALE_PRICE_LIST"), + + LARGE_ORDER_DISCOUNT("LARGE_ORDER_DISCOUNT"), + + TURNOVER_DISCOUNT("TURNOVER_DISCOUNT"), + + COUPON("COUPON"), + + CAMPAIGN("CAMPAIGN"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public LineItemDiscount() { + } + + public LineItemDiscount type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Describes the types of discounts used in the lineItems. The types of discounts can be as follows: - `BUNDLE` - a bundle discount (used also for bundles with no price change) - `UNIT_PERCENTAGE_DISCOUNT` - a MULTIPACK or CROSS_MULTIPACK discount - `WHOLESALE_PRICE_LIST` - a wholesale price list discount (a discount for company users only) - `LARGE_ORDER_DISCOUNT` - a large order discount (a discount for company users only) - `TURNOVER_DISCOUNT` - a turnover discount (a discount for company users only) - `COUPON` - a coupon discount - `CAMPAIGN` - a campaign discount + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LineItemDiscount lineItemDiscount = (LineItemDiscount) o; + return Objects.equals(this.type, lineItemDiscount.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LineItemDiscount {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LineItemDiscount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LineItemDiscount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LineItemDiscount is not found in the empty JSON string", LineItemDiscount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LineItemDiscount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LineItemDiscount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LineItemDiscount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LineItemDiscount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LineItemDiscount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LineItemDiscount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LineItemDiscount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LineItemDiscount given an JSON string + * + * @param jsonString JSON string + * @return An instance of LineItemDiscount + * @throws IOException if the JSON string is invalid with respect to LineItemDiscount + */ + public static LineItemDiscount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LineItemDiscount.class); + } + + /** + * Convert an instance of LineItemDiscount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/LineItemReconciliation.java b/src/main/java/pl/wtx/allegro/api/client/model/LineItemReconciliation.java new file mode 100644 index 0000000..5cc275a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/LineItemReconciliation.java @@ -0,0 +1,322 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * LineItemReconciliation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class LineItemReconciliation { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private Price value; + + /** + * Reconciliation type used in the Allegro Prices program, in which the offer is included. The following values are possible: * `BILLING` - a reconciliation value is counted as a new entry in the billing * `WALLET` - a reconciliation value is added to the checkout form payment + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + BILLING("BILLING"), + + WALLET("WALLET"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public LineItemReconciliation() { + } + + public LineItemReconciliation value(@javax.annotation.Nullable Price value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public Price getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable Price value) { + this.value = value; + } + + + public LineItemReconciliation type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Reconciliation type used in the Allegro Prices program, in which the offer is included. The following values are possible: * `BILLING` - a reconciliation value is counted as a new entry in the billing * `WALLET` - a reconciliation value is added to the checkout form payment + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public LineItemReconciliation quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Quantity of reconciled items + * minimum: 1 + * @return quantity + */ + @javax.annotation.Nullable + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LineItemReconciliation lineItemReconciliation = (LineItemReconciliation) o; + return Objects.equals(this.value, lineItemReconciliation.value) && + Objects.equals(this.type, lineItemReconciliation.type) && + Objects.equals(this.quantity, lineItemReconciliation.quantity); + } + + @Override + public int hashCode() { + return Objects.hash(value, type, quantity); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LineItemReconciliation {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + openapiFields.add("type"); + openapiFields.add("quantity"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LineItemReconciliation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LineItemReconciliation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LineItemReconciliation is not found in the empty JSON string", LineItemReconciliation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LineItemReconciliation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LineItemReconciliation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `value` + if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("value")); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LineItemReconciliation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LineItemReconciliation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LineItemReconciliation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LineItemReconciliation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LineItemReconciliation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LineItemReconciliation given an JSON string + * + * @param jsonString JSON string + * @return An instance of LineItemReconciliation + * @throws IOException if the JSON string is invalid with respect to LineItemReconciliation + */ + public static LineItemReconciliation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LineItemReconciliation.class); + } + + /** + * Convert an instance of LineItemReconciliation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/LineItemVoucher.java b/src/main/java/pl/wtx/allegro/api/client/model/LineItemVoucher.java new file mode 100644 index 0000000..4a01810 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/LineItemVoucher.java @@ -0,0 +1,444 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.LineItemVoucherValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * LineItemVoucher + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class LineItemVoucher { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + /** + * Describes the types of vouchers used in the lineItems. The types of vouchers can be as follows: * `NOTEBOOKS_FOR_TEACHERS` - a voucher for teacher's notebook action. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + NOTEBOOKS_FOR_TEACHERS("NOTEBOOKS_FOR_TEACHERS"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + /** + * Describes the status of the current voucher. The status of voucher can be as follows: * `ACTIVE` - an active voucher, ready to use, * `CANCELLED` - a cancelled voucher, disabled to use. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVE("ACTIVE"), + + CANCELLED("CANCELLED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_EXTERNAL_TRANSACTION_ID = "externalTransactionId"; + @SerializedName(SERIALIZED_NAME_EXTERNAL_TRANSACTION_ID) + @javax.annotation.Nullable + private String externalTransactionId; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private LineItemVoucherValue value; + + public LineItemVoucher() { + } + + public LineItemVoucher code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * The voucher code. + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public LineItemVoucher type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Describes the types of vouchers used in the lineItems. The types of vouchers can be as follows: * `NOTEBOOKS_FOR_TEACHERS` - a voucher for teacher's notebook action. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public LineItemVoucher status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Describes the status of the current voucher. The status of voucher can be as follows: * `ACTIVE` - an active voucher, ready to use, * `CANCELLED` - a cancelled voucher, disabled to use. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public LineItemVoucher externalTransactionId(@javax.annotation.Nullable String externalTransactionId) { + this.externalTransactionId = externalTransactionId; + return this; + } + + /** + * The external transaction id. The value may differ depending on the status type. + * @return externalTransactionId + */ + @javax.annotation.Nullable + public String getExternalTransactionId() { + return externalTransactionId; + } + + public void setExternalTransactionId(@javax.annotation.Nullable String externalTransactionId) { + this.externalTransactionId = externalTransactionId; + } + + + public LineItemVoucher value(@javax.annotation.Nullable LineItemVoucherValue value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public LineItemVoucherValue getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable LineItemVoucherValue value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LineItemVoucher lineItemVoucher = (LineItemVoucher) o; + return Objects.equals(this.code, lineItemVoucher.code) && + Objects.equals(this.type, lineItemVoucher.type) && + Objects.equals(this.status, lineItemVoucher.status) && + Objects.equals(this.externalTransactionId, lineItemVoucher.externalTransactionId) && + Objects.equals(this.value, lineItemVoucher.value); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, status, externalTransactionId, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LineItemVoucher {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" externalTransactionId: ").append(toIndentedString(externalTransactionId)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("type"); + openapiFields.add("status"); + openapiFields.add("externalTransactionId"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LineItemVoucher + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LineItemVoucher.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LineItemVoucher is not found in the empty JSON string", LineItemVoucher.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LineItemVoucher.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LineItemVoucher` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : LineItemVoucher.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("externalTransactionId") != null && !jsonObj.get("externalTransactionId").isJsonNull()) && !jsonObj.get("externalTransactionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `externalTransactionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("externalTransactionId").toString())); + } + // validate the optional field `value` + if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { + LineItemVoucherValue.validateJsonElement(jsonObj.get("value")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LineItemVoucher.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LineItemVoucher' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LineItemVoucher.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LineItemVoucher value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LineItemVoucher read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LineItemVoucher given an JSON string + * + * @param jsonString JSON string + * @return An instance of LineItemVoucher + * @throws IOException if the JSON string is invalid with respect to LineItemVoucher + */ + public static LineItemVoucher fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LineItemVoucher.class); + } + + /** + * Convert an instance of LineItemVoucher to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/LineItemVoucherValue.java b/src/main/java/pl/wtx/allegro/api/client/model/LineItemVoucherValue.java new file mode 100644 index 0000000..e875b87 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/LineItemVoucherValue.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * LineItemVoucherValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class LineItemVoucherValue { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public LineItemVoucherValue() { + } + + public LineItemVoucherValue amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public LineItemVoucherValue currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LineItemVoucherValue lineItemVoucherValue = (LineItemVoucherValue) o; + return Objects.equals(this.amount, lineItemVoucherValue.amount) && + Objects.equals(this.currency, lineItemVoucherValue.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LineItemVoucherValue {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LineItemVoucherValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LineItemVoucherValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LineItemVoucherValue is not found in the empty JSON string", LineItemVoucherValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LineItemVoucherValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LineItemVoucherValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : LineItemVoucherValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LineItemVoucherValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LineItemVoucherValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LineItemVoucherValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LineItemVoucherValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LineItemVoucherValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LineItemVoucherValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of LineItemVoucherValue + * @throws IOException if the JSON string is invalid with respect to LineItemVoucherValue + */ + public static LineItemVoucherValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LineItemVoucherValue.class); + } + + /** + * Convert an instance of LineItemVoucherValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ListingCategory.java b/src/main/java/pl/wtx/allegro/api/client/model/ListingCategory.java new file mode 100644 index 0000000..249cdd5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ListingCategory.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ListingCategory + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ListingCategory { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public ListingCategory() { + } + + public ListingCategory id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The Category ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ListingCategory name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The category name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListingCategory listingCategory = (ListingCategory) o; + return Objects.equals(this.id, listingCategory.id) && + Objects.equals(this.name, listingCategory.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListingCategory {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListingCategory + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListingCategory.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListingCategory is not found in the empty JSON string", ListingCategory.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListingCategory.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListingCategory` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListingCategory.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListingCategory' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListingCategory.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListingCategory value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListingCategory read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListingCategory given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListingCategory + * @throws IOException if the JSON string is invalid with respect to ListingCategory + */ + public static ListingCategory fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListingCategory.class); + } + + /** + * Convert an instance of ListingCategory to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ListingCategoryWithCount.java b/src/main/java/pl/wtx/allegro/api/client/model/ListingCategoryWithCount.java new file mode 100644 index 0000000..ec56fd8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ListingCategoryWithCount.java @@ -0,0 +1,264 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ListingCategoryWithCount + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ListingCategoryWithCount { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public ListingCategoryWithCount() { + } + + public ListingCategoryWithCount id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The category ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ListingCategoryWithCount name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The category name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ListingCategoryWithCount count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Results count in this category. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListingCategoryWithCount listingCategoryWithCount = (ListingCategoryWithCount) o; + return Objects.equals(this.id, listingCategoryWithCount.id) && + Objects.equals(this.name, listingCategoryWithCount.name) && + Objects.equals(this.count, listingCategoryWithCount.count); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, count); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListingCategoryWithCount {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("count"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListingCategoryWithCount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListingCategoryWithCount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListingCategoryWithCount is not found in the empty JSON string", ListingCategoryWithCount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListingCategoryWithCount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListingCategoryWithCount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListingCategoryWithCount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListingCategoryWithCount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListingCategoryWithCount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListingCategoryWithCount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListingCategoryWithCount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListingCategoryWithCount given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListingCategoryWithCount + * @throws IOException if the JSON string is invalid with respect to ListingCategoryWithCount + */ + public static ListingCategoryWithCount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListingCategoryWithCount.class); + } + + /** + * Convert an instance of ListingCategoryWithCount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ListingOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/ListingOffer.java new file mode 100644 index 0000000..c392931 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ListingOffer.java @@ -0,0 +1,544 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferCategory; +import pl.wtx.allegro.api.client.model.OfferDelivery; +import pl.wtx.allegro.api.client.model.OfferImages; +import pl.wtx.allegro.api.client.model.OfferPromotion; +import pl.wtx.allegro.api.client.model.OfferPublication; +import pl.wtx.allegro.api.client.model.OfferSeller; +import pl.wtx.allegro.api.client.model.OfferSellingMode; +import pl.wtx.allegro.api.client.model.OfferStock; +import pl.wtx.allegro.api.client.model.OfferVendor; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ListingOffer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ListingOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_SELLER = "seller"; + @SerializedName(SERIALIZED_NAME_SELLER) + @javax.annotation.Nullable + private OfferSeller seller; + + public static final String SERIALIZED_NAME_PROMOTION = "promotion"; + @SerializedName(SERIALIZED_NAME_PROMOTION) + @javax.annotation.Nullable + private OfferPromotion promotion; + + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private OfferDelivery delivery; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private OfferSellingMode sellingMode; + + public static final String SERIALIZED_NAME_STOCK = "stock"; + @SerializedName(SERIALIZED_NAME_STOCK) + @javax.annotation.Nullable + private OfferStock stock; + + public static final String SERIALIZED_NAME_VENDOR = "vendor"; + @SerializedName(SERIALIZED_NAME_VENDOR) + @javax.annotation.Nullable + private OfferVendor vendor; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private OfferCategory category; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private OfferPublication publication; + + public ListingOffer() { + } + + public ListingOffer id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The offer ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ListingOffer name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The title of the offer. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ListingOffer seller(@javax.annotation.Nullable OfferSeller seller) { + this.seller = seller; + return this; + } + + /** + * Get seller + * @return seller + */ + @javax.annotation.Nullable + public OfferSeller getSeller() { + return seller; + } + + public void setSeller(@javax.annotation.Nullable OfferSeller seller) { + this.seller = seller; + } + + + public ListingOffer promotion(@javax.annotation.Nullable OfferPromotion promotion) { + this.promotion = promotion; + return this; + } + + /** + * Get promotion + * @return promotion + */ + @javax.annotation.Nullable + public OfferPromotion getPromotion() { + return promotion; + } + + public void setPromotion(@javax.annotation.Nullable OfferPromotion promotion) { + this.promotion = promotion; + } + + + public ListingOffer delivery(@javax.annotation.Nullable OfferDelivery delivery) { + this.delivery = delivery; + return this; + } + + /** + * Get delivery + * @return delivery + */ + @javax.annotation.Nullable + public OfferDelivery getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable OfferDelivery delivery) { + this.delivery = delivery; + } + + + public ListingOffer images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public ListingOffer addImagesItem(OfferImages imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * The gallery of images. Only the URL of the original sized image is provided. The first image represents the thumbnail image used on listing. + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public ListingOffer sellingMode(@javax.annotation.Nullable OfferSellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public OfferSellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable OfferSellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + public ListingOffer stock(@javax.annotation.Nullable OfferStock stock) { + this.stock = stock; + return this; + } + + /** + * Get stock + * @return stock + */ + @javax.annotation.Nullable + public OfferStock getStock() { + return stock; + } + + public void setStock(@javax.annotation.Nullable OfferStock stock) { + this.stock = stock; + } + + + public ListingOffer vendor(@javax.annotation.Nullable OfferVendor vendor) { + this.vendor = vendor; + return this; + } + + /** + * Get vendor + * @return vendor + */ + @javax.annotation.Nullable + public OfferVendor getVendor() { + return vendor; + } + + public void setVendor(@javax.annotation.Nullable OfferVendor vendor) { + this.vendor = vendor; + } + + + public ListingOffer category(@javax.annotation.Nullable OfferCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + public OfferCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable OfferCategory category) { + this.category = category; + } + + + public ListingOffer publication(@javax.annotation.Nullable OfferPublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public OfferPublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable OfferPublication publication) { + this.publication = publication; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListingOffer listingOffer = (ListingOffer) o; + return Objects.equals(this.id, listingOffer.id) && + Objects.equals(this.name, listingOffer.name) && + Objects.equals(this.seller, listingOffer.seller) && + Objects.equals(this.promotion, listingOffer.promotion) && + Objects.equals(this.delivery, listingOffer.delivery) && + Objects.equals(this.images, listingOffer.images) && + Objects.equals(this.sellingMode, listingOffer.sellingMode) && + Objects.equals(this.stock, listingOffer.stock) && + Objects.equals(this.vendor, listingOffer.vendor) && + Objects.equals(this.category, listingOffer.category) && + Objects.equals(this.publication, listingOffer.publication); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, seller, promotion, delivery, images, sellingMode, stock, vendor, category, publication); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListingOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" seller: ").append(toIndentedString(seller)).append("\n"); + sb.append(" promotion: ").append(toIndentedString(promotion)).append("\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append(" stock: ").append(toIndentedString(stock)).append("\n"); + sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("seller"); + openapiFields.add("promotion"); + openapiFields.add("delivery"); + openapiFields.add("images"); + openapiFields.add("sellingMode"); + openapiFields.add("stock"); + openapiFields.add("vendor"); + openapiFields.add("category"); + openapiFields.add("publication"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListingOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListingOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListingOffer is not found in the empty JSON string", ListingOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListingOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListingOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `seller` + if (jsonObj.get("seller") != null && !jsonObj.get("seller").isJsonNull()) { + OfferSeller.validateJsonElement(jsonObj.get("seller")); + } + // validate the optional field `promotion` + if (jsonObj.get("promotion") != null && !jsonObj.get("promotion").isJsonNull()) { + OfferPromotion.validateJsonElement(jsonObj.get("promotion")); + } + // validate the optional field `delivery` + if (jsonObj.get("delivery") != null && !jsonObj.get("delivery").isJsonNull()) { + OfferDelivery.validateJsonElement(jsonObj.get("delivery")); + } + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull()) { + JsonArray jsonArrayimages = jsonObj.getAsJsonArray("images"); + if (jsonArrayimages != null) { + // ensure the json data is an array + if (!jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + + // validate the optional field `images` (array) + for (int i = 0; i < jsonArrayimages.size(); i++) { + OfferImages.validateJsonElement(jsonArrayimages.get(i)); + }; + } + } + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + OfferSellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + // validate the optional field `stock` + if (jsonObj.get("stock") != null && !jsonObj.get("stock").isJsonNull()) { + OfferStock.validateJsonElement(jsonObj.get("stock")); + } + // validate the optional field `vendor` + if (jsonObj.get("vendor") != null && !jsonObj.get("vendor").isJsonNull()) { + OfferVendor.validateJsonElement(jsonObj.get("vendor")); + } + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + OfferCategory.validateJsonElement(jsonObj.get("category")); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + OfferPublication.validateJsonElement(jsonObj.get("publication")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListingOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListingOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListingOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListingOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListingOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListingOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListingOffer + * @throws IOException if the JSON string is invalid with respect to ListingOffer + */ + public static ListingOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListingOffer.class); + } + + /** + * Convert an instance of ListingOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ListingResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponse.java new file mode 100644 index 0000000..7eb87ca --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponse.java @@ -0,0 +1,374 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ListingResponseCategories; +import pl.wtx.allegro.api.client.model.ListingResponseFilters; +import pl.wtx.allegro.api.client.model.ListingResponseOffers; +import pl.wtx.allegro.api.client.model.ListingResponseSearchMeta; +import pl.wtx.allegro.api.client.model.ListingResponseSort; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ListingResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ListingResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nullable + private ListingResponseOffers items; + + public static final String SERIALIZED_NAME_CATEGORIES = "categories"; + @SerializedName(SERIALIZED_NAME_CATEGORIES) + @javax.annotation.Nullable + private ListingResponseCategories categories; + + public static final String SERIALIZED_NAME_FILTERS = "filters"; + @SerializedName(SERIALIZED_NAME_FILTERS) + @javax.annotation.Nullable + private List filters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_SEARCH_META = "searchMeta"; + @SerializedName(SERIALIZED_NAME_SEARCH_META) + @javax.annotation.Nullable + private ListingResponseSearchMeta searchMeta; + + public static final String SERIALIZED_NAME_SORT = "sort"; + @SerializedName(SERIALIZED_NAME_SORT) + @javax.annotation.Nullable + private List sort = new ArrayList<>(); + + public ListingResponse() { + } + + public ListingResponse items(@javax.annotation.Nullable ListingResponseOffers items) { + this.items = items; + return this; + } + + /** + * Get items + * @return items + */ + @javax.annotation.Nullable + public ListingResponseOffers getItems() { + return items; + } + + public void setItems(@javax.annotation.Nullable ListingResponseOffers items) { + this.items = items; + } + + + public ListingResponse categories(@javax.annotation.Nullable ListingResponseCategories categories) { + this.categories = categories; + return this; + } + + /** + * Get categories + * @return categories + */ + @javax.annotation.Nullable + public ListingResponseCategories getCategories() { + return categories; + } + + public void setCategories(@javax.annotation.Nullable ListingResponseCategories categories) { + this.categories = categories; + } + + + public ListingResponse filters(@javax.annotation.Nullable List filters) { + this.filters = filters; + return this; + } + + public ListingResponse addFiltersItem(ListingResponseFilters filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * An array of filters with counters available for given search. This can be used to refine the search results. + * @return filters + */ + @javax.annotation.Nullable + public List getFilters() { + return filters; + } + + public void setFilters(@javax.annotation.Nullable List filters) { + this.filters = filters; + } + + + public ListingResponse searchMeta(@javax.annotation.Nullable ListingResponseSearchMeta searchMeta) { + this.searchMeta = searchMeta; + return this; + } + + /** + * Get searchMeta + * @return searchMeta + */ + @javax.annotation.Nullable + public ListingResponseSearchMeta getSearchMeta() { + return searchMeta; + } + + public void setSearchMeta(@javax.annotation.Nullable ListingResponseSearchMeta searchMeta) { + this.searchMeta = searchMeta; + } + + + public ListingResponse sort(@javax.annotation.Nullable List sort) { + this.sort = sort; + return this; + } + + public ListingResponse addSortItem(ListingResponseSort sortItem) { + if (this.sort == null) { + this.sort = new ArrayList<>(); + } + this.sort.add(sortItem); + return this; + } + + /** + * Available sorting options. + * @return sort + */ + @javax.annotation.Nullable + public List getSort() { + return sort; + } + + public void setSort(@javax.annotation.Nullable List sort) { + this.sort = sort; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListingResponse listingResponse = (ListingResponse) o; + return Objects.equals(this.items, listingResponse.items) && + Objects.equals(this.categories, listingResponse.categories) && + Objects.equals(this.filters, listingResponse.filters) && + Objects.equals(this.searchMeta, listingResponse.searchMeta) && + Objects.equals(this.sort, listingResponse.sort); + } + + @Override + public int hashCode() { + return Objects.hash(items, categories, filters, searchMeta, sort); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListingResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" searchMeta: ").append(toIndentedString(searchMeta)).append("\n"); + sb.append(" sort: ").append(toIndentedString(sort)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("items"); + openapiFields.add("categories"); + openapiFields.add("filters"); + openapiFields.add("searchMeta"); + openapiFields.add("sort"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListingResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListingResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListingResponse is not found in the empty JSON string", ListingResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListingResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListingResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `items` + if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { + ListingResponseOffers.validateJsonElement(jsonObj.get("items")); + } + // validate the optional field `categories` + if (jsonObj.get("categories") != null && !jsonObj.get("categories").isJsonNull()) { + ListingResponseCategories.validateJsonElement(jsonObj.get("categories")); + } + if (jsonObj.get("filters") != null && !jsonObj.get("filters").isJsonNull()) { + JsonArray jsonArrayfilters = jsonObj.getAsJsonArray("filters"); + if (jsonArrayfilters != null) { + // ensure the json data is an array + if (!jsonObj.get("filters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `filters` to be an array in the JSON string but got `%s`", jsonObj.get("filters").toString())); + } + + // validate the optional field `filters` (array) + for (int i = 0; i < jsonArrayfilters.size(); i++) { + ListingResponseFilters.validateJsonElement(jsonArrayfilters.get(i)); + }; + } + } + // validate the optional field `searchMeta` + if (jsonObj.get("searchMeta") != null && !jsonObj.get("searchMeta").isJsonNull()) { + ListingResponseSearchMeta.validateJsonElement(jsonObj.get("searchMeta")); + } + if (jsonObj.get("sort") != null && !jsonObj.get("sort").isJsonNull()) { + JsonArray jsonArraysort = jsonObj.getAsJsonArray("sort"); + if (jsonArraysort != null) { + // ensure the json data is an array + if (!jsonObj.get("sort").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `sort` to be an array in the JSON string but got `%s`", jsonObj.get("sort").toString())); + } + + // validate the optional field `sort` (array) + for (int i = 0; i < jsonArraysort.size(); i++) { + ListingResponseSort.validateJsonElement(jsonArraysort.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListingResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListingResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListingResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListingResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListingResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListingResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListingResponse + * @throws IOException if the JSON string is invalid with respect to ListingResponse + */ + public static ListingResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListingResponse.class); + } + + /** + * Convert an instance of ListingResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseCategories.java b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseCategories.java new file mode 100644 index 0000000..fee1082 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseCategories.java @@ -0,0 +1,278 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ListingCategory; +import pl.wtx.allegro.api.client.model.ListingCategoryWithCount; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about categories. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ListingResponseCategories { + public static final String SERIALIZED_NAME_SUBCATEGORIES = "subcategories"; + @SerializedName(SERIALIZED_NAME_SUBCATEGORIES) + @javax.annotation.Nullable + private List subcategories = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private List path = new ArrayList<>(); + + public ListingResponseCategories() { + } + + public ListingResponseCategories subcategories(@javax.annotation.Nullable List subcategories) { + this.subcategories = subcategories; + return this; + } + + public ListingResponseCategories addSubcategoriesItem(ListingCategoryWithCount subcategoriesItem) { + if (this.subcategories == null) { + this.subcategories = new ArrayList<>(); + } + this.subcategories.add(subcategoriesItem); + return this; + } + + /** + * Categories with counters, which can be used to refine search results. + * @return subcategories + */ + @javax.annotation.Nullable + public List getSubcategories() { + return subcategories; + } + + public void setSubcategories(@javax.annotation.Nullable List subcategories) { + this.subcategories = subcategories; + } + + + public ListingResponseCategories path(@javax.annotation.Nullable List path) { + this.path = path; + return this; + } + + public ListingResponseCategories addPathItem(ListingCategory pathItem) { + if (this.path == null) { + this.path = new ArrayList<>(); + } + this.path.add(pathItem); + return this; + } + + /** + * Categories path to the current listing category (breadcrumbs). + * @return path + */ + @javax.annotation.Nullable + public List getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable List path) { + this.path = path; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListingResponseCategories listingResponseCategories = (ListingResponseCategories) o; + return Objects.equals(this.subcategories, listingResponseCategories.subcategories) && + Objects.equals(this.path, listingResponseCategories.path); + } + + @Override + public int hashCode() { + return Objects.hash(subcategories, path); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListingResponseCategories {\n"); + sb.append(" subcategories: ").append(toIndentedString(subcategories)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("subcategories"); + openapiFields.add("path"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListingResponseCategories + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListingResponseCategories.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListingResponseCategories is not found in the empty JSON string", ListingResponseCategories.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListingResponseCategories.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListingResponseCategories` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("subcategories") != null && !jsonObj.get("subcategories").isJsonNull()) { + JsonArray jsonArraysubcategories = jsonObj.getAsJsonArray("subcategories"); + if (jsonArraysubcategories != null) { + // ensure the json data is an array + if (!jsonObj.get("subcategories").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `subcategories` to be an array in the JSON string but got `%s`", jsonObj.get("subcategories").toString())); + } + + // validate the optional field `subcategories` (array) + for (int i = 0; i < jsonArraysubcategories.size(); i++) { + ListingCategoryWithCount.validateJsonElement(jsonArraysubcategories.get(i)); + }; + } + } + if (jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) { + JsonArray jsonArraypath = jsonObj.getAsJsonArray("path"); + if (jsonArraypath != null) { + // ensure the json data is an array + if (!jsonObj.get("path").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be an array in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + + // validate the optional field `path` (array) + for (int i = 0; i < jsonArraypath.size(); i++) { + ListingCategory.validateJsonElement(jsonArraypath.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListingResponseCategories.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListingResponseCategories' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListingResponseCategories.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListingResponseCategories value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListingResponseCategories read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListingResponseCategories given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListingResponseCategories + * @throws IOException if the JSON string is invalid with respect to ListingResponseCategories + */ + public static ListingResponseCategories fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListingResponseCategories.class); + } + + /** + * Convert an instance of ListingResponseCategories to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseFilters.java b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseFilters.java new file mode 100644 index 0000000..830ff10 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseFilters.java @@ -0,0 +1,465 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ListingResponseFiltersValues; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ListingResponseFilters + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ListingResponseFilters { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + /** + * The type of the filter: - *MULTI* - multiple choice filter, - *SINGLE* - single select (dropdown) filter, - *NUMERIC* - range of numeric values (search offers with value matching this range), - *NUMERIC_SINGLE* - single numeric value (search offers with given value matching the range defined in offer), - *TEXT* - filter allowing user to input any text. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + MULTI("MULTI"), + + SINGLE("SINGLE"), + + NUMERIC("NUMERIC"), + + NUMERIC_SINGLE("NUMERIC_SINGLE"), + + TEXT("TEXT"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public static final String SERIALIZED_NAME_MIN_VALUE = "minValue"; + @SerializedName(SERIALIZED_NAME_MIN_VALUE) + @javax.annotation.Nullable + private BigDecimal minValue; + + public static final String SERIALIZED_NAME_MAX_VALUE = "maxValue"; + @SerializedName(SERIALIZED_NAME_MAX_VALUE) + @javax.annotation.Nullable + private BigDecimal maxValue; + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private String unit; + + public ListingResponseFilters() { + } + + public ListingResponseFilters id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Identifier of the filter. Should be used as query parameter key, optionally followed by idSuffix from parameter value (only for NUMERIC filters). + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ListingResponseFilters type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * The type of the filter: - *MULTI* - multiple choice filter, - *SINGLE* - single select (dropdown) filter, - *NUMERIC* - range of numeric values (search offers with value matching this range), - *NUMERIC_SINGLE* - single numeric value (search offers with given value matching the range defined in offer), - *TEXT* - filter allowing user to input any text. + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public ListingResponseFilters name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the filter. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ListingResponseFilters values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public ListingResponseFilters addValuesItem(ListingResponseFiltersValues valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Available filter values. + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + public ListingResponseFilters minValue(@javax.annotation.Nullable BigDecimal minValue) { + this.minValue = minValue; + return this; + } + + /** + * Minimum valid value for filters of type NUMERIC. + * @return minValue + */ + @javax.annotation.Nullable + public BigDecimal getMinValue() { + return minValue; + } + + public void setMinValue(@javax.annotation.Nullable BigDecimal minValue) { + this.minValue = minValue; + } + + + public ListingResponseFilters maxValue(@javax.annotation.Nullable BigDecimal maxValue) { + this.maxValue = maxValue; + return this; + } + + /** + * Maximum valid value for filters of type NUMERIC. + * @return maxValue + */ + @javax.annotation.Nullable + public BigDecimal getMaxValue() { + return maxValue; + } + + public void setMaxValue(@javax.annotation.Nullable BigDecimal maxValue) { + this.maxValue = maxValue; + } + + + public ListingResponseFilters unit(@javax.annotation.Nullable String unit) { + this.unit = unit; + return this; + } + + /** + * Unit of the NUMERIC/NUMERIC_SINGLE filter. + * @return unit + */ + @javax.annotation.Nullable + public String getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable String unit) { + this.unit = unit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListingResponseFilters listingResponseFilters = (ListingResponseFilters) o; + return Objects.equals(this.id, listingResponseFilters.id) && + Objects.equals(this.type, listingResponseFilters.type) && + Objects.equals(this.name, listingResponseFilters.name) && + Objects.equals(this.values, listingResponseFilters.values) && + Objects.equals(this.minValue, listingResponseFilters.minValue) && + Objects.equals(this.maxValue, listingResponseFilters.maxValue) && + Objects.equals(this.unit, listingResponseFilters.unit); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, name, values, minValue, maxValue, unit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListingResponseFilters {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" minValue: ").append(toIndentedString(minValue)).append("\n"); + sb.append(" maxValue: ").append(toIndentedString(maxValue)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("name"); + openapiFields.add("values"); + openapiFields.add("minValue"); + openapiFields.add("maxValue"); + openapiFields.add("unit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListingResponseFilters + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListingResponseFilters.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListingResponseFilters is not found in the empty JSON string", ListingResponseFilters.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListingResponseFilters.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListingResponseFilters` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull()) { + JsonArray jsonArrayvalues = jsonObj.getAsJsonArray("values"); + if (jsonArrayvalues != null) { + // ensure the json data is an array + if (!jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + + // validate the optional field `values` (array) + for (int i = 0; i < jsonArrayvalues.size(); i++) { + ListingResponseFiltersValues.validateJsonElement(jsonArrayvalues.get(i)); + }; + } + } + if ((jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) && !jsonObj.get("unit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unit").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListingResponseFilters.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListingResponseFilters' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListingResponseFilters.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListingResponseFilters value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListingResponseFilters read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListingResponseFilters given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListingResponseFilters + * @throws IOException if the JSON string is invalid with respect to ListingResponseFilters + */ + public static ListingResponseFilters fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListingResponseFilters.class); + } + + /** + * Convert an instance of ListingResponseFilters to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseFiltersValues.java b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseFiltersValues.java new file mode 100644 index 0000000..0788e69 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseFiltersValues.java @@ -0,0 +1,321 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ListingResponseFiltersValues + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ListingResponseFiltersValues { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_ID_SUFFIX = "idSuffix"; + @SerializedName(SERIALIZED_NAME_ID_SUFFIX) + @javax.annotation.Nullable + private String idSuffix; + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_SELECTED = "selected"; + @SerializedName(SERIALIZED_NAME_SELECTED) + @javax.annotation.Nullable + private Boolean selected; + + public ListingResponseFiltersValues() { + } + + public ListingResponseFiltersValues name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the option; for NUMERIC parameters - word indicating start or end of range (i.e. *from*, *to*). + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ListingResponseFiltersValues value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Filter value. Should be used as query parameter value in the request. This can be: - for MULTI and SINGLE parameters - a value identifier (e.g. KUJAWSKO_POMORSKIE option in location.province filter), - for other types - a value entered by user. + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public ListingResponseFiltersValues idSuffix(@javax.annotation.Nullable String idSuffix) { + this.idSuffix = idSuffix; + return this; + } + + /** + * Suffix used as a second part of query parameter name to be used in the request (the first part is the filter ID). Applicable for NUMERIC values only. + * @return idSuffix + */ + @javax.annotation.Nullable + public String getIdSuffix() { + return idSuffix; + } + + public void setIdSuffix(@javax.annotation.Nullable String idSuffix) { + this.idSuffix = idSuffix; + } + + + public ListingResponseFiltersValues count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Number of search results matching this filter value. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public ListingResponseFiltersValues selected(@javax.annotation.Nullable Boolean selected) { + this.selected = selected; + return this; + } + + /** + * Indicates whether this filter value was used in the current request. + * @return selected + */ + @javax.annotation.Nullable + public Boolean getSelected() { + return selected; + } + + public void setSelected(@javax.annotation.Nullable Boolean selected) { + this.selected = selected; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListingResponseFiltersValues listingResponseFiltersValues = (ListingResponseFiltersValues) o; + return Objects.equals(this.name, listingResponseFiltersValues.name) && + Objects.equals(this.value, listingResponseFiltersValues.value) && + Objects.equals(this.idSuffix, listingResponseFiltersValues.idSuffix) && + Objects.equals(this.count, listingResponseFiltersValues.count) && + Objects.equals(this.selected, listingResponseFiltersValues.selected); + } + + @Override + public int hashCode() { + return Objects.hash(name, value, idSuffix, count, selected); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListingResponseFiltersValues {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" idSuffix: ").append(toIndentedString(idSuffix)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" selected: ").append(toIndentedString(selected)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("value"); + openapiFields.add("idSuffix"); + openapiFields.add("count"); + openapiFields.add("selected"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListingResponseFiltersValues + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListingResponseFiltersValues.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListingResponseFiltersValues is not found in the empty JSON string", ListingResponseFiltersValues.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListingResponseFiltersValues.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListingResponseFiltersValues` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + if ((jsonObj.get("idSuffix") != null && !jsonObj.get("idSuffix").isJsonNull()) && !jsonObj.get("idSuffix").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idSuffix` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idSuffix").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListingResponseFiltersValues.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListingResponseFiltersValues' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListingResponseFiltersValues.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListingResponseFiltersValues value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListingResponseFiltersValues read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListingResponseFiltersValues given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListingResponseFiltersValues + * @throws IOException if the JSON string is invalid with respect to ListingResponseFiltersValues + */ + public static ListingResponseFiltersValues fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListingResponseFiltersValues.class); + } + + /** + * Convert an instance of ListingResponseFiltersValues to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseOffers.java b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseOffers.java new file mode 100644 index 0000000..f06e08f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseOffers.java @@ -0,0 +1,277 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ListingOffer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The lists of search results. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ListingResponseOffers { + public static final String SERIALIZED_NAME_PROMOTED = "promoted"; + @SerializedName(SERIALIZED_NAME_PROMOTED) + @javax.annotation.Nullable + private List promoted = new ArrayList<>(); + + public static final String SERIALIZED_NAME_REGULAR = "regular"; + @SerializedName(SERIALIZED_NAME_REGULAR) + @javax.annotation.Nullable + private List regular = new ArrayList<>(); + + public ListingResponseOffers() { + } + + public ListingResponseOffers promoted(@javax.annotation.Nullable List promoted) { + this.promoted = promoted; + return this; + } + + public ListingResponseOffers addPromotedItem(ListingOffer promotedItem) { + if (this.promoted == null) { + this.promoted = new ArrayList<>(); + } + this.promoted.add(promotedItem); + return this; + } + + /** + * List of promoted offers. + * @return promoted + */ + @javax.annotation.Nullable + public List getPromoted() { + return promoted; + } + + public void setPromoted(@javax.annotation.Nullable List promoted) { + this.promoted = promoted; + } + + + public ListingResponseOffers regular(@javax.annotation.Nullable List regular) { + this.regular = regular; + return this; + } + + public ListingResponseOffers addRegularItem(ListingOffer regularItem) { + if (this.regular == null) { + this.regular = new ArrayList<>(); + } + this.regular.add(regularItem); + return this; + } + + /** + * List of regular (non-promoted) offers. + * @return regular + */ + @javax.annotation.Nullable + public List getRegular() { + return regular; + } + + public void setRegular(@javax.annotation.Nullable List regular) { + this.regular = regular; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListingResponseOffers listingResponseOffers = (ListingResponseOffers) o; + return Objects.equals(this.promoted, listingResponseOffers.promoted) && + Objects.equals(this.regular, listingResponseOffers.regular); + } + + @Override + public int hashCode() { + return Objects.hash(promoted, regular); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListingResponseOffers {\n"); + sb.append(" promoted: ").append(toIndentedString(promoted)).append("\n"); + sb.append(" regular: ").append(toIndentedString(regular)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("promoted"); + openapiFields.add("regular"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListingResponseOffers + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListingResponseOffers.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListingResponseOffers is not found in the empty JSON string", ListingResponseOffers.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListingResponseOffers.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListingResponseOffers` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("promoted") != null && !jsonObj.get("promoted").isJsonNull()) { + JsonArray jsonArraypromoted = jsonObj.getAsJsonArray("promoted"); + if (jsonArraypromoted != null) { + // ensure the json data is an array + if (!jsonObj.get("promoted").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `promoted` to be an array in the JSON string but got `%s`", jsonObj.get("promoted").toString())); + } + + // validate the optional field `promoted` (array) + for (int i = 0; i < jsonArraypromoted.size(); i++) { + ListingOffer.validateJsonElement(jsonArraypromoted.get(i)); + }; + } + } + if (jsonObj.get("regular") != null && !jsonObj.get("regular").isJsonNull()) { + JsonArray jsonArrayregular = jsonObj.getAsJsonArray("regular"); + if (jsonArrayregular != null) { + // ensure the json data is an array + if (!jsonObj.get("regular").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `regular` to be an array in the JSON string but got `%s`", jsonObj.get("regular").toString())); + } + + // validate the optional field `regular` (array) + for (int i = 0; i < jsonArrayregular.size(); i++) { + ListingOffer.validateJsonElement(jsonArrayregular.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListingResponseOffers.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListingResponseOffers' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListingResponseOffers.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListingResponseOffers value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListingResponseOffers read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListingResponseOffers given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListingResponseOffers + * @throws IOException if the JSON string is invalid with respect to ListingResponseOffers + */ + public static ListingResponseOffers fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListingResponseOffers.class); + } + + /** + * Convert an instance of ListingResponseOffers to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseSearchMeta.java b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseSearchMeta.java new file mode 100644 index 0000000..88ba145 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseSearchMeta.java @@ -0,0 +1,259 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Search metadata. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ListingResponseSearchMeta { + public static final String SERIALIZED_NAME_AVAILABLE_COUNT = "availableCount"; + @SerializedName(SERIALIZED_NAME_AVAILABLE_COUNT) + @javax.annotation.Nullable + private Integer availableCount; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private Integer totalCount; + + public static final String SERIALIZED_NAME_FALLBACK = "fallback"; + @SerializedName(SERIALIZED_NAME_FALLBACK) + @javax.annotation.Nullable + private Boolean fallback; + + public ListingResponseSearchMeta() { + } + + public ListingResponseSearchMeta availableCount(@javax.annotation.Nullable Integer availableCount) { + this.availableCount = availableCount; + return this; + } + + /** + * The number of results available for navigation. If this number is less than total count, the search criteria (categories, filters, etc.) should be narrowed down to make all results available. + * minimum: 0 + * @return availableCount + */ + @javax.annotation.Nullable + public Integer getAvailableCount() { + return availableCount; + } + + public void setAvailableCount(@javax.annotation.Nullable Integer availableCount) { + this.availableCount = availableCount; + } + + + public ListingResponseSearchMeta totalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * The total number of search results with given parameters. + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + + public ListingResponseSearchMeta fallback(@javax.annotation.Nullable Boolean fallback) { + this.fallback = fallback; + return this; + } + + /** + * Indicates whether the search fallback was used. If true, no items matching exact given phrase were found and related items are presented. + * @return fallback + */ + @javax.annotation.Nullable + public Boolean getFallback() { + return fallback; + } + + public void setFallback(@javax.annotation.Nullable Boolean fallback) { + this.fallback = fallback; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListingResponseSearchMeta listingResponseSearchMeta = (ListingResponseSearchMeta) o; + return Objects.equals(this.availableCount, listingResponseSearchMeta.availableCount) && + Objects.equals(this.totalCount, listingResponseSearchMeta.totalCount) && + Objects.equals(this.fallback, listingResponseSearchMeta.fallback); + } + + @Override + public int hashCode() { + return Objects.hash(availableCount, totalCount, fallback); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListingResponseSearchMeta {\n"); + sb.append(" availableCount: ").append(toIndentedString(availableCount)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append(" fallback: ").append(toIndentedString(fallback)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("availableCount"); + openapiFields.add("totalCount"); + openapiFields.add("fallback"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListingResponseSearchMeta + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListingResponseSearchMeta.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListingResponseSearchMeta is not found in the empty JSON string", ListingResponseSearchMeta.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListingResponseSearchMeta.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListingResponseSearchMeta` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListingResponseSearchMeta.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListingResponseSearchMeta' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListingResponseSearchMeta.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListingResponseSearchMeta value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListingResponseSearchMeta read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListingResponseSearchMeta given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListingResponseSearchMeta + * @throws IOException if the JSON string is invalid with respect to ListingResponseSearchMeta + */ + public static ListingResponseSearchMeta fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListingResponseSearchMeta.class); + } + + /** + * Convert an instance of ListingResponseSearchMeta to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseSort.java b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseSort.java new file mode 100644 index 0000000..68c1f56 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ListingResponseSort.java @@ -0,0 +1,293 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Available sort options. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ListingResponseSort { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + @javax.annotation.Nullable + private String order; + + public static final String SERIALIZED_NAME_SELECTED = "selected"; + @SerializedName(SERIALIZED_NAME_SELECTED) + @javax.annotation.Nullable + private Boolean selected; + + public ListingResponseSort() { + } + + public ListingResponseSort value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * The query parameter value which should be used for this sorting option. + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public ListingResponseSort name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The sorting option name in Polish. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ListingResponseSort order(@javax.annotation.Nullable String order) { + this.order = order; + return this; + } + + /** + * The order label in Polish specifying ascending or descending mode. + * @return order + */ + @javax.annotation.Nullable + public String getOrder() { + return order; + } + + public void setOrder(@javax.annotation.Nullable String order) { + this.order = order; + } + + + public ListingResponseSort selected(@javax.annotation.Nullable Boolean selected) { + this.selected = selected; + return this; + } + + /** + * Indicates whether this sorting option was used in the current request. + * @return selected + */ + @javax.annotation.Nullable + public Boolean getSelected() { + return selected; + } + + public void setSelected(@javax.annotation.Nullable Boolean selected) { + this.selected = selected; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListingResponseSort listingResponseSort = (ListingResponseSort) o; + return Objects.equals(this.value, listingResponseSort.value) && + Objects.equals(this.name, listingResponseSort.name) && + Objects.equals(this.order, listingResponseSort.order) && + Objects.equals(this.selected, listingResponseSort.selected); + } + + @Override + public int hashCode() { + return Objects.hash(value, name, order, selected); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListingResponseSort {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" selected: ").append(toIndentedString(selected)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + openapiFields.add("name"); + openapiFields.add("order"); + openapiFields.add("selected"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListingResponseSort + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListingResponseSort.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListingResponseSort is not found in the empty JSON string", ListingResponseSort.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListingResponseSort.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListingResponseSort` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("order") != null && !jsonObj.get("order").isJsonNull()) && !jsonObj.get("order").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `order` to be a primitive type in the JSON string but got `%s`", jsonObj.get("order").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListingResponseSort.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListingResponseSort' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListingResponseSort.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListingResponseSort value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListingResponseSort read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListingResponseSort given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListingResponseSort + * @throws IOException if the JSON string is invalid with respect to ListingResponseSort + */ + public static ListingResponseSort fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListingResponseSort.class); + } + + /** + * Convert an instance of ListingResponseSort to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Location.java b/src/main/java/pl/wtx/allegro/api/client/model/Location.java new file mode 100644 index 0000000..e50d1a7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Location.java @@ -0,0 +1,296 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * for offer with a delivery method it is a parcel dispatch location. For offers with personal pick-up it is a pick-up location, additionally we recommend to use points of service (<a href=\"../../documentation/#tag/Points-of-service\" target=\"_blank\">https://developer.allegro.pl/documentation/#tag/Points-of-service</a>) + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Location { + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nullable + private String city; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode; + + public static final String SERIALIZED_NAME_POST_CODE = "postCode"; + @SerializedName(SERIALIZED_NAME_POST_CODE) + @javax.annotation.Nullable + private String postCode; + + public static final String SERIALIZED_NAME_PROVINCE = "province"; + @SerializedName(SERIALIZED_NAME_PROVINCE) + @javax.annotation.Nullable + private String province; + + public Location() { + } + + public Location city(@javax.annotation.Nullable String city) { + this.city = city; + return this; + } + + /** + * Get city + * @return city + */ + @javax.annotation.Nullable + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nullable String city) { + this.city = city; + } + + + public Location countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * The 2-letter country code as defined in ISO 3166. + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + public Location postCode(@javax.annotation.Nullable String postCode) { + this.postCode = postCode; + return this; + } + + /** + * The format of post code depends on 'countryCode'. For countryCode equal to 'PL', the expected format is 'XX-XXX', for other countries format is less restrictive - 12 characters or less are expected. + * @return postCode + */ + @javax.annotation.Nullable + public String getPostCode() { + return postCode; + } + + public void setPostCode(@javax.annotation.Nullable String postCode) { + this.postCode = postCode; + } + + + public Location province(@javax.annotation.Nullable String province) { + this.province = province; + return this; + } + + /** + * This field is mandatory if countryCode is set to \"PL\", for other values, currently, it is ignored. For countryCode equalling \"PL\", this field must be set to one of the following: DOLNOSLASKIE, KUJAWSKO_POMORSKIE, LUBELSKIE, LUBUSKIE, LODZKIE, MALOPOLSKIE, MAZOWIECKIE, OPOLSKIE, PODKARPACKIE, PODLASKIE, POMORSKIE, SLASKIE, SWIETOKRZYSKIE, WARMINSKO_MAZURSKIE, WIELKOPOLSKIE, ZACHODNIOPOMORSKIE. + * @return province + */ + @javax.annotation.Nullable + public String getProvince() { + return province; + } + + public void setProvince(@javax.annotation.Nullable String province) { + this.province = province; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Location location = (Location) o; + return Objects.equals(this.city, location.city) && + Objects.equals(this.countryCode, location.countryCode) && + Objects.equals(this.postCode, location.postCode) && + Objects.equals(this.province, location.province); + } + + @Override + public int hashCode() { + return Objects.hash(city, countryCode, postCode, province); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Location {\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" postCode: ").append(toIndentedString(postCode)).append("\n"); + sb.append(" province: ").append(toIndentedString(province)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("city"); + openapiFields.add("countryCode"); + openapiFields.add("postCode"); + openapiFields.add("province"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Location + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Location.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Location is not found in the empty JSON string", Location.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Location.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Location` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("city") != null && !jsonObj.get("city").isJsonNull()) && !jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if ((jsonObj.get("countryCode") != null && !jsonObj.get("countryCode").isJsonNull()) && !jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if ((jsonObj.get("postCode") != null && !jsonObj.get("postCode").isJsonNull()) && !jsonObj.get("postCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postCode").toString())); + } + if ((jsonObj.get("province") != null && !jsonObj.get("province").isJsonNull()) && !jsonObj.get("province").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `province` to be a primitive type in the JSON string but got `%s`", jsonObj.get("province").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Location.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Location' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Location.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Location value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Location read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Location given an JSON string + * + * @param jsonString JSON string + * @return An instance of Location + * @throws IOException if the JSON string is invalid with respect to Location + */ + public static Location fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Location.class); + } + + /** + * Convert an instance of Location to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ManualDescriptionTranslation.java b/src/main/java/pl/wtx/allegro/api/client/model/ManualDescriptionTranslation.java new file mode 100644 index 0000000..408bd00 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ManualDescriptionTranslation.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.StandardizedDescription; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Manual offer description translation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ManualDescriptionTranslation { + public static final String SERIALIZED_NAME_TRANSLATION = "translation"; + @SerializedName(SERIALIZED_NAME_TRANSLATION) + @javax.annotation.Nullable + private StandardizedDescription translation; + + public ManualDescriptionTranslation() { + } + + public ManualDescriptionTranslation translation(@javax.annotation.Nullable StandardizedDescription translation) { + this.translation = translation; + return this; + } + + /** + * Get translation + * @return translation + */ + @javax.annotation.Nullable + public StandardizedDescription getTranslation() { + return translation; + } + + public void setTranslation(@javax.annotation.Nullable StandardizedDescription translation) { + this.translation = translation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManualDescriptionTranslation manualDescriptionTranslation = (ManualDescriptionTranslation) o; + return Objects.equals(this.translation, manualDescriptionTranslation.translation); + } + + @Override + public int hashCode() { + return Objects.hash(translation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManualDescriptionTranslation {\n"); + sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("translation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ManualDescriptionTranslation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ManualDescriptionTranslation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ManualDescriptionTranslation is not found in the empty JSON string", ManualDescriptionTranslation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ManualDescriptionTranslation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ManualDescriptionTranslation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `translation` + if (jsonObj.get("translation") != null && !jsonObj.get("translation").isJsonNull()) { + StandardizedDescription.validateJsonElement(jsonObj.get("translation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ManualDescriptionTranslation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ManualDescriptionTranslation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ManualDescriptionTranslation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ManualDescriptionTranslation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ManualDescriptionTranslation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ManualDescriptionTranslation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ManualDescriptionTranslation + * @throws IOException if the JSON string is invalid with respect to ManualDescriptionTranslation + */ + public static ManualDescriptionTranslation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ManualDescriptionTranslation.class); + } + + /** + * Convert an instance of ManualDescriptionTranslation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ManualProductSafetyInformationDescriptionTranslation.java b/src/main/java/pl/wtx/allegro/api/client/model/ManualProductSafetyInformationDescriptionTranslation.java new file mode 100644 index 0000000..b6ba8c9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ManualProductSafetyInformationDescriptionTranslation.java @@ -0,0 +1,237 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Manual product safety information translation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ManualProductSafetyInformationDescriptionTranslation { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_TRANSLATION = "translation"; + @SerializedName(SERIALIZED_NAME_TRANSLATION) + @javax.annotation.Nullable + private String translation; + + public ManualProductSafetyInformationDescriptionTranslation() { + } + + public ManualProductSafetyInformationDescriptionTranslation id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * Product id connected with provided translated content + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public ManualProductSafetyInformationDescriptionTranslation translation(@javax.annotation.Nullable String translation) { + this.translation = translation; + return this; + } + + /** + * Manual product safety information translation content + * @return translation + */ + @javax.annotation.Nullable + public String getTranslation() { + return translation; + } + + public void setTranslation(@javax.annotation.Nullable String translation) { + this.translation = translation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManualProductSafetyInformationDescriptionTranslation manualProductSafetyInformationDescriptionTranslation = (ManualProductSafetyInformationDescriptionTranslation) o; + return Objects.equals(this.id, manualProductSafetyInformationDescriptionTranslation.id) && + Objects.equals(this.translation, manualProductSafetyInformationDescriptionTranslation.translation); + } + + @Override + public int hashCode() { + return Objects.hash(id, translation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManualProductSafetyInformationDescriptionTranslation {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("translation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ManualProductSafetyInformationDescriptionTranslation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ManualProductSafetyInformationDescriptionTranslation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ManualProductSafetyInformationDescriptionTranslation is not found in the empty JSON string", ManualProductSafetyInformationDescriptionTranslation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ManualProductSafetyInformationDescriptionTranslation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ManualProductSafetyInformationDescriptionTranslation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("translation") != null && !jsonObj.get("translation").isJsonNull()) && !jsonObj.get("translation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `translation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("translation").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ManualProductSafetyInformationDescriptionTranslation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ManualProductSafetyInformationDescriptionTranslation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ManualProductSafetyInformationDescriptionTranslation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ManualProductSafetyInformationDescriptionTranslation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ManualProductSafetyInformationDescriptionTranslation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ManualProductSafetyInformationDescriptionTranslation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ManualProductSafetyInformationDescriptionTranslation + * @throws IOException if the JSON string is invalid with respect to ManualProductSafetyInformationDescriptionTranslation + */ + public static ManualProductSafetyInformationDescriptionTranslation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ManualProductSafetyInformationDescriptionTranslation.class); + } + + /** + * Convert an instance of ManualProductSafetyInformationDescriptionTranslation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ManualSafetyInformationTranslation.java b/src/main/java/pl/wtx/allegro/api/client/model/ManualSafetyInformationTranslation.java new file mode 100644 index 0000000..b9096f7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ManualSafetyInformationTranslation.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ManualProductSafetyInformationDescriptionTranslation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Manual offer products safety information translations. Updating this resource is in accordance with <a href=\" https://datatracker.ietf.org/doc/html/rfc7396/\" target=\"_blank\">RFC7396</a> - all or nothing.' + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ManualSafetyInformationTranslation { + public static final String SERIALIZED_NAME_PRODUCTS = "products"; + @SerializedName(SERIALIZED_NAME_PRODUCTS) + @javax.annotation.Nullable + private List products = new ArrayList<>(); + + public ManualSafetyInformationTranslation() { + } + + public ManualSafetyInformationTranslation products(@javax.annotation.Nullable List products) { + this.products = products; + return this; + } + + public ManualSafetyInformationTranslation addProductsItem(ManualProductSafetyInformationDescriptionTranslation productsItem) { + if (this.products == null) { + this.products = new ArrayList<>(); + } + this.products.add(productsItem); + return this; + } + + /** + * Get products + * @return products + */ + @javax.annotation.Nullable + public List getProducts() { + return products; + } + + public void setProducts(@javax.annotation.Nullable List products) { + this.products = products; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManualSafetyInformationTranslation manualSafetyInformationTranslation = (ManualSafetyInformationTranslation) o; + return Objects.equals(this.products, manualSafetyInformationTranslation.products); + } + + @Override + public int hashCode() { + return Objects.hash(products); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManualSafetyInformationTranslation {\n"); + sb.append(" products: ").append(toIndentedString(products)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("products"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ManualSafetyInformationTranslation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ManualSafetyInformationTranslation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ManualSafetyInformationTranslation is not found in the empty JSON string", ManualSafetyInformationTranslation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ManualSafetyInformationTranslation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ManualSafetyInformationTranslation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("products") != null && !jsonObj.get("products").isJsonNull()) { + JsonArray jsonArrayproducts = jsonObj.getAsJsonArray("products"); + if (jsonArrayproducts != null) { + // ensure the json data is an array + if (!jsonObj.get("products").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `products` to be an array in the JSON string but got `%s`", jsonObj.get("products").toString())); + } + + // validate the optional field `products` (array) + for (int i = 0; i < jsonArrayproducts.size(); i++) { + ManualProductSafetyInformationDescriptionTranslation.validateJsonElement(jsonArrayproducts.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ManualSafetyInformationTranslation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ManualSafetyInformationTranslation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ManualSafetyInformationTranslation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ManualSafetyInformationTranslation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ManualSafetyInformationTranslation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ManualSafetyInformationTranslation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ManualSafetyInformationTranslation + * @throws IOException if the JSON string is invalid with respect to ManualSafetyInformationTranslation + */ + public static ManualSafetyInformationTranslation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ManualSafetyInformationTranslation.class); + } + + /** + * Convert an instance of ManualSafetyInformationTranslation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ManualTitleTranslation.java b/src/main/java/pl/wtx/allegro/api/client/model/ManualTitleTranslation.java new file mode 100644 index 0000000..430b0a5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ManualTitleTranslation.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Manual offer title translation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ManualTitleTranslation { + public static final String SERIALIZED_NAME_TRANSLATION = "translation"; + @SerializedName(SERIALIZED_NAME_TRANSLATION) + @javax.annotation.Nullable + private String translation; + + public ManualTitleTranslation() { + } + + public ManualTitleTranslation translation(@javax.annotation.Nullable String translation) { + this.translation = translation; + return this; + } + + /** + * Manual offer title translation content + * @return translation + */ + @javax.annotation.Nullable + public String getTranslation() { + return translation; + } + + public void setTranslation(@javax.annotation.Nullable String translation) { + this.translation = translation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManualTitleTranslation manualTitleTranslation = (ManualTitleTranslation) o; + return Objects.equals(this.translation, manualTitleTranslation.translation); + } + + @Override + public int hashCode() { + return Objects.hash(translation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManualTitleTranslation {\n"); + sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("translation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ManualTitleTranslation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ManualTitleTranslation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ManualTitleTranslation is not found in the empty JSON string", ManualTitleTranslation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ManualTitleTranslation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ManualTitleTranslation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("translation") != null && !jsonObj.get("translation").isJsonNull()) && !jsonObj.get("translation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `translation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("translation").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ManualTitleTranslation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ManualTitleTranslation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ManualTitleTranslation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ManualTitleTranslation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ManualTitleTranslation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ManualTitleTranslation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ManualTitleTranslation + * @throws IOException if the JSON string is invalid with respect to ManualTitleTranslation + */ + public static ManualTitleTranslation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ManualTitleTranslation.class); + } + + /** + * Convert an instance of ManualTitleTranslation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ManualTranslationUpdateRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ManualTranslationUpdateRequest.java new file mode 100644 index 0000000..4fb6ef5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ManualTranslationUpdateRequest.java @@ -0,0 +1,272 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ManualDescriptionTranslation; +import pl.wtx.allegro.api.client.model.ManualSafetyInformationTranslation; +import pl.wtx.allegro.api.client.model.ManualTitleTranslation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ManualTranslationUpdateRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ManualTranslationUpdateRequest { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private ManualDescriptionTranslation description; + + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + @javax.annotation.Nullable + private ManualTitleTranslation title; + + public static final String SERIALIZED_NAME_SAFETY_INFORMATION = "safetyInformation"; + @SerializedName(SERIALIZED_NAME_SAFETY_INFORMATION) + @javax.annotation.Nullable + private ManualSafetyInformationTranslation safetyInformation; + + public ManualTranslationUpdateRequest() { + } + + public ManualTranslationUpdateRequest description(@javax.annotation.Nullable ManualDescriptionTranslation description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public ManualDescriptionTranslation getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable ManualDescriptionTranslation description) { + this.description = description; + } + + + public ManualTranslationUpdateRequest title(@javax.annotation.Nullable ManualTitleTranslation title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @javax.annotation.Nullable + public ManualTitleTranslation getTitle() { + return title; + } + + public void setTitle(@javax.annotation.Nullable ManualTitleTranslation title) { + this.title = title; + } + + + public ManualTranslationUpdateRequest safetyInformation(@javax.annotation.Nullable ManualSafetyInformationTranslation safetyInformation) { + this.safetyInformation = safetyInformation; + return this; + } + + /** + * Get safetyInformation + * @return safetyInformation + */ + @javax.annotation.Nullable + public ManualSafetyInformationTranslation getSafetyInformation() { + return safetyInformation; + } + + public void setSafetyInformation(@javax.annotation.Nullable ManualSafetyInformationTranslation safetyInformation) { + this.safetyInformation = safetyInformation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManualTranslationUpdateRequest manualTranslationUpdateRequest = (ManualTranslationUpdateRequest) o; + return Objects.equals(this.description, manualTranslationUpdateRequest.description) && + Objects.equals(this.title, manualTranslationUpdateRequest.title) && + Objects.equals(this.safetyInformation, manualTranslationUpdateRequest.safetyInformation); + } + + @Override + public int hashCode() { + return Objects.hash(description, title, safetyInformation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManualTranslationUpdateRequest {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" safetyInformation: ").append(toIndentedString(safetyInformation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("description"); + openapiFields.add("title"); + openapiFields.add("safetyInformation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ManualTranslationUpdateRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ManualTranslationUpdateRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ManualTranslationUpdateRequest is not found in the empty JSON string", ManualTranslationUpdateRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ManualTranslationUpdateRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ManualTranslationUpdateRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + ManualDescriptionTranslation.validateJsonElement(jsonObj.get("description")); + } + // validate the optional field `title` + if (jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) { + ManualTitleTranslation.validateJsonElement(jsonObj.get("title")); + } + // validate the optional field `safetyInformation` + if (jsonObj.get("safetyInformation") != null && !jsonObj.get("safetyInformation").isJsonNull()) { + ManualSafetyInformationTranslation.validateJsonElement(jsonObj.get("safetyInformation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ManualTranslationUpdateRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ManualTranslationUpdateRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ManualTranslationUpdateRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ManualTranslationUpdateRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ManualTranslationUpdateRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ManualTranslationUpdateRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ManualTranslationUpdateRequest + * @throws IOException if the JSON string is invalid with respect to ManualTranslationUpdateRequest + */ + public static ManualTranslationUpdateRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ManualTranslationUpdateRequest.class); + } + + /** + * Convert an instance of ManualTranslationUpdateRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MarketedBeforeGPSRObligation.java b/src/main/java/pl/wtx/allegro/api/client/model/MarketedBeforeGPSRObligation.java new file mode 100644 index 0000000..bd1a235 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MarketedBeforeGPSRObligation.java @@ -0,0 +1,215 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MarketedBeforeGPSRObligation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MarketedBeforeGPSRObligation { + public static final String SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION = "marketedBeforeGPSRObligation"; + @SerializedName(SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION) + @javax.annotation.Nullable + private Boolean marketedBeforeGPSRObligation; + + public MarketedBeforeGPSRObligation() { + } + + public MarketedBeforeGPSRObligation marketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + return this; + } + + /** + * Allows you to declare that the product was introduced before 13 Dec 2024 and therefore does not require GPSR data. + * @return marketedBeforeGPSRObligation + */ + @javax.annotation.Nullable + public Boolean getMarketedBeforeGPSRObligation() { + return marketedBeforeGPSRObligation; + } + + public void setMarketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketedBeforeGPSRObligation marketedBeforeGPSRObligation = (MarketedBeforeGPSRObligation) o; + return Objects.equals(this.marketedBeforeGPSRObligation, marketedBeforeGPSRObligation.marketedBeforeGPSRObligation); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(marketedBeforeGPSRObligation); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketedBeforeGPSRObligation {\n"); + sb.append(" marketedBeforeGPSRObligation: ").append(toIndentedString(marketedBeforeGPSRObligation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketedBeforeGPSRObligation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MarketedBeforeGPSRObligation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketedBeforeGPSRObligation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MarketedBeforeGPSRObligation is not found in the empty JSON string", MarketedBeforeGPSRObligation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MarketedBeforeGPSRObligation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MarketedBeforeGPSRObligation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketedBeforeGPSRObligation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketedBeforeGPSRObligation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MarketedBeforeGPSRObligation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketedBeforeGPSRObligation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketedBeforeGPSRObligation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MarketedBeforeGPSRObligation given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketedBeforeGPSRObligation + * @throws IOException if the JSON string is invalid with respect to MarketedBeforeGPSRObligation + */ + public static MarketedBeforeGPSRObligation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketedBeforeGPSRObligation.class); + } + + /** + * Convert an instance of MarketedBeforeGPSRObligation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceAvailablePromotionPackages.java b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceAvailablePromotionPackages.java new file mode 100644 index 0000000..f8fe180 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceAvailablePromotionPackages.java @@ -0,0 +1,307 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AvailablePromotionPackage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MarketplaceAvailablePromotionPackages + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MarketplaceAvailablePromotionPackages { + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + public static final String SERIALIZED_NAME_BASE_PACKAGES = "basePackages"; + @SerializedName(SERIALIZED_NAME_BASE_PACKAGES) + @javax.annotation.Nullable + private List basePackages = new ArrayList<>(); + + public static final String SERIALIZED_NAME_EXTRA_PACKAGES = "extraPackages"; + @SerializedName(SERIALIZED_NAME_EXTRA_PACKAGES) + @javax.annotation.Nullable + private List extraPackages = new ArrayList<>(); + + public MarketplaceAvailablePromotionPackages() { + } + + public MarketplaceAvailablePromotionPackages marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * Get marketplaceId + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + public MarketplaceAvailablePromotionPackages basePackages(@javax.annotation.Nullable List basePackages) { + this.basePackages = basePackages; + return this; + } + + public MarketplaceAvailablePromotionPackages addBasePackagesItem(AvailablePromotionPackage basePackagesItem) { + if (this.basePackages == null) { + this.basePackages = new ArrayList<>(); + } + this.basePackages.add(basePackagesItem); + return this; + } + + /** + * Available base promotion packages. Only one base package can be set on an offer. + * @return basePackages + */ + @javax.annotation.Nullable + public List getBasePackages() { + return basePackages; + } + + public void setBasePackages(@javax.annotation.Nullable List basePackages) { + this.basePackages = basePackages; + } + + + public MarketplaceAvailablePromotionPackages extraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + return this; + } + + public MarketplaceAvailablePromotionPackages addExtraPackagesItem(AvailablePromotionPackage extraPackagesItem) { + if (this.extraPackages == null) { + this.extraPackages = new ArrayList<>(); + } + this.extraPackages.add(extraPackagesItem); + return this; + } + + /** + * Available extra promotion packages. Multiple different extra packages can be set on an offer. + * @return extraPackages + */ + @javax.annotation.Nullable + public List getExtraPackages() { + return extraPackages; + } + + public void setExtraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketplaceAvailablePromotionPackages marketplaceAvailablePromotionPackages = (MarketplaceAvailablePromotionPackages) o; + return Objects.equals(this.marketplaceId, marketplaceAvailablePromotionPackages.marketplaceId) && + Objects.equals(this.basePackages, marketplaceAvailablePromotionPackages.basePackages) && + Objects.equals(this.extraPackages, marketplaceAvailablePromotionPackages.extraPackages); + } + + @Override + public int hashCode() { + return Objects.hash(marketplaceId, basePackages, extraPackages); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketplaceAvailablePromotionPackages {\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append(" basePackages: ").append(toIndentedString(basePackages)).append("\n"); + sb.append(" extraPackages: ").append(toIndentedString(extraPackages)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplaceId"); + openapiFields.add("basePackages"); + openapiFields.add("extraPackages"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MarketplaceAvailablePromotionPackages + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketplaceAvailablePromotionPackages.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MarketplaceAvailablePromotionPackages is not found in the empty JSON string", MarketplaceAvailablePromotionPackages.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MarketplaceAvailablePromotionPackages.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MarketplaceAvailablePromotionPackages` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("marketplaceId") != null && !jsonObj.get("marketplaceId").isJsonNull()) && !jsonObj.get("marketplaceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("marketplaceId").toString())); + } + if (jsonObj.get("basePackages") != null && !jsonObj.get("basePackages").isJsonNull()) { + JsonArray jsonArraybasePackages = jsonObj.getAsJsonArray("basePackages"); + if (jsonArraybasePackages != null) { + // ensure the json data is an array + if (!jsonObj.get("basePackages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `basePackages` to be an array in the JSON string but got `%s`", jsonObj.get("basePackages").toString())); + } + + // validate the optional field `basePackages` (array) + for (int i = 0; i < jsonArraybasePackages.size(); i++) { + AvailablePromotionPackage.validateJsonElement(jsonArraybasePackages.get(i)); + }; + } + } + if (jsonObj.get("extraPackages") != null && !jsonObj.get("extraPackages").isJsonNull()) { + JsonArray jsonArrayextraPackages = jsonObj.getAsJsonArray("extraPackages"); + if (jsonArrayextraPackages != null) { + // ensure the json data is an array + if (!jsonObj.get("extraPackages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `extraPackages` to be an array in the JSON string but got `%s`", jsonObj.get("extraPackages").toString())); + } + + // validate the optional field `extraPackages` (array) + for (int i = 0; i < jsonArrayextraPackages.size(); i++) { + AvailablePromotionPackage.validateJsonElement(jsonArrayextraPackages.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketplaceAvailablePromotionPackages.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketplaceAvailablePromotionPackages' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MarketplaceAvailablePromotionPackages.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketplaceAvailablePromotionPackages value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketplaceAvailablePromotionPackages read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MarketplaceAvailablePromotionPackages given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketplaceAvailablePromotionPackages + * @throws IOException if the JSON string is invalid with respect to MarketplaceAvailablePromotionPackages + */ + public static MarketplaceAvailablePromotionPackages fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketplaceAvailablePromotionPackages.class); + } + + /** + * Convert an instance of MarketplaceAvailablePromotionPackages to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItem.java b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItem.java new file mode 100644 index 0000000..48ca541 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItem.java @@ -0,0 +1,322 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.MarketplaceItemCurrencies; +import pl.wtx.allegro.api.client.model.MarketplaceItemLanguages; +import pl.wtx.allegro.api.client.model.MarketplaceItemShippingCountry; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MarketplaceItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MarketplaceItem { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_LANGUAGES = "languages"; + @SerializedName(SERIALIZED_NAME_LANGUAGES) + @javax.annotation.Nullable + private MarketplaceItemLanguages languages; + + public static final String SERIALIZED_NAME_CURRENCIES = "currencies"; + @SerializedName(SERIALIZED_NAME_CURRENCIES) + @javax.annotation.Nullable + private MarketplaceItemCurrencies currencies; + + public static final String SERIALIZED_NAME_SHIPPING_COUNTRIES = "shippingCountries"; + @SerializedName(SERIALIZED_NAME_SHIPPING_COUNTRIES) + @javax.annotation.Nullable + private List shippingCountries = new ArrayList<>(); + + public MarketplaceItem() { + } + + public MarketplaceItem id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Marketplace id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public MarketplaceItem languages(@javax.annotation.Nullable MarketplaceItemLanguages languages) { + this.languages = languages; + return this; + } + + /** + * Get languages + * @return languages + */ + @javax.annotation.Nullable + public MarketplaceItemLanguages getLanguages() { + return languages; + } + + public void setLanguages(@javax.annotation.Nullable MarketplaceItemLanguages languages) { + this.languages = languages; + } + + + public MarketplaceItem currencies(@javax.annotation.Nullable MarketplaceItemCurrencies currencies) { + this.currencies = currencies; + return this; + } + + /** + * Get currencies + * @return currencies + */ + @javax.annotation.Nullable + public MarketplaceItemCurrencies getCurrencies() { + return currencies; + } + + public void setCurrencies(@javax.annotation.Nullable MarketplaceItemCurrencies currencies) { + this.currencies = currencies; + } + + + public MarketplaceItem shippingCountries(@javax.annotation.Nullable List shippingCountries) { + this.shippingCountries = shippingCountries; + return this; + } + + public MarketplaceItem addShippingCountriesItem(MarketplaceItemShippingCountry shippingCountriesItem) { + if (this.shippingCountries == null) { + this.shippingCountries = new ArrayList<>(); + } + this.shippingCountries.add(shippingCountriesItem); + return this; + } + + /** + * List of delivery countries for that marketplace + * @return shippingCountries + */ + @javax.annotation.Nullable + public List getShippingCountries() { + return shippingCountries; + } + + public void setShippingCountries(@javax.annotation.Nullable List shippingCountries) { + this.shippingCountries = shippingCountries; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketplaceItem marketplaceItem = (MarketplaceItem) o; + return Objects.equals(this.id, marketplaceItem.id) && + Objects.equals(this.languages, marketplaceItem.languages) && + Objects.equals(this.currencies, marketplaceItem.currencies) && + Objects.equals(this.shippingCountries, marketplaceItem.shippingCountries); + } + + @Override + public int hashCode() { + return Objects.hash(id, languages, currencies, shippingCountries); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketplaceItem {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" languages: ").append(toIndentedString(languages)).append("\n"); + sb.append(" currencies: ").append(toIndentedString(currencies)).append("\n"); + sb.append(" shippingCountries: ").append(toIndentedString(shippingCountries)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("languages"); + openapiFields.add("currencies"); + openapiFields.add("shippingCountries"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MarketplaceItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketplaceItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MarketplaceItem is not found in the empty JSON string", MarketplaceItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MarketplaceItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MarketplaceItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `languages` + if (jsonObj.get("languages") != null && !jsonObj.get("languages").isJsonNull()) { + MarketplaceItemLanguages.validateJsonElement(jsonObj.get("languages")); + } + // validate the optional field `currencies` + if (jsonObj.get("currencies") != null && !jsonObj.get("currencies").isJsonNull()) { + MarketplaceItemCurrencies.validateJsonElement(jsonObj.get("currencies")); + } + if (jsonObj.get("shippingCountries") != null && !jsonObj.get("shippingCountries").isJsonNull()) { + JsonArray jsonArrayshippingCountries = jsonObj.getAsJsonArray("shippingCountries"); + if (jsonArrayshippingCountries != null) { + // ensure the json data is an array + if (!jsonObj.get("shippingCountries").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `shippingCountries` to be an array in the JSON string but got `%s`", jsonObj.get("shippingCountries").toString())); + } + + // validate the optional field `shippingCountries` (array) + for (int i = 0; i < jsonArrayshippingCountries.size(); i++) { + MarketplaceItemShippingCountry.validateJsonElement(jsonArrayshippingCountries.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketplaceItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketplaceItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MarketplaceItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketplaceItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketplaceItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MarketplaceItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketplaceItem + * @throws IOException if the JSON string is invalid with respect to MarketplaceItem + */ + public static MarketplaceItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketplaceItem.class); + } + + /** + * Convert an instance of MarketplaceItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemCurrencies.java b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemCurrencies.java new file mode 100644 index 0000000..6102c70 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemCurrencies.java @@ -0,0 +1,259 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.MarketplaceItemCurrency; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Currencies available for that marketplace + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MarketplaceItemCurrencies { + public static final String SERIALIZED_NAME_BASE = "base"; + @SerializedName(SERIALIZED_NAME_BASE) + @javax.annotation.Nullable + private MarketplaceItemCurrency base; + + public static final String SERIALIZED_NAME_ADDITIONAL = "additional"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL) + @javax.annotation.Nullable + private List additional = new ArrayList<>(); + + public MarketplaceItemCurrencies() { + } + + public MarketplaceItemCurrencies base(@javax.annotation.Nullable MarketplaceItemCurrency base) { + this.base = base; + return this; + } + + /** + * Get base + * @return base + */ + @javax.annotation.Nullable + public MarketplaceItemCurrency getBase() { + return base; + } + + public void setBase(@javax.annotation.Nullable MarketplaceItemCurrency base) { + this.base = base; + } + + + public MarketplaceItemCurrencies additional(@javax.annotation.Nullable List additional) { + this.additional = additional; + return this; + } + + public MarketplaceItemCurrencies addAdditionalItem(MarketplaceItemCurrency additionalItem) { + if (this.additional == null) { + this.additional = new ArrayList<>(); + } + this.additional.add(additionalItem); + return this; + } + + /** + * List of other currencies available for that marketplace + * @return additional + */ + @javax.annotation.Nullable + public List getAdditional() { + return additional; + } + + public void setAdditional(@javax.annotation.Nullable List additional) { + this.additional = additional; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketplaceItemCurrencies marketplaceItemCurrencies = (MarketplaceItemCurrencies) o; + return Objects.equals(this.base, marketplaceItemCurrencies.base) && + Objects.equals(this.additional, marketplaceItemCurrencies.additional); + } + + @Override + public int hashCode() { + return Objects.hash(base, additional); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketplaceItemCurrencies {\n"); + sb.append(" base: ").append(toIndentedString(base)).append("\n"); + sb.append(" additional: ").append(toIndentedString(additional)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("base"); + openapiFields.add("additional"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MarketplaceItemCurrencies + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketplaceItemCurrencies.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MarketplaceItemCurrencies is not found in the empty JSON string", MarketplaceItemCurrencies.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MarketplaceItemCurrencies.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MarketplaceItemCurrencies` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `base` + if (jsonObj.get("base") != null && !jsonObj.get("base").isJsonNull()) { + MarketplaceItemCurrency.validateJsonElement(jsonObj.get("base")); + } + if (jsonObj.get("additional") != null && !jsonObj.get("additional").isJsonNull()) { + JsonArray jsonArrayadditional = jsonObj.getAsJsonArray("additional"); + if (jsonArrayadditional != null) { + // ensure the json data is an array + if (!jsonObj.get("additional").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additional` to be an array in the JSON string but got `%s`", jsonObj.get("additional").toString())); + } + + // validate the optional field `additional` (array) + for (int i = 0; i < jsonArrayadditional.size(); i++) { + MarketplaceItemCurrency.validateJsonElement(jsonArrayadditional.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketplaceItemCurrencies.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketplaceItemCurrencies' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MarketplaceItemCurrencies.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketplaceItemCurrencies value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketplaceItemCurrencies read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MarketplaceItemCurrencies given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketplaceItemCurrencies + * @throws IOException if the JSON string is invalid with respect to MarketplaceItemCurrencies + */ + public static MarketplaceItemCurrencies fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketplaceItemCurrencies.class); + } + + /** + * Convert an instance of MarketplaceItemCurrencies to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemCurrency.java b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemCurrency.java new file mode 100644 index 0000000..9ed87b8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemCurrency.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MarketplaceItemCurrency + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MarketplaceItemCurrency { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public MarketplaceItemCurrency() { + } + + public MarketplaceItemCurrency code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * ISO 4217 currency code + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketplaceItemCurrency marketplaceItemCurrency = (MarketplaceItemCurrency) o; + return Objects.equals(this.code, marketplaceItemCurrency.code); + } + + @Override + public int hashCode() { + return Objects.hash(code); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketplaceItemCurrency {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MarketplaceItemCurrency + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketplaceItemCurrency.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MarketplaceItemCurrency is not found in the empty JSON string", MarketplaceItemCurrency.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MarketplaceItemCurrency.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MarketplaceItemCurrency` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketplaceItemCurrency.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketplaceItemCurrency' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MarketplaceItemCurrency.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketplaceItemCurrency value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketplaceItemCurrency read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MarketplaceItemCurrency given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketplaceItemCurrency + * @throws IOException if the JSON string is invalid with respect to MarketplaceItemCurrency + */ + public static MarketplaceItemCurrency fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketplaceItemCurrency.class); + } + + /** + * Convert an instance of MarketplaceItemCurrency to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemLanguage.java b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemLanguage.java new file mode 100644 index 0000000..fc3403e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemLanguage.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MarketplaceItemLanguage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MarketplaceItemLanguage { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public MarketplaceItemLanguage() { + } + + public MarketplaceItemLanguage code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * BCP-47 language code + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketplaceItemLanguage marketplaceItemLanguage = (MarketplaceItemLanguage) o; + return Objects.equals(this.code, marketplaceItemLanguage.code); + } + + @Override + public int hashCode() { + return Objects.hash(code); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketplaceItemLanguage {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MarketplaceItemLanguage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketplaceItemLanguage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MarketplaceItemLanguage is not found in the empty JSON string", MarketplaceItemLanguage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MarketplaceItemLanguage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MarketplaceItemLanguage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketplaceItemLanguage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketplaceItemLanguage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MarketplaceItemLanguage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketplaceItemLanguage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketplaceItemLanguage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MarketplaceItemLanguage given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketplaceItemLanguage + * @throws IOException if the JSON string is invalid with respect to MarketplaceItemLanguage + */ + public static MarketplaceItemLanguage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketplaceItemLanguage.class); + } + + /** + * Convert an instance of MarketplaceItemLanguage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemLanguages.java b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemLanguages.java new file mode 100644 index 0000000..b890565 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemLanguages.java @@ -0,0 +1,277 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.MarketplaceItemLanguage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Languages available for that marketplace + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MarketplaceItemLanguages { + public static final String SERIALIZED_NAME_OFFER_CREATION = "offerCreation"; + @SerializedName(SERIALIZED_NAME_OFFER_CREATION) + @javax.annotation.Nullable + private List offerCreation = new ArrayList<>(); + + public static final String SERIALIZED_NAME_OFFER_DISPLAY = "offerDisplay"; + @SerializedName(SERIALIZED_NAME_OFFER_DISPLAY) + @javax.annotation.Nullable + private List offerDisplay = new ArrayList<>(); + + public MarketplaceItemLanguages() { + } + + public MarketplaceItemLanguages offerCreation(@javax.annotation.Nullable List offerCreation) { + this.offerCreation = offerCreation; + return this; + } + + public MarketplaceItemLanguages addOfferCreationItem(MarketplaceItemLanguage offerCreationItem) { + if (this.offerCreation == null) { + this.offerCreation = new ArrayList<>(); + } + this.offerCreation.add(offerCreationItem); + return this; + } + + /** + * Languages in which you can create offer + * @return offerCreation + */ + @javax.annotation.Nullable + public List getOfferCreation() { + return offerCreation; + } + + public void setOfferCreation(@javax.annotation.Nullable List offerCreation) { + this.offerCreation = offerCreation; + } + + + public MarketplaceItemLanguages offerDisplay(@javax.annotation.Nullable List offerDisplay) { + this.offerDisplay = offerDisplay; + return this; + } + + public MarketplaceItemLanguages addOfferDisplayItem(MarketplaceItemLanguage offerDisplayItem) { + if (this.offerDisplay == null) { + this.offerDisplay = new ArrayList<>(); + } + this.offerDisplay.add(offerDisplayItem); + return this; + } + + /** + * Languages in which buyer can see the offer + * @return offerDisplay + */ + @javax.annotation.Nullable + public List getOfferDisplay() { + return offerDisplay; + } + + public void setOfferDisplay(@javax.annotation.Nullable List offerDisplay) { + this.offerDisplay = offerDisplay; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketplaceItemLanguages marketplaceItemLanguages = (MarketplaceItemLanguages) o; + return Objects.equals(this.offerCreation, marketplaceItemLanguages.offerCreation) && + Objects.equals(this.offerDisplay, marketplaceItemLanguages.offerDisplay); + } + + @Override + public int hashCode() { + return Objects.hash(offerCreation, offerDisplay); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketplaceItemLanguages {\n"); + sb.append(" offerCreation: ").append(toIndentedString(offerCreation)).append("\n"); + sb.append(" offerDisplay: ").append(toIndentedString(offerDisplay)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offerCreation"); + openapiFields.add("offerDisplay"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MarketplaceItemLanguages + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketplaceItemLanguages.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MarketplaceItemLanguages is not found in the empty JSON string", MarketplaceItemLanguages.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MarketplaceItemLanguages.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MarketplaceItemLanguages` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("offerCreation") != null && !jsonObj.get("offerCreation").isJsonNull()) { + JsonArray jsonArrayofferCreation = jsonObj.getAsJsonArray("offerCreation"); + if (jsonArrayofferCreation != null) { + // ensure the json data is an array + if (!jsonObj.get("offerCreation").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerCreation` to be an array in the JSON string but got `%s`", jsonObj.get("offerCreation").toString())); + } + + // validate the optional field `offerCreation` (array) + for (int i = 0; i < jsonArrayofferCreation.size(); i++) { + MarketplaceItemLanguage.validateJsonElement(jsonArrayofferCreation.get(i)); + }; + } + } + if (jsonObj.get("offerDisplay") != null && !jsonObj.get("offerDisplay").isJsonNull()) { + JsonArray jsonArrayofferDisplay = jsonObj.getAsJsonArray("offerDisplay"); + if (jsonArrayofferDisplay != null) { + // ensure the json data is an array + if (!jsonObj.get("offerDisplay").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerDisplay` to be an array in the JSON string but got `%s`", jsonObj.get("offerDisplay").toString())); + } + + // validate the optional field `offerDisplay` (array) + for (int i = 0; i < jsonArrayofferDisplay.size(); i++) { + MarketplaceItemLanguage.validateJsonElement(jsonArrayofferDisplay.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketplaceItemLanguages.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketplaceItemLanguages' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MarketplaceItemLanguages.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketplaceItemLanguages value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketplaceItemLanguages read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MarketplaceItemLanguages given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketplaceItemLanguages + * @throws IOException if the JSON string is invalid with respect to MarketplaceItemLanguages + */ + public static MarketplaceItemLanguages fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketplaceItemLanguages.class); + } + + /** + * Convert an instance of MarketplaceItemLanguages to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemShippingCountry.java b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemShippingCountry.java new file mode 100644 index 0000000..6dda1b9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceItemShippingCountry.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MarketplaceItemShippingCountry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MarketplaceItemShippingCountry { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public MarketplaceItemShippingCountry() { + } + + public MarketplaceItemShippingCountry code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * ISO 3166 country code + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketplaceItemShippingCountry marketplaceItemShippingCountry = (MarketplaceItemShippingCountry) o; + return Objects.equals(this.code, marketplaceItemShippingCountry.code); + } + + @Override + public int hashCode() { + return Objects.hash(code); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketplaceItemShippingCountry {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MarketplaceItemShippingCountry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketplaceItemShippingCountry.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MarketplaceItemShippingCountry is not found in the empty JSON string", MarketplaceItemShippingCountry.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MarketplaceItemShippingCountry.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MarketplaceItemShippingCountry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketplaceItemShippingCountry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketplaceItemShippingCountry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MarketplaceItemShippingCountry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketplaceItemShippingCountry value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketplaceItemShippingCountry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MarketplaceItemShippingCountry given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketplaceItemShippingCountry + * @throws IOException if the JSON string is invalid with respect to MarketplaceItemShippingCountry + */ + public static MarketplaceItemShippingCountry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketplaceItemShippingCountry.class); + } + + /** + * Convert an instance of MarketplaceItemShippingCountry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceOfferPromoOption.java b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceOfferPromoOption.java new file mode 100644 index 0000000..1c58d08 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceOfferPromoOption.java @@ -0,0 +1,321 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferPromoOption; +import pl.wtx.allegro.api.client.model.OfferPromoOptionsPendingChanges; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MarketplaceOfferPromoOption + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MarketplaceOfferPromoOption { + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + public static final String SERIALIZED_NAME_BASE_PACKAGE = "basePackage"; + @SerializedName(SERIALIZED_NAME_BASE_PACKAGE) + @javax.annotation.Nullable + private OfferPromoOption basePackage; + + public static final String SERIALIZED_NAME_EXTRA_PACKAGES = "extraPackages"; + @SerializedName(SERIALIZED_NAME_EXTRA_PACKAGES) + @javax.annotation.Nullable + private List extraPackages = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PENDING_CHANGES = "pendingChanges"; + @SerializedName(SERIALIZED_NAME_PENDING_CHANGES) + @javax.annotation.Nullable + private OfferPromoOptionsPendingChanges pendingChanges; + + public MarketplaceOfferPromoOption() { + } + + public MarketplaceOfferPromoOption marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * Get marketplaceId + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + public MarketplaceOfferPromoOption basePackage(@javax.annotation.Nullable OfferPromoOption basePackage) { + this.basePackage = basePackage; + return this; + } + + /** + * Get basePackage + * @return basePackage + */ + @javax.annotation.Nullable + public OfferPromoOption getBasePackage() { + return basePackage; + } + + public void setBasePackage(@javax.annotation.Nullable OfferPromoOption basePackage) { + this.basePackage = basePackage; + } + + + public MarketplaceOfferPromoOption extraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + return this; + } + + public MarketplaceOfferPromoOption addExtraPackagesItem(OfferPromoOption extraPackagesItem) { + if (this.extraPackages == null) { + this.extraPackages = new ArrayList<>(); + } + this.extraPackages.add(extraPackagesItem); + return this; + } + + /** + * Extra promotion packages set on offer. + * @return extraPackages + */ + @javax.annotation.Nullable + public List getExtraPackages() { + return extraPackages; + } + + public void setExtraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + } + + + public MarketplaceOfferPromoOption pendingChanges(@javax.annotation.Nullable OfferPromoOptionsPendingChanges pendingChanges) { + this.pendingChanges = pendingChanges; + return this; + } + + /** + * Get pendingChanges + * @return pendingChanges + */ + @javax.annotation.Nullable + public OfferPromoOptionsPendingChanges getPendingChanges() { + return pendingChanges; + } + + public void setPendingChanges(@javax.annotation.Nullable OfferPromoOptionsPendingChanges pendingChanges) { + this.pendingChanges = pendingChanges; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketplaceOfferPromoOption marketplaceOfferPromoOption = (MarketplaceOfferPromoOption) o; + return Objects.equals(this.marketplaceId, marketplaceOfferPromoOption.marketplaceId) && + Objects.equals(this.basePackage, marketplaceOfferPromoOption.basePackage) && + Objects.equals(this.extraPackages, marketplaceOfferPromoOption.extraPackages) && + Objects.equals(this.pendingChanges, marketplaceOfferPromoOption.pendingChanges); + } + + @Override + public int hashCode() { + return Objects.hash(marketplaceId, basePackage, extraPackages, pendingChanges); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketplaceOfferPromoOption {\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append(" basePackage: ").append(toIndentedString(basePackage)).append("\n"); + sb.append(" extraPackages: ").append(toIndentedString(extraPackages)).append("\n"); + sb.append(" pendingChanges: ").append(toIndentedString(pendingChanges)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplaceId"); + openapiFields.add("basePackage"); + openapiFields.add("extraPackages"); + openapiFields.add("pendingChanges"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MarketplaceOfferPromoOption + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketplaceOfferPromoOption.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MarketplaceOfferPromoOption is not found in the empty JSON string", MarketplaceOfferPromoOption.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MarketplaceOfferPromoOption.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MarketplaceOfferPromoOption` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("marketplaceId") != null && !jsonObj.get("marketplaceId").isJsonNull()) && !jsonObj.get("marketplaceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("marketplaceId").toString())); + } + // validate the optional field `basePackage` + if (jsonObj.get("basePackage") != null && !jsonObj.get("basePackage").isJsonNull()) { + OfferPromoOption.validateJsonElement(jsonObj.get("basePackage")); + } + if (jsonObj.get("extraPackages") != null && !jsonObj.get("extraPackages").isJsonNull()) { + JsonArray jsonArrayextraPackages = jsonObj.getAsJsonArray("extraPackages"); + if (jsonArrayextraPackages != null) { + // ensure the json data is an array + if (!jsonObj.get("extraPackages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `extraPackages` to be an array in the JSON string but got `%s`", jsonObj.get("extraPackages").toString())); + } + + // validate the optional field `extraPackages` (array) + for (int i = 0; i < jsonArrayextraPackages.size(); i++) { + OfferPromoOption.validateJsonElement(jsonArrayextraPackages.get(i)); + }; + } + } + // validate the optional field `pendingChanges` + if (jsonObj.get("pendingChanges") != null && !jsonObj.get("pendingChanges").isJsonNull()) { + OfferPromoOptionsPendingChanges.validateJsonElement(jsonObj.get("pendingChanges")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketplaceOfferPromoOption.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketplaceOfferPromoOption' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MarketplaceOfferPromoOption.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketplaceOfferPromoOption value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketplaceOfferPromoOption read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MarketplaceOfferPromoOption given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketplaceOfferPromoOption + * @throws IOException if the JSON string is invalid with respect to MarketplaceOfferPromoOption + */ + public static MarketplaceOfferPromoOption fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketplaceOfferPromoOption.class); + } + + /** + * Convert an instance of MarketplaceOfferPromoOption to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceReference.java b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceReference.java new file mode 100644 index 0000000..3d67ec4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MarketplaceReference.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Identifies a marketplace. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MarketplaceReference { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public MarketplaceReference() { + } + + public MarketplaceReference id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The id of a marketplace.<br/> Available marketplaces can be determined using <a href=\"#operation/marketplacesGET\">GET /marketplaces</a>. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketplaceReference marketplaceReference = (MarketplaceReference) o; + return Objects.equals(this.id, marketplaceReference.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketplaceReference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MarketplaceReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketplaceReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MarketplaceReference is not found in the empty JSON string", MarketplaceReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MarketplaceReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MarketplaceReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MarketplaceReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketplaceReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketplaceReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MarketplaceReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketplaceReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketplaceReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MarketplaceReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketplaceReference + * @throws IOException if the JSON string is invalid with respect to MarketplaceReference + */ + public static MarketplaceReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketplaceReference.class); + } + + /** + * Convert an instance of MarketplaceReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MarketplacesVisibility.java b/src/main/java/pl/wtx/allegro/api/client/model/MarketplacesVisibility.java new file mode 100644 index 0000000..c955d52 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MarketplacesVisibility.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacesVisibility; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer marketplaces visibility information. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MarketplacesVisibility { + public static final String SERIALIZED_NAME_BASE = "base"; + @SerializedName(SERIALIZED_NAME_BASE) + @javax.annotation.Nonnull + private String base; + + public static final String SERIALIZED_NAME_ADDITIONAL = "additional"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL) + @javax.annotation.Nullable + private List additional = new ArrayList<>(); + + public MarketplacesVisibility() { + } + + public MarketplacesVisibility base(@javax.annotation.Nonnull String base) { + this.base = base; + return this; + } + + /** + * Base marketplace ID. + * @return base + */ + @javax.annotation.Nonnull + public String getBase() { + return base; + } + + public void setBase(@javax.annotation.Nonnull String base) { + this.base = base; + } + + + public MarketplacesVisibility additional(@javax.annotation.Nullable List additional) { + this.additional = additional; + return this; + } + + public MarketplacesVisibility addAdditionalItem(AdditionalMarketplacesVisibility additionalItem) { + if (this.additional == null) { + this.additional = new ArrayList<>(); + } + this.additional.add(additionalItem); + return this; + } + + /** + * Additional marketplaces information. + * @return additional + */ + @javax.annotation.Nullable + public List getAdditional() { + return additional; + } + + public void setAdditional(@javax.annotation.Nullable List additional) { + this.additional = additional; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MarketplacesVisibility marketplacesVisibility = (MarketplacesVisibility) o; + return Objects.equals(this.base, marketplacesVisibility.base) && + Objects.equals(this.additional, marketplacesVisibility.additional); + } + + @Override + public int hashCode() { + return Objects.hash(base, additional); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MarketplacesVisibility {\n"); + sb.append(" base: ").append(toIndentedString(base)).append("\n"); + sb.append(" additional: ").append(toIndentedString(additional)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("base"); + openapiFields.add("additional"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("base"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MarketplacesVisibility + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MarketplacesVisibility.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MarketplacesVisibility is not found in the empty JSON string", MarketplacesVisibility.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MarketplacesVisibility.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MarketplacesVisibility` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MarketplacesVisibility.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("base").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `base` to be a primitive type in the JSON string but got `%s`", jsonObj.get("base").toString())); + } + if (jsonObj.get("additional") != null && !jsonObj.get("additional").isJsonNull()) { + JsonArray jsonArrayadditional = jsonObj.getAsJsonArray("additional"); + if (jsonArrayadditional != null) { + // ensure the json data is an array + if (!jsonObj.get("additional").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additional` to be an array in the JSON string but got `%s`", jsonObj.get("additional").toString())); + } + + // validate the optional field `additional` (array) + for (int i = 0; i < jsonArrayadditional.size(); i++) { + AdditionalMarketplacesVisibility.validateJsonElement(jsonArrayadditional.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MarketplacesVisibility.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MarketplacesVisibility' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MarketplacesVisibility.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MarketplacesVisibility value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MarketplacesVisibility read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MarketplacesVisibility given an JSON string + * + * @param jsonString JSON string + * @return An instance of MarketplacesVisibility + * @throws IOException if the JSON string is invalid with respect to MarketplacesVisibility + */ + public static MarketplacesVisibility fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MarketplacesVisibility.class); + } + + /** + * Convert an instance of MarketplacesVisibility to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MaxPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/MaxPrice.java new file mode 100644 index 0000000..d7f738e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MaxPrice.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Maximum amount that user is willing to pay for the auction. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MaxPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public MaxPrice() { + } + + public MaxPrice amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public MaxPrice currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MaxPrice maxPrice = (MaxPrice) o; + return Objects.equals(this.amount, maxPrice.amount) && + Objects.equals(this.currency, maxPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MaxPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MaxPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MaxPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MaxPrice is not found in the empty JSON string", MaxPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MaxPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MaxPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MaxPrice.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MaxPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MaxPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MaxPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MaxPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MaxPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MaxPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of MaxPrice + * @throws IOException if the JSON string is invalid with respect to MaxPrice + */ + public static MaxPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MaxPrice.class); + } + + /** + * Convert an instance of MaxPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MeResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/MeResponse.java new file mode 100644 index 0000000..11a6bf0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MeResponse.java @@ -0,0 +1,431 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Company; +import pl.wtx.allegro.api.client.model.MeResponseBaseMarketplace; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MeResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MeResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nullable + private String login; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nullable + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nullable + private String lastName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_BASE_MARKETPLACE = "baseMarketplace"; + @SerializedName(SERIALIZED_NAME_BASE_MARKETPLACE) + @javax.annotation.Nullable + private MeResponseBaseMarketplace baseMarketplace; + + public static final String SERIALIZED_NAME_COMPANY = "company"; + @SerializedName(SERIALIZED_NAME_COMPANY) + @javax.annotation.Nullable + private Company company; + + public static final String SERIALIZED_NAME_FEATURES = "features"; + @SerializedName(SERIALIZED_NAME_FEATURES) + @javax.annotation.Nullable + private List features = new ArrayList<>(); + + public MeResponse() { + } + + public MeResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * User Id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public MeResponse login(@javax.annotation.Nullable String login) { + this.login = login; + return this; + } + + /** + * User login. + * @return login + */ + @javax.annotation.Nullable + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nullable String login) { + this.login = login; + } + + + public MeResponse firstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + return this; + } + + /** + * User's first name. + * @return firstName + */ + @javax.annotation.Nullable + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nullable String firstName) { + this.firstName = firstName; + } + + + public MeResponse lastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + return this; + } + + /** + * User's last name. + * @return lastName + */ + @javax.annotation.Nullable + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nullable String lastName) { + this.lastName = lastName; + } + + + public MeResponse email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * User's email. + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public MeResponse baseMarketplace(@javax.annotation.Nullable MeResponseBaseMarketplace baseMarketplace) { + this.baseMarketplace = baseMarketplace; + return this; + } + + /** + * Get baseMarketplace + * @return baseMarketplace + */ + @javax.annotation.Nullable + public MeResponseBaseMarketplace getBaseMarketplace() { + return baseMarketplace; + } + + public void setBaseMarketplace(@javax.annotation.Nullable MeResponseBaseMarketplace baseMarketplace) { + this.baseMarketplace = baseMarketplace; + } + + + public MeResponse company(@javax.annotation.Nullable Company company) { + this.company = company; + return this; + } + + /** + * Get company + * @return company + */ + @javax.annotation.Nullable + public Company getCompany() { + return company; + } + + public void setCompany(@javax.annotation.Nullable Company company) { + this.company = company; + } + + + public MeResponse features(@javax.annotation.Nullable List features) { + this.features = features; + return this; + } + + public MeResponse addFeaturesItem(String featuresItem) { + if (this.features == null) { + this.features = new ArrayList<>(); + } + this.features.add(featuresItem); + return this; + } + + /** + * User's features list: - `SUPER_SELLER` - Super Seller (\"Super Sprzedawca\") information. - `ONE_FULFILLMENT` - Seller uses the fulfillment service provided by Allegro. + * @return features + */ + @javax.annotation.Nullable + public List getFeatures() { + return features; + } + + public void setFeatures(@javax.annotation.Nullable List features) { + this.features = features; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MeResponse meResponse = (MeResponse) o; + return Objects.equals(this.id, meResponse.id) && + Objects.equals(this.login, meResponse.login) && + Objects.equals(this.firstName, meResponse.firstName) && + Objects.equals(this.lastName, meResponse.lastName) && + Objects.equals(this.email, meResponse.email) && + Objects.equals(this.baseMarketplace, meResponse.baseMarketplace) && + Objects.equals(this.company, meResponse.company) && + Objects.equals(this.features, meResponse.features); + } + + @Override + public int hashCode() { + return Objects.hash(id, login, firstName, lastName, email, baseMarketplace, company, features); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MeResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" baseMarketplace: ").append(toIndentedString(baseMarketplace)).append("\n"); + sb.append(" company: ").append(toIndentedString(company)).append("\n"); + sb.append(" features: ").append(toIndentedString(features)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("login"); + openapiFields.add("firstName"); + openapiFields.add("lastName"); + openapiFields.add("email"); + openapiFields.add("baseMarketplace"); + openapiFields.add("company"); + openapiFields.add("features"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MeResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MeResponse is not found in the empty JSON string", MeResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MeResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("login") != null && !jsonObj.get("login").isJsonNull()) && !jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + // validate the optional field `baseMarketplace` + if (jsonObj.get("baseMarketplace") != null && !jsonObj.get("baseMarketplace").isJsonNull()) { + MeResponseBaseMarketplace.validateJsonElement(jsonObj.get("baseMarketplace")); + } + // validate the optional field `company` + if (jsonObj.get("company") != null && !jsonObj.get("company").isJsonNull()) { + Company.validateJsonElement(jsonObj.get("company")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("features") != null && !jsonObj.get("features").isJsonNull() && !jsonObj.get("features").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `features` to be an array in the JSON string but got `%s`", jsonObj.get("features").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MeResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MeResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MeResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MeResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MeResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of MeResponse + * @throws IOException if the JSON string is invalid with respect to MeResponse + */ + public static MeResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MeResponse.class); + } + + /** + * Convert an instance of MeResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MeResponseBaseMarketplace.java b/src/main/java/pl/wtx/allegro/api/client/model/MeResponseBaseMarketplace.java new file mode 100644 index 0000000..2963789 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MeResponseBaseMarketplace.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MeResponseBaseMarketplace + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MeResponseBaseMarketplace { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public MeResponseBaseMarketplace() { + } + + public MeResponseBaseMarketplace id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Base marketplace identifier + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MeResponseBaseMarketplace meResponseBaseMarketplace = (MeResponseBaseMarketplace) o; + return Objects.equals(this.id, meResponseBaseMarketplace.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MeResponseBaseMarketplace {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MeResponseBaseMarketplace + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MeResponseBaseMarketplace.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MeResponseBaseMarketplace is not found in the empty JSON string", MeResponseBaseMarketplace.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MeResponseBaseMarketplace.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MeResponseBaseMarketplace` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MeResponseBaseMarketplace.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MeResponseBaseMarketplace' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MeResponseBaseMarketplace.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MeResponseBaseMarketplace value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MeResponseBaseMarketplace read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MeResponseBaseMarketplace given an JSON string + * + * @param jsonString JSON string + * @return An instance of MeResponseBaseMarketplace + * @throws IOException if the JSON string is invalid with respect to MeResponseBaseMarketplace + */ + public static MeResponseBaseMarketplace fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MeResponseBaseMarketplace.class); + } + + /** + * Convert an instance of MeResponseBaseMarketplace to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Message.java b/src/main/java/pl/wtx/allegro/api/client/model/Message.java new file mode 100644 index 0000000..b34a817 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Message.java @@ -0,0 +1,696 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.MessageAdditionalInformation; +import pl.wtx.allegro.api.client.model.MessageAttachmentInfo; +import pl.wtx.allegro.api.client.model.MessageAuthor; +import pl.wtx.allegro.api.client.model.MessageRelatedObject; +import pl.wtx.allegro.api.client.model.ThreadId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Message + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Message { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + VERIFYING("VERIFYING"), + + BLOCKED("BLOCKED"), + + DELIVERED("DELIVERED"), + + INTERACTING("INTERACTING"), + + DISMISSED("DISMISSED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ASK_QUESTION("ASK_QUESTION"), + + MAIL("MAIL"), + + MESSAGE_CENTER("MESSAGE_CENTER"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_THREAD = "thread"; + @SerializedName(SERIALIZED_NAME_THREAD) + @javax.annotation.Nonnull + private ThreadId thread; + + public static final String SERIALIZED_NAME_AUTHOR = "author"; + @SerializedName(SERIALIZED_NAME_AUTHOR) + @javax.annotation.Nonnull + private MessageAuthor author; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nonnull + private String text; + + public static final String SERIALIZED_NAME_SUBJECT = "subject"; + @SerializedName(SERIALIZED_NAME_SUBJECT) + @javax.annotation.Nullable + private String subject; + + public static final String SERIALIZED_NAME_RELATES_TO = "relatesTo"; + @SerializedName(SERIALIZED_NAME_RELATES_TO) + @javax.annotation.Nonnull + private MessageRelatedObject relatesTo; + + public static final String SERIALIZED_NAME_HAS_ADDITIONAL_ATTACHMENTS = "hasAdditionalAttachments"; + @SerializedName(SERIALIZED_NAME_HAS_ADDITIONAL_ATTACHMENTS) + @javax.annotation.Nonnull + private Boolean hasAdditionalAttachments; + + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nonnull + private List attachments = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ADDITIONAL_INFORMATION = "additionalInformation"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFORMATION) + @javax.annotation.Nullable + private MessageAdditionalInformation additionalInformation; + + public Message() { + } + + public Message id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public Message status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + public Message type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public Message createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public Message thread(@javax.annotation.Nonnull ThreadId thread) { + this.thread = thread; + return this; + } + + /** + * Get thread + * @return thread + */ + @javax.annotation.Nonnull + public ThreadId getThread() { + return thread; + } + + public void setThread(@javax.annotation.Nonnull ThreadId thread) { + this.thread = thread; + } + + + public Message author(@javax.annotation.Nonnull MessageAuthor author) { + this.author = author; + return this; + } + + /** + * Get author + * @return author + */ + @javax.annotation.Nonnull + public MessageAuthor getAuthor() { + return author; + } + + public void setAuthor(@javax.annotation.Nonnull MessageAuthor author) { + this.author = author; + } + + + public Message text(@javax.annotation.Nonnull String text) { + this.text = text; + return this; + } + + /** + * Get text + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nonnull String text) { + this.text = text; + } + + + public Message subject(@javax.annotation.Nullable String subject) { + this.subject = subject; + return this; + } + + /** + * Get subject + * @return subject + */ + @javax.annotation.Nullable + public String getSubject() { + return subject; + } + + public void setSubject(@javax.annotation.Nullable String subject) { + this.subject = subject; + } + + + public Message relatesTo(@javax.annotation.Nonnull MessageRelatedObject relatesTo) { + this.relatesTo = relatesTo; + return this; + } + + /** + * Get relatesTo + * @return relatesTo + */ + @javax.annotation.Nonnull + public MessageRelatedObject getRelatesTo() { + return relatesTo; + } + + public void setRelatesTo(@javax.annotation.Nonnull MessageRelatedObject relatesTo) { + this.relatesTo = relatesTo; + } + + + public Message hasAdditionalAttachments(@javax.annotation.Nonnull Boolean hasAdditionalAttachments) { + this.hasAdditionalAttachments = hasAdditionalAttachments; + return this; + } + + /** + * Get hasAdditionalAttachments + * @return hasAdditionalAttachments + */ + @javax.annotation.Nonnull + public Boolean getHasAdditionalAttachments() { + return hasAdditionalAttachments; + } + + public void setHasAdditionalAttachments(@javax.annotation.Nonnull Boolean hasAdditionalAttachments) { + this.hasAdditionalAttachments = hasAdditionalAttachments; + } + + + public Message attachments(@javax.annotation.Nonnull List attachments) { + this.attachments = attachments; + return this; + } + + public Message addAttachmentsItem(MessageAttachmentInfo attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * Get attachments + * @return attachments + */ + @javax.annotation.Nonnull + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nonnull List attachments) { + this.attachments = attachments; + } + + + public Message additionalInformation(@javax.annotation.Nullable MessageAdditionalInformation additionalInformation) { + this.additionalInformation = additionalInformation; + return this; + } + + /** + * Get additionalInformation + * @return additionalInformation + */ + @javax.annotation.Nullable + public MessageAdditionalInformation getAdditionalInformation() { + return additionalInformation; + } + + public void setAdditionalInformation(@javax.annotation.Nullable MessageAdditionalInformation additionalInformation) { + this.additionalInformation = additionalInformation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Message message = (Message) o; + return Objects.equals(this.id, message.id) && + Objects.equals(this.status, message.status) && + Objects.equals(this.type, message.type) && + Objects.equals(this.createdAt, message.createdAt) && + Objects.equals(this.thread, message.thread) && + Objects.equals(this.author, message.author) && + Objects.equals(this.text, message.text) && + Objects.equals(this.subject, message.subject) && + Objects.equals(this.relatesTo, message.relatesTo) && + Objects.equals(this.hasAdditionalAttachments, message.hasAdditionalAttachments) && + Objects.equals(this.attachments, message.attachments) && + Objects.equals(this.additionalInformation, message.additionalInformation); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, type, createdAt, thread, author, text, subject, relatesTo, hasAdditionalAttachments, attachments, additionalInformation); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Message {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" thread: ").append(toIndentedString(thread)).append("\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" subject: ").append(toIndentedString(subject)).append("\n"); + sb.append(" relatesTo: ").append(toIndentedString(relatesTo)).append("\n"); + sb.append(" hasAdditionalAttachments: ").append(toIndentedString(hasAdditionalAttachments)).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append(" additionalInformation: ").append(toIndentedString(additionalInformation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("status"); + openapiFields.add("type"); + openapiFields.add("createdAt"); + openapiFields.add("thread"); + openapiFields.add("author"); + openapiFields.add("text"); + openapiFields.add("subject"); + openapiFields.add("relatesTo"); + openapiFields.add("hasAdditionalAttachments"); + openapiFields.add("attachments"); + openapiFields.add("additionalInformation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("thread"); + openapiRequiredFields.add("author"); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("relatesTo"); + openapiRequiredFields.add("hasAdditionalAttachments"); + openapiRequiredFields.add("attachments"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Message + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Message.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Message is not found in the empty JSON string", Message.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Message.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Message` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Message.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `thread` + ThreadId.validateJsonElement(jsonObj.get("thread")); + // validate the required field `author` + MessageAuthor.validateJsonElement(jsonObj.get("author")); + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if ((jsonObj.get("subject") != null && !jsonObj.get("subject").isJsonNull()) && !jsonObj.get("subject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `subject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subject").toString())); + } + // validate the required field `relatesTo` + MessageRelatedObject.validateJsonElement(jsonObj.get("relatesTo")); + // ensure the json data is an array + if (!jsonObj.get("attachments").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `attachments` to be an array in the JSON string but got `%s`", jsonObj.get("attachments").toString())); + } + + JsonArray jsonArrayattachments = jsonObj.getAsJsonArray("attachments"); + // validate the required field `attachments` (array) + for (int i = 0; i < jsonArrayattachments.size(); i++) { + MessageAttachmentInfo.validateJsonElement(jsonArrayattachments.get(i)); + }; + // validate the optional field `additionalInformation` + if (jsonObj.get("additionalInformation") != null && !jsonObj.get("additionalInformation").isJsonNull()) { + MessageAdditionalInformation.validateJsonElement(jsonObj.get("additionalInformation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Message.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Message' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Message.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Message value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Message read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Message given an JSON string + * + * @param jsonString JSON string + * @return An instance of Message + * @throws IOException if the JSON string is invalid with respect to Message + */ + public static Message fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Message.class); + } + + /** + * Convert an instance of Message to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MessageAdditionalInformation.java b/src/main/java/pl/wtx/allegro/api/client/model/MessageAdditionalInformation.java new file mode 100644 index 0000000..d12a89b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MessageAdditionalInformation.java @@ -0,0 +1,218 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contains optional contextual information linked to message. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MessageAdditionalInformation { + public static final String SERIALIZED_NAME_VIN = "vin"; + @SerializedName(SERIALIZED_NAME_VIN) + @javax.annotation.Nullable + private String vin; + + public MessageAdditionalInformation() { + } + + public MessageAdditionalInformation vin(@javax.annotation.Nullable String vin) { + this.vin = vin; + return this; + } + + /** + * Vehicle Information Number (VIN) provided by sender in addition to message contents. + * @return vin + */ + @javax.annotation.Nullable + public String getVin() { + return vin; + } + + public void setVin(@javax.annotation.Nullable String vin) { + this.vin = vin; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageAdditionalInformation messageAdditionalInformation = (MessageAdditionalInformation) o; + return Objects.equals(this.vin, messageAdditionalInformation.vin); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(vin); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageAdditionalInformation {\n"); + sb.append(" vin: ").append(toIndentedString(vin)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("vin"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageAdditionalInformation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageAdditionalInformation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageAdditionalInformation is not found in the empty JSON string", MessageAdditionalInformation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MessageAdditionalInformation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MessageAdditionalInformation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("vin") != null && !jsonObj.get("vin").isJsonNull()) && !jsonObj.get("vin").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `vin` to be a primitive type in the JSON string but got `%s`", jsonObj.get("vin").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageAdditionalInformation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageAdditionalInformation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageAdditionalInformation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageAdditionalInformation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MessageAdditionalInformation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageAdditionalInformation given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageAdditionalInformation + * @throws IOException if the JSON string is invalid with respect to MessageAdditionalInformation + */ + public static MessageAdditionalInformation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageAdditionalInformation.class); + } + + /** + * Convert an instance of MessageAdditionalInformation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MessageAttachmentId.java b/src/main/java/pl/wtx/allegro/api/client/model/MessageAttachmentId.java new file mode 100644 index 0000000..c9a2738 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MessageAttachmentId.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MessageAttachmentId + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MessageAttachmentId { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public MessageAttachmentId() { + } + + public MessageAttachmentId id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageAttachmentId messageAttachmentId = (MessageAttachmentId) o; + return Objects.equals(this.id, messageAttachmentId.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageAttachmentId {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageAttachmentId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageAttachmentId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageAttachmentId is not found in the empty JSON string", MessageAttachmentId.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MessageAttachmentId.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MessageAttachmentId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageAttachmentId.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageAttachmentId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageAttachmentId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageAttachmentId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageAttachmentId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MessageAttachmentId read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageAttachmentId given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageAttachmentId + * @throws IOException if the JSON string is invalid with respect to MessageAttachmentId + */ + public static MessageAttachmentId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageAttachmentId.class); + } + + /** + * Convert an instance of MessageAttachmentId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MessageAttachmentInfo.java b/src/main/java/pl/wtx/allegro/api/client/model/MessageAttachmentInfo.java new file mode 100644 index 0000000..178127e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MessageAttachmentInfo.java @@ -0,0 +1,363 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MessageAttachmentInfo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MessageAttachmentInfo { + public static final String SERIALIZED_NAME_FILE_NAME = "fileName"; + @SerializedName(SERIALIZED_NAME_FILE_NAME) + @javax.annotation.Nonnull + private String fileName; + + public static final String SERIALIZED_NAME_MIME_TYPE = "mimeType"; + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + @javax.annotation.Nullable + private String mimeType; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + NEW("NEW"), + + SAFE("SAFE"), + + UNSAFE("UNSAFE"), + + EXPIRED("EXPIRED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public MessageAttachmentInfo() { + } + + public MessageAttachmentInfo fileName(@javax.annotation.Nonnull String fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get fileName + * @return fileName + */ + @javax.annotation.Nonnull + public String getFileName() { + return fileName; + } + + public void setFileName(@javax.annotation.Nonnull String fileName) { + this.fileName = fileName; + } + + + public MessageAttachmentInfo mimeType(@javax.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * Get mimeType + * @return mimeType + */ + @javax.annotation.Nullable + public String getMimeType() { + return mimeType; + } + + public void setMimeType(@javax.annotation.Nullable String mimeType) { + this.mimeType = mimeType; + } + + + public MessageAttachmentInfo url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + + public MessageAttachmentInfo status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageAttachmentInfo messageAttachmentInfo = (MessageAttachmentInfo) o; + return Objects.equals(this.fileName, messageAttachmentInfo.fileName) && + Objects.equals(this.mimeType, messageAttachmentInfo.mimeType) && + Objects.equals(this.url, messageAttachmentInfo.url) && + Objects.equals(this.status, messageAttachmentInfo.status); + } + + @Override + public int hashCode() { + return Objects.hash(fileName, mimeType, url, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageAttachmentInfo {\n"); + sb.append(" fileName: ").append(toIndentedString(fileName)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fileName"); + openapiFields.add("mimeType"); + openapiFields.add("url"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fileName"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageAttachmentInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageAttachmentInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageAttachmentInfo is not found in the empty JSON string", MessageAttachmentInfo.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MessageAttachmentInfo.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MessageAttachmentInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageAttachmentInfo.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("fileName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fileName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fileName").toString())); + } + if ((jsonObj.get("mimeType") != null && !jsonObj.get("mimeType").isJsonNull()) && !jsonObj.get("mimeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mimeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mimeType").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageAttachmentInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageAttachmentInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageAttachmentInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageAttachmentInfo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MessageAttachmentInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageAttachmentInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageAttachmentInfo + * @throws IOException if the JSON string is invalid with respect to MessageAttachmentInfo + */ + public static MessageAttachmentInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageAttachmentInfo.class); + } + + /** + * Convert an instance of MessageAttachmentInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MessageAuthor.java b/src/main/java/pl/wtx/allegro/api/client/model/MessageAuthor.java new file mode 100644 index 0000000..f512a35 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MessageAuthor.java @@ -0,0 +1,242 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MessageAuthor + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MessageAuthor { + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nonnull + private String login; + + public static final String SERIALIZED_NAME_IS_INTERLOCUTOR = "isInterlocutor"; + @SerializedName(SERIALIZED_NAME_IS_INTERLOCUTOR) + @javax.annotation.Nonnull + private Boolean isInterlocutor; + + public MessageAuthor() { + } + + public MessageAuthor login(@javax.annotation.Nonnull String login) { + this.login = login; + return this; + } + + /** + * Get login + * @return login + */ + @javax.annotation.Nonnull + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nonnull String login) { + this.login = login; + } + + + public MessageAuthor isInterlocutor(@javax.annotation.Nonnull Boolean isInterlocutor) { + this.isInterlocutor = isInterlocutor; + return this; + } + + /** + * Get isInterlocutor + * @return isInterlocutor + */ + @javax.annotation.Nonnull + public Boolean getIsInterlocutor() { + return isInterlocutor; + } + + public void setIsInterlocutor(@javax.annotation.Nonnull Boolean isInterlocutor) { + this.isInterlocutor = isInterlocutor; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageAuthor messageAuthor = (MessageAuthor) o; + return Objects.equals(this.login, messageAuthor.login) && + Objects.equals(this.isInterlocutor, messageAuthor.isInterlocutor); + } + + @Override + public int hashCode() { + return Objects.hash(login, isInterlocutor); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageAuthor {\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" isInterlocutor: ").append(toIndentedString(isInterlocutor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("login"); + openapiFields.add("isInterlocutor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("login"); + openapiRequiredFields.add("isInterlocutor"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageAuthor + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageAuthor.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageAuthor is not found in the empty JSON string", MessageAuthor.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MessageAuthor.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MessageAuthor` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageAuthor.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageAuthor.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageAuthor' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageAuthor.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageAuthor value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MessageAuthor read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageAuthor given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageAuthor + * @throws IOException if the JSON string is invalid with respect to MessageAuthor + */ + public static MessageAuthor fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageAuthor.class); + } + + /** + * Convert an instance of MessageAuthor to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MessageAuthorRole.java b/src/main/java/pl/wtx/allegro/api/client/model/MessageAuthorRole.java new file mode 100644 index 0000000..fc3b636 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MessageAuthorRole.java @@ -0,0 +1,84 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets MessageAuthorRole + */ +@JsonAdapter(MessageAuthorRole.Adapter.class) +public enum MessageAuthorRole { + + BUYER("BUYER"), + + SELLER("SELLER"), + + ADMIN("ADMIN"), + + SYSTEM("SYSTEM"), + + FULFILLMENT("FULFILLMENT"); + + private String value; + + MessageAuthorRole(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MessageAuthorRole fromValue(String value) { + for (MessageAuthorRole b : MessageAuthorRole.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MessageAuthorRole enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MessageAuthorRole read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MessageAuthorRole.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + MessageAuthorRole.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MessageOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/MessageOffer.java new file mode 100644 index 0000000..8c7a618 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MessageOffer.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MessageOffer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MessageOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public MessageOffer() { + } + + public MessageOffer id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageOffer messageOffer = (MessageOffer) o; + return Objects.equals(this.id, messageOffer.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageOffer is not found in the empty JSON string", MessageOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MessageOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MessageOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageOffer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MessageOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageOffer + * @throws IOException if the JSON string is invalid with respect to MessageOffer + */ + public static MessageOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageOffer.class); + } + + /** + * Convert an instance of MessageOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MessageOrder.java b/src/main/java/pl/wtx/allegro/api/client/model/MessageOrder.java new file mode 100644 index 0000000..2069c44 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MessageOrder.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MessageOrder + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MessageOrder { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public MessageOrder() { + } + + public MessageOrder id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageOrder messageOrder = (MessageOrder) o; + return Objects.equals(this.id, messageOrder.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageOrder {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageOrder + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageOrder.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageOrder is not found in the empty JSON string", MessageOrder.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MessageOrder.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MessageOrder` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageOrder.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageOrder.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageOrder' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageOrder.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageOrder value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MessageOrder read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageOrder given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageOrder + * @throws IOException if the JSON string is invalid with respect to MessageOrder + */ + public static MessageOrder fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageOrder.class); + } + + /** + * Convert an instance of MessageOrder to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MessageRelatedObject.java b/src/main/java/pl/wtx/allegro/api/client/model/MessageRelatedObject.java new file mode 100644 index 0000000..d61c773 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MessageRelatedObject.java @@ -0,0 +1,252 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.MessageOffer; +import pl.wtx.allegro.api.client.model.MessageOrder; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MessageRelatedObject + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MessageRelatedObject { + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private MessageOffer offer; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + @javax.annotation.Nullable + private MessageOrder order; + + public MessageRelatedObject() { + } + + public MessageRelatedObject offer(@javax.annotation.Nullable MessageOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public MessageOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable MessageOffer offer) { + this.offer = offer; + } + + + public MessageRelatedObject order(@javax.annotation.Nullable MessageOrder order) { + this.order = order; + return this; + } + + /** + * Get order + * @return order + */ + @javax.annotation.Nullable + public MessageOrder getOrder() { + return order; + } + + public void setOrder(@javax.annotation.Nullable MessageOrder order) { + this.order = order; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageRelatedObject messageRelatedObject = (MessageRelatedObject) o; + return Objects.equals(this.offer, messageRelatedObject.offer) && + Objects.equals(this.order, messageRelatedObject.order); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(offer, order); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageRelatedObject {\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offer"); + openapiFields.add("order"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageRelatedObject + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageRelatedObject.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageRelatedObject is not found in the empty JSON string", MessageRelatedObject.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MessageRelatedObject.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MessageRelatedObject` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + MessageOffer.validateJsonElement(jsonObj.get("offer")); + } + // validate the optional field `order` + if (jsonObj.get("order") != null && !jsonObj.get("order").isJsonNull()) { + MessageOrder.validateJsonElement(jsonObj.get("order")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageRelatedObject.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageRelatedObject' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageRelatedObject.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageRelatedObject value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MessageRelatedObject read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageRelatedObject given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageRelatedObject + * @throws IOException if the JSON string is invalid with respect to MessageRelatedObject + */ + public static MessageRelatedObject fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageRelatedObject.class); + } + + /** + * Convert an instance of MessageRelatedObject to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MessageRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/MessageRequest.java new file mode 100644 index 0000000..0229463 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MessageRequest.java @@ -0,0 +1,330 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DisputeAttachmentId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Request body to add message to the dispute. Presence of text or attachment fields or both is required. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MessageRequest { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nonnull + private String text; + + public static final String SERIALIZED_NAME_ATTACHMENT = "attachment"; + @SerializedName(SERIALIZED_NAME_ATTACHMENT) + @javax.annotation.Nonnull + private DisputeAttachmentId attachment; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + REGULAR("REGULAR"), + + END_REQUEST("END_REQUEST"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public MessageRequest() { + } + + public MessageRequest text(@javax.annotation.Nonnull String text) { + this.text = text; + return this; + } + + /** + * Get text + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nonnull String text) { + this.text = text; + } + + + public MessageRequest attachment(@javax.annotation.Nonnull DisputeAttachmentId attachment) { + this.attachment = attachment; + return this; + } + + /** + * Get attachment + * @return attachment + */ + @javax.annotation.Nonnull + public DisputeAttachmentId getAttachment() { + return attachment; + } + + public void setAttachment(@javax.annotation.Nonnull DisputeAttachmentId attachment) { + this.attachment = attachment; + } + + + public MessageRequest type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageRequest messageRequest = (MessageRequest) o; + return Objects.equals(this.text, messageRequest.text) && + Objects.equals(this.attachment, messageRequest.attachment) && + Objects.equals(this.type, messageRequest.type); + } + + @Override + public int hashCode() { + return Objects.hash(text, attachment, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageRequest {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" attachment: ").append(toIndentedString(attachment)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("text"); + openapiFields.add("attachment"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("attachment"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageRequest is not found in the empty JSON string", MessageRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MessageRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MessageRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + // validate the required field `attachment` + DisputeAttachmentId.validateJsonElement(jsonObj.get("attachment")); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MessageRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageRequest + * @throws IOException if the JSON string is invalid with respect to MessageRequest + */ + public static MessageRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageRequest.class); + } + + /** + * Convert an instance of MessageRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MessageToSellerSettings.java b/src/main/java/pl/wtx/allegro/api/client/model/MessageToSellerSettings.java new file mode 100644 index 0000000..6f86e7b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MessageToSellerSettings.java @@ -0,0 +1,294 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Defines message to the seller settings options. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MessageToSellerSettings { + /** + * Specify message to seller type. * `OPTIONAL`: buyer is able to enter a message for the seller * `HIDDEN`: there is no message box for the seller * `REQUIRED`: buyer is forced to enter a message for the seller (limited to categories with `sellerCanRequirePurchaseComments` option) + */ + @JsonAdapter(ModeEnum.Adapter.class) + public enum ModeEnum { + OPTIONAL("OPTIONAL"), + + HIDDEN("HIDDEN"), + + REQUIRED("REQUIRED"); + + private String value; + + ModeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ModeEnum fromValue(String value) { + for (ModeEnum b : ModeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ModeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ModeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ModeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ModeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_MODE = "mode"; + @SerializedName(SERIALIZED_NAME_MODE) + @javax.annotation.Nullable + private ModeEnum mode; + + public static final String SERIALIZED_NAME_HINT = "hint"; + @SerializedName(SERIALIZED_NAME_HINT) + @javax.annotation.Nullable + private String hint; + + public MessageToSellerSettings() { + } + + public MessageToSellerSettings mode(@javax.annotation.Nullable ModeEnum mode) { + this.mode = mode; + return this; + } + + /** + * Specify message to seller type. * `OPTIONAL`: buyer is able to enter a message for the seller * `HIDDEN`: there is no message box for the seller * `REQUIRED`: buyer is forced to enter a message for the seller (limited to categories with `sellerCanRequirePurchaseComments` option) + * @return mode + */ + @javax.annotation.Nullable + public ModeEnum getMode() { + return mode; + } + + public void setMode(@javax.annotation.Nullable ModeEnum mode) { + this.mode = mode; + } + + + public MessageToSellerSettings hint(@javax.annotation.Nullable String hint) { + this.hint = hint; + return this; + } + + /** + * Specify hint for REQUIRED message displayed for buyer + * @return hint + */ + @javax.annotation.Nullable + public String getHint() { + return hint; + } + + public void setHint(@javax.annotation.Nullable String hint) { + this.hint = hint; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageToSellerSettings messageToSellerSettings = (MessageToSellerSettings) o; + return Objects.equals(this.mode, messageToSellerSettings.mode) && + Objects.equals(this.hint, messageToSellerSettings.hint); + } + + @Override + public int hashCode() { + return Objects.hash(mode, hint); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageToSellerSettings {\n"); + sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); + sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("mode"); + openapiFields.add("hint"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageToSellerSettings + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageToSellerSettings.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageToSellerSettings is not found in the empty JSON string", MessageToSellerSettings.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MessageToSellerSettings.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MessageToSellerSettings` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("mode") != null && !jsonObj.get("mode").isJsonNull()) && !jsonObj.get("mode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mode").toString())); + } + // validate the optional field `mode` + if (jsonObj.get("mode") != null && !jsonObj.get("mode").isJsonNull()) { + ModeEnum.validateJsonElement(jsonObj.get("mode")); + } + if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) && !jsonObj.get("hint").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `hint` to be a primitive type in the JSON string but got `%s`", jsonObj.get("hint").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageToSellerSettings.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageToSellerSettings' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageToSellerSettings.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageToSellerSettings value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MessageToSellerSettings read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageToSellerSettings given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageToSellerSettings + * @throws IOException if the JSON string is invalid with respect to MessageToSellerSettings + */ + public static MessageToSellerSettings fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageToSellerSettings.class); + } + + /** + * Convert an instance of MessageToSellerSettings to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MessagesList.java b/src/main/java/pl/wtx/allegro/api/client/model/MessagesList.java new file mode 100644 index 0000000..6bdb956 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MessagesList.java @@ -0,0 +1,290 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Message; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MessagesList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MessagesList { + public static final String SERIALIZED_NAME_MESSAGES = "messages"; + @SerializedName(SERIALIZED_NAME_MESSAGES) + @javax.annotation.Nonnull + private List messages = new ArrayList<>(); + + public static final String SERIALIZED_NAME_OFFSET = "offset"; + @SerializedName(SERIALIZED_NAME_OFFSET) + @javax.annotation.Nonnull + private Integer offset; + + public static final String SERIALIZED_NAME_LIMIT = "limit"; + @SerializedName(SERIALIZED_NAME_LIMIT) + @javax.annotation.Nonnull + private Integer limit; + + public MessagesList() { + } + + public MessagesList messages(@javax.annotation.Nonnull List messages) { + this.messages = messages; + return this; + } + + public MessagesList addMessagesItem(Message messagesItem) { + if (this.messages == null) { + this.messages = new ArrayList<>(); + } + this.messages.add(messagesItem); + return this; + } + + /** + * Get messages + * @return messages + */ + @javax.annotation.Nonnull + public List getMessages() { + return messages; + } + + public void setMessages(@javax.annotation.Nonnull List messages) { + this.messages = messages; + } + + + public MessagesList offset(@javax.annotation.Nonnull Integer offset) { + this.offset = offset; + return this; + } + + /** + * Get offset + * minimum: 0 + * @return offset + */ + @javax.annotation.Nonnull + public Integer getOffset() { + return offset; + } + + public void setOffset(@javax.annotation.Nonnull Integer offset) { + this.offset = offset; + } + + + public MessagesList limit(@javax.annotation.Nonnull Integer limit) { + this.limit = limit; + return this; + } + + /** + * Get limit + * minimum: 0 + * @return limit + */ + @javax.annotation.Nonnull + public Integer getLimit() { + return limit; + } + + public void setLimit(@javax.annotation.Nonnull Integer limit) { + this.limit = limit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessagesList messagesList = (MessagesList) o; + return Objects.equals(this.messages, messagesList.messages) && + Objects.equals(this.offset, messagesList.offset) && + Objects.equals(this.limit, messagesList.limit); + } + + @Override + public int hashCode() { + return Objects.hash(messages, offset, limit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessagesList {\n"); + sb.append(" messages: ").append(toIndentedString(messages)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("messages"); + openapiFields.add("offset"); + openapiFields.add("limit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("messages"); + openapiRequiredFields.add("offset"); + openapiRequiredFields.add("limit"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessagesList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessagesList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessagesList is not found in the empty JSON string", MessagesList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MessagesList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MessagesList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessagesList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("messages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `messages` to be an array in the JSON string but got `%s`", jsonObj.get("messages").toString())); + } + + JsonArray jsonArraymessages = jsonObj.getAsJsonArray("messages"); + // validate the required field `messages` (array) + for (int i = 0; i < jsonArraymessages.size(); i++) { + Message.validateJsonElement(jsonArraymessages.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessagesList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessagesList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessagesList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessagesList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MessagesList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessagesList given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessagesList + * @throws IOException if the JSON string is invalid with respect to MessagesList + */ + public static MessagesList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessagesList.class); + } + + /** + * Convert an instance of MessagesList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MinimalPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/MinimalPrice.java new file mode 100644 index 0000000..148710b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MinimalPrice.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The minimal price for offers in auction format. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MinimalPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public MinimalPrice() { + } + + public MinimalPrice amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public MinimalPrice currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MinimalPrice minimalPrice = (MinimalPrice) o; + return Objects.equals(this.amount, minimalPrice.amount) && + Objects.equals(this.currency, minimalPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MinimalPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MinimalPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MinimalPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MinimalPrice is not found in the empty JSON string", MinimalPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MinimalPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MinimalPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MinimalPrice.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MinimalPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MinimalPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MinimalPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MinimalPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MinimalPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MinimalPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of MinimalPrice + * @throws IOException if the JSON string is invalid with respect to MinimalPrice + */ + public static MinimalPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MinimalPrice.class); + } + + /** + * Convert an instance of MinimalPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModelConfiguration.java b/src/main/java/pl/wtx/allegro/api/client/model/ModelConfiguration.java new file mode 100644 index 0000000..a0bd13e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModelConfiguration.java @@ -0,0 +1,240 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ConstraintCriteria; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ModelConfiguration + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModelConfiguration { + public static final String SERIALIZED_NAME_CONSTRAINT_CRITERIA = "constraintCriteria"; + @SerializedName(SERIALIZED_NAME_CONSTRAINT_CRITERIA) + @javax.annotation.Nullable + private ConstraintCriteria constraintCriteria; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private Price price; + + public ModelConfiguration() { + } + + public ModelConfiguration constraintCriteria(@javax.annotation.Nullable ConstraintCriteria constraintCriteria) { + this.constraintCriteria = constraintCriteria; + return this; + } + + /** + * Get constraintCriteria + * @return constraintCriteria + */ + @javax.annotation.Nullable + public ConstraintCriteria getConstraintCriteria() { + return constraintCriteria; + } + + public void setConstraintCriteria(@javax.annotation.Nullable ConstraintCriteria constraintCriteria) { + this.constraintCriteria = constraintCriteria; + } + + + public ModelConfiguration price(@javax.annotation.Nullable Price price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nullable + public Price getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable Price price) { + this.price = price; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelConfiguration _configuration = (ModelConfiguration) o; + return Objects.equals(this.constraintCriteria, _configuration.constraintCriteria) && + Objects.equals(this.price, _configuration.price); + } + + @Override + public int hashCode() { + return Objects.hash(constraintCriteria, price); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelConfiguration {\n"); + sb.append(" constraintCriteria: ").append(toIndentedString(constraintCriteria)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("constraintCriteria"); + openapiFields.add("price"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelConfiguration + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelConfiguration.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelConfiguration is not found in the empty JSON string", ModelConfiguration.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModelConfiguration.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelConfiguration` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `constraintCriteria` + if (jsonObj.get("constraintCriteria") != null && !jsonObj.get("constraintCriteria").isJsonNull()) { + ConstraintCriteria.validateJsonElement(jsonObj.get("constraintCriteria")); + } + // validate the optional field `price` + if (jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("price")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelConfiguration.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelConfiguration' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelConfiguration.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelConfiguration value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModelConfiguration read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelConfiguration given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelConfiguration + * @throws IOException if the JSON string is invalid with respect to ModelConfiguration + */ + public static ModelConfiguration fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelConfiguration.class); + } + + /** + * Convert an instance of ModelConfiguration to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Modification.java b/src/main/java/pl/wtx/allegro/api/client/model/Modification.java new file mode 100644 index 0000000..3c125d7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Modification.java @@ -0,0 +1,540 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AdditionalServicesGroup; +import pl.wtx.allegro.api.client.model.Location; +import pl.wtx.allegro.api.client.model.ModificationDelivery; +import pl.wtx.allegro.api.client.model.ModificationDiscounts; +import pl.wtx.allegro.api.client.model.ModificationPayments; +import pl.wtx.allegro.api.client.model.ModificationPublication; +import pl.wtx.allegro.api.client.model.ModificationResponsiblePerson; +import pl.wtx.allegro.api.client.model.ModificationResponsibleProducer; +import pl.wtx.allegro.api.client.model.ModificationSafetyInformation; +import pl.wtx.allegro.api.client.model.SizeTable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contains fields to change + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Modification { + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES_GROUP = "additionalServicesGroup"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES_GROUP) + @javax.annotation.Nullable + private AdditionalServicesGroup additionalServicesGroup; + + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private ModificationDelivery delivery; + + public static final String SERIALIZED_NAME_DISCOUNTS = "discounts"; + @SerializedName(SERIALIZED_NAME_DISCOUNTS) + @javax.annotation.Nullable + private ModificationDiscounts discounts; + + public static final String SERIALIZED_NAME_LOCATION = "location"; + @SerializedName(SERIALIZED_NAME_LOCATION) + @javax.annotation.Nullable + private Location location; + + public static final String SERIALIZED_NAME_PAYMENTS = "payments"; + @SerializedName(SERIALIZED_NAME_PAYMENTS) + @javax.annotation.Nullable + private ModificationPayments payments; + + public static final String SERIALIZED_NAME_SIZE_TABLE = "sizeTable"; + @SerializedName(SERIALIZED_NAME_SIZE_TABLE) + @javax.annotation.Nullable + private SizeTable sizeTable; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private ModificationPublication publication; + + public static final String SERIALIZED_NAME_RESPONSIBLE_PERSON = "responsiblePerson"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PERSON) + @javax.annotation.Nullable + private ModificationResponsiblePerson responsiblePerson; + + public static final String SERIALIZED_NAME_RESPONSIBLE_PRODUCER = "responsibleProducer"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PRODUCER) + @javax.annotation.Nullable + private ModificationResponsibleProducer responsibleProducer; + + public static final String SERIALIZED_NAME_SAFETY_INFORMATION = "safetyInformation"; + @SerializedName(SERIALIZED_NAME_SAFETY_INFORMATION) + @javax.annotation.Nullable + private ModificationSafetyInformation safetyInformation; + + public static final String SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION = "marketedBeforeGPSRObligation"; + @Deprecated + @SerializedName(SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION) + @javax.annotation.Nullable + private Boolean marketedBeforeGPSRObligation; + + public Modification() { + } + + public Modification additionalServicesGroup(@javax.annotation.Nullable AdditionalServicesGroup additionalServicesGroup) { + this.additionalServicesGroup = additionalServicesGroup; + return this; + } + + /** + * Get additionalServicesGroup + * @return additionalServicesGroup + */ + @javax.annotation.Nullable + public AdditionalServicesGroup getAdditionalServicesGroup() { + return additionalServicesGroup; + } + + public void setAdditionalServicesGroup(@javax.annotation.Nullable AdditionalServicesGroup additionalServicesGroup) { + this.additionalServicesGroup = additionalServicesGroup; + } + + + public Modification delivery(@javax.annotation.Nullable ModificationDelivery delivery) { + this.delivery = delivery; + return this; + } + + /** + * Get delivery + * @return delivery + */ + @javax.annotation.Nullable + public ModificationDelivery getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable ModificationDelivery delivery) { + this.delivery = delivery; + } + + + public Modification discounts(@javax.annotation.Nullable ModificationDiscounts discounts) { + this.discounts = discounts; + return this; + } + + /** + * Get discounts + * @return discounts + */ + @javax.annotation.Nullable + public ModificationDiscounts getDiscounts() { + return discounts; + } + + public void setDiscounts(@javax.annotation.Nullable ModificationDiscounts discounts) { + this.discounts = discounts; + } + + + public Modification location(@javax.annotation.Nullable Location location) { + this.location = location; + return this; + } + + /** + * Get location + * @return location + */ + @javax.annotation.Nullable + public Location getLocation() { + return location; + } + + public void setLocation(@javax.annotation.Nullable Location location) { + this.location = location; + } + + + public Modification payments(@javax.annotation.Nullable ModificationPayments payments) { + this.payments = payments; + return this; + } + + /** + * Get payments + * @return payments + */ + @javax.annotation.Nullable + public ModificationPayments getPayments() { + return payments; + } + + public void setPayments(@javax.annotation.Nullable ModificationPayments payments) { + this.payments = payments; + } + + + public Modification sizeTable(@javax.annotation.Nullable SizeTable sizeTable) { + this.sizeTable = sizeTable; + return this; + } + + /** + * Get sizeTable + * @return sizeTable + */ + @javax.annotation.Nullable + public SizeTable getSizeTable() { + return sizeTable; + } + + public void setSizeTable(@javax.annotation.Nullable SizeTable sizeTable) { + this.sizeTable = sizeTable; + } + + + public Modification publication(@javax.annotation.Nullable ModificationPublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public ModificationPublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable ModificationPublication publication) { + this.publication = publication; + } + + + public Modification responsiblePerson(@javax.annotation.Nullable ModificationResponsiblePerson responsiblePerson) { + this.responsiblePerson = responsiblePerson; + return this; + } + + /** + * Get responsiblePerson + * @return responsiblePerson + */ + @javax.annotation.Nullable + public ModificationResponsiblePerson getResponsiblePerson() { + return responsiblePerson; + } + + public void setResponsiblePerson(@javax.annotation.Nullable ModificationResponsiblePerson responsiblePerson) { + this.responsiblePerson = responsiblePerson; + } + + + public Modification responsibleProducer(@javax.annotation.Nullable ModificationResponsibleProducer responsibleProducer) { + this.responsibleProducer = responsibleProducer; + return this; + } + + /** + * Get responsibleProducer + * @return responsibleProducer + */ + @javax.annotation.Nullable + public ModificationResponsibleProducer getResponsibleProducer() { + return responsibleProducer; + } + + public void setResponsibleProducer(@javax.annotation.Nullable ModificationResponsibleProducer responsibleProducer) { + this.responsibleProducer = responsibleProducer; + } + + + public Modification safetyInformation(@javax.annotation.Nullable ModificationSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + return this; + } + + /** + * Get safetyInformation + * @return safetyInformation + */ + @javax.annotation.Nullable + public ModificationSafetyInformation getSafetyInformation() { + return safetyInformation; + } + + public void setSafetyInformation(@javax.annotation.Nullable ModificationSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + } + + + @Deprecated + public Modification marketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + return this; + } + + /** + * The field is deprecated and will be removed in the future. Allows you to declare whether the first product in the offer was marketed before the GPSR obligation. + * @return marketedBeforeGPSRObligation + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public Boolean getMarketedBeforeGPSRObligation() { + return marketedBeforeGPSRObligation; + } + + @Deprecated + public void setMarketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Modification modification = (Modification) o; + return Objects.equals(this.additionalServicesGroup, modification.additionalServicesGroup) && + Objects.equals(this.delivery, modification.delivery) && + Objects.equals(this.discounts, modification.discounts) && + Objects.equals(this.location, modification.location) && + Objects.equals(this.payments, modification.payments) && + Objects.equals(this.sizeTable, modification.sizeTable) && + Objects.equals(this.publication, modification.publication) && + Objects.equals(this.responsiblePerson, modification.responsiblePerson) && + Objects.equals(this.responsibleProducer, modification.responsibleProducer) && + Objects.equals(this.safetyInformation, modification.safetyInformation) && + Objects.equals(this.marketedBeforeGPSRObligation, modification.marketedBeforeGPSRObligation); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(additionalServicesGroup, delivery, discounts, location, payments, sizeTable, publication, responsiblePerson, responsibleProducer, safetyInformation, marketedBeforeGPSRObligation); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Modification {\n"); + sb.append(" additionalServicesGroup: ").append(toIndentedString(additionalServicesGroup)).append("\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" discounts: ").append(toIndentedString(discounts)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" payments: ").append(toIndentedString(payments)).append("\n"); + sb.append(" sizeTable: ").append(toIndentedString(sizeTable)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" responsiblePerson: ").append(toIndentedString(responsiblePerson)).append("\n"); + sb.append(" responsibleProducer: ").append(toIndentedString(responsibleProducer)).append("\n"); + sb.append(" safetyInformation: ").append(toIndentedString(safetyInformation)).append("\n"); + sb.append(" marketedBeforeGPSRObligation: ").append(toIndentedString(marketedBeforeGPSRObligation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("additionalServicesGroup"); + openapiFields.add("delivery"); + openapiFields.add("discounts"); + openapiFields.add("location"); + openapiFields.add("payments"); + openapiFields.add("sizeTable"); + openapiFields.add("publication"); + openapiFields.add("responsiblePerson"); + openapiFields.add("responsibleProducer"); + openapiFields.add("safetyInformation"); + openapiFields.add("marketedBeforeGPSRObligation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Modification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Modification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Modification is not found in the empty JSON string", Modification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Modification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Modification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `additionalServicesGroup` + if (jsonObj.get("additionalServicesGroup") != null && !jsonObj.get("additionalServicesGroup").isJsonNull()) { + AdditionalServicesGroup.validateJsonElement(jsonObj.get("additionalServicesGroup")); + } + // validate the optional field `delivery` + if (jsonObj.get("delivery") != null && !jsonObj.get("delivery").isJsonNull()) { + ModificationDelivery.validateJsonElement(jsonObj.get("delivery")); + } + // validate the optional field `discounts` + if (jsonObj.get("discounts") != null && !jsonObj.get("discounts").isJsonNull()) { + ModificationDiscounts.validateJsonElement(jsonObj.get("discounts")); + } + // validate the optional field `location` + if (jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) { + Location.validateJsonElement(jsonObj.get("location")); + } + // validate the optional field `payments` + if (jsonObj.get("payments") != null && !jsonObj.get("payments").isJsonNull()) { + ModificationPayments.validateJsonElement(jsonObj.get("payments")); + } + // validate the optional field `sizeTable` + if (jsonObj.get("sizeTable") != null && !jsonObj.get("sizeTable").isJsonNull()) { + SizeTable.validateJsonElement(jsonObj.get("sizeTable")); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + ModificationPublication.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `responsiblePerson` + if (jsonObj.get("responsiblePerson") != null && !jsonObj.get("responsiblePerson").isJsonNull()) { + ModificationResponsiblePerson.validateJsonElement(jsonObj.get("responsiblePerson")); + } + // validate the optional field `responsibleProducer` + if (jsonObj.get("responsibleProducer") != null && !jsonObj.get("responsibleProducer").isJsonNull()) { + ModificationResponsibleProducer.validateJsonElement(jsonObj.get("responsibleProducer")); + } + // validate the optional field `safetyInformation` + if (jsonObj.get("safetyInformation") != null && !jsonObj.get("safetyInformation").isJsonNull()) { + ModificationSafetyInformation.validateJsonElement(jsonObj.get("safetyInformation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Modification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Modification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Modification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Modification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Modification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Modification given an JSON string + * + * @param jsonString JSON string + * @return An instance of Modification + * @throws IOException if the JSON string is invalid with respect to Modification + */ + public static Modification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Modification.class); + } + + /** + * Convert an instance of Modification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationAttachmentSafetyInformation.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationAttachmentSafetyInformation.java new file mode 100644 index 0000000..1d539cc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationAttachmentSafetyInformation.java @@ -0,0 +1,226 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ModificationAttachmentSafetyInformationAllOfAttachments; +import pl.wtx.allegro.api.client.model.ModificationSafetyInformation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ModificationAttachmentSafetyInformation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationAttachmentSafetyInformation extends ModificationSafetyInformation { + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nullable + private List attachments = new ArrayList<>(); + + public ModificationAttachmentSafetyInformation() { + this.type = this.getClass().getSimpleName(); + } + + public ModificationAttachmentSafetyInformation attachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + return this; + } + + public ModificationAttachmentSafetyInformation addAttachmentsItem(ModificationAttachmentSafetyInformationAllOfAttachments attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * Full list of safety information attachments. + * @return attachments + */ + @javax.annotation.Nullable + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationAttachmentSafetyInformation modificationAttachmentSafetyInformation = (ModificationAttachmentSafetyInformation) o; + return Objects.equals(this.attachments, modificationAttachmentSafetyInformation.attachments) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(attachments, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationAttachmentSafetyInformation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attachments"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationAttachmentSafetyInformation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationAttachmentSafetyInformation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationAttachmentSafetyInformation is not found in the empty JSON string", ModificationAttachmentSafetyInformation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModificationAttachmentSafetyInformation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModificationAttachmentSafetyInformation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ModificationAttachmentSafetyInformation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModificationAttachmentSafetyInformation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModificationAttachmentSafetyInformation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModificationAttachmentSafetyInformation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModificationAttachmentSafetyInformation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModificationAttachmentSafetyInformation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModificationAttachmentSafetyInformation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationAttachmentSafetyInformation + * @throws IOException if the JSON string is invalid with respect to ModificationAttachmentSafetyInformation + */ + public static ModificationAttachmentSafetyInformation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationAttachmentSafetyInformation.class); + } + + /** + * Convert an instance of ModificationAttachmentSafetyInformation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationAttachmentSafetyInformationAllOfAttachments.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationAttachmentSafetyInformationAllOfAttachments.java new file mode 100644 index 0000000..cdf394d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationAttachmentSafetyInformationAllOfAttachments.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ModificationAttachmentSafetyInformationAllOfAttachments + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationAttachmentSafetyInformationAllOfAttachments { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ModificationAttachmentSafetyInformationAllOfAttachments() { + } + + public ModificationAttachmentSafetyInformationAllOfAttachments id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of the attachment. See <a href=\"#operation/createOfferAttachmentUsingPOST\">how to create and upload an attachment</a>. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationAttachmentSafetyInformationAllOfAttachments modificationAttachmentSafetyInformationAllOfAttachments = (ModificationAttachmentSafetyInformationAllOfAttachments) o; + return Objects.equals(this.id, modificationAttachmentSafetyInformationAllOfAttachments.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationAttachmentSafetyInformationAllOfAttachments {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationAttachmentSafetyInformationAllOfAttachments + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationAttachmentSafetyInformationAllOfAttachments.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationAttachmentSafetyInformationAllOfAttachments is not found in the empty JSON string", ModificationAttachmentSafetyInformationAllOfAttachments.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModificationAttachmentSafetyInformationAllOfAttachments.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModificationAttachmentSafetyInformationAllOfAttachments` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModificationAttachmentSafetyInformationAllOfAttachments.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModificationAttachmentSafetyInformationAllOfAttachments' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModificationAttachmentSafetyInformationAllOfAttachments.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModificationAttachmentSafetyInformationAllOfAttachments value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModificationAttachmentSafetyInformationAllOfAttachments read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModificationAttachmentSafetyInformationAllOfAttachments given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationAttachmentSafetyInformationAllOfAttachments + * @throws IOException if the JSON string is invalid with respect to ModificationAttachmentSafetyInformationAllOfAttachments + */ + public static ModificationAttachmentSafetyInformationAllOfAttachments fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationAttachmentSafetyInformationAllOfAttachments.class); + } + + /** + * Convert an instance of ModificationAttachmentSafetyInformationAllOfAttachments to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationDelivery.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationDelivery.java new file mode 100644 index 0000000..e08a911 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationDelivery.java @@ -0,0 +1,334 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ShippingRates; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contains delivery details to change. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationDelivery { + public static final String SERIALIZED_NAME_SHIPPING_RATES = "shippingRates"; + @SerializedName(SERIALIZED_NAME_SHIPPING_RATES) + @javax.annotation.Nullable + private ShippingRates shippingRates; + + /** + * Handling time, ISO 8601 duration format. PT0S for immediately. + */ + @JsonAdapter(HandlingTimeEnum.Adapter.class) + public enum HandlingTimeEnum { + PT0_S("PT0S"), + + PT24_H("PT24H"), + + PT48_H("PT48H"), + + PT72_H("PT72H"), + + PT96_H("PT96H"), + + PT120_H("PT120H"), + + PT168_H("PT168H"), + + PT240_H("PT240H"), + + PT336_H("PT336H"), + + PT504_H("PT504H"), + + PT720_H("PT720H"), + + PT1440_H("PT1440H"), + + P2_D("P2D"), + + P3_D("P3D"), + + P4_D("P4D"), + + P5_D("P5D"), + + P7_D("P7D"), + + P10_D("P10D"), + + P14_D("P14D"), + + P21_D("P21D"), + + P30_D("P30D"), + + P60_D("P60D"); + + private String value; + + HandlingTimeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static HandlingTimeEnum fromValue(String value) { + for (HandlingTimeEnum b : HandlingTimeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final HandlingTimeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public HandlingTimeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return HandlingTimeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + HandlingTimeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_HANDLING_TIME = "handlingTime"; + @SerializedName(SERIALIZED_NAME_HANDLING_TIME) + @javax.annotation.Nullable + private HandlingTimeEnum handlingTime; + + public ModificationDelivery() { + } + + public ModificationDelivery shippingRates(@javax.annotation.Nullable ShippingRates shippingRates) { + this.shippingRates = shippingRates; + return this; + } + + /** + * Get shippingRates + * @return shippingRates + */ + @javax.annotation.Nullable + public ShippingRates getShippingRates() { + return shippingRates; + } + + public void setShippingRates(@javax.annotation.Nullable ShippingRates shippingRates) { + this.shippingRates = shippingRates; + } + + + public ModificationDelivery handlingTime(@javax.annotation.Nullable HandlingTimeEnum handlingTime) { + this.handlingTime = handlingTime; + return this; + } + + /** + * Handling time, ISO 8601 duration format. PT0S for immediately. + * @return handlingTime + */ + @javax.annotation.Nullable + public HandlingTimeEnum getHandlingTime() { + return handlingTime; + } + + public void setHandlingTime(@javax.annotation.Nullable HandlingTimeEnum handlingTime) { + this.handlingTime = handlingTime; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationDelivery modificationDelivery = (ModificationDelivery) o; + return Objects.equals(this.shippingRates, modificationDelivery.shippingRates) && + Objects.equals(this.handlingTime, modificationDelivery.handlingTime); + } + + @Override + public int hashCode() { + return Objects.hash(shippingRates, handlingTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationDelivery {\n"); + sb.append(" shippingRates: ").append(toIndentedString(shippingRates)).append("\n"); + sb.append(" handlingTime: ").append(toIndentedString(handlingTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shippingRates"); + openapiFields.add("handlingTime"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationDelivery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationDelivery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationDelivery is not found in the empty JSON string", ModificationDelivery.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModificationDelivery.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModificationDelivery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `shippingRates` + if (jsonObj.get("shippingRates") != null && !jsonObj.get("shippingRates").isJsonNull()) { + ShippingRates.validateJsonElement(jsonObj.get("shippingRates")); + } + if ((jsonObj.get("handlingTime") != null && !jsonObj.get("handlingTime").isJsonNull()) && !jsonObj.get("handlingTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `handlingTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("handlingTime").toString())); + } + // validate the optional field `handlingTime` + if (jsonObj.get("handlingTime") != null && !jsonObj.get("handlingTime").isJsonNull()) { + HandlingTimeEnum.validateJsonElement(jsonObj.get("handlingTime")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModificationDelivery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModificationDelivery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModificationDelivery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModificationDelivery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModificationDelivery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModificationDelivery given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationDelivery + * @throws IOException if the JSON string is invalid with respect to ModificationDelivery + */ + public static ModificationDelivery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationDelivery.class); + } + + /** + * Convert an instance of ModificationDelivery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationDiscounts.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationDiscounts.java new file mode 100644 index 0000000..c4e1f13 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationDiscounts.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ModificationDiscountsWholesalePriceList; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Allows you to assign/unassign discounts (rebates) to/from offers. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationDiscounts { + public static final String SERIALIZED_NAME_WHOLESALE_PRICE_LIST = "wholesalePriceList"; + @SerializedName(SERIALIZED_NAME_WHOLESALE_PRICE_LIST) + @javax.annotation.Nullable + private ModificationDiscountsWholesalePriceList wholesalePriceList; + + public ModificationDiscounts() { + } + + public ModificationDiscounts wholesalePriceList(@javax.annotation.Nullable ModificationDiscountsWholesalePriceList wholesalePriceList) { + this.wholesalePriceList = wholesalePriceList; + return this; + } + + /** + * Get wholesalePriceList + * @return wholesalePriceList + */ + @javax.annotation.Nullable + public ModificationDiscountsWholesalePriceList getWholesalePriceList() { + return wholesalePriceList; + } + + public void setWholesalePriceList(@javax.annotation.Nullable ModificationDiscountsWholesalePriceList wholesalePriceList) { + this.wholesalePriceList = wholesalePriceList; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationDiscounts modificationDiscounts = (ModificationDiscounts) o; + return Objects.equals(this.wholesalePriceList, modificationDiscounts.wholesalePriceList); + } + + @Override + public int hashCode() { + return Objects.hash(wholesalePriceList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationDiscounts {\n"); + sb.append(" wholesalePriceList: ").append(toIndentedString(wholesalePriceList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("wholesalePriceList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationDiscounts + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationDiscounts.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationDiscounts is not found in the empty JSON string", ModificationDiscounts.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModificationDiscounts.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModificationDiscounts` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `wholesalePriceList` + if (jsonObj.get("wholesalePriceList") != null && !jsonObj.get("wholesalePriceList").isJsonNull()) { + ModificationDiscountsWholesalePriceList.validateJsonElement(jsonObj.get("wholesalePriceList")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModificationDiscounts.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModificationDiscounts' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModificationDiscounts.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModificationDiscounts value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModificationDiscounts read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModificationDiscounts given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationDiscounts + * @throws IOException if the JSON string is invalid with respect to ModificationDiscounts + */ + public static ModificationDiscounts fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationDiscounts.class); + } + + /** + * Convert an instance of ModificationDiscounts to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationDiscountsWholesalePriceList.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationDiscountsWholesalePriceList.java new file mode 100644 index 0000000..2b818a2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationDiscountsWholesalePriceList.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ModificationDiscountsWholesalePriceList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationDiscountsWholesalePriceList { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ModificationDiscountsWholesalePriceList() { + } + + public ModificationDiscountsWholesalePriceList id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Promotion id of a wholesale price list to assign to the offer or `null` to unassign wholesale price list from the offer. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationDiscountsWholesalePriceList modificationDiscountsWholesalePriceList = (ModificationDiscountsWholesalePriceList) o; + return Objects.equals(this.id, modificationDiscountsWholesalePriceList.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationDiscountsWholesalePriceList {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationDiscountsWholesalePriceList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationDiscountsWholesalePriceList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationDiscountsWholesalePriceList is not found in the empty JSON string", ModificationDiscountsWholesalePriceList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModificationDiscountsWholesalePriceList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModificationDiscountsWholesalePriceList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModificationDiscountsWholesalePriceList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModificationDiscountsWholesalePriceList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModificationDiscountsWholesalePriceList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModificationDiscountsWholesalePriceList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModificationDiscountsWholesalePriceList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModificationDiscountsWholesalePriceList given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationDiscountsWholesalePriceList + * @throws IOException if the JSON string is invalid with respect to ModificationDiscountsWholesalePriceList + */ + public static ModificationDiscountsWholesalePriceList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationDiscountsWholesalePriceList.class); + } + + /** + * Convert an instance of ModificationDiscountsWholesalePriceList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationNoSafetyInformation.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationNoSafetyInformation.java new file mode 100644 index 0000000..d517b0e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationNoSafetyInformation.java @@ -0,0 +1,211 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ModificationSafetyInformation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ModificationNoSafetyInformation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationNoSafetyInformation extends ModificationSafetyInformation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @Deprecated + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type; + + public ModificationNoSafetyInformation() { + this.type = this.getClass().getSimpleName(); + } + + @Deprecated + public ModificationNoSafetyInformation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * The option is deprecated and will be removed in the future. + * @return type + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public String getType() { + return type; + } + + @Deprecated + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationNoSafetyInformation modificationNoSafetyInformation = (ModificationNoSafetyInformation) o; + return Objects.equals(this.type, modificationNoSafetyInformation.type) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationNoSafetyInformation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationNoSafetyInformation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationNoSafetyInformation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationNoSafetyInformation is not found in the empty JSON string", ModificationNoSafetyInformation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModificationNoSafetyInformation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModificationNoSafetyInformation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModificationNoSafetyInformation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModificationNoSafetyInformation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModificationNoSafetyInformation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModificationNoSafetyInformation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModificationNoSafetyInformation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModificationNoSafetyInformation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationNoSafetyInformation + * @throws IOException if the JSON string is invalid with respect to ModificationNoSafetyInformation + */ + public static ModificationNoSafetyInformation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationNoSafetyInformation.class); + } + + /** + * Convert an instance of ModificationNoSafetyInformation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationPayments.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationPayments.java new file mode 100644 index 0000000..d0f74c1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationPayments.java @@ -0,0 +1,298 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Tax; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ModificationPayments + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationPayments { + /** + * Invoice type: VAT, VAT_MARGIN, WITHOUT_VAT, NO_INVOICE + */ + @JsonAdapter(InvoiceEnum.Adapter.class) + public enum InvoiceEnum { + VAT("VAT"), + + VAT_MARGIN("VAT_MARGIN"), + + WITHOUT_VAT("WITHOUT_VAT"), + + NO_INVOICE("NO_INVOICE"); + + private String value; + + InvoiceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static InvoiceEnum fromValue(String value) { + for (InvoiceEnum b : InvoiceEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final InvoiceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public InvoiceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return InvoiceEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + InvoiceEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_INVOICE = "invoice"; + @SerializedName(SERIALIZED_NAME_INVOICE) + @javax.annotation.Nullable + private InvoiceEnum invoice; + + public static final String SERIALIZED_NAME_TAX = "tax"; + @SerializedName(SERIALIZED_NAME_TAX) + @javax.annotation.Nullable + private Tax tax; + + public ModificationPayments() { + } + + public ModificationPayments invoice(@javax.annotation.Nullable InvoiceEnum invoice) { + this.invoice = invoice; + return this; + } + + /** + * Invoice type: VAT, VAT_MARGIN, WITHOUT_VAT, NO_INVOICE + * @return invoice + */ + @javax.annotation.Nullable + public InvoiceEnum getInvoice() { + return invoice; + } + + public void setInvoice(@javax.annotation.Nullable InvoiceEnum invoice) { + this.invoice = invoice; + } + + + public ModificationPayments tax(@javax.annotation.Nullable Tax tax) { + this.tax = tax; + return this; + } + + /** + * Get tax + * @return tax + */ + @javax.annotation.Nullable + public Tax getTax() { + return tax; + } + + public void setTax(@javax.annotation.Nullable Tax tax) { + this.tax = tax; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationPayments modificationPayments = (ModificationPayments) o; + return Objects.equals(this.invoice, modificationPayments.invoice) && + Objects.equals(this.tax, modificationPayments.tax); + } + + @Override + public int hashCode() { + return Objects.hash(invoice, tax); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationPayments {\n"); + sb.append(" invoice: ").append(toIndentedString(invoice)).append("\n"); + sb.append(" tax: ").append(toIndentedString(tax)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("invoice"); + openapiFields.add("tax"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationPayments + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationPayments.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationPayments is not found in the empty JSON string", ModificationPayments.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModificationPayments.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModificationPayments` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("invoice") != null && !jsonObj.get("invoice").isJsonNull()) && !jsonObj.get("invoice").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `invoice` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoice").toString())); + } + // validate the optional field `invoice` + if (jsonObj.get("invoice") != null && !jsonObj.get("invoice").isJsonNull()) { + InvoiceEnum.validateJsonElement(jsonObj.get("invoice")); + } + // validate the optional field `tax` + if (jsonObj.get("tax") != null && !jsonObj.get("tax").isJsonNull()) { + Tax.validateJsonElement(jsonObj.get("tax")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModificationPayments.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModificationPayments' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModificationPayments.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModificationPayments value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModificationPayments read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModificationPayments given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationPayments + * @throws IOException if the JSON string is invalid with respect to ModificationPayments + */ + public static ModificationPayments fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationPayments.class); + } + + /** + * Convert an instance of ModificationPayments to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationPublication.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationPublication.java new file mode 100644 index 0000000..5316e40 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationPublication.java @@ -0,0 +1,309 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Allows you to change duration of the offers. You can include only property in a request \"duration\" or \"durationUnlimited\". + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationPublication { + /** + * Offer duration time provided in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + */ + @JsonAdapter(DurationEnum.Adapter.class) + public enum DurationEnum { + PT72_H("PT72H"), + + PT120_H("PT120H"), + + PT168_H("PT168H"), + + PT240_H("PT240H"), + + PT480_H("PT480H"), + + PT720_H("PT720H"), + + P3_D("P3D"), + + P5_D("P5D"), + + P7_D("P7D"), + + P10_D("P10D"), + + P20_D("P20D"), + + P30_D("P30D"); + + private String value; + + DurationEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DurationEnum fromValue(String value) { + for (DurationEnum b : DurationEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DurationEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DurationEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DurationEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + DurationEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + @javax.annotation.Nullable + private DurationEnum duration; + + public static final String SERIALIZED_NAME_DURATION_UNLIMITED = "durationUnlimited"; + @SerializedName(SERIALIZED_NAME_DURATION_UNLIMITED) + @javax.annotation.Nullable + private Boolean durationUnlimited; + + public ModificationPublication() { + } + + public ModificationPublication duration(@javax.annotation.Nullable DurationEnum duration) { + this.duration = duration; + return this; + } + + /** + * Offer duration time provided in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + * @return duration + */ + @javax.annotation.Nullable + public DurationEnum getDuration() { + return duration; + } + + public void setDuration(@javax.annotation.Nullable DurationEnum duration) { + this.duration = duration; + } + + + public ModificationPublication durationUnlimited(@javax.annotation.Nullable Boolean durationUnlimited) { + this.durationUnlimited = durationUnlimited; + return this; + } + + /** + * Unlimited duration time. + * @return durationUnlimited + */ + @javax.annotation.Nullable + public Boolean getDurationUnlimited() { + return durationUnlimited; + } + + public void setDurationUnlimited(@javax.annotation.Nullable Boolean durationUnlimited) { + this.durationUnlimited = durationUnlimited; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationPublication modificationPublication = (ModificationPublication) o; + return Objects.equals(this.duration, modificationPublication.duration) && + Objects.equals(this.durationUnlimited, modificationPublication.durationUnlimited); + } + + @Override + public int hashCode() { + return Objects.hash(duration, durationUnlimited); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationPublication {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" durationUnlimited: ").append(toIndentedString(durationUnlimited)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("duration"); + openapiFields.add("durationUnlimited"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationPublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationPublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationPublication is not found in the empty JSON string", ModificationPublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModificationPublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModificationPublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + // validate the optional field `duration` + if (jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) { + DurationEnum.validateJsonElement(jsonObj.get("duration")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModificationPublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModificationPublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModificationPublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModificationPublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModificationPublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModificationPublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationPublication + * @throws IOException if the JSON string is invalid with respect to ModificationPublication + */ + public static ModificationPublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationPublication.class); + } + + /** + * Convert an instance of ModificationPublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationResponsiblePerson.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationResponsiblePerson.java new file mode 100644 index 0000000..13fde9c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationResponsiblePerson.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Allows you to assign/unassign responsible persons to/from offers. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationResponsiblePerson { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ModificationResponsiblePerson() { + } + + public ModificationResponsiblePerson id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of a responsible person configured using the <a href=\"#tag/Responsible-persons\">Responsible persons API</a>. _Note: if the offer contains multiple products, the responsible person will only be changed for the first product._ + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationResponsiblePerson modificationResponsiblePerson = (ModificationResponsiblePerson) o; + return Objects.equals(this.id, modificationResponsiblePerson.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationResponsiblePerson {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationResponsiblePerson + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationResponsiblePerson.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationResponsiblePerson is not found in the empty JSON string", ModificationResponsiblePerson.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModificationResponsiblePerson.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModificationResponsiblePerson` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModificationResponsiblePerson.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModificationResponsiblePerson' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModificationResponsiblePerson.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModificationResponsiblePerson value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModificationResponsiblePerson read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModificationResponsiblePerson given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationResponsiblePerson + * @throws IOException if the JSON string is invalid with respect to ModificationResponsiblePerson + */ + public static ModificationResponsiblePerson fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationResponsiblePerson.class); + } + + /** + * Convert an instance of ModificationResponsiblePerson to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationResponsibleProducer.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationResponsibleProducer.java new file mode 100644 index 0000000..e28d392 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationResponsibleProducer.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Allows you to assign/unassign responsible producers to/from offers. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationResponsibleProducer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ModificationResponsibleProducer() { + } + + public ModificationResponsibleProducer id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The ID of a responsible producer configured using the <a href=\"#tag/Responsible-producers\">Responsible Producers API</a>. _Note: if the offer contains multiple products, the responsible producer will only be changed for the first product._ + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationResponsibleProducer modificationResponsibleProducer = (ModificationResponsibleProducer) o; + return Objects.equals(this.id, modificationResponsibleProducer.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationResponsibleProducer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationResponsibleProducer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationResponsibleProducer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationResponsibleProducer is not found in the empty JSON string", ModificationResponsibleProducer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModificationResponsibleProducer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModificationResponsibleProducer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModificationResponsibleProducer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModificationResponsibleProducer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModificationResponsibleProducer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModificationResponsibleProducer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModificationResponsibleProducer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModificationResponsibleProducer given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationResponsibleProducer + * @throws IOException if the JSON string is invalid with respect to ModificationResponsibleProducer + */ + public static ModificationResponsibleProducer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationResponsibleProducer.class); + } + + /** + * Convert an instance of ModificationResponsibleProducer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationSafetyInformation.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationSafetyInformation.java new file mode 100644 index 0000000..edf31e5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationSafetyInformation.java @@ -0,0 +1,183 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Allows you to set safety information in offers. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationSafetyInformation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + public ModificationSafetyInformation() { + this.type = this.getClass().getSimpleName(); + } + + public ModificationSafetyInformation type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * _Note: if the offer contains multiple products, the safety information will only be changed for the first product._ + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationSafetyInformation modificationSafetyInformation = (ModificationSafetyInformation) o; + return Objects.equals(this.type, modificationSafetyInformation.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationSafetyInformation {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationSafetyInformation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationSafetyInformation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationSafetyInformation is not found in the empty JSON string", ModificationSafetyInformation.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "ATTACHMENTS": + ModificationAttachmentSafetyInformation.validateJsonElement(jsonElement); + break; + case "NO_SAFETY_INFORMATION": + ModificationNoSafetyInformation.validateJsonElement(jsonElement); + break; + case "TEXT": + ModificationTextSafetyInformation.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of ModificationSafetyInformation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationSafetyInformation + * @throws IOException if the JSON string is invalid with respect to ModificationSafetyInformation + */ + public static ModificationSafetyInformation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationSafetyInformation.class); + } + + /** + * Convert an instance of ModificationSafetyInformation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ModificationTextSafetyInformation.java b/src/main/java/pl/wtx/allegro/api/client/model/ModificationTextSafetyInformation.java new file mode 100644 index 0000000..1b8a6bf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ModificationTextSafetyInformation.java @@ -0,0 +1,215 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ModificationSafetyInformation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ModificationTextSafetyInformation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ModificationTextSafetyInformation extends ModificationSafetyInformation { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public ModificationTextSafetyInformation() { + this.type = this.getClass().getSimpleName(); + } + + public ModificationTextSafetyInformation description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Safety warnings and instructions for the product in plain text form, if the information cannot be provided through attachments. Text can't be longer than 5000 characters. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModificationTextSafetyInformation modificationTextSafetyInformation = (ModificationTextSafetyInformation) o; + return Objects.equals(this.description, modificationTextSafetyInformation.description) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(description, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModificationTextSafetyInformation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModificationTextSafetyInformation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModificationTextSafetyInformation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModificationTextSafetyInformation is not found in the empty JSON string", ModificationTextSafetyInformation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ModificationTextSafetyInformation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModificationTextSafetyInformation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ModificationTextSafetyInformation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModificationTextSafetyInformation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModificationTextSafetyInformation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModificationTextSafetyInformation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModificationTextSafetyInformation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ModificationTextSafetyInformation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModificationTextSafetyInformation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModificationTextSafetyInformation + * @throws IOException if the JSON string is invalid with respect to ModificationTextSafetyInformation + */ + public static ModificationTextSafetyInformation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModificationTextSafetyInformation.class); + } + + /** + * Convert an instance of ModificationTextSafetyInformation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecification.java b/src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecification.java new file mode 100644 index 0000000..8be7d6f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecification.java @@ -0,0 +1,271 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BenefitSpecification; +import pl.wtx.allegro.api.client.model.MultiPackBenefitSpecificationAllOfConfiguration; +import pl.wtx.allegro.api.client.model.MultiPackBenefitSpecificationAllOfTrigger; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * MultiPackBenefitSpecification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MultiPackBenefitSpecification extends BenefitSpecification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "UNIT_PERCENTAGE_DISCOUNT"; + + public static final String SERIALIZED_NAME_CONFIGURATION = "configuration"; + @SerializedName(SERIALIZED_NAME_CONFIGURATION) + @javax.annotation.Nonnull + private MultiPackBenefitSpecificationAllOfConfiguration _configuration; + + public static final String SERIALIZED_NAME_TRIGGER = "trigger"; + @SerializedName(SERIALIZED_NAME_TRIGGER) + @javax.annotation.Nonnull + private MultiPackBenefitSpecificationAllOfTrigger trigger; + + public MultiPackBenefitSpecification() { + this.type = this.getClass().getSimpleName(); + } + + public MultiPackBenefitSpecification type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public MultiPackBenefitSpecification _configuration(@javax.annotation.Nonnull MultiPackBenefitSpecificationAllOfConfiguration _configuration) { + this._configuration = _configuration; + return this; + } + + /** + * Get _configuration + * @return _configuration + */ + @javax.annotation.Nonnull + public MultiPackBenefitSpecificationAllOfConfiguration getConfiguration() { + return _configuration; + } + + public void setConfiguration(@javax.annotation.Nonnull MultiPackBenefitSpecificationAllOfConfiguration _configuration) { + this._configuration = _configuration; + } + + + public MultiPackBenefitSpecification trigger(@javax.annotation.Nonnull MultiPackBenefitSpecificationAllOfTrigger trigger) { + this.trigger = trigger; + return this; + } + + /** + * Get trigger + * @return trigger + */ + @javax.annotation.Nonnull + public MultiPackBenefitSpecificationAllOfTrigger getTrigger() { + return trigger; + } + + public void setTrigger(@javax.annotation.Nonnull MultiPackBenefitSpecificationAllOfTrigger trigger) { + this.trigger = trigger; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MultiPackBenefitSpecification multiPackBenefitSpecification = (MultiPackBenefitSpecification) o; + return Objects.equals(this.type, multiPackBenefitSpecification.type) && + Objects.equals(this._configuration, multiPackBenefitSpecification._configuration) && + Objects.equals(this.trigger, multiPackBenefitSpecification.trigger) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, _configuration, trigger, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MultiPackBenefitSpecification {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("configuration"); + openapiFields.add("trigger"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("configuration"); + openapiRequiredFields.add("trigger"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MultiPackBenefitSpecification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MultiPackBenefitSpecification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MultiPackBenefitSpecification is not found in the empty JSON string", MultiPackBenefitSpecification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MultiPackBenefitSpecification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MultiPackBenefitSpecification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MultiPackBenefitSpecification.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MultiPackBenefitSpecification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MultiPackBenefitSpecification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MultiPackBenefitSpecification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MultiPackBenefitSpecification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MultiPackBenefitSpecification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MultiPackBenefitSpecification given an JSON string + * + * @param jsonString JSON string + * @return An instance of MultiPackBenefitSpecification + * @throws IOException if the JSON string is invalid with respect to MultiPackBenefitSpecification + */ + public static MultiPackBenefitSpecification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MultiPackBenefitSpecification.class); + } + + /** + * Convert an instance of MultiPackBenefitSpecification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecificationAllOfConfiguration.java b/src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecificationAllOfConfiguration.java new file mode 100644 index 0000000..ac935fd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecificationAllOfConfiguration.java @@ -0,0 +1,213 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * What rebate will be given. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MultiPackBenefitSpecificationAllOfConfiguration { + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + @javax.annotation.Nonnull + private BigDecimal percentage; + + public MultiPackBenefitSpecificationAllOfConfiguration() { + } + + public MultiPackBenefitSpecificationAllOfConfiguration percentage(@javax.annotation.Nonnull BigDecimal percentage) { + this.percentage = percentage; + return this; + } + + /** + * discount percentage + * minimum: 1 + * @return percentage + */ + @javax.annotation.Nonnull + public BigDecimal getPercentage() { + return percentage; + } + + public void setPercentage(@javax.annotation.Nonnull BigDecimal percentage) { + this.percentage = percentage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MultiPackBenefitSpecificationAllOfConfiguration multiPackBenefitSpecificationAllOfConfiguration = (MultiPackBenefitSpecificationAllOfConfiguration) o; + return Objects.equals(this.percentage, multiPackBenefitSpecificationAllOfConfiguration.percentage); + } + + @Override + public int hashCode() { + return Objects.hash(percentage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MultiPackBenefitSpecificationAllOfConfiguration {\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("percentage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("percentage"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MultiPackBenefitSpecificationAllOfConfiguration + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MultiPackBenefitSpecificationAllOfConfiguration.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MultiPackBenefitSpecificationAllOfConfiguration is not found in the empty JSON string", MultiPackBenefitSpecificationAllOfConfiguration.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MultiPackBenefitSpecificationAllOfConfiguration.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MultiPackBenefitSpecificationAllOfConfiguration` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MultiPackBenefitSpecificationAllOfConfiguration.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MultiPackBenefitSpecificationAllOfConfiguration.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MultiPackBenefitSpecificationAllOfConfiguration' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MultiPackBenefitSpecificationAllOfConfiguration.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MultiPackBenefitSpecificationAllOfConfiguration value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MultiPackBenefitSpecificationAllOfConfiguration read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MultiPackBenefitSpecificationAllOfConfiguration given an JSON string + * + * @param jsonString JSON string + * @return An instance of MultiPackBenefitSpecificationAllOfConfiguration + * @throws IOException if the JSON string is invalid with respect to MultiPackBenefitSpecificationAllOfConfiguration + */ + public static MultiPackBenefitSpecificationAllOfConfiguration fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MultiPackBenefitSpecificationAllOfConfiguration.class); + } + + /** + * Convert an instance of MultiPackBenefitSpecificationAllOfConfiguration to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecificationAllOfTrigger.java b/src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecificationAllOfTrigger.java new file mode 100644 index 0000000..ec01abc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MultiPackBenefitSpecificationAllOfTrigger.java @@ -0,0 +1,242 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Describes what will cause the rebate. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MultiPackBenefitSpecificationAllOfTrigger { + public static final String SERIALIZED_NAME_FOR_EACH_QUANTITY = "forEachQuantity"; + @SerializedName(SERIALIZED_NAME_FOR_EACH_QUANTITY) + @javax.annotation.Nonnull + private BigDecimal forEachQuantity; + + public static final String SERIALIZED_NAME_DISCOUNTED_NUMBER = "discountedNumber"; + @SerializedName(SERIALIZED_NAME_DISCOUNTED_NUMBER) + @javax.annotation.Nonnull + private BigDecimal discountedNumber; + + public MultiPackBenefitSpecificationAllOfTrigger() { + } + + public MultiPackBenefitSpecificationAllOfTrigger forEachQuantity(@javax.annotation.Nonnull BigDecimal forEachQuantity) { + this.forEachQuantity = forEachQuantity; + return this; + } + + /** + * For every pack of this quantity new rebate will be given. + * minimum: 1 + * @return forEachQuantity + */ + @javax.annotation.Nonnull + public BigDecimal getForEachQuantity() { + return forEachQuantity; + } + + public void setForEachQuantity(@javax.annotation.Nonnull BigDecimal forEachQuantity) { + this.forEachQuantity = forEachQuantity; + } + + + public MultiPackBenefitSpecificationAllOfTrigger discountedNumber(@javax.annotation.Nonnull BigDecimal discountedNumber) { + this.discountedNumber = discountedNumber; + return this; + } + + /** + * Describes how many offers in pack should be discounted by discount percentage. + * minimum: 1 + * @return discountedNumber + */ + @javax.annotation.Nonnull + public BigDecimal getDiscountedNumber() { + return discountedNumber; + } + + public void setDiscountedNumber(@javax.annotation.Nonnull BigDecimal discountedNumber) { + this.discountedNumber = discountedNumber; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MultiPackBenefitSpecificationAllOfTrigger multiPackBenefitSpecificationAllOfTrigger = (MultiPackBenefitSpecificationAllOfTrigger) o; + return Objects.equals(this.forEachQuantity, multiPackBenefitSpecificationAllOfTrigger.forEachQuantity) && + Objects.equals(this.discountedNumber, multiPackBenefitSpecificationAllOfTrigger.discountedNumber); + } + + @Override + public int hashCode() { + return Objects.hash(forEachQuantity, discountedNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MultiPackBenefitSpecificationAllOfTrigger {\n"); + sb.append(" forEachQuantity: ").append(toIndentedString(forEachQuantity)).append("\n"); + sb.append(" discountedNumber: ").append(toIndentedString(discountedNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("forEachQuantity"); + openapiFields.add("discountedNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("forEachQuantity"); + openapiRequiredFields.add("discountedNumber"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MultiPackBenefitSpecificationAllOfTrigger + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MultiPackBenefitSpecificationAllOfTrigger.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MultiPackBenefitSpecificationAllOfTrigger is not found in the empty JSON string", MultiPackBenefitSpecificationAllOfTrigger.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MultiPackBenefitSpecificationAllOfTrigger.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MultiPackBenefitSpecificationAllOfTrigger` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MultiPackBenefitSpecificationAllOfTrigger.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MultiPackBenefitSpecificationAllOfTrigger.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MultiPackBenefitSpecificationAllOfTrigger' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MultiPackBenefitSpecificationAllOfTrigger.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MultiPackBenefitSpecificationAllOfTrigger value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MultiPackBenefitSpecificationAllOfTrigger read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MultiPackBenefitSpecificationAllOfTrigger given an JSON string + * + * @param jsonString JSON string + * @return An instance of MultiPackBenefitSpecificationAllOfTrigger + * @throws IOException if the JSON string is invalid with respect to MultiPackBenefitSpecificationAllOfTrigger + */ + public static MultiPackBenefitSpecificationAllOfTrigger fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MultiPackBenefitSpecificationAllOfTrigger.class); + } + + /** + * Convert an instance of MultiPackBenefitSpecificationAllOfTrigger to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/MyBidResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/MyBidResponse.java new file mode 100644 index 0000000..6ad7abb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/MyBidResponse.java @@ -0,0 +1,300 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AuctionDetails; +import pl.wtx.allegro.api.client.model.MaxPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * bid response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class MyBidResponse { + public static final String SERIALIZED_NAME_MAX_AMOUNT = "maxAmount"; + @SerializedName(SERIALIZED_NAME_MAX_AMOUNT) + @javax.annotation.Nonnull + private MaxPrice maxAmount; + + public static final String SERIALIZED_NAME_MINIMAL_PRICE_MET = "minimalPriceMet"; + @SerializedName(SERIALIZED_NAME_MINIMAL_PRICE_MET) + @javax.annotation.Nullable + private Boolean minimalPriceMet; + + public static final String SERIALIZED_NAME_HIGH_BIDDER = "highBidder"; + @SerializedName(SERIALIZED_NAME_HIGH_BIDDER) + @javax.annotation.Nonnull + private Boolean highBidder; + + public static final String SERIALIZED_NAME_AUCTION = "auction"; + @SerializedName(SERIALIZED_NAME_AUCTION) + @javax.annotation.Nonnull + private AuctionDetails auction; + + public MyBidResponse() { + } + + public MyBidResponse maxAmount(@javax.annotation.Nonnull MaxPrice maxAmount) { + this.maxAmount = maxAmount; + return this; + } + + /** + * Get maxAmount + * @return maxAmount + */ + @javax.annotation.Nonnull + public MaxPrice getMaxAmount() { + return maxAmount; + } + + public void setMaxAmount(@javax.annotation.Nonnull MaxPrice maxAmount) { + this.maxAmount = maxAmount; + } + + + public MyBidResponse minimalPriceMet(@javax.annotation.Nullable Boolean minimalPriceMet) { + this.minimalPriceMet = minimalPriceMet; + return this; + } + + /** + * This indicates if the minimal price of the auction has been met or is not set at all. A minimal price can be set by the seller and is the minimum amount the seller is willing to sell the item for. If the highest bid is not higher than the minimal price when the auction ends, the listing ends and the item is not sold. + * @return minimalPriceMet + */ + @javax.annotation.Nullable + public Boolean getMinimalPriceMet() { + return minimalPriceMet; + } + + public void setMinimalPriceMet(@javax.annotation.Nullable Boolean minimalPriceMet) { + this.minimalPriceMet = minimalPriceMet; + } + + + public MyBidResponse highBidder(@javax.annotation.Nonnull Boolean highBidder) { + this.highBidder = highBidder; + return this; + } + + /** + * Is this bid currently winning? + * @return highBidder + */ + @javax.annotation.Nonnull + public Boolean getHighBidder() { + return highBidder; + } + + public void setHighBidder(@javax.annotation.Nonnull Boolean highBidder) { + this.highBidder = highBidder; + } + + + public MyBidResponse auction(@javax.annotation.Nonnull AuctionDetails auction) { + this.auction = auction; + return this; + } + + /** + * Get auction + * @return auction + */ + @javax.annotation.Nonnull + public AuctionDetails getAuction() { + return auction; + } + + public void setAuction(@javax.annotation.Nonnull AuctionDetails auction) { + this.auction = auction; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MyBidResponse myBidResponse = (MyBidResponse) o; + return Objects.equals(this.maxAmount, myBidResponse.maxAmount) && + Objects.equals(this.minimalPriceMet, myBidResponse.minimalPriceMet) && + Objects.equals(this.highBidder, myBidResponse.highBidder) && + Objects.equals(this.auction, myBidResponse.auction); + } + + @Override + public int hashCode() { + return Objects.hash(maxAmount, minimalPriceMet, highBidder, auction); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MyBidResponse {\n"); + sb.append(" maxAmount: ").append(toIndentedString(maxAmount)).append("\n"); + sb.append(" minimalPriceMet: ").append(toIndentedString(minimalPriceMet)).append("\n"); + sb.append(" highBidder: ").append(toIndentedString(highBidder)).append("\n"); + sb.append(" auction: ").append(toIndentedString(auction)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("maxAmount"); + openapiFields.add("minimalPriceMet"); + openapiFields.add("highBidder"); + openapiFields.add("auction"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("maxAmount"); + openapiRequiredFields.add("highBidder"); + openapiRequiredFields.add("auction"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MyBidResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MyBidResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MyBidResponse is not found in the empty JSON string", MyBidResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MyBidResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MyBidResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MyBidResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `maxAmount` + MaxPrice.validateJsonElement(jsonObj.get("maxAmount")); + // validate the required field `auction` + AuctionDetails.validateJsonElement(jsonObj.get("auction")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MyBidResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MyBidResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MyBidResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MyBidResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MyBidResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MyBidResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of MyBidResponse + * @throws IOException if the JSON string is invalid with respect to MyBidResponse + */ + public static MyBidResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MyBidResponse.class); + } + + /** + * Convert an instance of MyBidResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/NetPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/NetPrice.java new file mode 100644 index 0000000..a2f36df --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/NetPrice.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The buy now net price computed based on tax. Provided for informational purposes only - ignored when creating (POST) or updating (PUT). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class NetPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public NetPrice() { + } + + public NetPrice amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public NetPrice currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NetPrice netPrice = (NetPrice) o; + return Objects.equals(this.amount, netPrice.amount) && + Objects.equals(this.currency, netPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NetPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NetPrice is not found in the empty JSON string", NetPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NetPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NetPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetPrice.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NetPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NetPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NetPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NetPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetPrice + * @throws IOException if the JSON string is invalid with respect to NetPrice + */ + public static NetPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetPrice.class); + } + + /** + * Convert an instance of NetPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/NewAttachmentDeclaration.java b/src/main/java/pl/wtx/allegro/api/client/model/NewAttachmentDeclaration.java new file mode 100644 index 0000000..2aa99c9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/NewAttachmentDeclaration.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * NewAttachmentDeclaration + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class NewAttachmentDeclaration { + public static final String SERIALIZED_NAME_FILENAME = "filename"; + @SerializedName(SERIALIZED_NAME_FILENAME) + @javax.annotation.Nonnull + private String filename; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nonnull + private Long size; + + public NewAttachmentDeclaration() { + } + + public NewAttachmentDeclaration filename(@javax.annotation.Nonnull String filename) { + this.filename = filename; + return this; + } + + /** + * Get filename + * @return filename + */ + @javax.annotation.Nonnull + public String getFilename() { + return filename; + } + + public void setFilename(@javax.annotation.Nonnull String filename) { + this.filename = filename; + } + + + public NewAttachmentDeclaration size(@javax.annotation.Nonnull Long size) { + this.size = size; + return this; + } + + /** + * Get size + * minimum: 0 + * maximum: 5242880 + * @return size + */ + @javax.annotation.Nonnull + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nonnull Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NewAttachmentDeclaration newAttachmentDeclaration = (NewAttachmentDeclaration) o; + return Objects.equals(this.filename, newAttachmentDeclaration.filename) && + Objects.equals(this.size, newAttachmentDeclaration.size); + } + + @Override + public int hashCode() { + return Objects.hash(filename, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewAttachmentDeclaration {\n"); + sb.append(" filename: ").append(toIndentedString(filename)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("filename"); + openapiFields.add("size"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("filename"); + openapiRequiredFields.add("size"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NewAttachmentDeclaration + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NewAttachmentDeclaration.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NewAttachmentDeclaration is not found in the empty JSON string", NewAttachmentDeclaration.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NewAttachmentDeclaration.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NewAttachmentDeclaration` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NewAttachmentDeclaration.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("filename").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `filename` to be a primitive type in the JSON string but got `%s`", jsonObj.get("filename").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NewAttachmentDeclaration.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NewAttachmentDeclaration' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NewAttachmentDeclaration.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NewAttachmentDeclaration value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NewAttachmentDeclaration read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NewAttachmentDeclaration given an JSON string + * + * @param jsonString JSON string + * @return An instance of NewAttachmentDeclaration + * @throws IOException if the JSON string is invalid with respect to NewAttachmentDeclaration + */ + public static NewAttachmentDeclaration fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NewAttachmentDeclaration.class); + } + + /** + * Convert an instance of NewAttachmentDeclaration to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/NewMessage.java b/src/main/java/pl/wtx/allegro/api/client/model/NewMessage.java new file mode 100644 index 0000000..8f59109 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/NewMessage.java @@ -0,0 +1,340 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.MessageAttachmentId; +import pl.wtx.allegro.api.client.model.MessageOrder; +import pl.wtx.allegro.api.client.model.Recipient; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * NewMessage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class NewMessage { + public static final String SERIALIZED_NAME_RECIPIENT = "recipient"; + @SerializedName(SERIALIZED_NAME_RECIPIENT) + @javax.annotation.Nonnull + private Recipient recipient; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nonnull + private String text; + + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nullable + private List attachments; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + @javax.annotation.Nullable + private MessageOrder order; + + public NewMessage() { + } + + public NewMessage recipient(@javax.annotation.Nonnull Recipient recipient) { + this.recipient = recipient; + return this; + } + + /** + * Get recipient + * @return recipient + */ + @javax.annotation.Nonnull + public Recipient getRecipient() { + return recipient; + } + + public void setRecipient(@javax.annotation.Nonnull Recipient recipient) { + this.recipient = recipient; + } + + + public NewMessage text(@javax.annotation.Nonnull String text) { + this.text = text; + return this; + } + + /** + * Get text + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nonnull String text) { + this.text = text; + } + + + public NewMessage attachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + return this; + } + + public NewMessage addAttachmentsItem(MessageAttachmentId attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * Get attachments + * @return attachments + */ + @javax.annotation.Nullable + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + } + + + public NewMessage order(@javax.annotation.Nullable MessageOrder order) { + this.order = order; + return this; + } + + /** + * Get order + * @return order + */ + @javax.annotation.Nullable + public MessageOrder getOrder() { + return order; + } + + public void setOrder(@javax.annotation.Nullable MessageOrder order) { + this.order = order; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NewMessage newMessage = (NewMessage) o; + return Objects.equals(this.recipient, newMessage.recipient) && + Objects.equals(this.text, newMessage.text) && + Objects.equals(this.attachments, newMessage.attachments) && + Objects.equals(this.order, newMessage.order); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(recipient, text, attachments, order); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewMessage {\n"); + sb.append(" recipient: ").append(toIndentedString(recipient)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("recipient"); + openapiFields.add("text"); + openapiFields.add("attachments"); + openapiFields.add("order"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("recipient"); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("order"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NewMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NewMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NewMessage is not found in the empty JSON string", NewMessage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NewMessage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NewMessage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NewMessage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `recipient` + Recipient.validateJsonElement(jsonObj.get("recipient")); + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if (jsonObj.get("attachments") != null && !jsonObj.get("attachments").isJsonNull()) { + JsonArray jsonArrayattachments = jsonObj.getAsJsonArray("attachments"); + if (jsonArrayattachments != null) { + // ensure the json data is an array + if (!jsonObj.get("attachments").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `attachments` to be an array in the JSON string but got `%s`", jsonObj.get("attachments").toString())); + } + + // validate the optional field `attachments` (array) + for (int i = 0; i < jsonArrayattachments.size(); i++) { + MessageAttachmentId.validateJsonElement(jsonArrayattachments.get(i)); + }; + } + } + // validate the required field `order` + MessageOrder.validateJsonElement(jsonObj.get("order")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NewMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NewMessage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NewMessage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NewMessage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NewMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NewMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of NewMessage + * @throws IOException if the JSON string is invalid with respect to NewMessage + */ + public static NewMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NewMessage.class); + } + + /** + * Convert an instance of NewMessage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/NewMessageInThread.java b/src/main/java/pl/wtx/allegro/api/client/model/NewMessageInThread.java new file mode 100644 index 0000000..c5776ae --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/NewMessageInThread.java @@ -0,0 +1,278 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.MessageAttachmentId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * NewMessageInThread + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class NewMessageInThread { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nonnull + private String text; + + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nullable + private List attachments; + + public NewMessageInThread() { + } + + public NewMessageInThread text(@javax.annotation.Nonnull String text) { + this.text = text; + return this; + } + + /** + * Get text + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nonnull String text) { + this.text = text; + } + + + public NewMessageInThread attachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + return this; + } + + public NewMessageInThread addAttachmentsItem(MessageAttachmentId attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * Get attachments + * @return attachments + */ + @javax.annotation.Nullable + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NewMessageInThread newMessageInThread = (NewMessageInThread) o; + return Objects.equals(this.text, newMessageInThread.text) && + Objects.equals(this.attachments, newMessageInThread.attachments); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(text, attachments); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewMessageInThread {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("text"); + openapiFields.add("attachments"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("text"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NewMessageInThread + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NewMessageInThread.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NewMessageInThread is not found in the empty JSON string", NewMessageInThread.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NewMessageInThread.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NewMessageInThread` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NewMessageInThread.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if (jsonObj.get("attachments") != null && !jsonObj.get("attachments").isJsonNull()) { + JsonArray jsonArrayattachments = jsonObj.getAsJsonArray("attachments"); + if (jsonArrayattachments != null) { + // ensure the json data is an array + if (!jsonObj.get("attachments").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `attachments` to be an array in the JSON string but got `%s`", jsonObj.get("attachments").toString())); + } + + // validate the optional field `attachments` (array) + for (int i = 0; i < jsonArrayattachments.size(); i++) { + MessageAttachmentId.validateJsonElement(jsonArrayattachments.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NewMessageInThread.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NewMessageInThread' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NewMessageInThread.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NewMessageInThread value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NewMessageInThread read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NewMessageInThread given an JSON string + * + * @param jsonString JSON string + * @return An instance of NewMessageInThread + * @throws IOException if the JSON string is invalid with respect to NewMessageInThread + */ + public static NewMessageInThread fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NewMessageInThread.class); + } + + /** + * Convert an instance of NewMessageInThread to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/NewProductParameterDto.java b/src/main/java/pl/wtx/allegro/api/client/model/NewProductParameterDto.java new file mode 100644 index 0000000..f06eb35 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/NewProductParameterDto.java @@ -0,0 +1,318 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParameterRangeValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * NewProductParameterDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class NewProductParameterDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_RANGE_VALUE = "rangeValue"; + @SerializedName(SERIALIZED_NAME_RANGE_VALUE) + @javax.annotation.Nullable + private ParameterRangeValue rangeValue; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALUES_IDS = "valuesIds"; + @SerializedName(SERIALIZED_NAME_VALUES_IDS) + @javax.annotation.Nullable + private List valuesIds = new ArrayList<>(); + + public NewProductParameterDto() { + } + + public NewProductParameterDto id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public NewProductParameterDto rangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + return this; + } + + /** + * Get rangeValue + * @return rangeValue + */ + @javax.annotation.Nullable + public ParameterRangeValue getRangeValue() { + return rangeValue; + } + + public void setRangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + } + + + public NewProductParameterDto values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public NewProductParameterDto addValuesItem(String valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Get values + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + public NewProductParameterDto valuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + return this; + } + + public NewProductParameterDto addValuesIdsItem(String valuesIdsItem) { + if (this.valuesIds == null) { + this.valuesIds = new ArrayList<>(); + } + this.valuesIds.add(valuesIdsItem); + return this; + } + + /** + * Get valuesIds + * @return valuesIds + */ + @javax.annotation.Nullable + public List getValuesIds() { + return valuesIds; + } + + public void setValuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NewProductParameterDto newProductParameterDto = (NewProductParameterDto) o; + return Objects.equals(this.id, newProductParameterDto.id) && + Objects.equals(this.rangeValue, newProductParameterDto.rangeValue) && + Objects.equals(this.values, newProductParameterDto.values) && + Objects.equals(this.valuesIds, newProductParameterDto.valuesIds); + } + + @Override + public int hashCode() { + return Objects.hash(id, rangeValue, values, valuesIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NewProductParameterDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" rangeValue: ").append(toIndentedString(rangeValue)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" valuesIds: ").append(toIndentedString(valuesIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("rangeValue"); + openapiFields.add("values"); + openapiFields.add("valuesIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NewProductParameterDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NewProductParameterDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NewProductParameterDto is not found in the empty JSON string", NewProductParameterDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NewProductParameterDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NewProductParameterDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `rangeValue` + if (jsonObj.get("rangeValue") != null && !jsonObj.get("rangeValue").isJsonNull()) { + ParameterRangeValue.validateJsonElement(jsonObj.get("rangeValue")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("valuesIds") != null && !jsonObj.get("valuesIds").isJsonNull() && !jsonObj.get("valuesIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `valuesIds` to be an array in the JSON string but got `%s`", jsonObj.get("valuesIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NewProductParameterDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NewProductParameterDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NewProductParameterDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NewProductParameterDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NewProductParameterDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NewProductParameterDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of NewProductParameterDto + * @throws IOException if the JSON string is invalid with respect to NewProductParameterDto + */ + public static NewProductParameterDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NewProductParameterDto.class); + } + + /** + * Convert an instance of NewProductParameterDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/NullableTurnoverDiscountDto.java b/src/main/java/pl/wtx/allegro/api/client/model/NullableTurnoverDiscountDto.java new file mode 100644 index 0000000..aea0e4a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/NullableTurnoverDiscountDto.java @@ -0,0 +1,358 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.TurnoverDiscountDefinitionDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Turnover discount for a marketplace. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class NullableTurnoverDiscountDto { + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + /** + * Turnover discount status. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVATING("ACTIVATING"), + + ACTIVE("ACTIVE"), + + DEACTIVATING("DEACTIVATING"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_DEFINITIONS = "definitions"; + @SerializedName(SERIALIZED_NAME_DEFINITIONS) + @javax.annotation.Nullable + private List definitions; + + public NullableTurnoverDiscountDto() { + } + + public NullableTurnoverDiscountDto marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * Marketplace ID. + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + public NullableTurnoverDiscountDto status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Turnover discount status. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public NullableTurnoverDiscountDto definitions(@javax.annotation.Nullable List definitions) { + this.definitions = definitions; + return this; + } + + public NullableTurnoverDiscountDto addDefinitionsItem(TurnoverDiscountDefinitionDto definitionsItem) { + if (this.definitions == null) { + this.definitions = new ArrayList<>(); + } + this.definitions.add(definitionsItem); + return this; + } + + /** + * Definitions currently active or active in the future. + * @return definitions + */ + @javax.annotation.Nullable + public List getDefinitions() { + return definitions; + } + + public void setDefinitions(@javax.annotation.Nullable List definitions) { + this.definitions = definitions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableTurnoverDiscountDto nullableTurnoverDiscountDto = (NullableTurnoverDiscountDto) o; + return Objects.equals(this.marketplaceId, nullableTurnoverDiscountDto.marketplaceId) && + Objects.equals(this.status, nullableTurnoverDiscountDto.status) && + Objects.equals(this.definitions, nullableTurnoverDiscountDto.definitions); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(marketplaceId, status, definitions); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableTurnoverDiscountDto {\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" definitions: ").append(toIndentedString(definitions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplaceId"); + openapiFields.add("status"); + openapiFields.add("definitions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NullableTurnoverDiscountDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NullableTurnoverDiscountDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NullableTurnoverDiscountDto is not found in the empty JSON string", NullableTurnoverDiscountDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NullableTurnoverDiscountDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NullableTurnoverDiscountDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("marketplaceId") != null && !jsonObj.get("marketplaceId").isJsonNull()) && !jsonObj.get("marketplaceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("marketplaceId").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if (jsonObj.get("definitions") != null && !jsonObj.get("definitions").isJsonNull()) { + JsonArray jsonArraydefinitions = jsonObj.getAsJsonArray("definitions"); + if (jsonArraydefinitions != null) { + // ensure the json data is an array + if (!jsonObj.get("definitions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `definitions` to be an array in the JSON string but got `%s`", jsonObj.get("definitions").toString())); + } + + // validate the optional field `definitions` (array) + for (int i = 0; i < jsonArraydefinitions.size(); i++) { + TurnoverDiscountDefinitionDto.validateJsonElement(jsonArraydefinitions.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NullableTurnoverDiscountDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NullableTurnoverDiscountDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NullableTurnoverDiscountDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NullableTurnoverDiscountDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NullableTurnoverDiscountDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NullableTurnoverDiscountDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of NullableTurnoverDiscountDto + * @throws IOException if the JSON string is invalid with respect to NullableTurnoverDiscountDto + */ + public static NullableTurnoverDiscountDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NullableTurnoverDiscountDto.class); + } + + /** + * Convert an instance of NullableTurnoverDiscountDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferActivatedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferActivatedEvent.java new file mode 100644 index 0000000..99fb5bc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferActivatedEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferEventExternalOffer; +import pl.wtx.allegro.api.client.model.SellerOfferBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferActivatedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferActivatedEvent extends SellerOfferBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "OFFER_ACTIVATED"; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OfferEventExternalOffer offer; + + public OfferActivatedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public OfferActivatedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public OfferActivatedEvent offer(@javax.annotation.Nonnull OfferEventExternalOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OfferEventExternalOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OfferEventExternalOffer offer) { + this.offer = offer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferActivatedEvent offerActivatedEvent = (OfferActivatedEvent) o; + return Objects.equals(this.type, offerActivatedEvent.type) && + Objects.equals(this.offer, offerActivatedEvent.offer) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, offer, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferActivatedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("offer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferActivatedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferActivatedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferActivatedEvent is not found in the empty JSON string", OfferActivatedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferActivatedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferActivatedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferActivatedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferActivatedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferActivatedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferActivatedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferActivatedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferActivatedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferActivatedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferActivatedEvent + * @throws IOException if the JSON string is invalid with respect to OfferActivatedEvent + */ + public static OfferActivatedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferActivatedEvent.class); + } + + /** + * Convert an instance of OfferActivatedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferAdditionalMarketplace.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferAdditionalMarketplace.java new file mode 100644 index 0000000..7809275 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferAdditionalMarketplace.java @@ -0,0 +1,240 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacePublication; +import pl.wtx.allegro.api.client.model.AdditionalMarketplaceSellingMode; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Additional marketplace settings. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferAdditionalMarketplace { + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private AdditionalMarketplacePublication publication; + + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private AdditionalMarketplaceSellingMode sellingMode; + + public OfferAdditionalMarketplace() { + } + + public OfferAdditionalMarketplace publication(@javax.annotation.Nullable AdditionalMarketplacePublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public AdditionalMarketplacePublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable AdditionalMarketplacePublication publication) { + this.publication = publication; + } + + + public OfferAdditionalMarketplace sellingMode(@javax.annotation.Nullable AdditionalMarketplaceSellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public AdditionalMarketplaceSellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable AdditionalMarketplaceSellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferAdditionalMarketplace offerAdditionalMarketplace = (OfferAdditionalMarketplace) o; + return Objects.equals(this.publication, offerAdditionalMarketplace.publication) && + Objects.equals(this.sellingMode, offerAdditionalMarketplace.sellingMode); + } + + @Override + public int hashCode() { + return Objects.hash(publication, sellingMode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferAdditionalMarketplace {\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("publication"); + openapiFields.add("sellingMode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferAdditionalMarketplace + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferAdditionalMarketplace.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferAdditionalMarketplace is not found in the empty JSON string", OfferAdditionalMarketplace.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferAdditionalMarketplace.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferAdditionalMarketplace` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + AdditionalMarketplacePublication.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + AdditionalMarketplaceSellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferAdditionalMarketplace.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferAdditionalMarketplace' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferAdditionalMarketplace.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferAdditionalMarketplace value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferAdditionalMarketplace read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferAdditionalMarketplace given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferAdditionalMarketplace + * @throws IOException if the JSON string is invalid with respect to OfferAdditionalMarketplace + */ + public static OfferAdditionalMarketplace fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferAdditionalMarketplace.class); + } + + /** + * Convert an instance of OfferAdditionalMarketplace to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferAdditionalServices.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferAdditionalServices.java new file mode 100644 index 0000000..98a8905 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferAdditionalServices.java @@ -0,0 +1,207 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The definition of the additional services assigned to the offer. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferAdditionalServices { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public OfferAdditionalServices() { + } + + public OfferAdditionalServices id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the additional services definition. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferAdditionalServices offerAdditionalServices = (OfferAdditionalServices) o; + return Objects.equals(this.id, offerAdditionalServices.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferAdditionalServices {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferAdditionalServices + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferAdditionalServices.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferAdditionalServices is not found in the empty JSON string", OfferAdditionalServices.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferAdditionalServices.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferAdditionalServices` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferAdditionalServices.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferAdditionalServices' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferAdditionalServices.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferAdditionalServices value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferAdditionalServices read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferAdditionalServices given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferAdditionalServices + * @throws IOException if the JSON string is invalid with respect to OfferAdditionalServices + */ + public static OfferAdditionalServices fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferAdditionalServices.class); + } + + /** + * Convert an instance of OfferAdditionalServices to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferArchivedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferArchivedEvent.java new file mode 100644 index 0000000..b6687cf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferArchivedEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferEventExternalOffer; +import pl.wtx.allegro.api.client.model.SellerOfferBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferArchivedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferArchivedEvent extends SellerOfferBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "OFFER_ARCHIVED"; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OfferEventExternalOffer offer; + + public OfferArchivedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public OfferArchivedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public OfferArchivedEvent offer(@javax.annotation.Nonnull OfferEventExternalOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OfferEventExternalOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OfferEventExternalOffer offer) { + this.offer = offer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferArchivedEvent offerArchivedEvent = (OfferArchivedEvent) o; + return Objects.equals(this.type, offerArchivedEvent.type) && + Objects.equals(this.offer, offerArchivedEvent.offer) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, offer, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferArchivedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("offer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferArchivedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferArchivedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferArchivedEvent is not found in the empty JSON string", OfferArchivedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferArchivedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferArchivedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferArchivedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferArchivedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferArchivedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferArchivedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferArchivedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferArchivedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferArchivedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferArchivedEvent + * @throws IOException if the JSON string is invalid with respect to OfferArchivedEvent + */ + public static OfferArchivedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferArchivedEvent.class); + } + + /** + * Convert an instance of OfferArchivedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferAttachment.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferAttachment.java new file mode 100644 index 0000000..f21fae9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferAttachment.java @@ -0,0 +1,270 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AttachmentFile; +import pl.wtx.allegro.api.client.model.AttachmentType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferAttachment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferAttachment { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private AttachmentType type; + + public static final String SERIALIZED_NAME_FILE = "file"; + @SerializedName(SERIALIZED_NAME_FILE) + @javax.annotation.Nullable + private AttachmentFile _file; + + public OfferAttachment() { + } + + public OfferAttachment id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public OfferAttachment type(@javax.annotation.Nullable AttachmentType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public AttachmentType getType() { + return type; + } + + public void setType(@javax.annotation.Nullable AttachmentType type) { + this.type = type; + } + + + public OfferAttachment _file(@javax.annotation.Nullable AttachmentFile _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @javax.annotation.Nullable + public AttachmentFile getFile() { + return _file; + } + + public void setFile(@javax.annotation.Nullable AttachmentFile _file) { + this._file = _file; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferAttachment offerAttachment = (OfferAttachment) o; + return Objects.equals(this.id, offerAttachment.id) && + Objects.equals(this.type, offerAttachment.type) && + Objects.equals(this._file, offerAttachment._file); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, _file); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferAttachment {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("file"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferAttachment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferAttachment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferAttachment is not found in the empty JSON string", OfferAttachment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferAttachment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferAttachment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + AttachmentType.validateJsonElement(jsonObj.get("type")); + } + // validate the optional field `file` + if (jsonObj.get("file") != null && !jsonObj.get("file").isJsonNull()) { + AttachmentFile.validateJsonElement(jsonObj.get("file")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferAttachment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferAttachment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferAttachment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferAttachment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferAttachment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferAttachment given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferAttachment + * @throws IOException if the JSON string is invalid with respect to OfferAttachment + */ + public static OfferAttachment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferAttachment.class); + } + + /** + * Convert an instance of OfferAttachment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferAttachmentRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferAttachmentRequest.java new file mode 100644 index 0000000..56ea5f0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferAttachmentRequest.java @@ -0,0 +1,240 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AttachmentFileRequest; +import pl.wtx.allegro.api.client.model.AttachmentType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferAttachmentRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferAttachmentRequest { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private AttachmentType type; + + public static final String SERIALIZED_NAME_FILE = "file"; + @SerializedName(SERIALIZED_NAME_FILE) + @javax.annotation.Nullable + private AttachmentFileRequest _file; + + public OfferAttachmentRequest() { + } + + public OfferAttachmentRequest type(@javax.annotation.Nullable AttachmentType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public AttachmentType getType() { + return type; + } + + public void setType(@javax.annotation.Nullable AttachmentType type) { + this.type = type; + } + + + public OfferAttachmentRequest _file(@javax.annotation.Nullable AttachmentFileRequest _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + */ + @javax.annotation.Nullable + public AttachmentFileRequest getFile() { + return _file; + } + + public void setFile(@javax.annotation.Nullable AttachmentFileRequest _file) { + this._file = _file; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferAttachmentRequest offerAttachmentRequest = (OfferAttachmentRequest) o; + return Objects.equals(this.type, offerAttachmentRequest.type) && + Objects.equals(this._file, offerAttachmentRequest._file); + } + + @Override + public int hashCode() { + return Objects.hash(type, _file); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferAttachmentRequest {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("file"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferAttachmentRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferAttachmentRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferAttachmentRequest is not found in the empty JSON string", OfferAttachmentRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferAttachmentRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferAttachmentRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + AttachmentType.validateJsonElement(jsonObj.get("type")); + } + // validate the optional field `file` + if (jsonObj.get("file") != null && !jsonObj.get("file").isJsonNull()) { + AttachmentFileRequest.validateJsonElement(jsonObj.get("file")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferAttachmentRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferAttachmentRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferAttachmentRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferAttachmentRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferAttachmentRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferAttachmentRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferAttachmentRequest + * @throws IOException if the JSON string is invalid with respect to OfferAttachmentRequest + */ + public static OfferAttachmentRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferAttachmentRequest.class); + } + + /** + * Convert an instance of OfferAttachmentRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingCommand.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingCommand.java new file mode 100644 index 0000000..db1eb66 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingCommand.java @@ -0,0 +1,294 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.OfferAutomaticPricingCommandModification; +import pl.wtx.allegro.api.client.model.OfferCriterium; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferAutomaticPricingCommand + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferAutomaticPricingCommand { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_MODIFICATION = "modification"; + @SerializedName(SERIALIZED_NAME_MODIFICATION) + @javax.annotation.Nonnull + private OfferAutomaticPricingCommandModification modification; + + public static final String SERIALIZED_NAME_OFFER_CRITERIA = "offerCriteria"; + @SerializedName(SERIALIZED_NAME_OFFER_CRITERIA) + @javax.annotation.Nonnull + private List offerCriteria = new ArrayList<>(); + + public OfferAutomaticPricingCommand() { + } + + public OfferAutomaticPricingCommand id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The Command identifier. This field is optional. If the client does not provide their own command id then the service will generate a command id and return it in the response. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public OfferAutomaticPricingCommand modification(@javax.annotation.Nonnull OfferAutomaticPricingCommandModification modification) { + this.modification = modification; + return this; + } + + /** + * Get modification + * @return modification + */ + @javax.annotation.Nonnull + public OfferAutomaticPricingCommandModification getModification() { + return modification; + } + + public void setModification(@javax.annotation.Nonnull OfferAutomaticPricingCommandModification modification) { + this.modification = modification; + } + + + public OfferAutomaticPricingCommand offerCriteria(@javax.annotation.Nonnull List offerCriteria) { + this.offerCriteria = offerCriteria; + return this; + } + + public OfferAutomaticPricingCommand addOfferCriteriaItem(OfferCriterium offerCriteriaItem) { + if (this.offerCriteria == null) { + this.offerCriteria = new ArrayList<>(); + } + this.offerCriteria.add(offerCriteriaItem); + return this; + } + + /** + * List of offer criteria. + * @return offerCriteria + */ + @javax.annotation.Nonnull + public List getOfferCriteria() { + return offerCriteria; + } + + public void setOfferCriteria(@javax.annotation.Nonnull List offerCriteria) { + this.offerCriteria = offerCriteria; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferAutomaticPricingCommand offerAutomaticPricingCommand = (OfferAutomaticPricingCommand) o; + return Objects.equals(this.id, offerAutomaticPricingCommand.id) && + Objects.equals(this.modification, offerAutomaticPricingCommand.modification) && + Objects.equals(this.offerCriteria, offerAutomaticPricingCommand.offerCriteria); + } + + @Override + public int hashCode() { + return Objects.hash(id, modification, offerCriteria); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferAutomaticPricingCommand {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" modification: ").append(toIndentedString(modification)).append("\n"); + sb.append(" offerCriteria: ").append(toIndentedString(offerCriteria)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("modification"); + openapiFields.add("offerCriteria"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("modification"); + openapiRequiredFields.add("offerCriteria"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferAutomaticPricingCommand + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferAutomaticPricingCommand.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferAutomaticPricingCommand is not found in the empty JSON string", OfferAutomaticPricingCommand.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferAutomaticPricingCommand.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferAutomaticPricingCommand` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferAutomaticPricingCommand.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `modification` + OfferAutomaticPricingCommandModification.validateJsonElement(jsonObj.get("modification")); + // ensure the json data is an array + if (!jsonObj.get("offerCriteria").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerCriteria` to be an array in the JSON string but got `%s`", jsonObj.get("offerCriteria").toString())); + } + + JsonArray jsonArrayofferCriteria = jsonObj.getAsJsonArray("offerCriteria"); + // validate the required field `offerCriteria` (array) + for (int i = 0; i < jsonArrayofferCriteria.size(); i++) { + OfferCriterium.validateJsonElement(jsonArrayofferCriteria.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferAutomaticPricingCommand.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferAutomaticPricingCommand' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferAutomaticPricingCommand.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferAutomaticPricingCommand value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferAutomaticPricingCommand read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferAutomaticPricingCommand given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferAutomaticPricingCommand + * @throws IOException if the JSON string is invalid with respect to OfferAutomaticPricingCommand + */ + public static OfferAutomaticPricingCommand fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferAutomaticPricingCommand.class); + } + + /** + * Convert an instance of OfferAutomaticPricingCommand to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingCommandModification.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingCommandModification.java new file mode 100644 index 0000000..9cbb911 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingCommandModification.java @@ -0,0 +1,279 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationRemove; +import pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationRemoveRemoveInner; +import pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationSet; +import pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationSetSetInner; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import pl.wtx.allegro.api.client.invoker.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferAutomaticPricingCommandModification extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(OfferAutomaticPricingCommandModification.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferAutomaticPricingCommandModification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferAutomaticPricingCommandModification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterOfferAutomaticPricingModificationSet = gson.getDelegateAdapter(this, TypeToken.get(OfferAutomaticPricingModificationSet.class)); + final TypeAdapter adapterOfferAutomaticPricingModificationRemove = gson.getDelegateAdapter(this, TypeToken.get(OfferAutomaticPricingModificationRemove.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferAutomaticPricingCommandModification value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `OfferAutomaticPricingModificationSet` + if (value.getActualInstance() instanceof OfferAutomaticPricingModificationSet) { + JsonElement element = adapterOfferAutomaticPricingModificationSet.toJsonTree((OfferAutomaticPricingModificationSet)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `OfferAutomaticPricingModificationRemove` + if (value.getActualInstance() instanceof OfferAutomaticPricingModificationRemove) { + JsonElement element = adapterOfferAutomaticPricingModificationRemove.toJsonTree((OfferAutomaticPricingModificationRemove)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: OfferAutomaticPricingModificationRemove, OfferAutomaticPricingModificationSet"); + } + + @Override + public OfferAutomaticPricingCommandModification read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize OfferAutomaticPricingModificationSet + try { + // validate the JSON object to see if any exception is thrown + OfferAutomaticPricingModificationSet.validateJsonElement(jsonElement); + actualAdapter = adapterOfferAutomaticPricingModificationSet; + match++; + log.log(Level.FINER, "Input data matches schema 'OfferAutomaticPricingModificationSet'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for OfferAutomaticPricingModificationSet failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'OfferAutomaticPricingModificationSet'", e); + } + // deserialize OfferAutomaticPricingModificationRemove + try { + // validate the JSON object to see if any exception is thrown + OfferAutomaticPricingModificationRemove.validateJsonElement(jsonElement); + actualAdapter = adapterOfferAutomaticPricingModificationRemove; + match++; + log.log(Level.FINER, "Input data matches schema 'OfferAutomaticPricingModificationRemove'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for OfferAutomaticPricingModificationRemove failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'OfferAutomaticPricingModificationRemove'", e); + } + + if (match == 1) { + OfferAutomaticPricingCommandModification ret = new OfferAutomaticPricingCommandModification(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for OfferAutomaticPricingCommandModification: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public OfferAutomaticPricingCommandModification() { + super("oneOf", Boolean.FALSE); + } + + public OfferAutomaticPricingCommandModification(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("OfferAutomaticPricingModificationSet", OfferAutomaticPricingModificationSet.class); + schemas.put("OfferAutomaticPricingModificationRemove", OfferAutomaticPricingModificationRemove.class); + } + + @Override + public Map> getSchemas() { + return OfferAutomaticPricingCommandModification.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * OfferAutomaticPricingModificationRemove, OfferAutomaticPricingModificationSet + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof OfferAutomaticPricingModificationSet) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof OfferAutomaticPricingModificationRemove) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be OfferAutomaticPricingModificationRemove, OfferAutomaticPricingModificationSet"); + } + + /** + * Get the actual instance, which can be the following: + * OfferAutomaticPricingModificationRemove, OfferAutomaticPricingModificationSet + * + * @return The actual instance (OfferAutomaticPricingModificationRemove, OfferAutomaticPricingModificationSet) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `OfferAutomaticPricingModificationSet`. If the actual instance is not `OfferAutomaticPricingModificationSet`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `OfferAutomaticPricingModificationSet` + * @throws ClassCastException if the instance is not `OfferAutomaticPricingModificationSet` + */ + public OfferAutomaticPricingModificationSet getOfferAutomaticPricingModificationSet() throws ClassCastException { + return (OfferAutomaticPricingModificationSet)super.getActualInstance(); + } + + /** + * Get the actual instance of `OfferAutomaticPricingModificationRemove`. If the actual instance is not `OfferAutomaticPricingModificationRemove`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `OfferAutomaticPricingModificationRemove` + * @throws ClassCastException if the instance is not `OfferAutomaticPricingModificationRemove` + */ + public OfferAutomaticPricingModificationRemove getOfferAutomaticPricingModificationRemove() throws ClassCastException { + return (OfferAutomaticPricingModificationRemove)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferAutomaticPricingCommandModification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with OfferAutomaticPricingModificationSet + try { + OfferAutomaticPricingModificationSet.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for OfferAutomaticPricingModificationSet failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with OfferAutomaticPricingModificationRemove + try { + OfferAutomaticPricingModificationRemove.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for OfferAutomaticPricingModificationRemove failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for OfferAutomaticPricingCommandModification with oneOf schemas: OfferAutomaticPricingModificationRemove, OfferAutomaticPricingModificationSet. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of OfferAutomaticPricingCommandModification given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferAutomaticPricingCommandModification + * @throws IOException if the JSON string is invalid with respect to OfferAutomaticPricingCommandModification + */ + public static OfferAutomaticPricingCommandModification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferAutomaticPricingCommandModification.class); + } + + /** + * Convert an instance of OfferAutomaticPricingCommandModification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationRemove.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationRemove.java new file mode 100644 index 0000000..39ffa77 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationRemove.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationRemoveRemoveInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferAutomaticPricingModificationRemove + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferAutomaticPricingModificationRemove { + public static final String SERIALIZED_NAME_REMOVE = "remove"; + @SerializedName(SERIALIZED_NAME_REMOVE) + @javax.annotation.Nullable + private List remove = new ArrayList<>(); + + public OfferAutomaticPricingModificationRemove() { + } + + public OfferAutomaticPricingModificationRemove remove(@javax.annotation.Nullable List remove) { + this.remove = remove; + return this; + } + + public OfferAutomaticPricingModificationRemove addRemoveItem(OfferAutomaticPricingModificationRemoveRemoveInner removeItem) { + if (this.remove == null) { + this.remove = new ArrayList<>(); + } + this.remove.add(removeItem); + return this; + } + + /** + * List of marketplaces from which rules will be removed. + * @return remove + */ + @javax.annotation.Nullable + public List getRemove() { + return remove; + } + + public void setRemove(@javax.annotation.Nullable List remove) { + this.remove = remove; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferAutomaticPricingModificationRemove offerAutomaticPricingModificationRemove = (OfferAutomaticPricingModificationRemove) o; + return Objects.equals(this.remove, offerAutomaticPricingModificationRemove.remove); + } + + @Override + public int hashCode() { + return Objects.hash(remove); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferAutomaticPricingModificationRemove {\n"); + sb.append(" remove: ").append(toIndentedString(remove)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("remove"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferAutomaticPricingModificationRemove + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferAutomaticPricingModificationRemove.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferAutomaticPricingModificationRemove is not found in the empty JSON string", OfferAutomaticPricingModificationRemove.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferAutomaticPricingModificationRemove.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferAutomaticPricingModificationRemove` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("remove") != null && !jsonObj.get("remove").isJsonNull()) { + JsonArray jsonArrayremove = jsonObj.getAsJsonArray("remove"); + if (jsonArrayremove != null) { + // ensure the json data is an array + if (!jsonObj.get("remove").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `remove` to be an array in the JSON string but got `%s`", jsonObj.get("remove").toString())); + } + + // validate the optional field `remove` (array) + for (int i = 0; i < jsonArrayremove.size(); i++) { + OfferAutomaticPricingModificationRemoveRemoveInner.validateJsonElement(jsonArrayremove.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferAutomaticPricingModificationRemove.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferAutomaticPricingModificationRemove' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferAutomaticPricingModificationRemove.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferAutomaticPricingModificationRemove value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferAutomaticPricingModificationRemove read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferAutomaticPricingModificationRemove given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferAutomaticPricingModificationRemove + * @throws IOException if the JSON string is invalid with respect to OfferAutomaticPricingModificationRemove + */ + public static OfferAutomaticPricingModificationRemove fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferAutomaticPricingModificationRemove.class); + } + + /** + * Convert an instance of OfferAutomaticPricingModificationRemove to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationRemoveRemoveInner.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationRemoveRemoveInner.java new file mode 100644 index 0000000..e4126a9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationRemoveRemoveInner.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferRulesRulesInnerMarketplace; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferAutomaticPricingModificationRemoveRemoveInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferAutomaticPricingModificationRemoveRemoveInner { + public static final String SERIALIZED_NAME_MARKETPLACE = "marketplace"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE) + @javax.annotation.Nonnull + private OfferRulesRulesInnerMarketplace marketplace; + + public OfferAutomaticPricingModificationRemoveRemoveInner() { + } + + public OfferAutomaticPricingModificationRemoveRemoveInner marketplace(@javax.annotation.Nonnull OfferRulesRulesInnerMarketplace marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get marketplace + * @return marketplace + */ + @javax.annotation.Nonnull + public OfferRulesRulesInnerMarketplace getMarketplace() { + return marketplace; + } + + public void setMarketplace(@javax.annotation.Nonnull OfferRulesRulesInnerMarketplace marketplace) { + this.marketplace = marketplace; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferAutomaticPricingModificationRemoveRemoveInner offerAutomaticPricingModificationRemoveRemoveInner = (OfferAutomaticPricingModificationRemoveRemoveInner) o; + return Objects.equals(this.marketplace, offerAutomaticPricingModificationRemoveRemoveInner.marketplace); + } + + @Override + public int hashCode() { + return Objects.hash(marketplace); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferAutomaticPricingModificationRemoveRemoveInner {\n"); + sb.append(" marketplace: ").append(toIndentedString(marketplace)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplace"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("marketplace"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferAutomaticPricingModificationRemoveRemoveInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferAutomaticPricingModificationRemoveRemoveInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferAutomaticPricingModificationRemoveRemoveInner is not found in the empty JSON string", OfferAutomaticPricingModificationRemoveRemoveInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferAutomaticPricingModificationRemoveRemoveInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferAutomaticPricingModificationRemoveRemoveInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferAutomaticPricingModificationRemoveRemoveInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `marketplace` + OfferRulesRulesInnerMarketplace.validateJsonElement(jsonObj.get("marketplace")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferAutomaticPricingModificationRemoveRemoveInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferAutomaticPricingModificationRemoveRemoveInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferAutomaticPricingModificationRemoveRemoveInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferAutomaticPricingModificationRemoveRemoveInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferAutomaticPricingModificationRemoveRemoveInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferAutomaticPricingModificationRemoveRemoveInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferAutomaticPricingModificationRemoveRemoveInner + * @throws IOException if the JSON string is invalid with respect to OfferAutomaticPricingModificationRemoveRemoveInner + */ + public static OfferAutomaticPricingModificationRemoveRemoveInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferAutomaticPricingModificationRemoveRemoveInner.class); + } + + /** + * Convert an instance of OfferAutomaticPricingModificationRemoveRemoveInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSet.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSet.java new file mode 100644 index 0000000..21e2420 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSet.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationSetSetInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferAutomaticPricingModificationSet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferAutomaticPricingModificationSet { + public static final String SERIALIZED_NAME_SET = "set"; + @SerializedName(SERIALIZED_NAME_SET) + @javax.annotation.Nullable + private List set = new ArrayList<>(); + + public OfferAutomaticPricingModificationSet() { + } + + public OfferAutomaticPricingModificationSet set(@javax.annotation.Nullable List set) { + this.set = set; + return this; + } + + public OfferAutomaticPricingModificationSet addSetItem(OfferAutomaticPricingModificationSetSetInner setItem) { + if (this.set == null) { + this.set = new ArrayList<>(); + } + this.set.add(setItem); + return this; + } + + /** + * List of marketplaces to which the rules will be added. + * @return set + */ + @javax.annotation.Nullable + public List getSet() { + return set; + } + + public void setSet(@javax.annotation.Nullable List set) { + this.set = set; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferAutomaticPricingModificationSet offerAutomaticPricingModificationSet = (OfferAutomaticPricingModificationSet) o; + return Objects.equals(this.set, offerAutomaticPricingModificationSet.set); + } + + @Override + public int hashCode() { + return Objects.hash(set); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferAutomaticPricingModificationSet {\n"); + sb.append(" set: ").append(toIndentedString(set)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("set"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferAutomaticPricingModificationSet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferAutomaticPricingModificationSet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferAutomaticPricingModificationSet is not found in the empty JSON string", OfferAutomaticPricingModificationSet.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferAutomaticPricingModificationSet.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferAutomaticPricingModificationSet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("set") != null && !jsonObj.get("set").isJsonNull()) { + JsonArray jsonArrayset = jsonObj.getAsJsonArray("set"); + if (jsonArrayset != null) { + // ensure the json data is an array + if (!jsonObj.get("set").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `set` to be an array in the JSON string but got `%s`", jsonObj.get("set").toString())); + } + + // validate the optional field `set` (array) + for (int i = 0; i < jsonArrayset.size(); i++) { + OfferAutomaticPricingModificationSetSetInner.validateJsonElement(jsonArrayset.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferAutomaticPricingModificationSet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferAutomaticPricingModificationSet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferAutomaticPricingModificationSet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferAutomaticPricingModificationSet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferAutomaticPricingModificationSet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferAutomaticPricingModificationSet given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferAutomaticPricingModificationSet + * @throws IOException if the JSON string is invalid with respect to OfferAutomaticPricingModificationSet + */ + public static OfferAutomaticPricingModificationSet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferAutomaticPricingModificationSet.class); + } + + /** + * Convert an instance of OfferAutomaticPricingModificationSet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSetSetInner.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSetSetInner.java new file mode 100644 index 0000000..39b5f04 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSetSetInner.java @@ -0,0 +1,277 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AutomaticPricingOfferRuleConfiguration; +import pl.wtx.allegro.api.client.model.OfferAutomaticPricingModificationSetSetInnerRule; +import pl.wtx.allegro.api.client.model.OfferRulesRulesInnerMarketplace; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferAutomaticPricingModificationSetSetInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferAutomaticPricingModificationSetSetInner { + public static final String SERIALIZED_NAME_MARKETPLACE = "marketplace"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE) + @javax.annotation.Nonnull + private OfferRulesRulesInnerMarketplace marketplace; + + public static final String SERIALIZED_NAME_RULE = "rule"; + @SerializedName(SERIALIZED_NAME_RULE) + @javax.annotation.Nonnull + private OfferAutomaticPricingModificationSetSetInnerRule rule; + + public static final String SERIALIZED_NAME_CONFIGURATION = "configuration"; + @SerializedName(SERIALIZED_NAME_CONFIGURATION) + @javax.annotation.Nullable + private AutomaticPricingOfferRuleConfiguration _configuration; + + public OfferAutomaticPricingModificationSetSetInner() { + } + + public OfferAutomaticPricingModificationSetSetInner marketplace(@javax.annotation.Nonnull OfferRulesRulesInnerMarketplace marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get marketplace + * @return marketplace + */ + @javax.annotation.Nonnull + public OfferRulesRulesInnerMarketplace getMarketplace() { + return marketplace; + } + + public void setMarketplace(@javax.annotation.Nonnull OfferRulesRulesInnerMarketplace marketplace) { + this.marketplace = marketplace; + } + + + public OfferAutomaticPricingModificationSetSetInner rule(@javax.annotation.Nonnull OfferAutomaticPricingModificationSetSetInnerRule rule) { + this.rule = rule; + return this; + } + + /** + * Get rule + * @return rule + */ + @javax.annotation.Nonnull + public OfferAutomaticPricingModificationSetSetInnerRule getRule() { + return rule; + } + + public void setRule(@javax.annotation.Nonnull OfferAutomaticPricingModificationSetSetInnerRule rule) { + this.rule = rule; + } + + + public OfferAutomaticPricingModificationSetSetInner _configuration(@javax.annotation.Nullable AutomaticPricingOfferRuleConfiguration _configuration) { + this._configuration = _configuration; + return this; + } + + /** + * Get _configuration + * @return _configuration + */ + @javax.annotation.Nullable + public AutomaticPricingOfferRuleConfiguration getConfiguration() { + return _configuration; + } + + public void setConfiguration(@javax.annotation.Nullable AutomaticPricingOfferRuleConfiguration _configuration) { + this._configuration = _configuration; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferAutomaticPricingModificationSetSetInner offerAutomaticPricingModificationSetSetInner = (OfferAutomaticPricingModificationSetSetInner) o; + return Objects.equals(this.marketplace, offerAutomaticPricingModificationSetSetInner.marketplace) && + Objects.equals(this.rule, offerAutomaticPricingModificationSetSetInner.rule) && + Objects.equals(this._configuration, offerAutomaticPricingModificationSetSetInner._configuration); + } + + @Override + public int hashCode() { + return Objects.hash(marketplace, rule, _configuration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferAutomaticPricingModificationSetSetInner {\n"); + sb.append(" marketplace: ").append(toIndentedString(marketplace)).append("\n"); + sb.append(" rule: ").append(toIndentedString(rule)).append("\n"); + sb.append(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplace"); + openapiFields.add("rule"); + openapiFields.add("configuration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("marketplace"); + openapiRequiredFields.add("rule"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferAutomaticPricingModificationSetSetInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferAutomaticPricingModificationSetSetInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferAutomaticPricingModificationSetSetInner is not found in the empty JSON string", OfferAutomaticPricingModificationSetSetInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferAutomaticPricingModificationSetSetInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferAutomaticPricingModificationSetSetInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferAutomaticPricingModificationSetSetInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `marketplace` + OfferRulesRulesInnerMarketplace.validateJsonElement(jsonObj.get("marketplace")); + // validate the required field `rule` + OfferAutomaticPricingModificationSetSetInnerRule.validateJsonElement(jsonObj.get("rule")); + // validate the optional field `configuration` + if (jsonObj.get("configuration") != null && !jsonObj.get("configuration").isJsonNull()) { + AutomaticPricingOfferRuleConfiguration.validateJsonElement(jsonObj.get("configuration")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferAutomaticPricingModificationSetSetInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferAutomaticPricingModificationSetSetInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferAutomaticPricingModificationSetSetInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferAutomaticPricingModificationSetSetInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferAutomaticPricingModificationSetSetInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferAutomaticPricingModificationSetSetInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferAutomaticPricingModificationSetSetInner + * @throws IOException if the JSON string is invalid with respect to OfferAutomaticPricingModificationSetSetInner + */ + public static OfferAutomaticPricingModificationSetSetInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferAutomaticPricingModificationSetSetInner.class); + } + + /** + * Convert an instance of OfferAutomaticPricingModificationSetSetInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSetSetInnerRule.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSetSetInnerRule.java new file mode 100644 index 0000000..3bcc558 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferAutomaticPricingModificationSetSetInnerRule.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferAutomaticPricingModificationSetSetInnerRule + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferAutomaticPricingModificationSetSetInnerRule { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public OfferAutomaticPricingModificationSetSetInnerRule() { + } + + public OfferAutomaticPricingModificationSetSetInnerRule id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Identifier of a automatic pricing rule. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferAutomaticPricingModificationSetSetInnerRule offerAutomaticPricingModificationSetSetInnerRule = (OfferAutomaticPricingModificationSetSetInnerRule) o; + return Objects.equals(this.id, offerAutomaticPricingModificationSetSetInnerRule.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferAutomaticPricingModificationSetSetInnerRule {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferAutomaticPricingModificationSetSetInnerRule + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferAutomaticPricingModificationSetSetInnerRule.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferAutomaticPricingModificationSetSetInnerRule is not found in the empty JSON string", OfferAutomaticPricingModificationSetSetInnerRule.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferAutomaticPricingModificationSetSetInnerRule.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferAutomaticPricingModificationSetSetInnerRule` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferAutomaticPricingModificationSetSetInnerRule.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferAutomaticPricingModificationSetSetInnerRule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferAutomaticPricingModificationSetSetInnerRule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferAutomaticPricingModificationSetSetInnerRule.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferAutomaticPricingModificationSetSetInnerRule value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferAutomaticPricingModificationSetSetInnerRule read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferAutomaticPricingModificationSetSetInnerRule given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferAutomaticPricingModificationSetSetInnerRule + * @throws IOException if the JSON string is invalid with respect to OfferAutomaticPricingModificationSetSetInnerRule + */ + public static OfferAutomaticPricingModificationSetSetInnerRule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferAutomaticPricingModificationSetSetInnerRule.class); + } + + /** + * Convert an instance of OfferAutomaticPricingModificationSetSetInnerRule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferBadgeCampaign.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferBadgeCampaign.java new file mode 100644 index 0000000..c86d4f2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferBadgeCampaign.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferBadgeCampaign + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferBadgeCampaign { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public OfferBadgeCampaign() { + } + + public OfferBadgeCampaign id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Badge campaign ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public OfferBadgeCampaign name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Badge campaign name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferBadgeCampaign offerBadgeCampaign = (OfferBadgeCampaign) o; + return Objects.equals(this.id, offerBadgeCampaign.id) && + Objects.equals(this.name, offerBadgeCampaign.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferBadgeCampaign {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferBadgeCampaign + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferBadgeCampaign.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferBadgeCampaign is not found in the empty JSON string", OfferBadgeCampaign.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferBadgeCampaign.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferBadgeCampaign` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferBadgeCampaign.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferBadgeCampaign.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferBadgeCampaign' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferBadgeCampaign.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferBadgeCampaign value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferBadgeCampaign read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferBadgeCampaign given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferBadgeCampaign + * @throws IOException if the JSON string is invalid with respect to OfferBadgeCampaign + */ + public static OfferBadgeCampaign fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferBadgeCampaign.class); + } + + /** + * Convert an instance of OfferBadgeCampaign to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferBidCanceledEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferBidCanceledEvent.java new file mode 100644 index 0000000..fcfee35 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferBidCanceledEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferEventBaseOffer; +import pl.wtx.allegro.api.client.model.SellerOfferBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferBidCanceledEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferBidCanceledEvent extends SellerOfferBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "OFFER_BID_CANCELED"; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OfferEventBaseOffer offer; + + public OfferBidCanceledEvent() { + this.type = this.getClass().getSimpleName(); + } + + public OfferBidCanceledEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public OfferBidCanceledEvent offer(@javax.annotation.Nonnull OfferEventBaseOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OfferEventBaseOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OfferEventBaseOffer offer) { + this.offer = offer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferBidCanceledEvent offerBidCanceledEvent = (OfferBidCanceledEvent) o; + return Objects.equals(this.type, offerBidCanceledEvent.type) && + Objects.equals(this.offer, offerBidCanceledEvent.offer) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, offer, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferBidCanceledEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("offer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferBidCanceledEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferBidCanceledEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferBidCanceledEvent is not found in the empty JSON string", OfferBidCanceledEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferBidCanceledEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferBidCanceledEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferBidCanceledEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferBidCanceledEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferBidCanceledEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferBidCanceledEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferBidCanceledEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferBidCanceledEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferBidCanceledEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferBidCanceledEvent + * @throws IOException if the JSON string is invalid with respect to OfferBidCanceledEvent + */ + public static OfferBidCanceledEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferBidCanceledEvent.class); + } + + /** + * Convert an instance of OfferBidCanceledEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferBidPlacedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferBidPlacedEvent.java new file mode 100644 index 0000000..00ab3d3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferBidPlacedEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferEventBaseOffer; +import pl.wtx.allegro.api.client.model.SellerOfferBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferBidPlacedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferBidPlacedEvent extends SellerOfferBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "OFFER_BID_PLACED"; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OfferEventBaseOffer offer; + + public OfferBidPlacedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public OfferBidPlacedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public OfferBidPlacedEvent offer(@javax.annotation.Nonnull OfferEventBaseOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OfferEventBaseOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OfferEventBaseOffer offer) { + this.offer = offer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferBidPlacedEvent offerBidPlacedEvent = (OfferBidPlacedEvent) o; + return Objects.equals(this.type, offerBidPlacedEvent.type) && + Objects.equals(this.offer, offerBidPlacedEvent.offer) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, offer, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferBidPlacedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("offer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferBidPlacedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferBidPlacedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferBidPlacedEvent is not found in the empty JSON string", OfferBidPlacedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferBidPlacedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferBidPlacedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferBidPlacedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferBidPlacedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferBidPlacedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferBidPlacedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferBidPlacedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferBidPlacedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferBidPlacedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferBidPlacedEvent + * @throws IOException if the JSON string is invalid with respect to OfferBidPlacedEvent + */ + public static OfferBidPlacedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferBidPlacedEvent.class); + } + + /** + * Convert an instance of OfferBidPlacedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferBundleDTO.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferBundleDTO.java new file mode 100644 index 0000000..7017f5a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferBundleDTO.java @@ -0,0 +1,455 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BundleDiscountDTO; +import pl.wtx.allegro.api.client.model.BundledOfferDTO; +import pl.wtx.allegro.api.client.model.OfferBundleDTOPublication; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferBundleDTO + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferBundleDTO { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_OFFERS = "offers"; + @SerializedName(SERIALIZED_NAME_OFFERS) + @javax.annotation.Nonnull + private List offers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nonnull + private OfferBundleDTOPublication publication; + + public static final String SERIALIZED_NAME_DISCOUNTS = "discounts"; + @SerializedName(SERIALIZED_NAME_DISCOUNTS) + @javax.annotation.Nullable + private List discounts; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + /** + * Who created this bundle. It is set to: <ul> <li> `USER` for all bundles created by seller on Allegro web page or via public API;</li> <li> `ALLEGRO` when bundle was created <a href=\"https://allegro.pl/dla-sprzedajacych/automatycznie-laczymy-wybrane-oferty-w-zestaw-K6VYllRgbs0\" target=\"_blank\">automatically</a> by Allegro. </li> </ul> + */ + @JsonAdapter(CreatedByEnum.Adapter.class) + public enum CreatedByEnum { + USER("USER"), + + ALLEGRO("ALLEGRO"); + + private String value; + + CreatedByEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CreatedByEnum fromValue(String value) { + for (CreatedByEnum b : CreatedByEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CreatedByEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CreatedByEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CreatedByEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CreatedByEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; + @SerializedName(SERIALIZED_NAME_CREATED_BY) + @javax.annotation.Nonnull + private CreatedByEnum createdBy; + + public OfferBundleDTO() { + } + + public OfferBundleDTO id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Bundle ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public OfferBundleDTO offers(@javax.annotation.Nonnull List offers) { + this.offers = offers; + return this; + } + + public OfferBundleDTO addOffersItem(BundledOfferDTO offersItem) { + if (this.offers == null) { + this.offers = new ArrayList<>(); + } + this.offers.add(offersItem); + return this; + } + + /** + * Offers included in bundle. + * @return offers + */ + @javax.annotation.Nonnull + public List getOffers() { + return offers; + } + + public void setOffers(@javax.annotation.Nonnull List offers) { + this.offers = offers; + } + + + public OfferBundleDTO publication(@javax.annotation.Nonnull OfferBundleDTOPublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nonnull + public OfferBundleDTOPublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nonnull OfferBundleDTOPublication publication) { + this.publication = publication; + } + + + public OfferBundleDTO discounts(@javax.annotation.Nullable List discounts) { + this.discounts = discounts; + return this; + } + + public OfferBundleDTO addDiscountsItem(BundleDiscountDTO discountsItem) { + if (this.discounts == null) { + this.discounts = new ArrayList<>(); + } + this.discounts.add(discountsItem); + return this; + } + + /** + * Discounts on marketplaces. + * @return discounts + */ + @javax.annotation.Nullable + public List getDiscounts() { + return discounts; + } + + public void setDiscounts(@javax.annotation.Nullable List discounts) { + this.discounts = discounts; + } + + + public OfferBundleDTO createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this bundle was created in <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO_8601</a> format. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public OfferBundleDTO createdBy(@javax.annotation.Nonnull CreatedByEnum createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Who created this bundle. It is set to: <ul> <li> `USER` for all bundles created by seller on Allegro web page or via public API;</li> <li> `ALLEGRO` when bundle was created <a href=\"https://allegro.pl/dla-sprzedajacych/automatycznie-laczymy-wybrane-oferty-w-zestaw-K6VYllRgbs0\" target=\"_blank\">automatically</a> by Allegro. </li> </ul> + * @return createdBy + */ + @javax.annotation.Nonnull + public CreatedByEnum getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(@javax.annotation.Nonnull CreatedByEnum createdBy) { + this.createdBy = createdBy; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferBundleDTO offerBundleDTO = (OfferBundleDTO) o; + return Objects.equals(this.id, offerBundleDTO.id) && + Objects.equals(this.offers, offerBundleDTO.offers) && + Objects.equals(this.publication, offerBundleDTO.publication) && + Objects.equals(this.discounts, offerBundleDTO.discounts) && + Objects.equals(this.createdAt, offerBundleDTO.createdAt) && + Objects.equals(this.createdBy, offerBundleDTO.createdBy); + } + + @Override + public int hashCode() { + return Objects.hash(id, offers, publication, discounts, createdAt, createdBy); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferBundleDTO {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" offers: ").append(toIndentedString(offers)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" discounts: ").append(toIndentedString(discounts)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("offers"); + openapiFields.add("publication"); + openapiFields.add("discounts"); + openapiFields.add("createdAt"); + openapiFields.add("createdBy"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("offers"); + openapiRequiredFields.add("publication"); + openapiRequiredFields.add("discounts"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("createdBy"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferBundleDTO + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferBundleDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferBundleDTO is not found in the empty JSON string", OfferBundleDTO.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferBundleDTO.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferBundleDTO` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferBundleDTO.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("offers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offers` to be an array in the JSON string but got `%s`", jsonObj.get("offers").toString())); + } + + JsonArray jsonArrayoffers = jsonObj.getAsJsonArray("offers"); + // validate the required field `offers` (array) + for (int i = 0; i < jsonArrayoffers.size(); i++) { + BundledOfferDTO.validateJsonElement(jsonArrayoffers.get(i)); + }; + // validate the required field `publication` + OfferBundleDTOPublication.validateJsonElement(jsonObj.get("publication")); + // ensure the json data is an array + if (!jsonObj.get("discounts").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `discounts` to be an array in the JSON string but got `%s`", jsonObj.get("discounts").toString())); + } + + JsonArray jsonArraydiscounts = jsonObj.getAsJsonArray("discounts"); + // validate the required field `discounts` (array) + for (int i = 0; i < jsonArraydiscounts.size(); i++) { + BundleDiscountDTO.validateJsonElement(jsonArraydiscounts.get(i)); + }; + if (!jsonObj.get("createdBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); + } + // validate the required field `createdBy` + CreatedByEnum.validateJsonElement(jsonObj.get("createdBy")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferBundleDTO.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferBundleDTO' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferBundleDTO.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferBundleDTO value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferBundleDTO read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferBundleDTO given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferBundleDTO + * @throws IOException if the JSON string is invalid with respect to OfferBundleDTO + */ + public static OfferBundleDTO fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferBundleDTO.class); + } + + /** + * Convert an instance of OfferBundleDTO to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferBundleDTOPublication.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferBundleDTOPublication.java new file mode 100644 index 0000000..a06f44c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferBundleDTOPublication.java @@ -0,0 +1,299 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BundleMarketplaceDTO; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Bundle status on each marketplace. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferBundleDTOPublication { + public static final String SERIALIZED_NAME_MARKETPLACE = "marketplace"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE) + @javax.annotation.Nonnull + private BundleMarketplaceDTO marketplace; + + /** + * Bundle's status. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVE("ACTIVE"), + + SUSPENDED("SUSPENDED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public OfferBundleDTOPublication() { + } + + public OfferBundleDTOPublication marketplace(@javax.annotation.Nonnull BundleMarketplaceDTO marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get marketplace + * @return marketplace + */ + @javax.annotation.Nonnull + public BundleMarketplaceDTO getMarketplace() { + return marketplace; + } + + public void setMarketplace(@javax.annotation.Nonnull BundleMarketplaceDTO marketplace) { + this.marketplace = marketplace; + } + + + public OfferBundleDTOPublication status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Bundle's status. + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferBundleDTOPublication offerBundleDTOPublication = (OfferBundleDTOPublication) o; + return Objects.equals(this.marketplace, offerBundleDTOPublication.marketplace) && + Objects.equals(this.status, offerBundleDTOPublication.status); + } + + @Override + public int hashCode() { + return Objects.hash(marketplace, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferBundleDTOPublication {\n"); + sb.append(" marketplace: ").append(toIndentedString(marketplace)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplace"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("marketplace"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferBundleDTOPublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferBundleDTOPublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferBundleDTOPublication is not found in the empty JSON string", OfferBundleDTOPublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferBundleDTOPublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferBundleDTOPublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferBundleDTOPublication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `marketplace` + BundleMarketplaceDTO.validateJsonElement(jsonObj.get("marketplace")); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferBundleDTOPublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferBundleDTOPublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferBundleDTOPublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferBundleDTOPublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferBundleDTOPublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferBundleDTOPublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferBundleDTOPublication + * @throws IOException if the JSON string is invalid with respect to OfferBundleDTOPublication + */ + public static OfferBundleDTOPublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferBundleDTOPublication.class); + } + + /** + * Convert an instance of OfferBundleDTOPublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferBundlesDTO.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferBundlesDTO.java new file mode 100644 index 0000000..e284c24 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferBundlesDTO.java @@ -0,0 +1,264 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferBundleDTO; +import pl.wtx.allegro.api.client.model.OfferBundlesDTONextPage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferBundlesDTO + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferBundlesDTO { + public static final String SERIALIZED_NAME_BUNDLES = "bundles"; + @SerializedName(SERIALIZED_NAME_BUNDLES) + @javax.annotation.Nonnull + private List bundles = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NEXT_PAGE = "nextPage"; + @SerializedName(SERIALIZED_NAME_NEXT_PAGE) + @javax.annotation.Nullable + private OfferBundlesDTONextPage nextPage; + + public OfferBundlesDTO() { + } + + public OfferBundlesDTO bundles(@javax.annotation.Nonnull List bundles) { + this.bundles = bundles; + return this; + } + + public OfferBundlesDTO addBundlesItem(OfferBundleDTO bundlesItem) { + if (this.bundles == null) { + this.bundles = new ArrayList<>(); + } + this.bundles.add(bundlesItem); + return this; + } + + /** + * Seller's bundles. + * @return bundles + */ + @javax.annotation.Nonnull + public List getBundles() { + return bundles; + } + + public void setBundles(@javax.annotation.Nonnull List bundles) { + this.bundles = bundles; + } + + + public OfferBundlesDTO nextPage(@javax.annotation.Nullable OfferBundlesDTONextPage nextPage) { + this.nextPage = nextPage; + return this; + } + + /** + * Get nextPage + * @return nextPage + */ + @javax.annotation.Nullable + public OfferBundlesDTONextPage getNextPage() { + return nextPage; + } + + public void setNextPage(@javax.annotation.Nullable OfferBundlesDTONextPage nextPage) { + this.nextPage = nextPage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferBundlesDTO offerBundlesDTO = (OfferBundlesDTO) o; + return Objects.equals(this.bundles, offerBundlesDTO.bundles) && + Objects.equals(this.nextPage, offerBundlesDTO.nextPage); + } + + @Override + public int hashCode() { + return Objects.hash(bundles, nextPage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferBundlesDTO {\n"); + sb.append(" bundles: ").append(toIndentedString(bundles)).append("\n"); + sb.append(" nextPage: ").append(toIndentedString(nextPage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("bundles"); + openapiFields.add("nextPage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("bundles"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferBundlesDTO + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferBundlesDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferBundlesDTO is not found in the empty JSON string", OfferBundlesDTO.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferBundlesDTO.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferBundlesDTO` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferBundlesDTO.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("bundles").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `bundles` to be an array in the JSON string but got `%s`", jsonObj.get("bundles").toString())); + } + + JsonArray jsonArraybundles = jsonObj.getAsJsonArray("bundles"); + // validate the required field `bundles` (array) + for (int i = 0; i < jsonArraybundles.size(); i++) { + OfferBundleDTO.validateJsonElement(jsonArraybundles.get(i)); + }; + // validate the optional field `nextPage` + if (jsonObj.get("nextPage") != null && !jsonObj.get("nextPage").isJsonNull()) { + OfferBundlesDTONextPage.validateJsonElement(jsonObj.get("nextPage")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferBundlesDTO.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferBundlesDTO' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferBundlesDTO.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferBundlesDTO value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferBundlesDTO read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferBundlesDTO given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferBundlesDTO + * @throws IOException if the JSON string is invalid with respect to OfferBundlesDTO + */ + public static OfferBundlesDTO fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferBundlesDTO.class); + } + + /** + * Convert an instance of OfferBundlesDTO to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferBundlesDTONextPage.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferBundlesDTONextPage.java new file mode 100644 index 0000000..e18ddda --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferBundlesDTONextPage.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Next page information. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferBundlesDTONextPage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public OfferBundlesDTONextPage() { + } + + public OfferBundlesDTONextPage id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Next page ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferBundlesDTONextPage offerBundlesDTONextPage = (OfferBundlesDTONextPage) o; + return Objects.equals(this.id, offerBundlesDTONextPage.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferBundlesDTONextPage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferBundlesDTONextPage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferBundlesDTONextPage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferBundlesDTONextPage is not found in the empty JSON string", OfferBundlesDTONextPage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferBundlesDTONextPage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferBundlesDTONextPage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferBundlesDTONextPage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferBundlesDTONextPage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferBundlesDTONextPage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferBundlesDTONextPage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferBundlesDTONextPage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferBundlesDTONextPage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferBundlesDTONextPage given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferBundlesDTONextPage + * @throws IOException if the JSON string is invalid with respect to OfferBundlesDTONextPage + */ + public static OfferBundlesDTONextPage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferBundlesDTONextPage.class); + } + + /** + * Convert an instance of OfferBundlesDTONextPage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferCategory.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferCategory.java new file mode 100644 index 0000000..3355040 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferCategory.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The category to which the offer is listed for sale. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferCategory { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public OfferCategory() { + } + + public OfferCategory id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Category identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferCategory offerCategory = (OfferCategory) o; + return Objects.equals(this.id, offerCategory.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferCategory {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferCategory + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferCategory.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferCategory is not found in the empty JSON string", OfferCategory.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferCategory.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferCategory` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferCategory.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferCategory' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferCategory.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferCategory value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferCategory read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferCategory given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferCategory + * @throws IOException if the JSON string is invalid with respect to OfferCategory + */ + public static OfferCategory fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferCategory.class); + } + + /** + * Convert an instance of OfferCategory to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferCategoryRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferCategoryRequest.java new file mode 100644 index 0000000..bfe7720 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferCategoryRequest.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Category in which the offer is listed for sale. You can indicate a category from the product's 'similar categories' to set the offer's category. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferCategoryRequest { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public OfferCategoryRequest() { + } + + public OfferCategoryRequest id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Category identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferCategoryRequest offerCategoryRequest = (OfferCategoryRequest) o; + return Objects.equals(this.id, offerCategoryRequest.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferCategoryRequest {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferCategoryRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferCategoryRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferCategoryRequest is not found in the empty JSON string", OfferCategoryRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferCategoryRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferCategoryRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferCategoryRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferCategoryRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferCategoryRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferCategoryRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferCategoryRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferCategoryRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferCategoryRequest + * @throws IOException if the JSON string is invalid with respect to OfferCategoryRequest + */ + public static OfferCategoryRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferCategoryRequest.class); + } + + /** + * Convert an instance of OfferCategoryRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferChangeCommand.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferChangeCommand.java new file mode 100644 index 0000000..487ae2e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferChangeCommand.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Modification; +import pl.wtx.allegro.api.client.model.OfferCriterium; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Modification command payload + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferChangeCommand { + public static final String SERIALIZED_NAME_MODIFICATION = "modification"; + @SerializedName(SERIALIZED_NAME_MODIFICATION) + @javax.annotation.Nullable + private Modification modification; + + public static final String SERIALIZED_NAME_OFFER_CRITERIA = "offerCriteria"; + @SerializedName(SERIALIZED_NAME_OFFER_CRITERIA) + @javax.annotation.Nullable + private List offerCriteria = new ArrayList<>(); + + public OfferChangeCommand() { + } + + public OfferChangeCommand modification(@javax.annotation.Nullable Modification modification) { + this.modification = modification; + return this; + } + + /** + * Get modification + * @return modification + */ + @javax.annotation.Nullable + public Modification getModification() { + return modification; + } + + public void setModification(@javax.annotation.Nullable Modification modification) { + this.modification = modification; + } + + + public OfferChangeCommand offerCriteria(@javax.annotation.Nullable List offerCriteria) { + this.offerCriteria = offerCriteria; + return this; + } + + public OfferChangeCommand addOfferCriteriaItem(OfferCriterium offerCriteriaItem) { + if (this.offerCriteria == null) { + this.offerCriteria = new ArrayList<>(); + } + this.offerCriteria.add(offerCriteriaItem); + return this; + } + + /** + * List of offer criteria + * @return offerCriteria + */ + @javax.annotation.Nullable + public List getOfferCriteria() { + return offerCriteria; + } + + public void setOfferCriteria(@javax.annotation.Nullable List offerCriteria) { + this.offerCriteria = offerCriteria; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferChangeCommand offerChangeCommand = (OfferChangeCommand) o; + return Objects.equals(this.modification, offerChangeCommand.modification) && + Objects.equals(this.offerCriteria, offerChangeCommand.offerCriteria); + } + + @Override + public int hashCode() { + return Objects.hash(modification, offerCriteria); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferChangeCommand {\n"); + sb.append(" modification: ").append(toIndentedString(modification)).append("\n"); + sb.append(" offerCriteria: ").append(toIndentedString(offerCriteria)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("modification"); + openapiFields.add("offerCriteria"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferChangeCommand + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferChangeCommand.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferChangeCommand is not found in the empty JSON string", OfferChangeCommand.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferChangeCommand.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferChangeCommand` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `modification` + if (jsonObj.get("modification") != null && !jsonObj.get("modification").isJsonNull()) { + Modification.validateJsonElement(jsonObj.get("modification")); + } + if (jsonObj.get("offerCriteria") != null && !jsonObj.get("offerCriteria").isJsonNull()) { + JsonArray jsonArrayofferCriteria = jsonObj.getAsJsonArray("offerCriteria"); + if (jsonArrayofferCriteria != null) { + // ensure the json data is an array + if (!jsonObj.get("offerCriteria").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerCriteria` to be an array in the JSON string but got `%s`", jsonObj.get("offerCriteria").toString())); + } + + // validate the optional field `offerCriteria` (array) + for (int i = 0; i < jsonArrayofferCriteria.size(); i++) { + OfferCriterium.validateJsonElement(jsonArrayofferCriteria.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferChangeCommand.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferChangeCommand' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferChangeCommand.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferChangeCommand value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferChangeCommand read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferChangeCommand given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferChangeCommand + * @throws IOException if the JSON string is invalid with respect to OfferChangeCommand + */ + public static OfferChangeCommand fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferChangeCommand.class); + } + + /** + * Convert an instance of OfferChangeCommand to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferChangedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferChangedEvent.java new file mode 100644 index 0000000..44cecad --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferChangedEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferEventExternalOffer; +import pl.wtx.allegro.api.client.model.SellerOfferBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferChangedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferChangedEvent extends SellerOfferBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "OFFER_CHANGED"; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OfferEventExternalOffer offer; + + public OfferChangedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public OfferChangedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public OfferChangedEvent offer(@javax.annotation.Nonnull OfferEventExternalOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OfferEventExternalOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OfferEventExternalOffer offer) { + this.offer = offer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferChangedEvent offerChangedEvent = (OfferChangedEvent) o; + return Objects.equals(this.type, offerChangedEvent.type) && + Objects.equals(this.offer, offerChangedEvent.offer) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, offer, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferChangedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("offer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferChangedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferChangedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferChangedEvent is not found in the empty JSON string", OfferChangedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferChangedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferChangedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferChangedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferChangedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferChangedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferChangedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferChangedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferChangedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferChangedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferChangedEvent + * @throws IOException if the JSON string is invalid with respect to OfferChangedEvent + */ + public static OfferChangedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferChangedEvent.class); + } + + /** + * Convert an instance of OfferChangedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferCriterium.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferCriterium.java new file mode 100644 index 0000000..cc99a44 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferCriterium.java @@ -0,0 +1,312 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contains offers criteria + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferCriterium { + public static final String SERIALIZED_NAME_OFFERS = "offers"; + @SerializedName(SERIALIZED_NAME_OFFERS) + @javax.annotation.Nullable + private List offers = new ArrayList<>(); + + /** + * Criteria type: CONTAINS_OFFERS + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CONTAINS_OFFERS("CONTAINS_OFFERS"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public OfferCriterium() { + } + + public OfferCriterium offers(@javax.annotation.Nullable List offers) { + this.offers = offers; + return this; + } + + public OfferCriterium addOffersItem(OfferId offersItem) { + if (this.offers == null) { + this.offers = new ArrayList<>(); + } + this.offers.add(offersItem); + return this; + } + + /** + * Set of offers + * @return offers + */ + @javax.annotation.Nullable + public List getOffers() { + return offers; + } + + public void setOffers(@javax.annotation.Nullable List offers) { + this.offers = offers; + } + + + public OfferCriterium type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Criteria type: CONTAINS_OFFERS + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferCriterium offerCriterium = (OfferCriterium) o; + return Objects.equals(this.offers, offerCriterium.offers) && + Objects.equals(this.type, offerCriterium.type); + } + + @Override + public int hashCode() { + return Objects.hash(offers, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferCriterium {\n"); + sb.append(" offers: ").append(toIndentedString(offers)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offers"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferCriterium + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferCriterium.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferCriterium is not found in the empty JSON string", OfferCriterium.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferCriterium.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferCriterium` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("offers") != null && !jsonObj.get("offers").isJsonNull()) { + JsonArray jsonArrayoffers = jsonObj.getAsJsonArray("offers"); + if (jsonArrayoffers != null) { + // ensure the json data is an array + if (!jsonObj.get("offers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offers` to be an array in the JSON string but got `%s`", jsonObj.get("offers").toString())); + } + + // validate the optional field `offers` (array) + for (int i = 0; i < jsonArrayoffers.size(); i++) { + OfferId.validateJsonElement(jsonArrayoffers.get(i)); + }; + } + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferCriterium.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferCriterium' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferCriterium.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferCriterium value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferCriterium read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferCriterium given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferCriterium + * @throws IOException if the JSON string is invalid with respect to OfferCriterium + */ + public static OfferCriterium fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferCriterium.class); + } + + /** + * Convert an instance of OfferCriterium to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferDelivery.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferDelivery.java new file mode 100644 index 0000000..8a40a4d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferDelivery.java @@ -0,0 +1,235 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferLowestPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about shipping options for the offer. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferDelivery { + public static final String SERIALIZED_NAME_AVAILABLE_FOR_FREE = "availableForFree"; + @SerializedName(SERIALIZED_NAME_AVAILABLE_FOR_FREE) + @javax.annotation.Nullable + private Boolean availableForFree; + + public static final String SERIALIZED_NAME_LOWEST_PRICE = "lowestPrice"; + @SerializedName(SERIALIZED_NAME_LOWEST_PRICE) + @javax.annotation.Nullable + private OfferLowestPrice lowestPrice; + + public OfferDelivery() { + } + + public OfferDelivery availableForFree(@javax.annotation.Nullable Boolean availableForFree) { + this.availableForFree = availableForFree; + return this; + } + + /** + * Indicates whether the offer has free shipping option. + * @return availableForFree + */ + @javax.annotation.Nullable + public Boolean getAvailableForFree() { + return availableForFree; + } + + public void setAvailableForFree(@javax.annotation.Nullable Boolean availableForFree) { + this.availableForFree = availableForFree; + } + + + public OfferDelivery lowestPrice(@javax.annotation.Nullable OfferLowestPrice lowestPrice) { + this.lowestPrice = lowestPrice; + return this; + } + + /** + * Get lowestPrice + * @return lowestPrice + */ + @javax.annotation.Nullable + public OfferLowestPrice getLowestPrice() { + return lowestPrice; + } + + public void setLowestPrice(@javax.annotation.Nullable OfferLowestPrice lowestPrice) { + this.lowestPrice = lowestPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferDelivery offerDelivery = (OfferDelivery) o; + return Objects.equals(this.availableForFree, offerDelivery.availableForFree) && + Objects.equals(this.lowestPrice, offerDelivery.lowestPrice); + } + + @Override + public int hashCode() { + return Objects.hash(availableForFree, lowestPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferDelivery {\n"); + sb.append(" availableForFree: ").append(toIndentedString(availableForFree)).append("\n"); + sb.append(" lowestPrice: ").append(toIndentedString(lowestPrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("availableForFree"); + openapiFields.add("lowestPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferDelivery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferDelivery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferDelivery is not found in the empty JSON string", OfferDelivery.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferDelivery.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferDelivery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `lowestPrice` + if (jsonObj.get("lowestPrice") != null && !jsonObj.get("lowestPrice").isJsonNull()) { + OfferLowestPrice.validateJsonElement(jsonObj.get("lowestPrice")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferDelivery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferDelivery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferDelivery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferDelivery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferDelivery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferDelivery given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferDelivery + * @throws IOException if the JSON string is invalid with respect to OfferDelivery + */ + public static OfferDelivery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferDelivery.class); + } + + /** + * Convert an instance of OfferDelivery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferDescriptionTranslation.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferDescriptionTranslation.java new file mode 100644 index 0000000..a7b8001 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferDescriptionTranslation.java @@ -0,0 +1,240 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferTranslationType; +import pl.wtx.allegro.api.client.model.StandardizedDescription; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer description translation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferDescriptionTranslation { + public static final String SERIALIZED_NAME_TRANSLATION = "translation"; + @SerializedName(SERIALIZED_NAME_TRANSLATION) + @javax.annotation.Nullable + private StandardizedDescription translation; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private OfferTranslationType type; + + public OfferDescriptionTranslation() { + } + + public OfferDescriptionTranslation translation(@javax.annotation.Nullable StandardizedDescription translation) { + this.translation = translation; + return this; + } + + /** + * Get translation + * @return translation + */ + @javax.annotation.Nullable + public StandardizedDescription getTranslation() { + return translation; + } + + public void setTranslation(@javax.annotation.Nullable StandardizedDescription translation) { + this.translation = translation; + } + + + public OfferDescriptionTranslation type(@javax.annotation.Nullable OfferTranslationType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public OfferTranslationType getType() { + return type; + } + + public void setType(@javax.annotation.Nullable OfferTranslationType type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferDescriptionTranslation offerDescriptionTranslation = (OfferDescriptionTranslation) o; + return Objects.equals(this.translation, offerDescriptionTranslation.translation) && + Objects.equals(this.type, offerDescriptionTranslation.type); + } + + @Override + public int hashCode() { + return Objects.hash(translation, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferDescriptionTranslation {\n"); + sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("translation"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferDescriptionTranslation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferDescriptionTranslation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferDescriptionTranslation is not found in the empty JSON string", OfferDescriptionTranslation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferDescriptionTranslation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferDescriptionTranslation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `translation` + if (jsonObj.get("translation") != null && !jsonObj.get("translation").isJsonNull()) { + StandardizedDescription.validateJsonElement(jsonObj.get("translation")); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + OfferTranslationType.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferDescriptionTranslation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferDescriptionTranslation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferDescriptionTranslation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferDescriptionTranslation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferDescriptionTranslation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferDescriptionTranslation given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferDescriptionTranslation + * @throws IOException if the JSON string is invalid with respect to OfferDescriptionTranslation + */ + public static OfferDescriptionTranslation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferDescriptionTranslation.class); + } + + /** + * Convert an instance of OfferDescriptionTranslation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferEndedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferEndedEvent.java new file mode 100644 index 0000000..2f29409 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferEndedEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferEventEndedOffer; +import pl.wtx.allegro.api.client.model.SellerOfferBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferEndedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferEndedEvent extends SellerOfferBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "OFFER_ENDED"; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OfferEventEndedOffer offer; + + public OfferEndedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public OfferEndedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public OfferEndedEvent offer(@javax.annotation.Nonnull OfferEventEndedOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OfferEventEndedOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OfferEventEndedOffer offer) { + this.offer = offer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferEndedEvent offerEndedEvent = (OfferEndedEvent) o; + return Objects.equals(this.type, offerEndedEvent.type) && + Objects.equals(this.offer, offerEndedEvent.offer) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, offer, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferEndedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("offer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferEndedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferEndedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferEndedEvent is not found in the empty JSON string", OfferEndedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferEndedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferEndedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferEndedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferEndedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferEndedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferEndedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferEndedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferEndedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferEndedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferEndedEvent + * @throws IOException if the JSON string is invalid with respect to OfferEndedEvent + */ + public static OfferEndedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferEndedEvent.class); + } + + /** + * Convert an instance of OfferEndedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferEventBaseOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventBaseOffer.java new file mode 100644 index 0000000..243dc1c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventBaseOffer.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The data of the offer, for which the event occurred. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferEventBaseOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public OfferEventBaseOffer() { + } + + public OfferEventBaseOffer id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The offer ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferEventBaseOffer offerEventBaseOffer = (OfferEventBaseOffer) o; + return Objects.equals(this.id, offerEventBaseOffer.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferEventBaseOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferEventBaseOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferEventBaseOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferEventBaseOffer is not found in the empty JSON string", OfferEventBaseOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferEventBaseOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferEventBaseOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferEventBaseOffer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferEventBaseOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferEventBaseOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferEventBaseOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferEventBaseOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferEventBaseOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferEventBaseOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferEventBaseOffer + * @throws IOException if the JSON string is invalid with respect to OfferEventBaseOffer + */ + public static OfferEventBaseOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferEventBaseOffer.class); + } + + /** + * Convert an instance of OfferEventBaseOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferEventEndedOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventEndedOffer.java new file mode 100644 index 0000000..791f978 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventEndedOffer.java @@ -0,0 +1,277 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ExternalId; +import pl.wtx.allegro.api.client.model.OfferEventEndedOfferAllOfPublication; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferEventEndedOffer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferEventEndedOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nullable + private ExternalId external; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nonnull + private OfferEventEndedOfferAllOfPublication publication; + + public OfferEventEndedOffer() { + } + + public OfferEventEndedOffer id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The offer ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public OfferEventEndedOffer external(@javax.annotation.Nullable ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nullable + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nullable ExternalId external) { + this.external = external; + } + + + public OfferEventEndedOffer publication(@javax.annotation.Nonnull OfferEventEndedOfferAllOfPublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nonnull + public OfferEventEndedOfferAllOfPublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nonnull OfferEventEndedOfferAllOfPublication publication) { + this.publication = publication; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferEventEndedOffer offerEventEndedOffer = (OfferEventEndedOffer) o; + return Objects.equals(this.id, offerEventEndedOffer.id) && + Objects.equals(this.external, offerEventEndedOffer.external) && + Objects.equals(this.publication, offerEventEndedOffer.publication); + } + + @Override + public int hashCode() { + return Objects.hash(id, external, publication); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferEventEndedOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("external"); + openapiFields.add("publication"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("publication"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferEventEndedOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferEventEndedOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferEventEndedOffer is not found in the empty JSON string", OfferEventEndedOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferEventEndedOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferEventEndedOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferEventEndedOffer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `external` + if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { + ExternalId.validateJsonElement(jsonObj.get("external")); + } + // validate the required field `publication` + OfferEventEndedOfferAllOfPublication.validateJsonElement(jsonObj.get("publication")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferEventEndedOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferEventEndedOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferEventEndedOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferEventEndedOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferEventEndedOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferEventEndedOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferEventEndedOffer + * @throws IOException if the JSON string is invalid with respect to OfferEventEndedOffer + */ + public static OfferEventEndedOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferEventEndedOffer.class); + } + + /** + * Convert an instance of OfferEventEndedOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferEventEndedOfferAllOfPublication.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventEndedOfferAllOfPublication.java new file mode 100644 index 0000000..4b8d864 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventEndedOfferAllOfPublication.java @@ -0,0 +1,278 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about publication of the given offer. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferEventEndedOfferAllOfPublication { + /** + * Indicates the reason for ending the offer: - `USER` - offer ended by the seller. - `ADMIN` - offer ended by an admin. - `EXPIRATION` - offer duration had expired (valid for offers with specified duration). - `EMPTY_STOCK` - offer ended because all available items had been sold out. - `PRODUCT_DETACHMENT` - offer ended because its link to the product was removed. Status will only occur if the base marketplace of offer requires full productization. - `ERROR` - offer ended due to internal problem with offer publication. The publication command responded with success status, but further processing failed. - `UNKNOWN` - in rare cases the reason might be unknown. + */ + @JsonAdapter(EndedByEnum.Adapter.class) + public enum EndedByEnum { + USER("USER"), + + ADMIN("ADMIN"), + + EXPIRATION("EXPIRATION"), + + EMPTY_STOCK("EMPTY_STOCK"), + + PRODUCT_DETACHMENT("PRODUCT_DETACHMENT"), + + ERROR("ERROR"), + + UNKNOWN("UNKNOWN"); + + private String value; + + EndedByEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EndedByEnum fromValue(String value) { + for (EndedByEnum b : EndedByEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EndedByEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EndedByEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EndedByEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EndedByEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENDED_BY = "endedBy"; + @SerializedName(SERIALIZED_NAME_ENDED_BY) + @javax.annotation.Nonnull + private EndedByEnum endedBy; + + public OfferEventEndedOfferAllOfPublication() { + } + + public OfferEventEndedOfferAllOfPublication endedBy(@javax.annotation.Nonnull EndedByEnum endedBy) { + this.endedBy = endedBy; + return this; + } + + /** + * Indicates the reason for ending the offer: - `USER` - offer ended by the seller. - `ADMIN` - offer ended by an admin. - `EXPIRATION` - offer duration had expired (valid for offers with specified duration). - `EMPTY_STOCK` - offer ended because all available items had been sold out. - `PRODUCT_DETACHMENT` - offer ended because its link to the product was removed. Status will only occur if the base marketplace of offer requires full productization. - `ERROR` - offer ended due to internal problem with offer publication. The publication command responded with success status, but further processing failed. - `UNKNOWN` - in rare cases the reason might be unknown. + * @return endedBy + */ + @javax.annotation.Nonnull + public EndedByEnum getEndedBy() { + return endedBy; + } + + public void setEndedBy(@javax.annotation.Nonnull EndedByEnum endedBy) { + this.endedBy = endedBy; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferEventEndedOfferAllOfPublication offerEventEndedOfferAllOfPublication = (OfferEventEndedOfferAllOfPublication) o; + return Objects.equals(this.endedBy, offerEventEndedOfferAllOfPublication.endedBy); + } + + @Override + public int hashCode() { + return Objects.hash(endedBy); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferEventEndedOfferAllOfPublication {\n"); + sb.append(" endedBy: ").append(toIndentedString(endedBy)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("endedBy"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("endedBy"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferEventEndedOfferAllOfPublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferEventEndedOfferAllOfPublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferEventEndedOfferAllOfPublication is not found in the empty JSON string", OfferEventEndedOfferAllOfPublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferEventEndedOfferAllOfPublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferEventEndedOfferAllOfPublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferEventEndedOfferAllOfPublication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("endedBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `endedBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endedBy").toString())); + } + // validate the required field `endedBy` + EndedByEnum.validateJsonElement(jsonObj.get("endedBy")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferEventEndedOfferAllOfPublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferEventEndedOfferAllOfPublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferEventEndedOfferAllOfPublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferEventEndedOfferAllOfPublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferEventEndedOfferAllOfPublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferEventEndedOfferAllOfPublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferEventEndedOfferAllOfPublication + * @throws IOException if the JSON string is invalid with respect to OfferEventEndedOfferAllOfPublication + */ + public static OfferEventEndedOfferAllOfPublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferEventEndedOfferAllOfPublication.class); + } + + /** + * Convert an instance of OfferEventEndedOfferAllOfPublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOffer.java new file mode 100644 index 0000000..afafa14 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOffer.java @@ -0,0 +1,246 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ExternalId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferEventExternalOffer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferEventExternalOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nullable + private ExternalId external; + + public OfferEventExternalOffer() { + } + + public OfferEventExternalOffer id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The offer ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public OfferEventExternalOffer external(@javax.annotation.Nullable ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nullable + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nullable ExternalId external) { + this.external = external; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferEventExternalOffer offerEventExternalOffer = (OfferEventExternalOffer) o; + return Objects.equals(this.id, offerEventExternalOffer.id) && + Objects.equals(this.external, offerEventExternalOffer.external); + } + + @Override + public int hashCode() { + return Objects.hash(id, external); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferEventExternalOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("external"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferEventExternalOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferEventExternalOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferEventExternalOffer is not found in the empty JSON string", OfferEventExternalOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferEventExternalOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferEventExternalOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferEventExternalOffer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `external` + if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { + ExternalId.validateJsonElement(jsonObj.get("external")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferEventExternalOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferEventExternalOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferEventExternalOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferEventExternalOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferEventExternalOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferEventExternalOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferEventExternalOffer + * @throws IOException if the JSON string is invalid with respect to OfferEventExternalOffer + */ + public static OfferEventExternalOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferEventExternalOffer.class); + } + + /** + * Convert an instance of OfferEventExternalOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOfferForPriceChanges.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOfferForPriceChanges.java new file mode 100644 index 0000000..2a86b2f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOfferForPriceChanges.java @@ -0,0 +1,297 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ExternalId; +import pl.wtx.allegro.api.client.model.OfferMarketplacesPriceChanges; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferEventExternalOfferForPriceChanges + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferEventExternalOfferForPriceChanges { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nonnull + private ExternalId external; + + public static final String SERIALIZED_NAME_MARKETPLACES = "marketplaces"; + @SerializedName(SERIALIZED_NAME_MARKETPLACES) + @javax.annotation.Nullable + private List marketplaces = new ArrayList<>(); + + public OfferEventExternalOfferForPriceChanges() { + } + + public OfferEventExternalOfferForPriceChanges id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The offer ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public OfferEventExternalOfferForPriceChanges external(@javax.annotation.Nonnull ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nonnull + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nonnull ExternalId external) { + this.external = external; + } + + + public OfferEventExternalOfferForPriceChanges marketplaces(@javax.annotation.Nullable List marketplaces) { + this.marketplaces = marketplaces; + return this; + } + + public OfferEventExternalOfferForPriceChanges addMarketplacesItem(OfferMarketplacesPriceChanges marketplacesItem) { + if (this.marketplaces == null) { + this.marketplaces = new ArrayList<>(); + } + this.marketplaces.add(marketplacesItem); + return this; + } + + /** + * Get marketplaces + * @return marketplaces + */ + @javax.annotation.Nullable + public List getMarketplaces() { + return marketplaces; + } + + public void setMarketplaces(@javax.annotation.Nullable List marketplaces) { + this.marketplaces = marketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferEventExternalOfferForPriceChanges offerEventExternalOfferForPriceChanges = (OfferEventExternalOfferForPriceChanges) o; + return Objects.equals(this.id, offerEventExternalOfferForPriceChanges.id) && + Objects.equals(this.external, offerEventExternalOfferForPriceChanges.external) && + Objects.equals(this.marketplaces, offerEventExternalOfferForPriceChanges.marketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(id, external, marketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferEventExternalOfferForPriceChanges {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append(" marketplaces: ").append(toIndentedString(marketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("external"); + openapiFields.add("marketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("external"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferEventExternalOfferForPriceChanges + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferEventExternalOfferForPriceChanges.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferEventExternalOfferForPriceChanges is not found in the empty JSON string", OfferEventExternalOfferForPriceChanges.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferEventExternalOfferForPriceChanges.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferEventExternalOfferForPriceChanges` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferEventExternalOfferForPriceChanges.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `external` + ExternalId.validateJsonElement(jsonObj.get("external")); + if (jsonObj.get("marketplaces") != null && !jsonObj.get("marketplaces").isJsonNull()) { + JsonArray jsonArraymarketplaces = jsonObj.getAsJsonArray("marketplaces"); + if (jsonArraymarketplaces != null) { + // ensure the json data is an array + if (!jsonObj.get("marketplaces").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaces` to be an array in the JSON string but got `%s`", jsonObj.get("marketplaces").toString())); + } + + // validate the optional field `marketplaces` (array) + for (int i = 0; i < jsonArraymarketplaces.size(); i++) { + OfferMarketplacesPriceChanges.validateJsonElement(jsonArraymarketplaces.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferEventExternalOfferForPriceChanges.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferEventExternalOfferForPriceChanges' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferEventExternalOfferForPriceChanges.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferEventExternalOfferForPriceChanges value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferEventExternalOfferForPriceChanges read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferEventExternalOfferForPriceChanges given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferEventExternalOfferForPriceChanges + * @throws IOException if the JSON string is invalid with respect to OfferEventExternalOfferForPriceChanges + */ + public static OfferEventExternalOfferForPriceChanges fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferEventExternalOfferForPriceChanges.class); + } + + /** + * Convert an instance of OfferEventExternalOfferForPriceChanges to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOfferWithPublication.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOfferWithPublication.java new file mode 100644 index 0000000..1de1901 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferEventExternalOfferWithPublication.java @@ -0,0 +1,277 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ExternalId; +import pl.wtx.allegro.api.client.model.OfferMarketplacesPublication; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferEventExternalOfferWithPublication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferEventExternalOfferWithPublication { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nullable + private ExternalId external; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nonnull + private OfferMarketplacesPublication publication; + + public OfferEventExternalOfferWithPublication() { + } + + public OfferEventExternalOfferWithPublication id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The offer ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public OfferEventExternalOfferWithPublication external(@javax.annotation.Nullable ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nullable + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nullable ExternalId external) { + this.external = external; + } + + + public OfferEventExternalOfferWithPublication publication(@javax.annotation.Nonnull OfferMarketplacesPublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nonnull + public OfferMarketplacesPublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nonnull OfferMarketplacesPublication publication) { + this.publication = publication; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferEventExternalOfferWithPublication offerEventExternalOfferWithPublication = (OfferEventExternalOfferWithPublication) o; + return Objects.equals(this.id, offerEventExternalOfferWithPublication.id) && + Objects.equals(this.external, offerEventExternalOfferWithPublication.external) && + Objects.equals(this.publication, offerEventExternalOfferWithPublication.publication); + } + + @Override + public int hashCode() { + return Objects.hash(id, external, publication); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferEventExternalOfferWithPublication {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("external"); + openapiFields.add("publication"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("publication"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferEventExternalOfferWithPublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferEventExternalOfferWithPublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferEventExternalOfferWithPublication is not found in the empty JSON string", OfferEventExternalOfferWithPublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferEventExternalOfferWithPublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferEventExternalOfferWithPublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferEventExternalOfferWithPublication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `external` + if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { + ExternalId.validateJsonElement(jsonObj.get("external")); + } + // validate the required field `publication` + OfferMarketplacesPublication.validateJsonElement(jsonObj.get("publication")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferEventExternalOfferWithPublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferEventExternalOfferWithPublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferEventExternalOfferWithPublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferEventExternalOfferWithPublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferEventExternalOfferWithPublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferEventExternalOfferWithPublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferEventExternalOfferWithPublication + * @throws IOException if the JSON string is invalid with respect to OfferEventExternalOfferWithPublication + */ + public static OfferEventExternalOfferWithPublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferEventExternalOfferWithPublication.class); + } + + /** + * Convert an instance of OfferEventExternalOfferWithPublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferFixedPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferFixedPrice.java new file mode 100644 index 0000000..68004ed --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferFixedPrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Fixed (buy now) price of the offer in case of *AUCTION* selling format with buy now option enabled. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferFixedPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public OfferFixedPrice() { + } + + public OfferFixedPrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public OfferFixedPrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferFixedPrice offerFixedPrice = (OfferFixedPrice) o; + return Objects.equals(this.amount, offerFixedPrice.amount) && + Objects.equals(this.currency, offerFixedPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferFixedPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferFixedPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferFixedPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferFixedPrice is not found in the empty JSON string", OfferFixedPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferFixedPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferFixedPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferFixedPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferFixedPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferFixedPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferFixedPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferFixedPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferFixedPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferFixedPrice + * @throws IOException if the JSON string is invalid with respect to OfferFixedPrice + */ + public static OfferFixedPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferFixedPrice.class); + } + + /** + * Convert an instance of OfferFixedPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferId.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferId.java new file mode 100644 index 0000000..241b72c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferId.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferId + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferId { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public OfferId() { + } + + public OfferId id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Offer id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferId offerId = (OfferId) o; + return Objects.equals(this.id, offerId.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferId {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferId is not found in the empty JSON string", OfferId.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferId.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferId read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferId given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferId + * @throws IOException if the JSON string is invalid with respect to OfferId + */ + public static OfferId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferId.class); + } + + /** + * Convert an instance of OfferId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferImageLinkUploadRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferImageLinkUploadRequest.java new file mode 100644 index 0000000..4a0b0fb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferImageLinkUploadRequest.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferImageLinkUploadRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferImageLinkUploadRequest { + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nonnull + private String url; + + public OfferImageLinkUploadRequest() { + } + + public OfferImageLinkUploadRequest url(@javax.annotation.Nonnull String url) { + this.url = url; + return this; + } + + /** + * URL of the image. It has to contain domain name, not an IP address. Currently we support http and https protocols. When using https the certificate chain needs to be valid. + * @return url + */ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nonnull String url) { + this.url = url; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferImageLinkUploadRequest offerImageLinkUploadRequest = (OfferImageLinkUploadRequest) o; + return Objects.equals(this.url, offerImageLinkUploadRequest.url); + } + + @Override + public int hashCode() { + return Objects.hash(url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferImageLinkUploadRequest {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferImageLinkUploadRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferImageLinkUploadRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferImageLinkUploadRequest is not found in the empty JSON string", OfferImageLinkUploadRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferImageLinkUploadRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferImageLinkUploadRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferImageLinkUploadRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferImageLinkUploadRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferImageLinkUploadRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferImageLinkUploadRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferImageLinkUploadRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferImageLinkUploadRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferImageLinkUploadRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferImageLinkUploadRequest + * @throws IOException if the JSON string is invalid with respect to OfferImageLinkUploadRequest + */ + public static OfferImageLinkUploadRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferImageLinkUploadRequest.class); + } + + /** + * Convert an instance of OfferImageLinkUploadRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferImageUploadResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferImageUploadResponse.java new file mode 100644 index 0000000..b1e938d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferImageUploadResponse.java @@ -0,0 +1,234 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferImageUploadResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferImageUploadResponse { + public static final String SERIALIZED_NAME_EXPIRES_AT = "expiresAt"; + @SerializedName(SERIALIZED_NAME_EXPIRES_AT) + @javax.annotation.Nullable + private OffsetDateTime expiresAt; + + public static final String SERIALIZED_NAME_LOCATION = "location"; + @SerializedName(SERIALIZED_NAME_LOCATION) + @javax.annotation.Nullable + private String location; + + public OfferImageUploadResponse() { + } + + public OfferImageUploadResponse expiresAt(@javax.annotation.Nullable OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * Date of file expiration (removal from the server). We will remove it unless you use it in your offer. + * @return expiresAt + */ + @javax.annotation.Nullable + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + public void setExpiresAt(@javax.annotation.Nullable OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + + public OfferImageUploadResponse location(@javax.annotation.Nullable String location) { + this.location = location; + return this; + } + + /** + * Link to the uploaded image + * @return location + */ + @javax.annotation.Nullable + public String getLocation() { + return location; + } + + public void setLocation(@javax.annotation.Nullable String location) { + this.location = location; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferImageUploadResponse offerImageUploadResponse = (OfferImageUploadResponse) o; + return Objects.equals(this.expiresAt, offerImageUploadResponse.expiresAt) && + Objects.equals(this.location, offerImageUploadResponse.location); + } + + @Override + public int hashCode() { + return Objects.hash(expiresAt, location); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferImageUploadResponse {\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("expiresAt"); + openapiFields.add("location"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferImageUploadResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferImageUploadResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferImageUploadResponse is not found in the empty JSON string", OfferImageUploadResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferImageUploadResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferImageUploadResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) && !jsonObj.get("location").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `location` to be a primitive type in the JSON string but got `%s`", jsonObj.get("location").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferImageUploadResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferImageUploadResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferImageUploadResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferImageUploadResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferImageUploadResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferImageUploadResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferImageUploadResponse + * @throws IOException if the JSON string is invalid with respect to OfferImageUploadResponse + */ + public static OfferImageUploadResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferImageUploadResponse.class); + } + + /** + * Convert an instance of OfferImageUploadResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferImages.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferImages.java new file mode 100644 index 0000000..973687b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferImages.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferImages + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferImages { + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public OfferImages() { + } + + public OfferImages url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * The URL of the original sized image. + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferImages offerImages = (OfferImages) o; + return Objects.equals(this.url, offerImages.url); + } + + @Override + public int hashCode() { + return Objects.hash(url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferImages {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferImages + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferImages.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferImages is not found in the empty JSON string", OfferImages.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferImages.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferImages` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferImages.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferImages' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferImages.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferImages value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferImages read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferImages given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferImages + * @throws IOException if the JSON string is invalid with respect to OfferImages + */ + public static OfferImages fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferImages.class); + } + + /** + * Convert an instance of OfferImages to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDto.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDto.java new file mode 100644 index 0000000..a489e7b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDto.java @@ -0,0 +1,702 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AfterSalesServices; +import pl.wtx.allegro.api.client.model.ExternalId; +import pl.wtx.allegro.api.client.model.JustId; +import pl.wtx.allegro.api.client.model.OfferAdditionalServices; +import pl.wtx.allegro.api.client.model.OfferCategory; +import pl.wtx.allegro.api.client.model.OfferListingDtoImage; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1AdditionalMarketplace; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1B2b; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1Delivery; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1Publication; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1SaleInfo; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1SellingMode; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1Stats; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1Stock; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * An offer. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private OfferCategory category; + + public static final String SERIALIZED_NAME_PRIMARY_IMAGE = "primaryImage"; + @SerializedName(SERIALIZED_NAME_PRIMARY_IMAGE) + @javax.annotation.Nullable + private OfferListingDtoImage primaryImage; + + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private OfferListingDtoV1SellingMode sellingMode; + + public static final String SERIALIZED_NAME_SALE_INFO = "saleInfo"; + @SerializedName(SERIALIZED_NAME_SALE_INFO) + @javax.annotation.Nullable + private OfferListingDtoV1SaleInfo saleInfo; + + public static final String SERIALIZED_NAME_STOCK = "stock"; + @SerializedName(SERIALIZED_NAME_STOCK) + @javax.annotation.Nullable + private OfferListingDtoV1Stock stock; + + public static final String SERIALIZED_NAME_STATS = "stats"; + @SerializedName(SERIALIZED_NAME_STATS) + @javax.annotation.Nullable + private OfferListingDtoV1Stats stats; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private OfferListingDtoV1Publication publication; + + public static final String SERIALIZED_NAME_AFTER_SALES_SERVICES = "afterSalesServices"; + @SerializedName(SERIALIZED_NAME_AFTER_SALES_SERVICES) + @javax.annotation.Nullable + private AfterSalesServices afterSalesServices; + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private OfferAdditionalServices additionalServices; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nullable + private ExternalId external; + + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private OfferListingDtoV1Delivery delivery; + + public static final String SERIALIZED_NAME_B2B = "b2b"; + @SerializedName(SERIALIZED_NAME_B2B) + @javax.annotation.Nullable + private OfferListingDtoV1B2b b2b; + + public static final String SERIALIZED_NAME_FUNDRAISING_CAMPAIGN = "fundraisingCampaign"; + @SerializedName(SERIALIZED_NAME_FUNDRAISING_CAMPAIGN) + @javax.annotation.Nullable + private JustId fundraisingCampaign; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private Map additionalMarketplaces = new HashMap<>(); + + public OfferListingDto() { + } + + public OfferListingDto id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The offer ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public OfferListingDto name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The title of the offer. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public OfferListingDto category(@javax.annotation.Nullable OfferCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + public OfferCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable OfferCategory category) { + this.category = category; + } + + + public OfferListingDto primaryImage(@javax.annotation.Nullable OfferListingDtoImage primaryImage) { + this.primaryImage = primaryImage; + return this; + } + + /** + * Get primaryImage + * @return primaryImage + */ + @javax.annotation.Nullable + public OfferListingDtoImage getPrimaryImage() { + return primaryImage; + } + + public void setPrimaryImage(@javax.annotation.Nullable OfferListingDtoImage primaryImage) { + this.primaryImage = primaryImage; + } + + + public OfferListingDto sellingMode(@javax.annotation.Nullable OfferListingDtoV1SellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public OfferListingDtoV1SellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable OfferListingDtoV1SellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + public OfferListingDto saleInfo(@javax.annotation.Nullable OfferListingDtoV1SaleInfo saleInfo) { + this.saleInfo = saleInfo; + return this; + } + + /** + * Get saleInfo + * @return saleInfo + */ + @javax.annotation.Nullable + public OfferListingDtoV1SaleInfo getSaleInfo() { + return saleInfo; + } + + public void setSaleInfo(@javax.annotation.Nullable OfferListingDtoV1SaleInfo saleInfo) { + this.saleInfo = saleInfo; + } + + + public OfferListingDto stock(@javax.annotation.Nullable OfferListingDtoV1Stock stock) { + this.stock = stock; + return this; + } + + /** + * Get stock + * @return stock + */ + @javax.annotation.Nullable + public OfferListingDtoV1Stock getStock() { + return stock; + } + + public void setStock(@javax.annotation.Nullable OfferListingDtoV1Stock stock) { + this.stock = stock; + } + + + public OfferListingDto stats(@javax.annotation.Nullable OfferListingDtoV1Stats stats) { + this.stats = stats; + return this; + } + + /** + * Get stats + * @return stats + */ + @javax.annotation.Nullable + public OfferListingDtoV1Stats getStats() { + return stats; + } + + public void setStats(@javax.annotation.Nullable OfferListingDtoV1Stats stats) { + this.stats = stats; + } + + + public OfferListingDto publication(@javax.annotation.Nullable OfferListingDtoV1Publication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public OfferListingDtoV1Publication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable OfferListingDtoV1Publication publication) { + this.publication = publication; + } + + + public OfferListingDto afterSalesServices(@javax.annotation.Nullable AfterSalesServices afterSalesServices) { + this.afterSalesServices = afterSalesServices; + return this; + } + + /** + * Get afterSalesServices + * @return afterSalesServices + */ + @javax.annotation.Nullable + public AfterSalesServices getAfterSalesServices() { + return afterSalesServices; + } + + public void setAfterSalesServices(@javax.annotation.Nullable AfterSalesServices afterSalesServices) { + this.afterSalesServices = afterSalesServices; + } + + + public OfferListingDto additionalServices(@javax.annotation.Nullable OfferAdditionalServices additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nullable + public OfferAdditionalServices getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable OfferAdditionalServices additionalServices) { + this.additionalServices = additionalServices; + } + + + public OfferListingDto external(@javax.annotation.Nullable ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nullable + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nullable ExternalId external) { + this.external = external; + } + + + public OfferListingDto delivery(@javax.annotation.Nullable OfferListingDtoV1Delivery delivery) { + this.delivery = delivery; + return this; + } + + /** + * Get delivery + * @return delivery + */ + @javax.annotation.Nullable + public OfferListingDtoV1Delivery getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable OfferListingDtoV1Delivery delivery) { + this.delivery = delivery; + } + + + public OfferListingDto b2b(@javax.annotation.Nullable OfferListingDtoV1B2b b2b) { + this.b2b = b2b; + return this; + } + + /** + * Get b2b + * @return b2b + */ + @javax.annotation.Nullable + public OfferListingDtoV1B2b getB2b() { + return b2b; + } + + public void setB2b(@javax.annotation.Nullable OfferListingDtoV1B2b b2b) { + this.b2b = b2b; + } + + + public OfferListingDto fundraisingCampaign(@javax.annotation.Nullable JustId fundraisingCampaign) { + this.fundraisingCampaign = fundraisingCampaign; + return this; + } + + /** + * Get fundraisingCampaign + * @return fundraisingCampaign + */ + @javax.annotation.Nullable + public JustId getFundraisingCampaign() { + return fundraisingCampaign; + } + + public void setFundraisingCampaign(@javax.annotation.Nullable JustId fundraisingCampaign) { + this.fundraisingCampaign = fundraisingCampaign; + } + + + public OfferListingDto additionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public OfferListingDto putAdditionalMarketplacesItem(String key, OfferListingDtoV1AdditionalMarketplace additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new HashMap<>(); + } + this.additionalMarketplaces.put(key, additionalMarketplacesItem); + return this; + } + + /** + * Properties of the offer for each additional marketplace. + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public Map getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDto offerListingDto = (OfferListingDto) o; + return Objects.equals(this.id, offerListingDto.id) && + Objects.equals(this.name, offerListingDto.name) && + Objects.equals(this.category, offerListingDto.category) && + Objects.equals(this.primaryImage, offerListingDto.primaryImage) && + Objects.equals(this.sellingMode, offerListingDto.sellingMode) && + Objects.equals(this.saleInfo, offerListingDto.saleInfo) && + Objects.equals(this.stock, offerListingDto.stock) && + Objects.equals(this.stats, offerListingDto.stats) && + Objects.equals(this.publication, offerListingDto.publication) && + Objects.equals(this.afterSalesServices, offerListingDto.afterSalesServices) && + Objects.equals(this.additionalServices, offerListingDto.additionalServices) && + Objects.equals(this.external, offerListingDto.external) && + Objects.equals(this.delivery, offerListingDto.delivery) && + Objects.equals(this.b2b, offerListingDto.b2b) && + Objects.equals(this.fundraisingCampaign, offerListingDto.fundraisingCampaign) && + Objects.equals(this.additionalMarketplaces, offerListingDto.additionalMarketplaces); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, category, primaryImage, sellingMode, saleInfo, stock, stats, publication, afterSalesServices, additionalServices, external, delivery, b2b, fundraisingCampaign, additionalMarketplaces); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" primaryImage: ").append(toIndentedString(primaryImage)).append("\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append(" saleInfo: ").append(toIndentedString(saleInfo)).append("\n"); + sb.append(" stock: ").append(toIndentedString(stock)).append("\n"); + sb.append(" stats: ").append(toIndentedString(stats)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" afterSalesServices: ").append(toIndentedString(afterSalesServices)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" b2b: ").append(toIndentedString(b2b)).append("\n"); + sb.append(" fundraisingCampaign: ").append(toIndentedString(fundraisingCampaign)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("category"); + openapiFields.add("primaryImage"); + openapiFields.add("sellingMode"); + openapiFields.add("saleInfo"); + openapiFields.add("stock"); + openapiFields.add("stats"); + openapiFields.add("publication"); + openapiFields.add("afterSalesServices"); + openapiFields.add("additionalServices"); + openapiFields.add("external"); + openapiFields.add("delivery"); + openapiFields.add("b2b"); + openapiFields.add("fundraisingCampaign"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDto is not found in the empty JSON string", OfferListingDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + OfferCategory.validateJsonElement(jsonObj.get("category")); + } + // validate the optional field `primaryImage` + if (jsonObj.get("primaryImage") != null && !jsonObj.get("primaryImage").isJsonNull()) { + OfferListingDtoImage.validateJsonElement(jsonObj.get("primaryImage")); + } + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + OfferListingDtoV1SellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + // validate the optional field `saleInfo` + if (jsonObj.get("saleInfo") != null && !jsonObj.get("saleInfo").isJsonNull()) { + OfferListingDtoV1SaleInfo.validateJsonElement(jsonObj.get("saleInfo")); + } + // validate the optional field `stock` + if (jsonObj.get("stock") != null && !jsonObj.get("stock").isJsonNull()) { + OfferListingDtoV1Stock.validateJsonElement(jsonObj.get("stock")); + } + // validate the optional field `stats` + if (jsonObj.get("stats") != null && !jsonObj.get("stats").isJsonNull()) { + OfferListingDtoV1Stats.validateJsonElement(jsonObj.get("stats")); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + OfferListingDtoV1Publication.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `afterSalesServices` + if (jsonObj.get("afterSalesServices") != null && !jsonObj.get("afterSalesServices").isJsonNull()) { + AfterSalesServices.validateJsonElement(jsonObj.get("afterSalesServices")); + } + // validate the optional field `additionalServices` + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull()) { + OfferAdditionalServices.validateJsonElement(jsonObj.get("additionalServices")); + } + // validate the optional field `external` + if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { + ExternalId.validateJsonElement(jsonObj.get("external")); + } + // validate the optional field `delivery` + if (jsonObj.get("delivery") != null && !jsonObj.get("delivery").isJsonNull()) { + OfferListingDtoV1Delivery.validateJsonElement(jsonObj.get("delivery")); + } + // validate the optional field `b2b` + if (jsonObj.get("b2b") != null && !jsonObj.get("b2b").isJsonNull()) { + OfferListingDtoV1B2b.validateJsonElement(jsonObj.get("b2b")); + } + // validate the optional field `fundraisingCampaign` + if (jsonObj.get("fundraisingCampaign") != null && !jsonObj.get("fundraisingCampaign").isJsonNull()) { + JustId.validateJsonElement(jsonObj.get("fundraisingCampaign")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDto + * @throws IOException if the JSON string is invalid with respect to OfferListingDto + */ + public static OfferListingDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDto.class); + } + + /** + * Convert an instance of OfferListingDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoImage.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoImage.java new file mode 100644 index 0000000..08ad32d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoImage.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The image used as a thumbnail on the listings. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoImage { + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public OfferListingDtoImage() { + } + + public OfferListingDtoImage url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * The url to the image in its original size. + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoImage offerListingDtoImage = (OfferListingDtoImage) o; + return Objects.equals(this.url, offerListingDtoImage.url); + } + + @Override + public int hashCode() { + return Objects.hash(url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoImage {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoImage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoImage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoImage is not found in the empty JSON string", OfferListingDtoImage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoImage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoImage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoImage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoImage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoImage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoImage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoImage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoImage given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoImage + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoImage + */ + public static OfferListingDtoImage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoImage.class); + } + + /** + * Convert an instance of OfferListingDtoImage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplace.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplace.java new file mode 100644 index 0000000..b423a4e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplace.java @@ -0,0 +1,316 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1AdditionalMarketplacePublication; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1AdditionalMarketplaceSellingMode; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1AdditionalMarketplaceStock; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1Stats; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Properties of the offer for the given marketplace. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1AdditionalMarketplace { + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private OfferListingDtoV1AdditionalMarketplacePublication publication; + + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private OfferListingDtoV1AdditionalMarketplaceSellingMode sellingMode; + + public static final String SERIALIZED_NAME_STATS = "stats"; + @SerializedName(SERIALIZED_NAME_STATS) + @javax.annotation.Nullable + private OfferListingDtoV1Stats stats; + + public static final String SERIALIZED_NAME_STOCK = "stock"; + @SerializedName(SERIALIZED_NAME_STOCK) + @javax.annotation.Nullable + private OfferListingDtoV1AdditionalMarketplaceStock stock; + + public OfferListingDtoV1AdditionalMarketplace() { + } + + public OfferListingDtoV1AdditionalMarketplace publication(@javax.annotation.Nullable OfferListingDtoV1AdditionalMarketplacePublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public OfferListingDtoV1AdditionalMarketplacePublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable OfferListingDtoV1AdditionalMarketplacePublication publication) { + this.publication = publication; + } + + + public OfferListingDtoV1AdditionalMarketplace sellingMode(@javax.annotation.Nullable OfferListingDtoV1AdditionalMarketplaceSellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public OfferListingDtoV1AdditionalMarketplaceSellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable OfferListingDtoV1AdditionalMarketplaceSellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + public OfferListingDtoV1AdditionalMarketplace stats(@javax.annotation.Nullable OfferListingDtoV1Stats stats) { + this.stats = stats; + return this; + } + + /** + * The offer's statistics on the given marketplace. + * @return stats + */ + @javax.annotation.Nullable + public OfferListingDtoV1Stats getStats() { + return stats; + } + + public void setStats(@javax.annotation.Nullable OfferListingDtoV1Stats stats) { + this.stats = stats; + } + + + public OfferListingDtoV1AdditionalMarketplace stock(@javax.annotation.Nullable OfferListingDtoV1AdditionalMarketplaceStock stock) { + this.stock = stock; + return this; + } + + /** + * Get stock + * @return stock + */ + @javax.annotation.Nullable + public OfferListingDtoV1AdditionalMarketplaceStock getStock() { + return stock; + } + + public void setStock(@javax.annotation.Nullable OfferListingDtoV1AdditionalMarketplaceStock stock) { + this.stock = stock; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1AdditionalMarketplace offerListingDtoV1AdditionalMarketplace = (OfferListingDtoV1AdditionalMarketplace) o; + return Objects.equals(this.publication, offerListingDtoV1AdditionalMarketplace.publication) && + Objects.equals(this.sellingMode, offerListingDtoV1AdditionalMarketplace.sellingMode) && + Objects.equals(this.stats, offerListingDtoV1AdditionalMarketplace.stats) && + Objects.equals(this.stock, offerListingDtoV1AdditionalMarketplace.stock); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(publication, sellingMode, stats, stock); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1AdditionalMarketplace {\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append(" stats: ").append(toIndentedString(stats)).append("\n"); + sb.append(" stock: ").append(toIndentedString(stock)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("publication"); + openapiFields.add("sellingMode"); + openapiFields.add("stats"); + openapiFields.add("stock"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1AdditionalMarketplace + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1AdditionalMarketplace.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1AdditionalMarketplace is not found in the empty JSON string", OfferListingDtoV1AdditionalMarketplace.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1AdditionalMarketplace.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1AdditionalMarketplace` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + OfferListingDtoV1AdditionalMarketplacePublication.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + OfferListingDtoV1AdditionalMarketplaceSellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + // validate the optional field `stats` + if (jsonObj.get("stats") != null && !jsonObj.get("stats").isJsonNull()) { + OfferListingDtoV1Stats.validateJsonElement(jsonObj.get("stats")); + } + // validate the optional field `stock` + if (jsonObj.get("stock") != null && !jsonObj.get("stock").isJsonNull()) { + OfferListingDtoV1AdditionalMarketplaceStock.validateJsonElement(jsonObj.get("stock")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1AdditionalMarketplace.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1AdditionalMarketplace' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1AdditionalMarketplace.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1AdditionalMarketplace value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1AdditionalMarketplace read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1AdditionalMarketplace given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1AdditionalMarketplace + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1AdditionalMarketplace + */ + public static OfferListingDtoV1AdditionalMarketplace fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1AdditionalMarketplace.class); + } + + /** + * Convert an instance of OfferListingDtoV1AdditionalMarketplace to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplacePublication.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplacePublication.java new file mode 100644 index 0000000..52f9571 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplacePublication.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacePublicationState; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about the publication of the offer on the given marketplace. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1AdditionalMarketplacePublication { + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nullable + private AdditionalMarketplacePublicationState state; + + public OfferListingDtoV1AdditionalMarketplacePublication() { + } + + public OfferListingDtoV1AdditionalMarketplacePublication state(@javax.annotation.Nullable AdditionalMarketplacePublicationState state) { + this.state = state; + return this; + } + + /** + * Get state + * @return state + */ + @javax.annotation.Nullable + public AdditionalMarketplacePublicationState getState() { + return state; + } + + public void setState(@javax.annotation.Nullable AdditionalMarketplacePublicationState state) { + this.state = state; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1AdditionalMarketplacePublication offerListingDtoV1AdditionalMarketplacePublication = (OfferListingDtoV1AdditionalMarketplacePublication) o; + return Objects.equals(this.state, offerListingDtoV1AdditionalMarketplacePublication.state); + } + + @Override + public int hashCode() { + return Objects.hash(state); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1AdditionalMarketplacePublication {\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("state"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1AdditionalMarketplacePublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1AdditionalMarketplacePublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1AdditionalMarketplacePublication is not found in the empty JSON string", OfferListingDtoV1AdditionalMarketplacePublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1AdditionalMarketplacePublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1AdditionalMarketplacePublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `state` + if (jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) { + AdditionalMarketplacePublicationState.validateJsonElement(jsonObj.get("state")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1AdditionalMarketplacePublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1AdditionalMarketplacePublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1AdditionalMarketplacePublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1AdditionalMarketplacePublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1AdditionalMarketplacePublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1AdditionalMarketplacePublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1AdditionalMarketplacePublication + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1AdditionalMarketplacePublication + */ + public static OfferListingDtoV1AdditionalMarketplacePublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1AdditionalMarketplacePublication.class); + } + + /** + * Convert an instance of OfferListingDtoV1AdditionalMarketplacePublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplaceSellingMode.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplaceSellingMode.java new file mode 100644 index 0000000..33ce851 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplaceSellingMode.java @@ -0,0 +1,240 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BuyNowPrice; +import pl.wtx.allegro.api.client.model.PriceAutomation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about the selling mode of the offer on the given marketplace. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1AdditionalMarketplaceSellingMode { + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private BuyNowPrice price; + + public static final String SERIALIZED_NAME_PRICE_AUTOMATION = "priceAutomation"; + @SerializedName(SERIALIZED_NAME_PRICE_AUTOMATION) + @javax.annotation.Nullable + private PriceAutomation priceAutomation; + + public OfferListingDtoV1AdditionalMarketplaceSellingMode() { + } + + public OfferListingDtoV1AdditionalMarketplaceSellingMode price(@javax.annotation.Nullable BuyNowPrice price) { + this.price = price; + return this; + } + + /** + * The price of the offer on the given marketplace. + * @return price + */ + @javax.annotation.Nullable + public BuyNowPrice getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable BuyNowPrice price) { + this.price = price; + } + + + public OfferListingDtoV1AdditionalMarketplaceSellingMode priceAutomation(@javax.annotation.Nullable PriceAutomation priceAutomation) { + this.priceAutomation = priceAutomation; + return this; + } + + /** + * The automatic pricing rule on the given marketplace. + * @return priceAutomation + */ + @javax.annotation.Nullable + public PriceAutomation getPriceAutomation() { + return priceAutomation; + } + + public void setPriceAutomation(@javax.annotation.Nullable PriceAutomation priceAutomation) { + this.priceAutomation = priceAutomation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1AdditionalMarketplaceSellingMode offerListingDtoV1AdditionalMarketplaceSellingMode = (OfferListingDtoV1AdditionalMarketplaceSellingMode) o; + return Objects.equals(this.price, offerListingDtoV1AdditionalMarketplaceSellingMode.price) && + Objects.equals(this.priceAutomation, offerListingDtoV1AdditionalMarketplaceSellingMode.priceAutomation); + } + + @Override + public int hashCode() { + return Objects.hash(price, priceAutomation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1AdditionalMarketplaceSellingMode {\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" priceAutomation: ").append(toIndentedString(priceAutomation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("price"); + openapiFields.add("priceAutomation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1AdditionalMarketplaceSellingMode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1AdditionalMarketplaceSellingMode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1AdditionalMarketplaceSellingMode is not found in the empty JSON string", OfferListingDtoV1AdditionalMarketplaceSellingMode.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1AdditionalMarketplaceSellingMode.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1AdditionalMarketplaceSellingMode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `price` + if (jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) { + BuyNowPrice.validateJsonElement(jsonObj.get("price")); + } + // validate the optional field `priceAutomation` + if (jsonObj.get("priceAutomation") != null && !jsonObj.get("priceAutomation").isJsonNull()) { + PriceAutomation.validateJsonElement(jsonObj.get("priceAutomation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1AdditionalMarketplaceSellingMode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1AdditionalMarketplaceSellingMode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1AdditionalMarketplaceSellingMode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1AdditionalMarketplaceSellingMode value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1AdditionalMarketplaceSellingMode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1AdditionalMarketplaceSellingMode given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1AdditionalMarketplaceSellingMode + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1AdditionalMarketplaceSellingMode + */ + public static OfferListingDtoV1AdditionalMarketplaceSellingMode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1AdditionalMarketplaceSellingMode.class); + } + + /** + * Convert an instance of OfferListingDtoV1AdditionalMarketplaceSellingMode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplaceStock.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplaceStock.java new file mode 100644 index 0000000..7e05d9c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1AdditionalMarketplaceStock.java @@ -0,0 +1,204 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contains only the sold stock on the given marketplace. The available stock applies to all marketplaces. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1AdditionalMarketplaceStock { + public static final String SERIALIZED_NAME_SOLD = "sold"; + @SerializedName(SERIALIZED_NAME_SOLD) + @javax.annotation.Nullable + private Integer sold; + + public OfferListingDtoV1AdditionalMarketplaceStock() { + } + + public OfferListingDtoV1AdditionalMarketplaceStock sold(@javax.annotation.Nullable Integer sold) { + this.sold = sold; + return this; + } + + /** + * The number of sold items in the last 30 days on the given marketplace. + * minimum: 0 + * @return sold + */ + @javax.annotation.Nullable + public Integer getSold() { + return sold; + } + + public void setSold(@javax.annotation.Nullable Integer sold) { + this.sold = sold; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1AdditionalMarketplaceStock offerListingDtoV1AdditionalMarketplaceStock = (OfferListingDtoV1AdditionalMarketplaceStock) o; + return Objects.equals(this.sold, offerListingDtoV1AdditionalMarketplaceStock.sold); + } + + @Override + public int hashCode() { + return Objects.hash(sold); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1AdditionalMarketplaceStock {\n"); + sb.append(" sold: ").append(toIndentedString(sold)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sold"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1AdditionalMarketplaceStock + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1AdditionalMarketplaceStock.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1AdditionalMarketplaceStock is not found in the empty JSON string", OfferListingDtoV1AdditionalMarketplaceStock.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1AdditionalMarketplaceStock.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1AdditionalMarketplaceStock` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1AdditionalMarketplaceStock.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1AdditionalMarketplaceStock' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1AdditionalMarketplaceStock.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1AdditionalMarketplaceStock value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1AdditionalMarketplaceStock read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1AdditionalMarketplaceStock given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1AdditionalMarketplaceStock + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1AdditionalMarketplaceStock + */ + public static OfferListingDtoV1AdditionalMarketplaceStock fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1AdditionalMarketplaceStock.class); + } + + /** + * Convert an instance of OfferListingDtoV1AdditionalMarketplaceStock to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1B2b.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1B2b.java new file mode 100644 index 0000000..e42ce18 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1B2b.java @@ -0,0 +1,203 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about offer's business properties. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1B2b { + public static final String SERIALIZED_NAME_BUYABLE_ONLY_BY_BUSINESS = "buyableOnlyByBusiness"; + @SerializedName(SERIALIZED_NAME_BUYABLE_ONLY_BY_BUSINESS) + @javax.annotation.Nullable + private Boolean buyableOnlyByBusiness; + + public OfferListingDtoV1B2b() { + } + + public OfferListingDtoV1B2b buyableOnlyByBusiness(@javax.annotation.Nullable Boolean buyableOnlyByBusiness) { + this.buyableOnlyByBusiness = buyableOnlyByBusiness; + return this; + } + + /** + * Get buyableOnlyByBusiness + * @return buyableOnlyByBusiness + */ + @javax.annotation.Nullable + public Boolean getBuyableOnlyByBusiness() { + return buyableOnlyByBusiness; + } + + public void setBuyableOnlyByBusiness(@javax.annotation.Nullable Boolean buyableOnlyByBusiness) { + this.buyableOnlyByBusiness = buyableOnlyByBusiness; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1B2b offerListingDtoV1B2b = (OfferListingDtoV1B2b) o; + return Objects.equals(this.buyableOnlyByBusiness, offerListingDtoV1B2b.buyableOnlyByBusiness); + } + + @Override + public int hashCode() { + return Objects.hash(buyableOnlyByBusiness); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1B2b {\n"); + sb.append(" buyableOnlyByBusiness: ").append(toIndentedString(buyableOnlyByBusiness)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("buyableOnlyByBusiness"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1B2b + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1B2b.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1B2b is not found in the empty JSON string", OfferListingDtoV1B2b.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1B2b.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1B2b` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1B2b.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1B2b' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1B2b.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1B2b value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1B2b read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1B2b given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1B2b + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1B2b + */ + public static OfferListingDtoV1B2b fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1B2b.class); + } + + /** + * Convert an instance of OfferListingDtoV1B2b to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Delivery.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Delivery.java new file mode 100644 index 0000000..b713184 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Delivery.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ShippingRates; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Delivery information. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1Delivery { + public static final String SERIALIZED_NAME_SHIPPING_RATES = "shippingRates"; + @SerializedName(SERIALIZED_NAME_SHIPPING_RATES) + @javax.annotation.Nullable + private ShippingRates shippingRates; + + public OfferListingDtoV1Delivery() { + } + + public OfferListingDtoV1Delivery shippingRates(@javax.annotation.Nullable ShippingRates shippingRates) { + this.shippingRates = shippingRates; + return this; + } + + /** + * Get shippingRates + * @return shippingRates + */ + @javax.annotation.Nullable + public ShippingRates getShippingRates() { + return shippingRates; + } + + public void setShippingRates(@javax.annotation.Nullable ShippingRates shippingRates) { + this.shippingRates = shippingRates; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1Delivery offerListingDtoV1Delivery = (OfferListingDtoV1Delivery) o; + return Objects.equals(this.shippingRates, offerListingDtoV1Delivery.shippingRates); + } + + @Override + public int hashCode() { + return Objects.hash(shippingRates); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1Delivery {\n"); + sb.append(" shippingRates: ").append(toIndentedString(shippingRates)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shippingRates"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1Delivery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1Delivery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1Delivery is not found in the empty JSON string", OfferListingDtoV1Delivery.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1Delivery.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1Delivery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `shippingRates` + if (jsonObj.get("shippingRates") != null && !jsonObj.get("shippingRates").isJsonNull()) { + ShippingRates.validateJsonElement(jsonObj.get("shippingRates")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1Delivery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1Delivery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1Delivery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1Delivery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1Delivery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1Delivery given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1Delivery + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1Delivery + */ + public static OfferListingDtoV1Delivery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1Delivery.class); + } + + /** + * Convert an instance of OfferListingDtoV1Delivery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Publication.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Publication.java new file mode 100644 index 0000000..ae3f79b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Publication.java @@ -0,0 +1,360 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferListingDtoV1PublicationMarketplaces; +import pl.wtx.allegro.api.client.model.OfferStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information on the offer's publication status and dates. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1Publication { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private OfferStatus status; + + public static final String SERIALIZED_NAME_STARTING_AT = "startingAt"; + @SerializedName(SERIALIZED_NAME_STARTING_AT) + @javax.annotation.Nullable + private String startingAt; + + public static final String SERIALIZED_NAME_STARTED_AT = "startedAt"; + @SerializedName(SERIALIZED_NAME_STARTED_AT) + @javax.annotation.Nullable + private String startedAt; + + public static final String SERIALIZED_NAME_ENDING_AT = "endingAt"; + @SerializedName(SERIALIZED_NAME_ENDING_AT) + @javax.annotation.Nullable + private String endingAt; + + public static final String SERIALIZED_NAME_ENDED_AT = "endedAt"; + @SerializedName(SERIALIZED_NAME_ENDED_AT) + @javax.annotation.Nullable + private String endedAt; + + public static final String SERIALIZED_NAME_MARKETPLACES = "marketplaces"; + @SerializedName(SERIALIZED_NAME_MARKETPLACES) + @javax.annotation.Nullable + private OfferListingDtoV1PublicationMarketplaces marketplaces; + + public OfferListingDtoV1Publication() { + } + + public OfferListingDtoV1Publication status(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public OfferStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + } + + + public OfferListingDtoV1Publication startingAt(@javax.annotation.Nullable String startingAt) { + this.startingAt = startingAt; + return this; + } + + /** + * The date and time of activation in UTC for a planned listing. + * @return startingAt + */ + @javax.annotation.Nullable + public String getStartingAt() { + return startingAt; + } + + public void setStartingAt(@javax.annotation.Nullable String startingAt) { + this.startingAt = startingAt; + } + + + public OfferListingDtoV1Publication startedAt(@javax.annotation.Nullable String startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + * The actual date and time of activation in UTC. + * @return startedAt + */ + @javax.annotation.Nullable + public String getStartedAt() { + return startedAt; + } + + public void setStartedAt(@javax.annotation.Nullable String startedAt) { + this.startedAt = startedAt; + } + + + public OfferListingDtoV1Publication endingAt(@javax.annotation.Nullable String endingAt) { + this.endingAt = endingAt; + return this; + } + + /** + * The date and time of a planned ending in UTC. + * @return endingAt + */ + @javax.annotation.Nullable + public String getEndingAt() { + return endingAt; + } + + public void setEndingAt(@javax.annotation.Nullable String endingAt) { + this.endingAt = endingAt; + } + + + public OfferListingDtoV1Publication endedAt(@javax.annotation.Nullable String endedAt) { + this.endedAt = endedAt; + return this; + } + + /** + * The actual date and time of last ending in UTC. + * @return endedAt + */ + @javax.annotation.Nullable + public String getEndedAt() { + return endedAt; + } + + public void setEndedAt(@javax.annotation.Nullable String endedAt) { + this.endedAt = endedAt; + } + + + public OfferListingDtoV1Publication marketplaces(@javax.annotation.Nullable OfferListingDtoV1PublicationMarketplaces marketplaces) { + this.marketplaces = marketplaces; + return this; + } + + /** + * Get marketplaces + * @return marketplaces + */ + @javax.annotation.Nullable + public OfferListingDtoV1PublicationMarketplaces getMarketplaces() { + return marketplaces; + } + + public void setMarketplaces(@javax.annotation.Nullable OfferListingDtoV1PublicationMarketplaces marketplaces) { + this.marketplaces = marketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1Publication offerListingDtoV1Publication = (OfferListingDtoV1Publication) o; + return Objects.equals(this.status, offerListingDtoV1Publication.status) && + Objects.equals(this.startingAt, offerListingDtoV1Publication.startingAt) && + Objects.equals(this.startedAt, offerListingDtoV1Publication.startedAt) && + Objects.equals(this.endingAt, offerListingDtoV1Publication.endingAt) && + Objects.equals(this.endedAt, offerListingDtoV1Publication.endedAt) && + Objects.equals(this.marketplaces, offerListingDtoV1Publication.marketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(status, startingAt, startedAt, endingAt, endedAt, marketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1Publication {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" startingAt: ").append(toIndentedString(startingAt)).append("\n"); + sb.append(" startedAt: ").append(toIndentedString(startedAt)).append("\n"); + sb.append(" endingAt: ").append(toIndentedString(endingAt)).append("\n"); + sb.append(" endedAt: ").append(toIndentedString(endedAt)).append("\n"); + sb.append(" marketplaces: ").append(toIndentedString(marketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("startingAt"); + openapiFields.add("startedAt"); + openapiFields.add("endingAt"); + openapiFields.add("endedAt"); + openapiFields.add("marketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1Publication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1Publication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1Publication is not found in the empty JSON string", OfferListingDtoV1Publication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1Publication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1Publication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + OfferStatus.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("startingAt") != null && !jsonObj.get("startingAt").isJsonNull()) && !jsonObj.get("startingAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `startingAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("startingAt").toString())); + } + if ((jsonObj.get("startedAt") != null && !jsonObj.get("startedAt").isJsonNull()) && !jsonObj.get("startedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `startedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("startedAt").toString())); + } + if ((jsonObj.get("endingAt") != null && !jsonObj.get("endingAt").isJsonNull()) && !jsonObj.get("endingAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `endingAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endingAt").toString())); + } + if ((jsonObj.get("endedAt") != null && !jsonObj.get("endedAt").isJsonNull()) && !jsonObj.get("endedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `endedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endedAt").toString())); + } + // validate the optional field `marketplaces` + if (jsonObj.get("marketplaces") != null && !jsonObj.get("marketplaces").isJsonNull()) { + OfferListingDtoV1PublicationMarketplaces.validateJsonElement(jsonObj.get("marketplaces")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1Publication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1Publication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1Publication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1Publication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1Publication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1Publication given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1Publication + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1Publication + */ + public static OfferListingDtoV1Publication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1Publication.class); + } + + /** + * Convert an instance of OfferListingDtoV1Publication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1PublicationMarketplaces.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1PublicationMarketplaces.java new file mode 100644 index 0000000..779cc49 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1PublicationMarketplaces.java @@ -0,0 +1,259 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.MarketplaceReference; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information on the offer's publication marketplaces. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1PublicationMarketplaces { + public static final String SERIALIZED_NAME_BASE = "base"; + @SerializedName(SERIALIZED_NAME_BASE) + @javax.annotation.Nullable + private MarketplaceReference base; + + public static final String SERIALIZED_NAME_ADDITIONAL = "additional"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL) + @javax.annotation.Nullable + private List additional = new ArrayList<>(); + + public OfferListingDtoV1PublicationMarketplaces() { + } + + public OfferListingDtoV1PublicationMarketplaces base(@javax.annotation.Nullable MarketplaceReference base) { + this.base = base; + return this; + } + + /** + * The base marketplace of the offer. + * @return base + */ + @javax.annotation.Nullable + public MarketplaceReference getBase() { + return base; + } + + public void setBase(@javax.annotation.Nullable MarketplaceReference base) { + this.base = base; + } + + + public OfferListingDtoV1PublicationMarketplaces additional(@javax.annotation.Nullable List additional) { + this.additional = additional; + return this; + } + + public OfferListingDtoV1PublicationMarketplaces addAdditionalItem(MarketplaceReference additionalItem) { + if (this.additional == null) { + this.additional = new ArrayList<>(); + } + this.additional.add(additionalItem); + return this; + } + + /** + * Additional marketplaces, on which the offer is to be listed. + * @return additional + */ + @javax.annotation.Nullable + public List getAdditional() { + return additional; + } + + public void setAdditional(@javax.annotation.Nullable List additional) { + this.additional = additional; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1PublicationMarketplaces offerListingDtoV1PublicationMarketplaces = (OfferListingDtoV1PublicationMarketplaces) o; + return Objects.equals(this.base, offerListingDtoV1PublicationMarketplaces.base) && + Objects.equals(this.additional, offerListingDtoV1PublicationMarketplaces.additional); + } + + @Override + public int hashCode() { + return Objects.hash(base, additional); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1PublicationMarketplaces {\n"); + sb.append(" base: ").append(toIndentedString(base)).append("\n"); + sb.append(" additional: ").append(toIndentedString(additional)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("base"); + openapiFields.add("additional"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1PublicationMarketplaces + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1PublicationMarketplaces.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1PublicationMarketplaces is not found in the empty JSON string", OfferListingDtoV1PublicationMarketplaces.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1PublicationMarketplaces.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1PublicationMarketplaces` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `base` + if (jsonObj.get("base") != null && !jsonObj.get("base").isJsonNull()) { + MarketplaceReference.validateJsonElement(jsonObj.get("base")); + } + if (jsonObj.get("additional") != null && !jsonObj.get("additional").isJsonNull()) { + JsonArray jsonArrayadditional = jsonObj.getAsJsonArray("additional"); + if (jsonArrayadditional != null) { + // ensure the json data is an array + if (!jsonObj.get("additional").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additional` to be an array in the JSON string but got `%s`", jsonObj.get("additional").toString())); + } + + // validate the optional field `additional` (array) + for (int i = 0; i < jsonArrayadditional.size(); i++) { + MarketplaceReference.validateJsonElement(jsonArrayadditional.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1PublicationMarketplaces.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1PublicationMarketplaces' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1PublicationMarketplaces.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1PublicationMarketplaces value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1PublicationMarketplaces read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1PublicationMarketplaces given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1PublicationMarketplaces + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1PublicationMarketplaces + */ + public static OfferListingDtoV1PublicationMarketplaces fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1PublicationMarketplaces.class); + } + + /** + * Convert an instance of OfferListingDtoV1PublicationMarketplaces to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1SaleInfo.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1SaleInfo.java new file mode 100644 index 0000000..fb0d6b8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1SaleInfo.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CurrentPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Additional information about offers in auction format. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1SaleInfo { + public static final String SERIALIZED_NAME_CURRENT_PRICE = "currentPrice"; + @SerializedName(SERIALIZED_NAME_CURRENT_PRICE) + @javax.annotation.Nullable + private CurrentPrice currentPrice; + + public static final String SERIALIZED_NAME_BIDDERS_COUNT = "biddersCount"; + @SerializedName(SERIALIZED_NAME_BIDDERS_COUNT) + @javax.annotation.Nullable + private Integer biddersCount; + + public OfferListingDtoV1SaleInfo() { + } + + public OfferListingDtoV1SaleInfo currentPrice(@javax.annotation.Nullable CurrentPrice currentPrice) { + this.currentPrice = currentPrice; + return this; + } + + /** + * Get currentPrice + * @return currentPrice + */ + @javax.annotation.Nullable + public CurrentPrice getCurrentPrice() { + return currentPrice; + } + + public void setCurrentPrice(@javax.annotation.Nullable CurrentPrice currentPrice) { + this.currentPrice = currentPrice; + } + + + public OfferListingDtoV1SaleInfo biddersCount(@javax.annotation.Nullable Integer biddersCount) { + this.biddersCount = biddersCount; + return this; + } + + /** + * The number of bidders. + * minimum: 0 + * @return biddersCount + */ + @javax.annotation.Nullable + public Integer getBiddersCount() { + return biddersCount; + } + + public void setBiddersCount(@javax.annotation.Nullable Integer biddersCount) { + this.biddersCount = biddersCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1SaleInfo offerListingDtoV1SaleInfo = (OfferListingDtoV1SaleInfo) o; + return Objects.equals(this.currentPrice, offerListingDtoV1SaleInfo.currentPrice) && + Objects.equals(this.biddersCount, offerListingDtoV1SaleInfo.biddersCount); + } + + @Override + public int hashCode() { + return Objects.hash(currentPrice, biddersCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1SaleInfo {\n"); + sb.append(" currentPrice: ").append(toIndentedString(currentPrice)).append("\n"); + sb.append(" biddersCount: ").append(toIndentedString(biddersCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("currentPrice"); + openapiFields.add("biddersCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1SaleInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1SaleInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1SaleInfo is not found in the empty JSON string", OfferListingDtoV1SaleInfo.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1SaleInfo.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1SaleInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `currentPrice` + if (jsonObj.get("currentPrice") != null && !jsonObj.get("currentPrice").isJsonNull()) { + CurrentPrice.validateJsonElement(jsonObj.get("currentPrice")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1SaleInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1SaleInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1SaleInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1SaleInfo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1SaleInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1SaleInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1SaleInfo + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1SaleInfo + */ + public static OfferListingDtoV1SaleInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1SaleInfo.class); + } + + /** + * Convert an instance of OfferListingDtoV1SaleInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1SellingMode.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1SellingMode.java new file mode 100644 index 0000000..675f6cd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1SellingMode.java @@ -0,0 +1,336 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BuyNowPrice; +import pl.wtx.allegro.api.client.model.MinimalPrice; +import pl.wtx.allegro.api.client.model.PriceAutomation; +import pl.wtx.allegro.api.client.model.SellingModeFormat; +import pl.wtx.allegro.api.client.model.StartingPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information on the offer's selling mode. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1SellingMode { + public static final String SERIALIZED_NAME_FORMAT = "format"; + @SerializedName(SERIALIZED_NAME_FORMAT) + @javax.annotation.Nullable + private SellingModeFormat format; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private BuyNowPrice price; + + public static final String SERIALIZED_NAME_PRICE_AUTOMATION = "priceAutomation"; + @SerializedName(SERIALIZED_NAME_PRICE_AUTOMATION) + @javax.annotation.Nullable + private PriceAutomation priceAutomation; + + public static final String SERIALIZED_NAME_MINIMAL_PRICE = "minimalPrice"; + @SerializedName(SERIALIZED_NAME_MINIMAL_PRICE) + @javax.annotation.Nullable + private MinimalPrice minimalPrice; + + public static final String SERIALIZED_NAME_STARTING_PRICE = "startingPrice"; + @SerializedName(SERIALIZED_NAME_STARTING_PRICE) + @javax.annotation.Nullable + private StartingPrice startingPrice; + + public OfferListingDtoV1SellingMode() { + } + + public OfferListingDtoV1SellingMode format(@javax.annotation.Nullable SellingModeFormat format) { + this.format = format; + return this; + } + + /** + * Get format + * @return format + */ + @javax.annotation.Nullable + public SellingModeFormat getFormat() { + return format; + } + + public void setFormat(@javax.annotation.Nullable SellingModeFormat format) { + this.format = format; + } + + + public OfferListingDtoV1SellingMode price(@javax.annotation.Nullable BuyNowPrice price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nullable + public BuyNowPrice getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable BuyNowPrice price) { + this.price = price; + } + + + public OfferListingDtoV1SellingMode priceAutomation(@javax.annotation.Nullable PriceAutomation priceAutomation) { + this.priceAutomation = priceAutomation; + return this; + } + + /** + * Get priceAutomation + * @return priceAutomation + */ + @javax.annotation.Nullable + public PriceAutomation getPriceAutomation() { + return priceAutomation; + } + + public void setPriceAutomation(@javax.annotation.Nullable PriceAutomation priceAutomation) { + this.priceAutomation = priceAutomation; + } + + + public OfferListingDtoV1SellingMode minimalPrice(@javax.annotation.Nullable MinimalPrice minimalPrice) { + this.minimalPrice = minimalPrice; + return this; + } + + /** + * Get minimalPrice + * @return minimalPrice + */ + @javax.annotation.Nullable + public MinimalPrice getMinimalPrice() { + return minimalPrice; + } + + public void setMinimalPrice(@javax.annotation.Nullable MinimalPrice minimalPrice) { + this.minimalPrice = minimalPrice; + } + + + public OfferListingDtoV1SellingMode startingPrice(@javax.annotation.Nullable StartingPrice startingPrice) { + this.startingPrice = startingPrice; + return this; + } + + /** + * Get startingPrice + * @return startingPrice + */ + @javax.annotation.Nullable + public StartingPrice getStartingPrice() { + return startingPrice; + } + + public void setStartingPrice(@javax.annotation.Nullable StartingPrice startingPrice) { + this.startingPrice = startingPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1SellingMode offerListingDtoV1SellingMode = (OfferListingDtoV1SellingMode) o; + return Objects.equals(this.format, offerListingDtoV1SellingMode.format) && + Objects.equals(this.price, offerListingDtoV1SellingMode.price) && + Objects.equals(this.priceAutomation, offerListingDtoV1SellingMode.priceAutomation) && + Objects.equals(this.minimalPrice, offerListingDtoV1SellingMode.minimalPrice) && + Objects.equals(this.startingPrice, offerListingDtoV1SellingMode.startingPrice); + } + + @Override + public int hashCode() { + return Objects.hash(format, price, priceAutomation, minimalPrice, startingPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1SellingMode {\n"); + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" priceAutomation: ").append(toIndentedString(priceAutomation)).append("\n"); + sb.append(" minimalPrice: ").append(toIndentedString(minimalPrice)).append("\n"); + sb.append(" startingPrice: ").append(toIndentedString(startingPrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("format"); + openapiFields.add("price"); + openapiFields.add("priceAutomation"); + openapiFields.add("minimalPrice"); + openapiFields.add("startingPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1SellingMode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1SellingMode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1SellingMode is not found in the empty JSON string", OfferListingDtoV1SellingMode.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1SellingMode.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1SellingMode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `format` + if (jsonObj.get("format") != null && !jsonObj.get("format").isJsonNull()) { + SellingModeFormat.validateJsonElement(jsonObj.get("format")); + } + // validate the optional field `price` + if (jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) { + BuyNowPrice.validateJsonElement(jsonObj.get("price")); + } + // validate the optional field `priceAutomation` + if (jsonObj.get("priceAutomation") != null && !jsonObj.get("priceAutomation").isJsonNull()) { + PriceAutomation.validateJsonElement(jsonObj.get("priceAutomation")); + } + // validate the optional field `minimalPrice` + if (jsonObj.get("minimalPrice") != null && !jsonObj.get("minimalPrice").isJsonNull()) { + MinimalPrice.validateJsonElement(jsonObj.get("minimalPrice")); + } + // validate the optional field `startingPrice` + if (jsonObj.get("startingPrice") != null && !jsonObj.get("startingPrice").isJsonNull()) { + StartingPrice.validateJsonElement(jsonObj.get("startingPrice")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1SellingMode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1SellingMode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1SellingMode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1SellingMode value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1SellingMode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1SellingMode given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1SellingMode + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1SellingMode + */ + public static OfferListingDtoV1SellingMode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1SellingMode.class); + } + + /** + * Convert an instance of OfferListingDtoV1SellingMode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Stats.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Stats.java new file mode 100644 index 0000000..7065f97 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Stats.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The offer's statistics on the base marketplace. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1Stats { + public static final String SERIALIZED_NAME_WATCHERS_COUNT = "watchersCount"; + @SerializedName(SERIALIZED_NAME_WATCHERS_COUNT) + @javax.annotation.Nullable + private Integer watchersCount; + + public static final String SERIALIZED_NAME_VISITS_COUNT = "visitsCount"; + @SerializedName(SERIALIZED_NAME_VISITS_COUNT) + @javax.annotation.Nullable + private Integer visitsCount; + + public OfferListingDtoV1Stats() { + } + + public OfferListingDtoV1Stats watchersCount(@javax.annotation.Nullable Integer watchersCount) { + this.watchersCount = watchersCount; + return this; + } + + /** + * The number of users who added this offer to their watch lists. + * minimum: 0 + * @return watchersCount + */ + @javax.annotation.Nullable + public Integer getWatchersCount() { + return watchersCount; + } + + public void setWatchersCount(@javax.annotation.Nullable Integer watchersCount) { + this.watchersCount = watchersCount; + } + + + public OfferListingDtoV1Stats visitsCount(@javax.annotation.Nullable Integer visitsCount) { + this.visitsCount = visitsCount; + return this; + } + + /** + * The number of unique users viewing this offer in the past 30 days. + * minimum: 0 + * @return visitsCount + */ + @javax.annotation.Nullable + public Integer getVisitsCount() { + return visitsCount; + } + + public void setVisitsCount(@javax.annotation.Nullable Integer visitsCount) { + this.visitsCount = visitsCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1Stats offerListingDtoV1Stats = (OfferListingDtoV1Stats) o; + return Objects.equals(this.watchersCount, offerListingDtoV1Stats.watchersCount) && + Objects.equals(this.visitsCount, offerListingDtoV1Stats.visitsCount); + } + + @Override + public int hashCode() { + return Objects.hash(watchersCount, visitsCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1Stats {\n"); + sb.append(" watchersCount: ").append(toIndentedString(watchersCount)).append("\n"); + sb.append(" visitsCount: ").append(toIndentedString(visitsCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("watchersCount"); + openapiFields.add("visitsCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1Stats + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1Stats.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1Stats is not found in the empty JSON string", OfferListingDtoV1Stats.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1Stats.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1Stats` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1Stats.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1Stats' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1Stats.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1Stats value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1Stats read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1Stats given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1Stats + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1Stats + */ + public static OfferListingDtoV1Stats fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1Stats.class); + } + + /** + * Convert an instance of OfferListingDtoV1Stats to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Stock.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Stock.java new file mode 100644 index 0000000..f8a2ae4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferListingDtoV1Stock.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information on the offer's stock. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferListingDtoV1Stock { + public static final String SERIALIZED_NAME_AVAILABLE = "available"; + @SerializedName(SERIALIZED_NAME_AVAILABLE) + @javax.annotation.Nullable + private Integer available; + + public static final String SERIALIZED_NAME_SOLD = "sold"; + @SerializedName(SERIALIZED_NAME_SOLD) + @javax.annotation.Nullable + private Integer sold; + + public OfferListingDtoV1Stock() { + } + + public OfferListingDtoV1Stock available(@javax.annotation.Nullable Integer available) { + this.available = available; + return this; + } + + /** + * The available stock value. + * minimum: 0 + * @return available + */ + @javax.annotation.Nullable + public Integer getAvailable() { + return available; + } + + public void setAvailable(@javax.annotation.Nullable Integer available) { + this.available = available; + } + + + public OfferListingDtoV1Stock sold(@javax.annotation.Nullable Integer sold) { + this.sold = sold; + return this; + } + + /** + * The number of sold items in the last 30 days on the base marketplace. + * minimum: 0 + * @return sold + */ + @javax.annotation.Nullable + public Integer getSold() { + return sold; + } + + public void setSold(@javax.annotation.Nullable Integer sold) { + this.sold = sold; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferListingDtoV1Stock offerListingDtoV1Stock = (OfferListingDtoV1Stock) o; + return Objects.equals(this.available, offerListingDtoV1Stock.available) && + Objects.equals(this.sold, offerListingDtoV1Stock.sold); + } + + @Override + public int hashCode() { + return Objects.hash(available, sold); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferListingDtoV1Stock {\n"); + sb.append(" available: ").append(toIndentedString(available)).append("\n"); + sb.append(" sold: ").append(toIndentedString(sold)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("available"); + openapiFields.add("sold"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferListingDtoV1Stock + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferListingDtoV1Stock.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferListingDtoV1Stock is not found in the empty JSON string", OfferListingDtoV1Stock.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferListingDtoV1Stock.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferListingDtoV1Stock` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferListingDtoV1Stock.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferListingDtoV1Stock' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferListingDtoV1Stock.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferListingDtoV1Stock value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferListingDtoV1Stock read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferListingDtoV1Stock given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferListingDtoV1Stock + * @throws IOException if the JSON string is invalid with respect to OfferListingDtoV1Stock + */ + public static OfferListingDtoV1Stock fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferListingDtoV1Stock.class); + } + + /** + * Convert an instance of OfferListingDtoV1Stock to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferLowestPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferLowestPrice.java new file mode 100644 index 0000000..f3fddd1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferLowestPrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The lowest shipping cost available. Lack of this entity means that the offer has no shipping options (i.e. it is an advertisement or an offer with electronic delivery only). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferLowestPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public OfferLowestPrice() { + } + + public OfferLowestPrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public OfferLowestPrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferLowestPrice offerLowestPrice = (OfferLowestPrice) o; + return Objects.equals(this.amount, offerLowestPrice.amount) && + Objects.equals(this.currency, offerLowestPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferLowestPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferLowestPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferLowestPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferLowestPrice is not found in the empty JSON string", OfferLowestPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferLowestPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferLowestPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferLowestPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferLowestPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferLowestPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferLowestPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferLowestPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferLowestPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferLowestPrice + * @throws IOException if the JSON string is invalid with respect to OfferLowestPrice + */ + public static OfferLowestPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferLowestPrice.class); + } + + /** + * Convert an instance of OfferLowestPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferMarketplacesPriceChanges.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferMarketplacesPriceChanges.java new file mode 100644 index 0000000..3d12e16 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferMarketplacesPriceChanges.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer with marketplace data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferMarketplacesPriceChanges { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_CHANGE_TYPE = "changeType"; + @SerializedName(SERIALIZED_NAME_CHANGE_TYPE) + @javax.annotation.Nullable + private String changeType; + + public OfferMarketplacesPriceChanges() { + } + + public OfferMarketplacesPriceChanges id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of the marketplace on which the price has been changed. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public OfferMarketplacesPriceChanges changeType(@javax.annotation.Nullable String changeType) { + this.changeType = changeType; + return this; + } + + /** + * Change type. One of MANUAL or AUTOMATIC. + * @return changeType + */ + @javax.annotation.Nullable + public String getChangeType() { + return changeType; + } + + public void setChangeType(@javax.annotation.Nullable String changeType) { + this.changeType = changeType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferMarketplacesPriceChanges offerMarketplacesPriceChanges = (OfferMarketplacesPriceChanges) o; + return Objects.equals(this.id, offerMarketplacesPriceChanges.id) && + Objects.equals(this.changeType, offerMarketplacesPriceChanges.changeType); + } + + @Override + public int hashCode() { + return Objects.hash(id, changeType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferMarketplacesPriceChanges {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" changeType: ").append(toIndentedString(changeType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("changeType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferMarketplacesPriceChanges + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferMarketplacesPriceChanges.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferMarketplacesPriceChanges is not found in the empty JSON string", OfferMarketplacesPriceChanges.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferMarketplacesPriceChanges.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferMarketplacesPriceChanges` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("changeType") != null && !jsonObj.get("changeType").isJsonNull()) && !jsonObj.get("changeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `changeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("changeType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferMarketplacesPriceChanges.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferMarketplacesPriceChanges' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferMarketplacesPriceChanges.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferMarketplacesPriceChanges value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferMarketplacesPriceChanges read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferMarketplacesPriceChanges given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferMarketplacesPriceChanges + * @throws IOException if the JSON string is invalid with respect to OfferMarketplacesPriceChanges + */ + public static OfferMarketplacesPriceChanges fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferMarketplacesPriceChanges.class); + } + + /** + * Convert an instance of OfferMarketplacesPriceChanges to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferMarketplacesPublication.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferMarketplacesPublication.java new file mode 100644 index 0000000..62e6522 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferMarketplacesPublication.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.MarketplacesVisibility; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer publication data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferMarketplacesPublication { + public static final String SERIALIZED_NAME_MARKETPLACES = "marketplaces"; + @SerializedName(SERIALIZED_NAME_MARKETPLACES) + @javax.annotation.Nonnull + private MarketplacesVisibility marketplaces; + + public static final String SERIALIZED_NAME_UPDATED_MARKETPLACES = "updatedMarketplaces"; + @SerializedName(SERIALIZED_NAME_UPDATED_MARKETPLACES) + @javax.annotation.Nonnull + private List updatedMarketplaces = new ArrayList<>(); + + public OfferMarketplacesPublication() { + } + + public OfferMarketplacesPublication marketplaces(@javax.annotation.Nonnull MarketplacesVisibility marketplaces) { + this.marketplaces = marketplaces; + return this; + } + + /** + * Get marketplaces + * @return marketplaces + */ + @javax.annotation.Nonnull + public MarketplacesVisibility getMarketplaces() { + return marketplaces; + } + + public void setMarketplaces(@javax.annotation.Nonnull MarketplacesVisibility marketplaces) { + this.marketplaces = marketplaces; + } + + + public OfferMarketplacesPublication updatedMarketplaces(@javax.annotation.Nonnull List updatedMarketplaces) { + this.updatedMarketplaces = updatedMarketplaces; + return this; + } + + public OfferMarketplacesPublication addUpdatedMarketplacesItem(String updatedMarketplacesItem) { + if (this.updatedMarketplaces == null) { + this.updatedMarketplaces = new ArrayList<>(); + } + this.updatedMarketplaces.add(updatedMarketplacesItem); + return this; + } + + /** + * List of marketplaces with updated visibility. + * @return updatedMarketplaces + */ + @javax.annotation.Nonnull + public List getUpdatedMarketplaces() { + return updatedMarketplaces; + } + + public void setUpdatedMarketplaces(@javax.annotation.Nonnull List updatedMarketplaces) { + this.updatedMarketplaces = updatedMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferMarketplacesPublication offerMarketplacesPublication = (OfferMarketplacesPublication) o; + return Objects.equals(this.marketplaces, offerMarketplacesPublication.marketplaces) && + Objects.equals(this.updatedMarketplaces, offerMarketplacesPublication.updatedMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(marketplaces, updatedMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferMarketplacesPublication {\n"); + sb.append(" marketplaces: ").append(toIndentedString(marketplaces)).append("\n"); + sb.append(" updatedMarketplaces: ").append(toIndentedString(updatedMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplaces"); + openapiFields.add("updatedMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("marketplaces"); + openapiRequiredFields.add("updatedMarketplaces"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferMarketplacesPublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferMarketplacesPublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferMarketplacesPublication is not found in the empty JSON string", OfferMarketplacesPublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferMarketplacesPublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferMarketplacesPublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferMarketplacesPublication.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `marketplaces` + MarketplacesVisibility.validateJsonElement(jsonObj.get("marketplaces")); + // ensure the required json array is present + if (jsonObj.get("updatedMarketplaces") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("updatedMarketplaces").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `updatedMarketplaces` to be an array in the JSON string but got `%s`", jsonObj.get("updatedMarketplaces").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferMarketplacesPublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferMarketplacesPublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferMarketplacesPublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferMarketplacesPublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferMarketplacesPublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferMarketplacesPublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferMarketplacesPublication + * @throws IOException if the JSON string is invalid with respect to OfferMarketplacesPublication + */ + public static OfferMarketplacesPublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferMarketplacesPublication.class); + } + + /** + * Convert an instance of OfferMarketplacesPublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferPrice.java new file mode 100644 index 0000000..19de3e6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferPrice.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The price of the offer. It is the buy now price for *BUY_NOW* selling format and current auction price for *AUCTION* format. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public OfferPrice() { + } + + public OfferPrice amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public OfferPrice currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferPrice offerPrice = (OfferPrice) o; + return Objects.equals(this.amount, offerPrice.amount) && + Objects.equals(this.currency, offerPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferPrice is not found in the empty JSON string", OfferPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferPrice + * @throws IOException if the JSON string is invalid with respect to OfferPrice + */ + public static OfferPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferPrice.class); + } + + /** + * Convert an instance of OfferPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferPriceChangeCommand.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferPriceChangeCommand.java new file mode 100644 index 0000000..877d3a9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferPriceChangeCommand.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferCriterium; +import pl.wtx.allegro.api.client.model.PriceModification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Price modification command payload + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferPriceChangeCommand { + public static final String SERIALIZED_NAME_MODIFICATION = "modification"; + @SerializedName(SERIALIZED_NAME_MODIFICATION) + @javax.annotation.Nullable + private PriceModification modification; + + public static final String SERIALIZED_NAME_OFFER_CRITERIA = "offerCriteria"; + @SerializedName(SERIALIZED_NAME_OFFER_CRITERIA) + @javax.annotation.Nullable + private List offerCriteria = new ArrayList<>(); + + public OfferPriceChangeCommand() { + } + + public OfferPriceChangeCommand modification(@javax.annotation.Nullable PriceModification modification) { + this.modification = modification; + return this; + } + + /** + * Get modification + * @return modification + */ + @javax.annotation.Nullable + public PriceModification getModification() { + return modification; + } + + public void setModification(@javax.annotation.Nullable PriceModification modification) { + this.modification = modification; + } + + + public OfferPriceChangeCommand offerCriteria(@javax.annotation.Nullable List offerCriteria) { + this.offerCriteria = offerCriteria; + return this; + } + + public OfferPriceChangeCommand addOfferCriteriaItem(OfferCriterium offerCriteriaItem) { + if (this.offerCriteria == null) { + this.offerCriteria = new ArrayList<>(); + } + this.offerCriteria.add(offerCriteriaItem); + return this; + } + + /** + * List of offer criteria + * @return offerCriteria + */ + @javax.annotation.Nullable + public List getOfferCriteria() { + return offerCriteria; + } + + public void setOfferCriteria(@javax.annotation.Nullable List offerCriteria) { + this.offerCriteria = offerCriteria; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferPriceChangeCommand offerPriceChangeCommand = (OfferPriceChangeCommand) o; + return Objects.equals(this.modification, offerPriceChangeCommand.modification) && + Objects.equals(this.offerCriteria, offerPriceChangeCommand.offerCriteria); + } + + @Override + public int hashCode() { + return Objects.hash(modification, offerCriteria); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferPriceChangeCommand {\n"); + sb.append(" modification: ").append(toIndentedString(modification)).append("\n"); + sb.append(" offerCriteria: ").append(toIndentedString(offerCriteria)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("modification"); + openapiFields.add("offerCriteria"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferPriceChangeCommand + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferPriceChangeCommand.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferPriceChangeCommand is not found in the empty JSON string", OfferPriceChangeCommand.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferPriceChangeCommand.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferPriceChangeCommand` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `modification` + if (jsonObj.get("modification") != null && !jsonObj.get("modification").isJsonNull()) { + PriceModification.validateJsonElement(jsonObj.get("modification")); + } + if (jsonObj.get("offerCriteria") != null && !jsonObj.get("offerCriteria").isJsonNull()) { + JsonArray jsonArrayofferCriteria = jsonObj.getAsJsonArray("offerCriteria"); + if (jsonArrayofferCriteria != null) { + // ensure the json data is an array + if (!jsonObj.get("offerCriteria").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerCriteria` to be an array in the JSON string but got `%s`", jsonObj.get("offerCriteria").toString())); + } + + // validate the optional field `offerCriteria` (array) + for (int i = 0; i < jsonArrayofferCriteria.size(); i++) { + OfferCriterium.validateJsonElement(jsonArrayofferCriteria.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferPriceChangeCommand.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferPriceChangeCommand' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferPriceChangeCommand.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferPriceChangeCommand value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferPriceChangeCommand read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferPriceChangeCommand given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferPriceChangeCommand + * @throws IOException if the JSON string is invalid with respect to OfferPriceChangeCommand + */ + public static OfferPriceChangeCommand fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferPriceChangeCommand.class); + } + + /** + * Convert an instance of OfferPriceChangeCommand to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferPriceChangedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferPriceChangedEvent.java new file mode 100644 index 0000000..47a05e5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferPriceChangedEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferEventExternalOfferForPriceChanges; +import pl.wtx.allegro.api.client.model.SellerOfferBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferPriceChangedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferPriceChangedEvent extends SellerOfferBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "OFFER_PRICE_CHANGED"; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OfferEventExternalOfferForPriceChanges offer; + + public OfferPriceChangedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public OfferPriceChangedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public OfferPriceChangedEvent offer(@javax.annotation.Nonnull OfferEventExternalOfferForPriceChanges offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OfferEventExternalOfferForPriceChanges getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OfferEventExternalOfferForPriceChanges offer) { + this.offer = offer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferPriceChangedEvent offerPriceChangedEvent = (OfferPriceChangedEvent) o; + return Objects.equals(this.type, offerPriceChangedEvent.type) && + Objects.equals(this.offer, offerPriceChangedEvent.offer) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, offer, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferPriceChangedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("offer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferPriceChangedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferPriceChangedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferPriceChangedEvent is not found in the empty JSON string", OfferPriceChangedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferPriceChangedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferPriceChangedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferPriceChangedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferPriceChangedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferPriceChangedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferPriceChangedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferPriceChangedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferPriceChangedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferPriceChangedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferPriceChangedEvent + * @throws IOException if the JSON string is invalid with respect to OfferPriceChangedEvent + */ + public static OfferPriceChangedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferPriceChangedEvent.class); + } + + /** + * Convert an instance of OfferPriceChangedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferProductSetProductReference.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferProductSetProductReference.java new file mode 100644 index 0000000..efec316 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferProductSetProductReference.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Product element definition. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferProductSetProductReference { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private BigDecimal quantity; + + public OfferProductSetProductReference() { + } + + public OfferProductSetProductReference id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Product id. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public OfferProductSetProductReference quantity(@javax.annotation.Nullable BigDecimal quantity) { + this.quantity = quantity; + return this; + } + + /** + * Product quantity in a product set. + * minimum: 1 + * @return quantity + */ + @javax.annotation.Nullable + public BigDecimal getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable BigDecimal quantity) { + this.quantity = quantity; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferProductSetProductReference offerProductSetProductReference = (OfferProductSetProductReference) o; + return Objects.equals(this.id, offerProductSetProductReference.id) && + Objects.equals(this.quantity, offerProductSetProductReference.quantity); + } + + @Override + public int hashCode() { + return Objects.hash(id, quantity); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferProductSetProductReference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("quantity"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferProductSetProductReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferProductSetProductReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferProductSetProductReference is not found in the empty JSON string", OfferProductSetProductReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferProductSetProductReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferProductSetProductReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferProductSetProductReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferProductSetProductReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferProductSetProductReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferProductSetProductReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferProductSetProductReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferProductSetProductReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferProductSetProductReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferProductSetProductReference + * @throws IOException if the JSON string is invalid with respect to OfferProductSetProductReference + */ + public static OfferProductSetProductReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferProductSetProductReference.class); + } + + /** + * Convert an instance of OfferProductSetProductReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferProductSetReference.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferProductSetReference.java new file mode 100644 index 0000000..3ba6bcd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferProductSetReference.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferProductSetProductReference; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * If the offer was a product set, you can see a list of component products (product id with quantity). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferProductSetReference { + public static final String SERIALIZED_NAME_PRODUCTS = "products"; + @SerializedName(SERIALIZED_NAME_PRODUCTS) + @javax.annotation.Nonnull + private List products = new ArrayList<>(); + + public OfferProductSetReference() { + } + + public OfferProductSetReference products(@javax.annotation.Nonnull List products) { + this.products = products; + return this; + } + + public OfferProductSetReference addProductsItem(OfferProductSetProductReference productsItem) { + if (this.products == null) { + this.products = new ArrayList<>(); + } + this.products.add(productsItem); + return this; + } + + /** + * List of products in a product set. + * @return products + */ + @javax.annotation.Nonnull + public List getProducts() { + return products; + } + + public void setProducts(@javax.annotation.Nonnull List products) { + this.products = products; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferProductSetReference offerProductSetReference = (OfferProductSetReference) o; + return Objects.equals(this.products, offerProductSetReference.products); + } + + @Override + public int hashCode() { + return Objects.hash(products); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferProductSetReference {\n"); + sb.append(" products: ").append(toIndentedString(products)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("products"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("products"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferProductSetReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferProductSetReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferProductSetReference is not found in the empty JSON string", OfferProductSetReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferProductSetReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferProductSetReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferProductSetReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("products").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `products` to be an array in the JSON string but got `%s`", jsonObj.get("products").toString())); + } + + JsonArray jsonArrayproducts = jsonObj.getAsJsonArray("products"); + // validate the required field `products` (array) + for (int i = 0; i < jsonArrayproducts.size(); i++) { + OfferProductSetProductReference.validateJsonElement(jsonArrayproducts.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferProductSetReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferProductSetReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferProductSetReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferProductSetReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferProductSetReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferProductSetReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferProductSetReference + * @throws IOException if the JSON string is invalid with respect to OfferProductSetReference + */ + public static OfferProductSetReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferProductSetReference.class); + } + + /** + * Convert an instance of OfferProductSetReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOption.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOption.java new file mode 100644 index 0000000..548cdae --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOption.java @@ -0,0 +1,288 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferPromoOption + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferPromoOption { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_VALID_FROM = "validFrom"; + @SerializedName(SERIALIZED_NAME_VALID_FROM) + @javax.annotation.Nullable + private OffsetDateTime validFrom; + + public static final String SERIALIZED_NAME_VALID_TO = "validTo"; + @SerializedName(SERIALIZED_NAME_VALID_TO) + @javax.annotation.Nullable + private OffsetDateTime validTo; + + public static final String SERIALIZED_NAME_NEXT_CYCLE_DATE = "nextCycleDate"; + @SerializedName(SERIALIZED_NAME_NEXT_CYCLE_DATE) + @javax.annotation.Nullable + private OffsetDateTime nextCycleDate; + + public OfferPromoOption() { + } + + public OfferPromoOption id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Promotion package identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public OfferPromoOption validFrom(@javax.annotation.Nullable OffsetDateTime validFrom) { + this.validFrom = validFrom; + return this; + } + + /** + * Date from which the promotion package is valid: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + * @return validFrom + */ + @javax.annotation.Nullable + public OffsetDateTime getValidFrom() { + return validFrom; + } + + public void setValidFrom(@javax.annotation.Nullable OffsetDateTime validFrom) { + this.validFrom = validFrom; + } + + + public OfferPromoOption validTo(@javax.annotation.Nullable OffsetDateTime validTo) { + this.validTo = validTo; + return this; + } + + /** + * Date to which the promotion package is valid: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + * @return validTo + */ + @javax.annotation.Nullable + public OffsetDateTime getValidTo() { + return validTo; + } + + public void setValidTo(@javax.annotation.Nullable OffsetDateTime validTo) { + this.validTo = validTo; + } + + + public OfferPromoOption nextCycleDate(@javax.annotation.Nullable OffsetDateTime nextCycleDate) { + this.nextCycleDate = nextCycleDate; + return this; + } + + /** + * Date on which the promotion package will be renewed for a new cycle: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + * @return nextCycleDate + */ + @javax.annotation.Nullable + public OffsetDateTime getNextCycleDate() { + return nextCycleDate; + } + + public void setNextCycleDate(@javax.annotation.Nullable OffsetDateTime nextCycleDate) { + this.nextCycleDate = nextCycleDate; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferPromoOption offerPromoOption = (OfferPromoOption) o; + return Objects.equals(this.id, offerPromoOption.id) && + Objects.equals(this.validFrom, offerPromoOption.validFrom) && + Objects.equals(this.validTo, offerPromoOption.validTo) && + Objects.equals(this.nextCycleDate, offerPromoOption.nextCycleDate); + } + + @Override + public int hashCode() { + return Objects.hash(id, validFrom, validTo, nextCycleDate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferPromoOption {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" validFrom: ").append(toIndentedString(validFrom)).append("\n"); + sb.append(" validTo: ").append(toIndentedString(validTo)).append("\n"); + sb.append(" nextCycleDate: ").append(toIndentedString(nextCycleDate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("validFrom"); + openapiFields.add("validTo"); + openapiFields.add("nextCycleDate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferPromoOption + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferPromoOption.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferPromoOption is not found in the empty JSON string", OfferPromoOption.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferPromoOption.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferPromoOption` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferPromoOption.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferPromoOption' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferPromoOption.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferPromoOption value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferPromoOption read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferPromoOption given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferPromoOption + * @throws IOException if the JSON string is invalid with respect to OfferPromoOption + */ + public static OfferPromoOption fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferPromoOption.class); + } + + /** + * Convert an instance of OfferPromoOption to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptions.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptions.java new file mode 100644 index 0000000..0946bc9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptions.java @@ -0,0 +1,401 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.MarketplaceOfferPromoOption; +import pl.wtx.allegro.api.client.model.OfferPromoOption; +import pl.wtx.allegro.api.client.model.OfferPromoOptionsPendingChanges; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferPromoOptions + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferPromoOptions { + public static final String SERIALIZED_NAME_OFFER_ID = "offerId"; + @SerializedName(SERIALIZED_NAME_OFFER_ID) + @javax.annotation.Nullable + private String offerId; + + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + public static final String SERIALIZED_NAME_BASE_PACKAGE = "basePackage"; + @SerializedName(SERIALIZED_NAME_BASE_PACKAGE) + @javax.annotation.Nullable + private OfferPromoOption basePackage; + + public static final String SERIALIZED_NAME_EXTRA_PACKAGES = "extraPackages"; + @SerializedName(SERIALIZED_NAME_EXTRA_PACKAGES) + @javax.annotation.Nullable + private List extraPackages = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PENDING_CHANGES = "pendingChanges"; + @SerializedName(SERIALIZED_NAME_PENDING_CHANGES) + @javax.annotation.Nullable + private OfferPromoOptionsPendingChanges pendingChanges; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private List additionalMarketplaces = new ArrayList<>(); + + public OfferPromoOptions() { + } + + public OfferPromoOptions offerId(@javax.annotation.Nullable String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Offer identifier + * @return offerId + */ + @javax.annotation.Nullable + public String getOfferId() { + return offerId; + } + + public void setOfferId(@javax.annotation.Nullable String offerId) { + this.offerId = offerId; + } + + + public OfferPromoOptions marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * Get marketplaceId + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + public OfferPromoOptions basePackage(@javax.annotation.Nullable OfferPromoOption basePackage) { + this.basePackage = basePackage; + return this; + } + + /** + * Get basePackage + * @return basePackage + */ + @javax.annotation.Nullable + public OfferPromoOption getBasePackage() { + return basePackage; + } + + public void setBasePackage(@javax.annotation.Nullable OfferPromoOption basePackage) { + this.basePackage = basePackage; + } + + + public OfferPromoOptions extraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + return this; + } + + public OfferPromoOptions addExtraPackagesItem(OfferPromoOption extraPackagesItem) { + if (this.extraPackages == null) { + this.extraPackages = new ArrayList<>(); + } + this.extraPackages.add(extraPackagesItem); + return this; + } + + /** + * Extra promotion packages set on offer. + * @return extraPackages + */ + @javax.annotation.Nullable + public List getExtraPackages() { + return extraPackages; + } + + public void setExtraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + } + + + public OfferPromoOptions pendingChanges(@javax.annotation.Nullable OfferPromoOptionsPendingChanges pendingChanges) { + this.pendingChanges = pendingChanges; + return this; + } + + /** + * Get pendingChanges + * @return pendingChanges + */ + @javax.annotation.Nullable + public OfferPromoOptionsPendingChanges getPendingChanges() { + return pendingChanges; + } + + public void setPendingChanges(@javax.annotation.Nullable OfferPromoOptionsPendingChanges pendingChanges) { + this.pendingChanges = pendingChanges; + } + + + public OfferPromoOptions additionalMarketplaces(@javax.annotation.Nullable List additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public OfferPromoOptions addAdditionalMarketplacesItem(MarketplaceOfferPromoOption additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new ArrayList<>(); + } + this.additionalMarketplaces.add(additionalMarketplacesItem); + return this; + } + + /** + * Promo packages on additional marketplaces + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public List getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable List additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferPromoOptions offerPromoOptions = (OfferPromoOptions) o; + return Objects.equals(this.offerId, offerPromoOptions.offerId) && + Objects.equals(this.marketplaceId, offerPromoOptions.marketplaceId) && + Objects.equals(this.basePackage, offerPromoOptions.basePackage) && + Objects.equals(this.extraPackages, offerPromoOptions.extraPackages) && + Objects.equals(this.pendingChanges, offerPromoOptions.pendingChanges) && + Objects.equals(this.additionalMarketplaces, offerPromoOptions.additionalMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(offerId, marketplaceId, basePackage, extraPackages, pendingChanges, additionalMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferPromoOptions {\n"); + sb.append(" offerId: ").append(toIndentedString(offerId)).append("\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append(" basePackage: ").append(toIndentedString(basePackage)).append("\n"); + sb.append(" extraPackages: ").append(toIndentedString(extraPackages)).append("\n"); + sb.append(" pendingChanges: ").append(toIndentedString(pendingChanges)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offerId"); + openapiFields.add("marketplaceId"); + openapiFields.add("basePackage"); + openapiFields.add("extraPackages"); + openapiFields.add("pendingChanges"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferPromoOptions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferPromoOptions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferPromoOptions is not found in the empty JSON string", OfferPromoOptions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferPromoOptions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferPromoOptions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("offerId") != null && !jsonObj.get("offerId").isJsonNull()) && !jsonObj.get("offerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `offerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("offerId").toString())); + } + if ((jsonObj.get("marketplaceId") != null && !jsonObj.get("marketplaceId").isJsonNull()) && !jsonObj.get("marketplaceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("marketplaceId").toString())); + } + // validate the optional field `basePackage` + if (jsonObj.get("basePackage") != null && !jsonObj.get("basePackage").isJsonNull()) { + OfferPromoOption.validateJsonElement(jsonObj.get("basePackage")); + } + if (jsonObj.get("extraPackages") != null && !jsonObj.get("extraPackages").isJsonNull()) { + JsonArray jsonArrayextraPackages = jsonObj.getAsJsonArray("extraPackages"); + if (jsonArrayextraPackages != null) { + // ensure the json data is an array + if (!jsonObj.get("extraPackages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `extraPackages` to be an array in the JSON string but got `%s`", jsonObj.get("extraPackages").toString())); + } + + // validate the optional field `extraPackages` (array) + for (int i = 0; i < jsonArrayextraPackages.size(); i++) { + OfferPromoOption.validateJsonElement(jsonArrayextraPackages.get(i)); + }; + } + } + // validate the optional field `pendingChanges` + if (jsonObj.get("pendingChanges") != null && !jsonObj.get("pendingChanges").isJsonNull()) { + OfferPromoOptionsPendingChanges.validateJsonElement(jsonObj.get("pendingChanges")); + } + if (jsonObj.get("additionalMarketplaces") != null && !jsonObj.get("additionalMarketplaces").isJsonNull()) { + JsonArray jsonArrayadditionalMarketplaces = jsonObj.getAsJsonArray("additionalMarketplaces"); + if (jsonArrayadditionalMarketplaces != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalMarketplaces").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalMarketplaces` to be an array in the JSON string but got `%s`", jsonObj.get("additionalMarketplaces").toString())); + } + + // validate the optional field `additionalMarketplaces` (array) + for (int i = 0; i < jsonArrayadditionalMarketplaces.size(); i++) { + MarketplaceOfferPromoOption.validateJsonElement(jsonArrayadditionalMarketplaces.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferPromoOptions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferPromoOptions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferPromoOptions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferPromoOptions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferPromoOptions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferPromoOptions given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferPromoOptions + * @throws IOException if the JSON string is invalid with respect to OfferPromoOptions + */ + public static OfferPromoOptions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferPromoOptions.class); + } + + /** + * Convert an instance of OfferPromoOptions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptionsForSeller.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptionsForSeller.java new file mode 100644 index 0000000..5a52ee2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptionsForSeller.java @@ -0,0 +1,284 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferPromoOptions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferPromoOptionsForSeller + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferPromoOptionsForSeller { + public static final String SERIALIZED_NAME_PROMO_OPTIONS = "promoOptions"; + @SerializedName(SERIALIZED_NAME_PROMO_OPTIONS) + @javax.annotation.Nullable + private List promoOptions = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private Long totalCount; + + public OfferPromoOptionsForSeller() { + } + + public OfferPromoOptionsForSeller promoOptions(@javax.annotation.Nullable List promoOptions) { + this.promoOptions = promoOptions; + return this; + } + + public OfferPromoOptionsForSeller addPromoOptionsItem(OfferPromoOptions promoOptionsItem) { + if (this.promoOptions == null) { + this.promoOptions = new ArrayList<>(); + } + this.promoOptions.add(promoOptionsItem); + return this; + } + + /** + * Promo options for seller offers. + * @return promoOptions + */ + @javax.annotation.Nullable + public List getPromoOptions() { + return promoOptions; + } + + public void setPromoOptions(@javax.annotation.Nullable List promoOptions) { + this.promoOptions = promoOptions; + } + + + public OfferPromoOptionsForSeller count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Number of returned elements. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public OfferPromoOptionsForSeller totalCount(@javax.annotation.Nullable Long totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of available elements. + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nullable + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable Long totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferPromoOptionsForSeller offerPromoOptionsForSeller = (OfferPromoOptionsForSeller) o; + return Objects.equals(this.promoOptions, offerPromoOptionsForSeller.promoOptions) && + Objects.equals(this.count, offerPromoOptionsForSeller.count) && + Objects.equals(this.totalCount, offerPromoOptionsForSeller.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(promoOptions, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferPromoOptionsForSeller {\n"); + sb.append(" promoOptions: ").append(toIndentedString(promoOptions)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("promoOptions"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferPromoOptionsForSeller + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferPromoOptionsForSeller.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferPromoOptionsForSeller is not found in the empty JSON string", OfferPromoOptionsForSeller.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferPromoOptionsForSeller.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferPromoOptionsForSeller` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("promoOptions") != null && !jsonObj.get("promoOptions").isJsonNull()) { + JsonArray jsonArraypromoOptions = jsonObj.getAsJsonArray("promoOptions"); + if (jsonArraypromoOptions != null) { + // ensure the json data is an array + if (!jsonObj.get("promoOptions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `promoOptions` to be an array in the JSON string but got `%s`", jsonObj.get("promoOptions").toString())); + } + + // validate the optional field `promoOptions` (array) + for (int i = 0; i < jsonArraypromoOptions.size(); i++) { + OfferPromoOptions.validateJsonElement(jsonArraypromoOptions.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferPromoOptionsForSeller.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferPromoOptionsForSeller' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferPromoOptionsForSeller.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferPromoOptionsForSeller value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferPromoOptionsForSeller read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferPromoOptionsForSeller given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferPromoOptionsForSeller + * @throws IOException if the JSON string is invalid with respect to OfferPromoOptionsForSeller + */ + public static OfferPromoOptionsForSeller fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferPromoOptionsForSeller.class); + } + + /** + * Convert an instance of OfferPromoOptionsForSeller to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptionsPendingChanges.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptionsPendingChanges.java new file mode 100644 index 0000000..abeab08 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferPromoOptionsPendingChanges.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferPromoOption; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferPromoOptionsPendingChanges + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferPromoOptionsPendingChanges { + public static final String SERIALIZED_NAME_BASE_PACKAGE = "basePackage"; + @SerializedName(SERIALIZED_NAME_BASE_PACKAGE) + @javax.annotation.Nullable + private OfferPromoOption basePackage; + + public OfferPromoOptionsPendingChanges() { + } + + public OfferPromoOptionsPendingChanges basePackage(@javax.annotation.Nullable OfferPromoOption basePackage) { + this.basePackage = basePackage; + return this; + } + + /** + * Get basePackage + * @return basePackage + */ + @javax.annotation.Nullable + public OfferPromoOption getBasePackage() { + return basePackage; + } + + public void setBasePackage(@javax.annotation.Nullable OfferPromoOption basePackage) { + this.basePackage = basePackage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferPromoOptionsPendingChanges offerPromoOptionsPendingChanges = (OfferPromoOptionsPendingChanges) o; + return Objects.equals(this.basePackage, offerPromoOptionsPendingChanges.basePackage); + } + + @Override + public int hashCode() { + return Objects.hash(basePackage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferPromoOptionsPendingChanges {\n"); + sb.append(" basePackage: ").append(toIndentedString(basePackage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("basePackage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferPromoOptionsPendingChanges + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferPromoOptionsPendingChanges.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferPromoOptionsPendingChanges is not found in the empty JSON string", OfferPromoOptionsPendingChanges.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferPromoOptionsPendingChanges.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferPromoOptionsPendingChanges` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `basePackage` + if (jsonObj.get("basePackage") != null && !jsonObj.get("basePackage").isJsonNull()) { + OfferPromoOption.validateJsonElement(jsonObj.get("basePackage")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferPromoOptionsPendingChanges.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferPromoOptionsPendingChanges' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferPromoOptionsPendingChanges.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferPromoOptionsPendingChanges value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferPromoOptionsPendingChanges read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferPromoOptionsPendingChanges given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferPromoOptionsPendingChanges + * @throws IOException if the JSON string is invalid with respect to OfferPromoOptionsPendingChanges + */ + public static OfferPromoOptionsPendingChanges fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferPromoOptionsPendingChanges.class); + } + + /** + * Convert an instance of OfferPromoOptionsPendingChanges to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferPromotion.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferPromotion.java new file mode 100644 index 0000000..5ebb8ab --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferPromotion.java @@ -0,0 +1,257 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about promotion options for the item. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferPromotion { + public static final String SERIALIZED_NAME_EMPHASIZED = "emphasized"; + @SerializedName(SERIALIZED_NAME_EMPHASIZED) + @javax.annotation.Nullable + private Boolean emphasized; + + public static final String SERIALIZED_NAME_BOLD = "bold"; + @SerializedName(SERIALIZED_NAME_BOLD) + @javax.annotation.Nullable + private Boolean bold; + + public static final String SERIALIZED_NAME_HIGHLIGHT = "highlight"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT) + @javax.annotation.Nullable + private Boolean highlight; + + public OfferPromotion() { + } + + public OfferPromotion emphasized(@javax.annotation.Nullable Boolean emphasized) { + this.emphasized = emphasized; + return this; + } + + /** + * Indicates whether the offer is promoted. + * @return emphasized + */ + @javax.annotation.Nullable + public Boolean getEmphasized() { + return emphasized; + } + + public void setEmphasized(@javax.annotation.Nullable Boolean emphasized) { + this.emphasized = emphasized; + } + + + public OfferPromotion bold(@javax.annotation.Nullable Boolean bold) { + this.bold = bold; + return this; + } + + /** + * Indicates whether the offer has bold title option. + * @return bold + */ + @javax.annotation.Nullable + public Boolean getBold() { + return bold; + } + + public void setBold(@javax.annotation.Nullable Boolean bold) { + this.bold = bold; + } + + + public OfferPromotion highlight(@javax.annotation.Nullable Boolean highlight) { + this.highlight = highlight; + return this; + } + + /** + * Indicates whether the offer has highlight option. + * @return highlight + */ + @javax.annotation.Nullable + public Boolean getHighlight() { + return highlight; + } + + public void setHighlight(@javax.annotation.Nullable Boolean highlight) { + this.highlight = highlight; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferPromotion offerPromotion = (OfferPromotion) o; + return Objects.equals(this.emphasized, offerPromotion.emphasized) && + Objects.equals(this.bold, offerPromotion.bold) && + Objects.equals(this.highlight, offerPromotion.highlight); + } + + @Override + public int hashCode() { + return Objects.hash(emphasized, bold, highlight); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferPromotion {\n"); + sb.append(" emphasized: ").append(toIndentedString(emphasized)).append("\n"); + sb.append(" bold: ").append(toIndentedString(bold)).append("\n"); + sb.append(" highlight: ").append(toIndentedString(highlight)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("emphasized"); + openapiFields.add("bold"); + openapiFields.add("highlight"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferPromotion + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferPromotion.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferPromotion is not found in the empty JSON string", OfferPromotion.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferPromotion.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferPromotion` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferPromotion.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferPromotion' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferPromotion.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferPromotion value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferPromotion read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferPromotion given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferPromotion + * @throws IOException if the JSON string is invalid with respect to OfferPromotion + */ + public static OfferPromotion fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferPromotion.class); + } + + /** + * Convert an instance of OfferPromotion to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferPublication.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferPublication.java new file mode 100644 index 0000000..30ebfca --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferPublication.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * This section is available only for offers with a defined end of publication. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferPublication { + public static final String SERIALIZED_NAME_ENDING_AT = "endingAt"; + @SerializedName(SERIALIZED_NAME_ENDING_AT) + @javax.annotation.Nullable + private String endingAt; + + public OfferPublication() { + } + + public OfferPublication endingAt(@javax.annotation.Nullable String endingAt) { + this.endingAt = endingAt; + return this; + } + + /** + * Publication ending date and time in UTC. + * @return endingAt + */ + @javax.annotation.Nullable + public String getEndingAt() { + return endingAt; + } + + public void setEndingAt(@javax.annotation.Nullable String endingAt) { + this.endingAt = endingAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferPublication offerPublication = (OfferPublication) o; + return Objects.equals(this.endingAt, offerPublication.endingAt); + } + + @Override + public int hashCode() { + return Objects.hash(endingAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferPublication {\n"); + sb.append(" endingAt: ").append(toIndentedString(endingAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("endingAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferPublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferPublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferPublication is not found in the empty JSON string", OfferPublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferPublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferPublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("endingAt") != null && !jsonObj.get("endingAt").isJsonNull()) && !jsonObj.get("endingAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `endingAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endingAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferPublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferPublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferPublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferPublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferPublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferPublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferPublication + * @throws IOException if the JSON string is invalid with respect to OfferPublication + */ + public static OfferPublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferPublication.class); + } + + /** + * Convert an instance of OfferPublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferQuantityChangeCommand.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferQuantityChangeCommand.java new file mode 100644 index 0000000..23d143d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferQuantityChangeCommand.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferCriterium; +import pl.wtx.allegro.api.client.model.QuantityModification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Quantity modification command payload + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferQuantityChangeCommand { + public static final String SERIALIZED_NAME_MODIFICATION = "modification"; + @SerializedName(SERIALIZED_NAME_MODIFICATION) + @javax.annotation.Nullable + private QuantityModification modification; + + public static final String SERIALIZED_NAME_OFFER_CRITERIA = "offerCriteria"; + @SerializedName(SERIALIZED_NAME_OFFER_CRITERIA) + @javax.annotation.Nullable + private List offerCriteria = new ArrayList<>(); + + public OfferQuantityChangeCommand() { + } + + public OfferQuantityChangeCommand modification(@javax.annotation.Nullable QuantityModification modification) { + this.modification = modification; + return this; + } + + /** + * Get modification + * @return modification + */ + @javax.annotation.Nullable + public QuantityModification getModification() { + return modification; + } + + public void setModification(@javax.annotation.Nullable QuantityModification modification) { + this.modification = modification; + } + + + public OfferQuantityChangeCommand offerCriteria(@javax.annotation.Nullable List offerCriteria) { + this.offerCriteria = offerCriteria; + return this; + } + + public OfferQuantityChangeCommand addOfferCriteriaItem(OfferCriterium offerCriteriaItem) { + if (this.offerCriteria == null) { + this.offerCriteria = new ArrayList<>(); + } + this.offerCriteria.add(offerCriteriaItem); + return this; + } + + /** + * List of offer criteria + * @return offerCriteria + */ + @javax.annotation.Nullable + public List getOfferCriteria() { + return offerCriteria; + } + + public void setOfferCriteria(@javax.annotation.Nullable List offerCriteria) { + this.offerCriteria = offerCriteria; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferQuantityChangeCommand offerQuantityChangeCommand = (OfferQuantityChangeCommand) o; + return Objects.equals(this.modification, offerQuantityChangeCommand.modification) && + Objects.equals(this.offerCriteria, offerQuantityChangeCommand.offerCriteria); + } + + @Override + public int hashCode() { + return Objects.hash(modification, offerCriteria); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferQuantityChangeCommand {\n"); + sb.append(" modification: ").append(toIndentedString(modification)).append("\n"); + sb.append(" offerCriteria: ").append(toIndentedString(offerCriteria)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("modification"); + openapiFields.add("offerCriteria"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferQuantityChangeCommand + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferQuantityChangeCommand.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferQuantityChangeCommand is not found in the empty JSON string", OfferQuantityChangeCommand.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferQuantityChangeCommand.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferQuantityChangeCommand` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `modification` + if (jsonObj.get("modification") != null && !jsonObj.get("modification").isJsonNull()) { + QuantityModification.validateJsonElement(jsonObj.get("modification")); + } + if (jsonObj.get("offerCriteria") != null && !jsonObj.get("offerCriteria").isJsonNull()) { + JsonArray jsonArrayofferCriteria = jsonObj.getAsJsonArray("offerCriteria"); + if (jsonArrayofferCriteria != null) { + // ensure the json data is an array + if (!jsonObj.get("offerCriteria").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerCriteria` to be an array in the JSON string but got `%s`", jsonObj.get("offerCriteria").toString())); + } + + // validate the optional field `offerCriteria` (array) + for (int i = 0; i < jsonArrayofferCriteria.size(); i++) { + OfferCriterium.validateJsonElement(jsonArrayofferCriteria.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferQuantityChangeCommand.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferQuantityChangeCommand' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferQuantityChangeCommand.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferQuantityChangeCommand value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferQuantityChangeCommand read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferQuantityChangeCommand given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferQuantityChangeCommand + * @throws IOException if the JSON string is invalid with respect to OfferQuantityChangeCommand + */ + public static OfferQuantityChangeCommand fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferQuantityChangeCommand.class); + } + + /** + * Convert an instance of OfferQuantityChangeCommand to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferQuoteDto.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferQuoteDto.java new file mode 100644 index 0000000..a7ea808 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferQuoteDto.java @@ -0,0 +1,355 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Fee; +import pl.wtx.allegro.api.client.model.OfferId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferQuoteDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferQuoteDto { + public static final String SERIALIZED_NAME_ENABLED = "enabled"; + @SerializedName(SERIALIZED_NAME_ENABLED) + @javax.annotation.Nullable + private Boolean enabled; + + public static final String SERIALIZED_NAME_FEE = "fee"; + @SerializedName(SERIALIZED_NAME_FEE) + @javax.annotation.Nullable + private Fee fee; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_NEXT_DATE = "nextDate"; + @SerializedName(SERIALIZED_NAME_NEXT_DATE) + @javax.annotation.Nullable + private OffsetDateTime nextDate; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private OfferId offer; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public OfferQuoteDto() { + } + + public OfferQuoteDto enabled(@javax.annotation.Nullable Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get enabled + * @return enabled + */ + @javax.annotation.Nullable + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(@javax.annotation.Nullable Boolean enabled) { + this.enabled = enabled; + } + + + public OfferQuoteDto fee(@javax.annotation.Nullable Fee fee) { + this.fee = fee; + return this; + } + + /** + * Get fee + * @return fee + */ + @javax.annotation.Nullable + public Fee getFee() { + return fee; + } + + public void setFee(@javax.annotation.Nullable Fee fee) { + this.fee = fee; + } + + + public OfferQuoteDto name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public OfferQuoteDto nextDate(@javax.annotation.Nullable OffsetDateTime nextDate) { + this.nextDate = nextDate; + return this; + } + + /** + * Get nextDate + * @return nextDate + */ + @javax.annotation.Nullable + public OffsetDateTime getNextDate() { + return nextDate; + } + + public void setNextDate(@javax.annotation.Nullable OffsetDateTime nextDate) { + this.nextDate = nextDate; + } + + + public OfferQuoteDto offer(@javax.annotation.Nullable OfferId offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public OfferId getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable OfferId offer) { + this.offer = offer; + } + + + public OfferQuoteDto type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferQuoteDto offerQuoteDto = (OfferQuoteDto) o; + return Objects.equals(this.enabled, offerQuoteDto.enabled) && + Objects.equals(this.fee, offerQuoteDto.fee) && + Objects.equals(this.name, offerQuoteDto.name) && + Objects.equals(this.nextDate, offerQuoteDto.nextDate) && + Objects.equals(this.offer, offerQuoteDto.offer) && + Objects.equals(this.type, offerQuoteDto.type); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, fee, name, nextDate, offer, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferQuoteDto {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" nextDate: ").append(toIndentedString(nextDate)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("enabled"); + openapiFields.add("fee"); + openapiFields.add("name"); + openapiFields.add("nextDate"); + openapiFields.add("offer"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferQuoteDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferQuoteDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferQuoteDto is not found in the empty JSON string", OfferQuoteDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferQuoteDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferQuoteDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `fee` + if (jsonObj.get("fee") != null && !jsonObj.get("fee").isJsonNull()) { + Fee.validateJsonElement(jsonObj.get("fee")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + OfferId.validateJsonElement(jsonObj.get("offer")); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferQuoteDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferQuoteDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferQuoteDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferQuoteDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferQuoteDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferQuoteDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferQuoteDto + * @throws IOException if the JSON string is invalid with respect to OfferQuoteDto + */ + public static OfferQuoteDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferQuoteDto.class); + } + + /** + * Convert an instance of OfferQuoteDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferQuotesDto.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferQuotesDto.java new file mode 100644 index 0000000..fb07a74 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferQuotesDto.java @@ -0,0 +1,256 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferQuoteDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferQuotesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferQuotesDto { + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_QUOTES = "quotes"; + @SerializedName(SERIALIZED_NAME_QUOTES) + @javax.annotation.Nullable + private List quotes = new ArrayList<>(); + + public OfferQuotesDto() { + } + + public OfferQuotesDto count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public OfferQuotesDto quotes(@javax.annotation.Nullable List quotes) { + this.quotes = quotes; + return this; + } + + public OfferQuotesDto addQuotesItem(OfferQuoteDto quotesItem) { + if (this.quotes == null) { + this.quotes = new ArrayList<>(); + } + this.quotes.add(quotesItem); + return this; + } + + /** + * Get quotes + * @return quotes + */ + @javax.annotation.Nullable + public List getQuotes() { + return quotes; + } + + public void setQuotes(@javax.annotation.Nullable List quotes) { + this.quotes = quotes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferQuotesDto offerQuotesDto = (OfferQuotesDto) o; + return Objects.equals(this.count, offerQuotesDto.count) && + Objects.equals(this.quotes, offerQuotesDto.quotes); + } + + @Override + public int hashCode() { + return Objects.hash(count, quotes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferQuotesDto {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" quotes: ").append(toIndentedString(quotes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("count"); + openapiFields.add("quotes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferQuotesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferQuotesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferQuotesDto is not found in the empty JSON string", OfferQuotesDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferQuotesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferQuotesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("quotes") != null && !jsonObj.get("quotes").isJsonNull()) { + JsonArray jsonArrayquotes = jsonObj.getAsJsonArray("quotes"); + if (jsonArrayquotes != null) { + // ensure the json data is an array + if (!jsonObj.get("quotes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `quotes` to be an array in the JSON string but got `%s`", jsonObj.get("quotes").toString())); + } + + // validate the optional field `quotes` (array) + for (int i = 0; i < jsonArrayquotes.size(); i++) { + OfferQuoteDto.validateJsonElement(jsonArrayquotes.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferQuotesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferQuotesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferQuotesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferQuotesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferQuotesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferQuotesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferQuotesDto + * @throws IOException if the JSON string is invalid with respect to OfferQuotesDto + */ + public static OfferQuotesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferQuotesDto.class); + } + + /** + * Convert an instance of OfferQuotesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferRating.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferRating.java new file mode 100644 index 0000000..08f4446 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferRating.java @@ -0,0 +1,336 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferRatingScoreDistributionInner; +import pl.wtx.allegro.api.client.model.OfferRatingSizeFeedbackInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferRating + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferRating { + public static final String SERIALIZED_NAME_AVERAGE_SCORE = "averageScore"; + @SerializedName(SERIALIZED_NAME_AVERAGE_SCORE) + @javax.annotation.Nullable + private String averageScore; + + public static final String SERIALIZED_NAME_SCORE_DISTRIBUTION = "scoreDistribution"; + @SerializedName(SERIALIZED_NAME_SCORE_DISTRIBUTION) + @javax.annotation.Nullable + private List scoreDistribution = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TOTAL_RESPONSES = "totalResponses"; + @SerializedName(SERIALIZED_NAME_TOTAL_RESPONSES) + @javax.annotation.Nullable + private Integer totalResponses; + + public static final String SERIALIZED_NAME_SIZE_FEEDBACK = "sizeFeedback"; + @SerializedName(SERIALIZED_NAME_SIZE_FEEDBACK) + @javax.annotation.Nullable + private List sizeFeedback = new ArrayList<>(); + + public OfferRating() { + } + + public OfferRating averageScore(@javax.annotation.Nullable String averageScore) { + this.averageScore = averageScore; + return this; + } + + /** + * Average score of offer rating. + * @return averageScore + */ + @javax.annotation.Nullable + public String getAverageScore() { + return averageScore; + } + + public void setAverageScore(@javax.annotation.Nullable String averageScore) { + this.averageScore = averageScore; + } + + + public OfferRating scoreDistribution(@javax.annotation.Nullable List scoreDistribution) { + this.scoreDistribution = scoreDistribution; + return this; + } + + public OfferRating addScoreDistributionItem(OfferRatingScoreDistributionInner scoreDistributionItem) { + if (this.scoreDistribution == null) { + this.scoreDistribution = new ArrayList<>(); + } + this.scoreDistribution.add(scoreDistributionItem); + return this; + } + + /** + * List score distribution with count. + * @return scoreDistribution + */ + @javax.annotation.Nullable + public List getScoreDistribution() { + return scoreDistribution; + } + + public void setScoreDistribution(@javax.annotation.Nullable List scoreDistribution) { + this.scoreDistribution = scoreDistribution; + } + + + public OfferRating totalResponses(@javax.annotation.Nullable Integer totalResponses) { + this.totalResponses = totalResponses; + return this; + } + + /** + * Number of total responses. + * minimum: 0 + * @return totalResponses + */ + @javax.annotation.Nullable + public Integer getTotalResponses() { + return totalResponses; + } + + public void setTotalResponses(@javax.annotation.Nullable Integer totalResponses) { + this.totalResponses = totalResponses; + } + + + public OfferRating sizeFeedback(@javax.annotation.Nullable List sizeFeedback) { + this.sizeFeedback = sizeFeedback; + return this; + } + + public OfferRating addSizeFeedbackItem(OfferRatingSizeFeedbackInner sizeFeedbackItem) { + if (this.sizeFeedback == null) { + this.sizeFeedback = new ArrayList<>(); + } + this.sizeFeedback.add(sizeFeedbackItem); + return this; + } + + /** + * List of size feedback. + * @return sizeFeedback + */ + @javax.annotation.Nullable + public List getSizeFeedback() { + return sizeFeedback; + } + + public void setSizeFeedback(@javax.annotation.Nullable List sizeFeedback) { + this.sizeFeedback = sizeFeedback; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferRating offerRating = (OfferRating) o; + return Objects.equals(this.averageScore, offerRating.averageScore) && + Objects.equals(this.scoreDistribution, offerRating.scoreDistribution) && + Objects.equals(this.totalResponses, offerRating.totalResponses) && + Objects.equals(this.sizeFeedback, offerRating.sizeFeedback); + } + + @Override + public int hashCode() { + return Objects.hash(averageScore, scoreDistribution, totalResponses, sizeFeedback); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferRating {\n"); + sb.append(" averageScore: ").append(toIndentedString(averageScore)).append("\n"); + sb.append(" scoreDistribution: ").append(toIndentedString(scoreDistribution)).append("\n"); + sb.append(" totalResponses: ").append(toIndentedString(totalResponses)).append("\n"); + sb.append(" sizeFeedback: ").append(toIndentedString(sizeFeedback)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("averageScore"); + openapiFields.add("scoreDistribution"); + openapiFields.add("totalResponses"); + openapiFields.add("sizeFeedback"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferRating + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferRating.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferRating is not found in the empty JSON string", OfferRating.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferRating.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferRating` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("averageScore") != null && !jsonObj.get("averageScore").isJsonNull()) && !jsonObj.get("averageScore").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `averageScore` to be a primitive type in the JSON string but got `%s`", jsonObj.get("averageScore").toString())); + } + if (jsonObj.get("scoreDistribution") != null && !jsonObj.get("scoreDistribution").isJsonNull()) { + JsonArray jsonArrayscoreDistribution = jsonObj.getAsJsonArray("scoreDistribution"); + if (jsonArrayscoreDistribution != null) { + // ensure the json data is an array + if (!jsonObj.get("scoreDistribution").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `scoreDistribution` to be an array in the JSON string but got `%s`", jsonObj.get("scoreDistribution").toString())); + } + + // validate the optional field `scoreDistribution` (array) + for (int i = 0; i < jsonArrayscoreDistribution.size(); i++) { + OfferRatingScoreDistributionInner.validateJsonElement(jsonArrayscoreDistribution.get(i)); + }; + } + } + if (jsonObj.get("sizeFeedback") != null && !jsonObj.get("sizeFeedback").isJsonNull()) { + JsonArray jsonArraysizeFeedback = jsonObj.getAsJsonArray("sizeFeedback"); + if (jsonArraysizeFeedback != null) { + // ensure the json data is an array + if (!jsonObj.get("sizeFeedback").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `sizeFeedback` to be an array in the JSON string but got `%s`", jsonObj.get("sizeFeedback").toString())); + } + + // validate the optional field `sizeFeedback` (array) + for (int i = 0; i < jsonArraysizeFeedback.size(); i++) { + OfferRatingSizeFeedbackInner.validateJsonElement(jsonArraysizeFeedback.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferRating.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferRating' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferRating.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferRating value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferRating read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferRating given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferRating + * @throws IOException if the JSON string is invalid with respect to OfferRating + */ + public static OfferRating fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferRating.class); + } + + /** + * Convert an instance of OfferRating to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferRatingScoreDistributionInner.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferRatingScoreDistributionInner.java new file mode 100644 index 0000000..b539faa --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferRatingScoreDistributionInner.java @@ -0,0 +1,234 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferRatingScoreDistributionInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferRatingScoreDistributionInner { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public OfferRatingScoreDistributionInner() { + } + + public OfferRatingScoreDistributionInner name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Identifier of score: 5, 4, 3, 2, 1. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public OfferRatingScoreDistributionInner count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Count of score. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferRatingScoreDistributionInner offerRatingScoreDistributionInner = (OfferRatingScoreDistributionInner) o; + return Objects.equals(this.name, offerRatingScoreDistributionInner.name) && + Objects.equals(this.count, offerRatingScoreDistributionInner.count); + } + + @Override + public int hashCode() { + return Objects.hash(name, count); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferRatingScoreDistributionInner {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("count"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferRatingScoreDistributionInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferRatingScoreDistributionInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferRatingScoreDistributionInner is not found in the empty JSON string", OfferRatingScoreDistributionInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferRatingScoreDistributionInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferRatingScoreDistributionInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferRatingScoreDistributionInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferRatingScoreDistributionInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferRatingScoreDistributionInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferRatingScoreDistributionInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferRatingScoreDistributionInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferRatingScoreDistributionInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferRatingScoreDistributionInner + * @throws IOException if the JSON string is invalid with respect to OfferRatingScoreDistributionInner + */ + public static OfferRatingScoreDistributionInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferRatingScoreDistributionInner.class); + } + + /** + * Convert an instance of OfferRatingScoreDistributionInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferRatingSizeFeedbackInner.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferRatingSizeFeedbackInner.java new file mode 100644 index 0000000..79925f6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferRatingSizeFeedbackInner.java @@ -0,0 +1,234 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferRatingSizeFeedbackInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferRatingSizeFeedbackInner { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public OfferRatingSizeFeedbackInner() { + } + + public OfferRatingSizeFeedbackInner name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Identifier of sizeFeedback: BIGGER, FIT, SMALLER. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public OfferRatingSizeFeedbackInner count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Count of sizeFeedback responses. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferRatingSizeFeedbackInner offerRatingSizeFeedbackInner = (OfferRatingSizeFeedbackInner) o; + return Objects.equals(this.name, offerRatingSizeFeedbackInner.name) && + Objects.equals(this.count, offerRatingSizeFeedbackInner.count); + } + + @Override + public int hashCode() { + return Objects.hash(name, count); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferRatingSizeFeedbackInner {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("count"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferRatingSizeFeedbackInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferRatingSizeFeedbackInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferRatingSizeFeedbackInner is not found in the empty JSON string", OfferRatingSizeFeedbackInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferRatingSizeFeedbackInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferRatingSizeFeedbackInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferRatingSizeFeedbackInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferRatingSizeFeedbackInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferRatingSizeFeedbackInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferRatingSizeFeedbackInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferRatingSizeFeedbackInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferRatingSizeFeedbackInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferRatingSizeFeedbackInner + * @throws IOException if the JSON string is invalid with respect to OfferRatingSizeFeedbackInner + */ + public static OfferRatingSizeFeedbackInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferRatingSizeFeedbackInner.class); + } + + /** + * Convert an instance of OfferRatingSizeFeedbackInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferReference.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferReference.java new file mode 100644 index 0000000..1210db4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferReference.java @@ -0,0 +1,309 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ExternalId; +import pl.wtx.allegro.api.client.model.OfferProductSetReference; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer identifier. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferReference { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nullable + private ExternalId external; + + public static final String SERIALIZED_NAME_PRODUCT_SET = "productSet"; + @SerializedName(SERIALIZED_NAME_PRODUCT_SET) + @javax.annotation.Nullable + private OfferProductSetReference productSet; + + public OfferReference() { + } + + public OfferReference id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public OfferReference name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Offer name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public OfferReference external(@javax.annotation.Nullable ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nullable + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nullable ExternalId external) { + this.external = external; + } + + + public OfferReference productSet(@javax.annotation.Nullable OfferProductSetReference productSet) { + this.productSet = productSet; + return this; + } + + /** + * Get productSet + * @return productSet + */ + @javax.annotation.Nullable + public OfferProductSetReference getProductSet() { + return productSet; + } + + public void setProductSet(@javax.annotation.Nullable OfferProductSetReference productSet) { + this.productSet = productSet; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferReference offerReference = (OfferReference) o; + return Objects.equals(this.id, offerReference.id) && + Objects.equals(this.name, offerReference.name) && + Objects.equals(this.external, offerReference.external) && + Objects.equals(this.productSet, offerReference.productSet); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, external, productSet); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferReference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append(" productSet: ").append(toIndentedString(productSet)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("external"); + openapiFields.add("productSet"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferReference is not found in the empty JSON string", OfferReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `external` + if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { + ExternalId.validateJsonElement(jsonObj.get("external")); + } + // validate the optional field `productSet` + if (jsonObj.get("productSet") != null && !jsonObj.get("productSet").isJsonNull()) { + OfferProductSetReference.validateJsonElement(jsonObj.get("productSet")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferReference + * @throws IOException if the JSON string is invalid with respect to OfferReference + */ + public static OfferReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferReference.class); + } + + /** + * Convert an instance of OfferReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferRequirements.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferRequirements.java new file mode 100644 index 0000000..a56e885 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferRequirements.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ProductParameterDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Conditions which an offer must meet to be assigned with the product, i.e. Condition parameter must be set to New. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferRequirements { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public OfferRequirements() { + } + + public OfferRequirements id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The id of the offer that can be associated with this product. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public OfferRequirements parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public OfferRequirements addParametersItem(ProductParameterDto parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Get parameters + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferRequirements offerRequirements = (OfferRequirements) o; + return Objects.equals(this.id, offerRequirements.id) && + Objects.equals(this.parameters, offerRequirements.parameters); + } + + @Override + public int hashCode() { + return Objects.hash(id, parameters); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferRequirements {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("parameters"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferRequirements + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferRequirements.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferRequirements is not found in the empty JSON string", OfferRequirements.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferRequirements.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferRequirements` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ProductParameterDto.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferRequirements.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferRequirements' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferRequirements.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferRequirements value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferRequirements read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferRequirements given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferRequirements + * @throws IOException if the JSON string is invalid with respect to OfferRequirements + */ + public static OfferRequirements fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferRequirements.class); + } + + /** + * Convert an instance of OfferRequirements to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferRules.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferRules.java new file mode 100644 index 0000000..bc853ac --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferRules.java @@ -0,0 +1,261 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferRulesRulesInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferRules + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferRules { + public static final String SERIALIZED_NAME_RULES = "rules"; + @SerializedName(SERIALIZED_NAME_RULES) + @javax.annotation.Nonnull + private List rules = new ArrayList<>(); + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime updatedAt; + + public OfferRules() { + } + + public OfferRules rules(@javax.annotation.Nonnull List rules) { + this.rules = rules; + return this; + } + + public OfferRules addRulesItem(OfferRulesRulesInner rulesItem) { + if (this.rules == null) { + this.rules = new ArrayList<>(); + } + this.rules.add(rulesItem); + return this; + } + + /** + * List of assigned rules. + * @return rules + */ + @javax.annotation.Nonnull + public List getRules() { + return rules; + } + + public void setRules(@javax.annotation.Nonnull List rules) { + this.rules = rules; + } + + + public OfferRules updatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The date the rule assignments to offer were last modified in ISO 8601 format. + * @return updatedAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferRules offerRules = (OfferRules) o; + return Objects.equals(this.rules, offerRules.rules) && + Objects.equals(this.updatedAt, offerRules.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(rules, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferRules {\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rules"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("rules"); + openapiRequiredFields.add("updatedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferRules + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferRules.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferRules is not found in the empty JSON string", OfferRules.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferRules.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferRules` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferRules.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("rules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rules` to be an array in the JSON string but got `%s`", jsonObj.get("rules").toString())); + } + + JsonArray jsonArrayrules = jsonObj.getAsJsonArray("rules"); + // validate the required field `rules` (array) + for (int i = 0; i < jsonArrayrules.size(); i++) { + OfferRulesRulesInner.validateJsonElement(jsonArrayrules.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferRules.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferRules' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferRules.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferRules value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferRules read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferRules given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferRules + * @throws IOException if the JSON string is invalid with respect to OfferRules + */ + public static OfferRules fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferRules.class); + } + + /** + * Convert an instance of OfferRules to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInner.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInner.java new file mode 100644 index 0000000..a386dd6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInner.java @@ -0,0 +1,306 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AutomaticPricingOfferRuleConfiguration; +import pl.wtx.allegro.api.client.model.OfferRulesRulesInnerMarketplace; +import pl.wtx.allegro.api.client.model.OfferRulesRulesInnerRule; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferRulesRulesInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferRulesRulesInner { + public static final String SERIALIZED_NAME_MARKETPLACE = "marketplace"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE) + @javax.annotation.Nonnull + private OfferRulesRulesInnerMarketplace marketplace; + + public static final String SERIALIZED_NAME_RULE = "rule"; + @SerializedName(SERIALIZED_NAME_RULE) + @javax.annotation.Nonnull + private OfferRulesRulesInnerRule rule; + + public static final String SERIALIZED_NAME_CONFIGURATION = "configuration"; + @SerializedName(SERIALIZED_NAME_CONFIGURATION) + @javax.annotation.Nullable + private AutomaticPricingOfferRuleConfiguration _configuration; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime updatedAt; + + public OfferRulesRulesInner() { + } + + public OfferRulesRulesInner marketplace(@javax.annotation.Nonnull OfferRulesRulesInnerMarketplace marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get marketplace + * @return marketplace + */ + @javax.annotation.Nonnull + public OfferRulesRulesInnerMarketplace getMarketplace() { + return marketplace; + } + + public void setMarketplace(@javax.annotation.Nonnull OfferRulesRulesInnerMarketplace marketplace) { + this.marketplace = marketplace; + } + + + public OfferRulesRulesInner rule(@javax.annotation.Nonnull OfferRulesRulesInnerRule rule) { + this.rule = rule; + return this; + } + + /** + * Get rule + * @return rule + */ + @javax.annotation.Nonnull + public OfferRulesRulesInnerRule getRule() { + return rule; + } + + public void setRule(@javax.annotation.Nonnull OfferRulesRulesInnerRule rule) { + this.rule = rule; + } + + + public OfferRulesRulesInner _configuration(@javax.annotation.Nullable AutomaticPricingOfferRuleConfiguration _configuration) { + this._configuration = _configuration; + return this; + } + + /** + * Get _configuration + * @return _configuration + */ + @javax.annotation.Nullable + public AutomaticPricingOfferRuleConfiguration getConfiguration() { + return _configuration; + } + + public void setConfiguration(@javax.annotation.Nullable AutomaticPricingOfferRuleConfiguration _configuration) { + this._configuration = _configuration; + } + + + public OfferRulesRulesInner updatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The date the rule assignment to offer.marketplace was last modified in ISO 8601 format. + * @return updatedAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferRulesRulesInner offerRulesRulesInner = (OfferRulesRulesInner) o; + return Objects.equals(this.marketplace, offerRulesRulesInner.marketplace) && + Objects.equals(this.rule, offerRulesRulesInner.rule) && + Objects.equals(this._configuration, offerRulesRulesInner._configuration) && + Objects.equals(this.updatedAt, offerRulesRulesInner.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(marketplace, rule, _configuration, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferRulesRulesInner {\n"); + sb.append(" marketplace: ").append(toIndentedString(marketplace)).append("\n"); + sb.append(" rule: ").append(toIndentedString(rule)).append("\n"); + sb.append(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplace"); + openapiFields.add("rule"); + openapiFields.add("configuration"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("marketplace"); + openapiRequiredFields.add("rule"); + openapiRequiredFields.add("updatedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferRulesRulesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferRulesRulesInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferRulesRulesInner is not found in the empty JSON string", OfferRulesRulesInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferRulesRulesInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferRulesRulesInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferRulesRulesInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `marketplace` + OfferRulesRulesInnerMarketplace.validateJsonElement(jsonObj.get("marketplace")); + // validate the required field `rule` + OfferRulesRulesInnerRule.validateJsonElement(jsonObj.get("rule")); + // validate the optional field `configuration` + if (jsonObj.get("configuration") != null && !jsonObj.get("configuration").isJsonNull()) { + AutomaticPricingOfferRuleConfiguration.validateJsonElement(jsonObj.get("configuration")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferRulesRulesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferRulesRulesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferRulesRulesInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferRulesRulesInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferRulesRulesInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferRulesRulesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferRulesRulesInner + * @throws IOException if the JSON string is invalid with respect to OfferRulesRulesInner + */ + public static OfferRulesRulesInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferRulesRulesInner.class); + } + + /** + * Convert an instance of OfferRulesRulesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInnerMarketplace.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInnerMarketplace.java new file mode 100644 index 0000000..ed7555f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInnerMarketplace.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferRulesRulesInnerMarketplace + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferRulesRulesInnerMarketplace { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public OfferRulesRulesInnerMarketplace() { + } + + public OfferRulesRulesInnerMarketplace id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The id of a marketplace.<br/> Available marketplaces can be determined using <a href=\"#operation/marketplacesGET\">GET /marketplaces</a>. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferRulesRulesInnerMarketplace offerRulesRulesInnerMarketplace = (OfferRulesRulesInnerMarketplace) o; + return Objects.equals(this.id, offerRulesRulesInnerMarketplace.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferRulesRulesInnerMarketplace {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferRulesRulesInnerMarketplace + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferRulesRulesInnerMarketplace.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferRulesRulesInnerMarketplace is not found in the empty JSON string", OfferRulesRulesInnerMarketplace.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferRulesRulesInnerMarketplace.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferRulesRulesInnerMarketplace` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferRulesRulesInnerMarketplace.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferRulesRulesInnerMarketplace.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferRulesRulesInnerMarketplace' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferRulesRulesInnerMarketplace.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferRulesRulesInnerMarketplace value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferRulesRulesInnerMarketplace read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferRulesRulesInnerMarketplace given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferRulesRulesInnerMarketplace + * @throws IOException if the JSON string is invalid with respect to OfferRulesRulesInnerMarketplace + */ + public static OfferRulesRulesInnerMarketplace fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferRulesRulesInnerMarketplace.class); + } + + /** + * Convert an instance of OfferRulesRulesInnerMarketplace to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInnerRule.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInnerRule.java new file mode 100644 index 0000000..c990fbc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferRulesRulesInnerRule.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferRulesRulesInnerRule + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferRulesRulesInnerRule { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private AutomaticPricingRuleType type; + + public OfferRulesRulesInnerRule() { + } + + public OfferRulesRulesInnerRule id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Identifier of a automatic pricing rule. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public OfferRulesRulesInnerRule type(@javax.annotation.Nonnull AutomaticPricingRuleType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public AutomaticPricingRuleType getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull AutomaticPricingRuleType type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferRulesRulesInnerRule offerRulesRulesInnerRule = (OfferRulesRulesInnerRule) o; + return Objects.equals(this.id, offerRulesRulesInnerRule.id) && + Objects.equals(this.type, offerRulesRulesInnerRule.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferRulesRulesInnerRule {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferRulesRulesInnerRule + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferRulesRulesInnerRule.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferRulesRulesInnerRule is not found in the empty JSON string", OfferRulesRulesInnerRule.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferRulesRulesInnerRule.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferRulesRulesInnerRule` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferRulesRulesInnerRule.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `type` + AutomaticPricingRuleType.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferRulesRulesInnerRule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferRulesRulesInnerRule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferRulesRulesInnerRule.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferRulesRulesInnerRule value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferRulesRulesInnerRule read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferRulesRulesInnerRule given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferRulesRulesInnerRule + * @throws IOException if the JSON string is invalid with respect to OfferRulesRulesInnerRule + */ + public static OfferRulesRulesInnerRule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferRulesRulesInnerRule.class); + } + + /** + * Convert an instance of OfferRulesRulesInnerRule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferSafetyInformationTranslation.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferSafetyInformationTranslation.java new file mode 100644 index 0000000..8ab715d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferSafetyInformationTranslation.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ProductSafetyInformationDescription; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer safety information translations + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferSafetyInformationTranslation { + public static final String SERIALIZED_NAME_PRODUCTS = "products"; + @SerializedName(SERIALIZED_NAME_PRODUCTS) + @javax.annotation.Nullable + private List products = new ArrayList<>(); + + public OfferSafetyInformationTranslation() { + } + + public OfferSafetyInformationTranslation products(@javax.annotation.Nullable List products) { + this.products = products; + return this; + } + + public OfferSafetyInformationTranslation addProductsItem(ProductSafetyInformationDescription productsItem) { + if (this.products == null) { + this.products = new ArrayList<>(); + } + this.products.add(productsItem); + return this; + } + + /** + * Get products + * @return products + */ + @javax.annotation.Nullable + public List getProducts() { + return products; + } + + public void setProducts(@javax.annotation.Nullable List products) { + this.products = products; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferSafetyInformationTranslation offerSafetyInformationTranslation = (OfferSafetyInformationTranslation) o; + return Objects.equals(this.products, offerSafetyInformationTranslation.products); + } + + @Override + public int hashCode() { + return Objects.hash(products); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferSafetyInformationTranslation {\n"); + sb.append(" products: ").append(toIndentedString(products)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("products"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferSafetyInformationTranslation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferSafetyInformationTranslation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferSafetyInformationTranslation is not found in the empty JSON string", OfferSafetyInformationTranslation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferSafetyInformationTranslation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferSafetyInformationTranslation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("products") != null && !jsonObj.get("products").isJsonNull()) { + JsonArray jsonArrayproducts = jsonObj.getAsJsonArray("products"); + if (jsonArrayproducts != null) { + // ensure the json data is an array + if (!jsonObj.get("products").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `products` to be an array in the JSON string but got `%s`", jsonObj.get("products").toString())); + } + + // validate the optional field `products` (array) + for (int i = 0; i < jsonArrayproducts.size(); i++) { + ProductSafetyInformationDescription.validateJsonElement(jsonArrayproducts.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferSafetyInformationTranslation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferSafetyInformationTranslation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferSafetyInformationTranslation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferSafetyInformationTranslation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferSafetyInformationTranslation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferSafetyInformationTranslation given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferSafetyInformationTranslation + * @throws IOException if the JSON string is invalid with respect to OfferSafetyInformationTranslation + */ + public static OfferSafetyInformationTranslation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferSafetyInformationTranslation.class); + } + + /** + * Convert an instance of OfferSafetyInformationTranslation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferSeller.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferSeller.java new file mode 100644 index 0000000..8531bb9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferSeller.java @@ -0,0 +1,290 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about the seller. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferSeller { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nullable + private String login; + + public static final String SERIALIZED_NAME_COMPANY = "company"; + @SerializedName(SERIALIZED_NAME_COMPANY) + @javax.annotation.Nullable + private Boolean company; + + public static final String SERIALIZED_NAME_SUPER_SELLER = "superSeller"; + @SerializedName(SERIALIZED_NAME_SUPER_SELLER) + @javax.annotation.Nullable + private Boolean superSeller; + + public OfferSeller() { + } + + public OfferSeller id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The seller ID. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public OfferSeller login(@javax.annotation.Nullable String login) { + this.login = login; + return this; + } + + /** + * The seller login. + * @return login + */ + @javax.annotation.Nullable + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nullable String login) { + this.login = login; + } + + + public OfferSeller company(@javax.annotation.Nullable Boolean company) { + this.company = company; + return this; + } + + /** + * Indicates whether the seller represents a registered business. + * @return company + */ + @javax.annotation.Nullable + public Boolean getCompany() { + return company; + } + + public void setCompany(@javax.annotation.Nullable Boolean company) { + this.company = company; + } + + + public OfferSeller superSeller(@javax.annotation.Nullable Boolean superSeller) { + this.superSeller = superSeller; + return this; + } + + /** + * Indicates whether the seller has the \"Super Sprzedawca\" status. + * @return superSeller + */ + @javax.annotation.Nullable + public Boolean getSuperSeller() { + return superSeller; + } + + public void setSuperSeller(@javax.annotation.Nullable Boolean superSeller) { + this.superSeller = superSeller; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferSeller offerSeller = (OfferSeller) o; + return Objects.equals(this.id, offerSeller.id) && + Objects.equals(this.login, offerSeller.login) && + Objects.equals(this.company, offerSeller.company) && + Objects.equals(this.superSeller, offerSeller.superSeller); + } + + @Override + public int hashCode() { + return Objects.hash(id, login, company, superSeller); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferSeller {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" company: ").append(toIndentedString(company)).append("\n"); + sb.append(" superSeller: ").append(toIndentedString(superSeller)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("login"); + openapiFields.add("company"); + openapiFields.add("superSeller"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferSeller + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferSeller.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferSeller is not found in the empty JSON string", OfferSeller.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferSeller.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferSeller` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("login") != null && !jsonObj.get("login").isJsonNull()) && !jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferSeller.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferSeller' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferSeller.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferSeller value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferSeller read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferSeller given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferSeller + * @throws IOException if the JSON string is invalid with respect to OfferSeller + */ + public static OfferSeller fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferSeller.class); + } + + /** + * Convert an instance of OfferSeller to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferSellingMode.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferSellingMode.java new file mode 100644 index 0000000..2383127 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferSellingMode.java @@ -0,0 +1,358 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferFixedPrice; +import pl.wtx.allegro.api.client.model.OfferPrice; +import pl.wtx.allegro.api.client.model.SellingModeFormat; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * This section describes the selling format and prices. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferSellingMode { + public static final String SERIALIZED_NAME_FORMAT = "format"; + @SerializedName(SERIALIZED_NAME_FORMAT) + @javax.annotation.Nullable + private SellingModeFormat format; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private OfferPrice price; + + public static final String SERIALIZED_NAME_FIXED_PRICE = "fixedPrice"; + @SerializedName(SERIALIZED_NAME_FIXED_PRICE) + @javax.annotation.Nullable + private OfferFixedPrice fixedPrice; + + public static final String SERIALIZED_NAME_POPULARITY = "popularity"; + @SerializedName(SERIALIZED_NAME_POPULARITY) + @javax.annotation.Nullable + private Integer popularity; + + public static final String SERIALIZED_NAME_POPULARITY_RANGE = "popularityRange"; + @SerializedName(SERIALIZED_NAME_POPULARITY_RANGE) + @javax.annotation.Nullable + private String popularityRange; + + public static final String SERIALIZED_NAME_BID_COUNT = "bidCount"; + @SerializedName(SERIALIZED_NAME_BID_COUNT) + @javax.annotation.Nullable + private Integer bidCount; + + public OfferSellingMode() { + } + + public OfferSellingMode format(@javax.annotation.Nullable SellingModeFormat format) { + this.format = format; + return this; + } + + /** + * Get format + * @return format + */ + @javax.annotation.Nullable + public SellingModeFormat getFormat() { + return format; + } + + public void setFormat(@javax.annotation.Nullable SellingModeFormat format) { + this.format = format; + } + + + public OfferSellingMode price(@javax.annotation.Nullable OfferPrice price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nullable + public OfferPrice getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable OfferPrice price) { + this.price = price; + } + + + public OfferSellingMode fixedPrice(@javax.annotation.Nullable OfferFixedPrice fixedPrice) { + this.fixedPrice = fixedPrice; + return this; + } + + /** + * Get fixedPrice + * @return fixedPrice + */ + @javax.annotation.Nullable + public OfferFixedPrice getFixedPrice() { + return fixedPrice; + } + + public void setFixedPrice(@javax.annotation.Nullable OfferFixedPrice fixedPrice) { + this.fixedPrice = fixedPrice; + } + + + public OfferSellingMode popularity(@javax.annotation.Nullable Integer popularity) { + this.popularity = popularity; + return this; + } + + /** + * Lower bound of popularity range of the offer for *BUY_NOW* selling format. + * minimum: 0 + * @return popularity + */ + @javax.annotation.Nullable + public Integer getPopularity() { + return popularity; + } + + public void setPopularity(@javax.annotation.Nullable Integer popularity) { + this.popularity = popularity; + } + + + public OfferSellingMode popularityRange(@javax.annotation.Nullable String popularityRange) { + this.popularityRange = popularityRange; + return this; + } + + /** + * Popularity ranges of the offer for *BUY_NOW* selling format. Possible values: 0, [1-5], [6-10], [11-20], [21-50], [51-100] and [101+] + * @return popularityRange + */ + @javax.annotation.Nullable + public String getPopularityRange() { + return popularityRange; + } + + public void setPopularityRange(@javax.annotation.Nullable String popularityRange) { + this.popularityRange = popularityRange; + } + + + public OfferSellingMode bidCount(@javax.annotation.Nullable Integer bidCount) { + this.bidCount = bidCount; + return this; + } + + /** + * Number of bidders for *AUCTION* selling format. + * minimum: 0 + * @return bidCount + */ + @javax.annotation.Nullable + public Integer getBidCount() { + return bidCount; + } + + public void setBidCount(@javax.annotation.Nullable Integer bidCount) { + this.bidCount = bidCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferSellingMode offerSellingMode = (OfferSellingMode) o; + return Objects.equals(this.format, offerSellingMode.format) && + Objects.equals(this.price, offerSellingMode.price) && + Objects.equals(this.fixedPrice, offerSellingMode.fixedPrice) && + Objects.equals(this.popularity, offerSellingMode.popularity) && + Objects.equals(this.popularityRange, offerSellingMode.popularityRange) && + Objects.equals(this.bidCount, offerSellingMode.bidCount); + } + + @Override + public int hashCode() { + return Objects.hash(format, price, fixedPrice, popularity, popularityRange, bidCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferSellingMode {\n"); + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" fixedPrice: ").append(toIndentedString(fixedPrice)).append("\n"); + sb.append(" popularity: ").append(toIndentedString(popularity)).append("\n"); + sb.append(" popularityRange: ").append(toIndentedString(popularityRange)).append("\n"); + sb.append(" bidCount: ").append(toIndentedString(bidCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("format"); + openapiFields.add("price"); + openapiFields.add("fixedPrice"); + openapiFields.add("popularity"); + openapiFields.add("popularityRange"); + openapiFields.add("bidCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferSellingMode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferSellingMode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferSellingMode is not found in the empty JSON string", OfferSellingMode.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferSellingMode.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferSellingMode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `format` + if (jsonObj.get("format") != null && !jsonObj.get("format").isJsonNull()) { + SellingModeFormat.validateJsonElement(jsonObj.get("format")); + } + // validate the optional field `price` + if (jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) { + OfferPrice.validateJsonElement(jsonObj.get("price")); + } + // validate the optional field `fixedPrice` + if (jsonObj.get("fixedPrice") != null && !jsonObj.get("fixedPrice").isJsonNull()) { + OfferFixedPrice.validateJsonElement(jsonObj.get("fixedPrice")); + } + if ((jsonObj.get("popularityRange") != null && !jsonObj.get("popularityRange").isJsonNull()) && !jsonObj.get("popularityRange").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `popularityRange` to be a primitive type in the JSON string but got `%s`", jsonObj.get("popularityRange").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferSellingMode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferSellingMode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferSellingMode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferSellingMode value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferSellingMode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferSellingMode given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferSellingMode + * @throws IOException if the JSON string is invalid with respect to OfferSellingMode + */ + public static OfferSellingMode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferSellingMode.class); + } + + /** + * Convert an instance of OfferSellingMode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferShippingRates.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferShippingRates.java new file mode 100644 index 0000000..2c80204 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferShippingRates.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ShippingRate; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferShippingRates + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferShippingRates { + public static final String SERIALIZED_NAME_RATES = "rates"; + @SerializedName(SERIALIZED_NAME_RATES) + @javax.annotation.Nullable + private List rates = new ArrayList<>(); + + public OfferShippingRates() { + } + + public OfferShippingRates rates(@javax.annotation.Nullable List rates) { + this.rates = rates; + return this; + } + + public OfferShippingRates addRatesItem(ShippingRate ratesItem) { + if (this.rates == null) { + this.rates = new ArrayList<>(); + } + this.rates.add(ratesItem); + return this; + } + + /** + * If empty there is the shipping rates set attached to offer. You should use the GET /sale/offers/{offerId} resource to retrieve the shipping rates set ID. + * @return rates + */ + @javax.annotation.Nullable + public List getRates() { + return rates; + } + + public void setRates(@javax.annotation.Nullable List rates) { + this.rates = rates; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferShippingRates offerShippingRates = (OfferShippingRates) o; + return Objects.equals(this.rates, offerShippingRates.rates); + } + + @Override + public int hashCode() { + return Objects.hash(rates); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferShippingRates {\n"); + sb.append(" rates: ").append(toIndentedString(rates)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rates"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferShippingRates + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferShippingRates.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferShippingRates is not found in the empty JSON string", OfferShippingRates.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferShippingRates.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferShippingRates` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("rates") != null && !jsonObj.get("rates").isJsonNull()) { + JsonArray jsonArrayrates = jsonObj.getAsJsonArray("rates"); + if (jsonArrayrates != null) { + // ensure the json data is an array + if (!jsonObj.get("rates").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rates` to be an array in the JSON string but got `%s`", jsonObj.get("rates").toString())); + } + + // validate the optional field `rates` (array) + for (int i = 0; i < jsonArrayrates.size(); i++) { + ShippingRate.validateJsonElement(jsonArrayrates.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferShippingRates.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferShippingRates' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferShippingRates.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferShippingRates value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferShippingRates read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferShippingRates given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferShippingRates + * @throws IOException if the JSON string is invalid with respect to OfferShippingRates + */ + public static OfferShippingRates fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferShippingRates.class); + } + + /** + * Convert an instance of OfferShippingRates to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferStatModelDto.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferStatModelDto.java new file mode 100644 index 0000000..4de1030 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferStatModelDto.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer details data, containg offer identifier. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferStatModelDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public OfferStatModelDto() { + } + + public OfferStatModelDto id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferStatModelDto offerStatModelDto = (OfferStatModelDto) o; + return Objects.equals(this.id, offerStatModelDto.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferStatModelDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferStatModelDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferStatModelDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferStatModelDto is not found in the empty JSON string", OfferStatModelDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferStatModelDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferStatModelDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferStatModelDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferStatModelDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferStatModelDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferStatModelDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferStatModelDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferStatModelDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferStatModelDto + * @throws IOException if the JSON string is invalid with respect to OfferStatModelDto + */ + public static OfferStatModelDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferStatModelDto.class); + } + + /** + * Convert an instance of OfferStatModelDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferStatResponseDto.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferStatResponseDto.java new file mode 100644 index 0000000..ca4ca2e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferStatResponseDto.java @@ -0,0 +1,310 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ClassifiedDailyEventStatResponseDto; +import pl.wtx.allegro.api.client.model.ClassifiedEventStat; +import pl.wtx.allegro.api.client.model.OfferStatModelDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferStatResponseDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferStatResponseDto { + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private OfferStatModelDto offer; + + public static final String SERIALIZED_NAME_EVENT_STATS_TOTAL = "eventStatsTotal"; + @SerializedName(SERIALIZED_NAME_EVENT_STATS_TOTAL) + @javax.annotation.Nullable + private List eventStatsTotal = new ArrayList<>(); + + public static final String SERIALIZED_NAME_EVENTS_PER_DAY = "eventsPerDay"; + @SerializedName(SERIALIZED_NAME_EVENTS_PER_DAY) + @javax.annotation.Nullable + private List eventsPerDay = new ArrayList<>(); + + public OfferStatResponseDto() { + } + + public OfferStatResponseDto offer(@javax.annotation.Nullable OfferStatModelDto offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public OfferStatModelDto getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable OfferStatModelDto offer) { + this.offer = offer; + } + + + public OfferStatResponseDto eventStatsTotal(@javax.annotation.Nullable List eventStatsTotal) { + this.eventStatsTotal = eventStatsTotal; + return this; + } + + public OfferStatResponseDto addEventStatsTotalItem(ClassifiedEventStat eventStatsTotalItem) { + if (this.eventStatsTotal == null) { + this.eventStatsTotal = new ArrayList<>(); + } + this.eventStatsTotal.add(eventStatsTotalItem); + return this; + } + + /** + * Get eventStatsTotal + * @return eventStatsTotal + */ + @javax.annotation.Nullable + public List getEventStatsTotal() { + return eventStatsTotal; + } + + public void setEventStatsTotal(@javax.annotation.Nullable List eventStatsTotal) { + this.eventStatsTotal = eventStatsTotal; + } + + + public OfferStatResponseDto eventsPerDay(@javax.annotation.Nullable List eventsPerDay) { + this.eventsPerDay = eventsPerDay; + return this; + } + + public OfferStatResponseDto addEventsPerDayItem(ClassifiedDailyEventStatResponseDto eventsPerDayItem) { + if (this.eventsPerDay == null) { + this.eventsPerDay = new ArrayList<>(); + } + this.eventsPerDay.add(eventsPerDayItem); + return this; + } + + /** + * Get eventsPerDay + * @return eventsPerDay + */ + @javax.annotation.Nullable + public List getEventsPerDay() { + return eventsPerDay; + } + + public void setEventsPerDay(@javax.annotation.Nullable List eventsPerDay) { + this.eventsPerDay = eventsPerDay; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferStatResponseDto offerStatResponseDto = (OfferStatResponseDto) o; + return Objects.equals(this.offer, offerStatResponseDto.offer) && + Objects.equals(this.eventStatsTotal, offerStatResponseDto.eventStatsTotal) && + Objects.equals(this.eventsPerDay, offerStatResponseDto.eventsPerDay); + } + + @Override + public int hashCode() { + return Objects.hash(offer, eventStatsTotal, eventsPerDay); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferStatResponseDto {\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" eventStatsTotal: ").append(toIndentedString(eventStatsTotal)).append("\n"); + sb.append(" eventsPerDay: ").append(toIndentedString(eventsPerDay)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offer"); + openapiFields.add("eventStatsTotal"); + openapiFields.add("eventsPerDay"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferStatResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferStatResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferStatResponseDto is not found in the empty JSON string", OfferStatResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferStatResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferStatResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + OfferStatModelDto.validateJsonElement(jsonObj.get("offer")); + } + if (jsonObj.get("eventStatsTotal") != null && !jsonObj.get("eventStatsTotal").isJsonNull()) { + JsonArray jsonArrayeventStatsTotal = jsonObj.getAsJsonArray("eventStatsTotal"); + if (jsonArrayeventStatsTotal != null) { + // ensure the json data is an array + if (!jsonObj.get("eventStatsTotal").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `eventStatsTotal` to be an array in the JSON string but got `%s`", jsonObj.get("eventStatsTotal").toString())); + } + + // validate the optional field `eventStatsTotal` (array) + for (int i = 0; i < jsonArrayeventStatsTotal.size(); i++) { + ClassifiedEventStat.validateJsonElement(jsonArrayeventStatsTotal.get(i)); + }; + } + } + if (jsonObj.get("eventsPerDay") != null && !jsonObj.get("eventsPerDay").isJsonNull()) { + JsonArray jsonArrayeventsPerDay = jsonObj.getAsJsonArray("eventsPerDay"); + if (jsonArrayeventsPerDay != null) { + // ensure the json data is an array + if (!jsonObj.get("eventsPerDay").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `eventsPerDay` to be an array in the JSON string but got `%s`", jsonObj.get("eventsPerDay").toString())); + } + + // validate the optional field `eventsPerDay` (array) + for (int i = 0; i < jsonArrayeventsPerDay.size(); i++) { + ClassifiedDailyEventStatResponseDto.validateJsonElement(jsonArrayeventsPerDay.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferStatResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferStatResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferStatResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferStatResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferStatResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferStatResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferStatResponseDto + * @throws IOException if the JSON string is invalid with respect to OfferStatResponseDto + */ + public static OfferStatResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferStatResponseDto.class); + } + + /** + * Convert an instance of OfferStatResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferStatsResponseDto.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferStatsResponseDto.java new file mode 100644 index 0000000..80d1f32 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferStatsResponseDto.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferStatResponseDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Data objects containing details for counted events per offer. Includes a list of OfferStatResponseDto grouped by date and a list of ClassifiedEventStat grouped by EventType for a specific period. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferStatsResponseDto { + public static final String SERIALIZED_NAME_OFFER_STATS = "offerStats"; + @SerializedName(SERIALIZED_NAME_OFFER_STATS) + @javax.annotation.Nullable + private List offerStats = new ArrayList<>(); + + public OfferStatsResponseDto() { + } + + public OfferStatsResponseDto offerStats(@javax.annotation.Nullable List offerStats) { + this.offerStats = offerStats; + return this; + } + + public OfferStatsResponseDto addOfferStatsItem(OfferStatResponseDto offerStatsItem) { + if (this.offerStats == null) { + this.offerStats = new ArrayList<>(); + } + this.offerStats.add(offerStatsItem); + return this; + } + + /** + * Get offerStats + * @return offerStats + */ + @javax.annotation.Nullable + public List getOfferStats() { + return offerStats; + } + + public void setOfferStats(@javax.annotation.Nullable List offerStats) { + this.offerStats = offerStats; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferStatsResponseDto offerStatsResponseDto = (OfferStatsResponseDto) o; + return Objects.equals(this.offerStats, offerStatsResponseDto.offerStats); + } + + @Override + public int hashCode() { + return Objects.hash(offerStats); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferStatsResponseDto {\n"); + sb.append(" offerStats: ").append(toIndentedString(offerStats)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offerStats"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferStatsResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferStatsResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferStatsResponseDto is not found in the empty JSON string", OfferStatsResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferStatsResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferStatsResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("offerStats") != null && !jsonObj.get("offerStats").isJsonNull()) { + JsonArray jsonArrayofferStats = jsonObj.getAsJsonArray("offerStats"); + if (jsonArrayofferStats != null) { + // ensure the json data is an array + if (!jsonObj.get("offerStats").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerStats` to be an array in the JSON string but got `%s`", jsonObj.get("offerStats").toString())); + } + + // validate the optional field `offerStats` (array) + for (int i = 0; i < jsonArrayofferStats.size(); i++) { + OfferStatResponseDto.validateJsonElement(jsonArrayofferStats.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferStatsResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferStatsResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferStatsResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferStatsResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferStatsResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferStatsResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferStatsResponseDto + * @throws IOException if the JSON string is invalid with respect to OfferStatsResponseDto + */ + public static OfferStatsResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferStatsResponseDto.class); + } + + /** + * Convert an instance of OfferStatsResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferStatus.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferStatus.java new file mode 100644 index 0000000..0f26aa3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferStatus.java @@ -0,0 +1,82 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The publication status of the current offer. The possible values: - *INACTIVE* - a draft offer - *ACTIVATING* - the offer is planned for listing or is during the process of activation - *ACTIVE* - the offer is active - *ENDED* - the offer was active and is now ended (for whatever reason) + */ +@JsonAdapter(OfferStatus.Adapter.class) +public enum OfferStatus { + + INACTIVE("INACTIVE"), + + ACTIVATING("ACTIVATING"), + + ACTIVE("ACTIVE"), + + ENDED("ENDED"); + + private String value; + + OfferStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OfferStatus fromValue(String value) { + for (OfferStatus b : OfferStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OfferStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OfferStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OfferStatus.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OfferStatus.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferStock.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferStock.java new file mode 100644 index 0000000..963309e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferStock.java @@ -0,0 +1,292 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about the stock. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferStock { + /** + * The unit type of the stock. + */ + @JsonAdapter(UnitEnum.Adapter.class) + public enum UnitEnum { + UNIT("UNIT"), + + PAIR("PAIR"), + + SET("SET"); + + private String value; + + UnitEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static UnitEnum fromValue(String value) { + for (UnitEnum b : UnitEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final UnitEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public UnitEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return UnitEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + UnitEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private UnitEnum unit; + + public static final String SERIALIZED_NAME_AVAILABLE = "available"; + @SerializedName(SERIALIZED_NAME_AVAILABLE) + @javax.annotation.Nullable + private Integer available; + + public OfferStock() { + } + + public OfferStock unit(@javax.annotation.Nullable UnitEnum unit) { + this.unit = unit; + return this; + } + + /** + * The unit type of the stock. + * @return unit + */ + @javax.annotation.Nullable + public UnitEnum getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable UnitEnum unit) { + this.unit = unit; + } + + + public OfferStock available(@javax.annotation.Nullable Integer available) { + this.available = available; + return this; + } + + /** + * The available stock value. + * minimum: 0 + * @return available + */ + @javax.annotation.Nullable + public Integer getAvailable() { + return available; + } + + public void setAvailable(@javax.annotation.Nullable Integer available) { + this.available = available; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferStock offerStock = (OfferStock) o; + return Objects.equals(this.unit, offerStock.unit) && + Objects.equals(this.available, offerStock.available); + } + + @Override + public int hashCode() { + return Objects.hash(unit, available); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferStock {\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append(" available: ").append(toIndentedString(available)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("unit"); + openapiFields.add("available"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferStock + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferStock.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferStock is not found in the empty JSON string", OfferStock.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferStock.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferStock` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) && !jsonObj.get("unit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unit").toString())); + } + // validate the optional field `unit` + if (jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) { + UnitEnum.validateJsonElement(jsonObj.get("unit")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferStock.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferStock' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferStock.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferStock value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferStock read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferStock given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferStock + * @throws IOException if the JSON string is invalid with respect to OfferStock + */ + public static OfferStock fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferStock.class); + } + + /** + * Convert an instance of OfferStock to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferStockChangedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferStockChangedEvent.java new file mode 100644 index 0000000..b8cc35c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferStockChangedEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferEventExternalOffer; +import pl.wtx.allegro.api.client.model.SellerOfferBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferStockChangedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferStockChangedEvent extends SellerOfferBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "OFFER_STOCK_CHANGED"; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OfferEventExternalOffer offer; + + public OfferStockChangedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public OfferStockChangedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public OfferStockChangedEvent offer(@javax.annotation.Nonnull OfferEventExternalOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OfferEventExternalOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OfferEventExternalOffer offer) { + this.offer = offer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferStockChangedEvent offerStockChangedEvent = (OfferStockChangedEvent) o; + return Objects.equals(this.type, offerStockChangedEvent.type) && + Objects.equals(this.offer, offerStockChangedEvent.offer) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, offer, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferStockChangedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("offer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferStockChangedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferStockChangedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferStockChangedEvent is not found in the empty JSON string", OfferStockChangedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferStockChangedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferStockChangedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferStockChangedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferStockChangedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferStockChangedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferStockChangedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferStockChangedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferStockChangedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferStockChangedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferStockChangedEvent + * @throws IOException if the JSON string is invalid with respect to OfferStockChangedEvent + */ + public static OfferStockChangedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferStockChangedEvent.class); + } + + /** + * Convert an instance of OfferStockChangedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferTaxRate.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferTaxRate.java new file mode 100644 index 0000000..cd9b316 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferTaxRate.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer tax rate for country. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferTaxRate { + public static final String SERIALIZED_NAME_RATE = "rate"; + @SerializedName(SERIALIZED_NAME_RATE) + @javax.annotation.Nullable + private String rate; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode; + + public OfferTaxRate() { + } + + public OfferTaxRate rate(@javax.annotation.Nullable String rate) { + this.rate = rate; + return this; + } + + /** + * Tax rate value. + * @return rate + */ + @javax.annotation.Nullable + public String getRate() { + return rate; + } + + public void setRate(@javax.annotation.Nullable String rate) { + this.rate = rate; + } + + + public OfferTaxRate countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Tax rate country code. + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferTaxRate offerTaxRate = (OfferTaxRate) o; + return Objects.equals(this.rate, offerTaxRate.rate) && + Objects.equals(this.countryCode, offerTaxRate.countryCode); + } + + @Override + public int hashCode() { + return Objects.hash(rate, countryCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferTaxRate {\n"); + sb.append(" rate: ").append(toIndentedString(rate)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rate"); + openapiFields.add("countryCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferTaxRate + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferTaxRate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferTaxRate is not found in the empty JSON string", OfferTaxRate.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferTaxRate.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferTaxRate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("rate") != null && !jsonObj.get("rate").isJsonNull()) && !jsonObj.get("rate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `rate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rate").toString())); + } + if ((jsonObj.get("countryCode") != null && !jsonObj.get("countryCode").isJsonNull()) && !jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferTaxRate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferTaxRate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferTaxRate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferTaxRate value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferTaxRate read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferTaxRate given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferTaxRate + * @throws IOException if the JSON string is invalid with respect to OfferTaxRate + */ + public static OfferTaxRate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferTaxRate.class); + } + + /** + * Convert an instance of OfferTaxRate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferTaxSettings.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferTaxSettings.java new file mode 100644 index 0000000..5b0256f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferTaxSettings.java @@ -0,0 +1,292 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferTaxRate; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Tax settings for offer. Available settings can be found under <a href=\"#operation/getTaxSettingsForCategory\" target=\"_blank\">\"get all tax settings for category\" resource</a>. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferTaxSettings { + public static final String SERIALIZED_NAME_RATES = "rates"; + @SerializedName(SERIALIZED_NAME_RATES) + @javax.annotation.Nonnull + private List rates = new ArrayList<>(); + + public static final String SERIALIZED_NAME_SUBJECT = "subject"; + @SerializedName(SERIALIZED_NAME_SUBJECT) + @javax.annotation.Nullable + private String subject; + + public static final String SERIALIZED_NAME_EXEMPTION = "exemption"; + @SerializedName(SERIALIZED_NAME_EXEMPTION) + @javax.annotation.Nullable + private String exemption; + + public OfferTaxSettings() { + } + + public OfferTaxSettings rates(@javax.annotation.Nonnull List rates) { + this.rates = rates; + return this; + } + + public OfferTaxSettings addRatesItem(OfferTaxRate ratesItem) { + if (this.rates == null) { + this.rates = new ArrayList<>(); + } + this.rates.add(ratesItem); + return this; + } + + /** + * Tax rates for offer. + * @return rates + */ + @javax.annotation.Nonnull + public List getRates() { + return rates; + } + + public void setRates(@javax.annotation.Nonnull List rates) { + this.rates = rates; + } + + + public OfferTaxSettings subject(@javax.annotation.Nullable String subject) { + this.subject = subject; + return this; + } + + /** + * The subject of taxation for offer. + * @return subject + */ + @javax.annotation.Nullable + public String getSubject() { + return subject; + } + + public void setSubject(@javax.annotation.Nullable String subject) { + this.subject = subject; + } + + + public OfferTaxSettings exemption(@javax.annotation.Nullable String exemption) { + this.exemption = exemption; + return this; + } + + /** + * The exemption of taxation for offer. + * @return exemption + */ + @javax.annotation.Nullable + public String getExemption() { + return exemption; + } + + public void setExemption(@javax.annotation.Nullable String exemption) { + this.exemption = exemption; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferTaxSettings offerTaxSettings = (OfferTaxSettings) o; + return Objects.equals(this.rates, offerTaxSettings.rates) && + Objects.equals(this.subject, offerTaxSettings.subject) && + Objects.equals(this.exemption, offerTaxSettings.exemption); + } + + @Override + public int hashCode() { + return Objects.hash(rates, subject, exemption); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferTaxSettings {\n"); + sb.append(" rates: ").append(toIndentedString(rates)).append("\n"); + sb.append(" subject: ").append(toIndentedString(subject)).append("\n"); + sb.append(" exemption: ").append(toIndentedString(exemption)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rates"); + openapiFields.add("subject"); + openapiFields.add("exemption"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("rates"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferTaxSettings + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferTaxSettings.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferTaxSettings is not found in the empty JSON string", OfferTaxSettings.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferTaxSettings.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferTaxSettings` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferTaxSettings.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("rates").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rates` to be an array in the JSON string but got `%s`", jsonObj.get("rates").toString())); + } + + JsonArray jsonArrayrates = jsonObj.getAsJsonArray("rates"); + // validate the required field `rates` (array) + for (int i = 0; i < jsonArrayrates.size(); i++) { + OfferTaxRate.validateJsonElement(jsonArrayrates.get(i)); + }; + if ((jsonObj.get("subject") != null && !jsonObj.get("subject").isJsonNull()) && !jsonObj.get("subject").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `subject` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subject").toString())); + } + if ((jsonObj.get("exemption") != null && !jsonObj.get("exemption").isJsonNull()) && !jsonObj.get("exemption").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `exemption` to be a primitive type in the JSON string but got `%s`", jsonObj.get("exemption").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferTaxSettings.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferTaxSettings' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferTaxSettings.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferTaxSettings value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferTaxSettings read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferTaxSettings given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferTaxSettings + * @throws IOException if the JSON string is invalid with respect to OfferTaxSettings + */ + public static OfferTaxSettings fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferTaxSettings.class); + } + + /** + * Convert an instance of OfferTaxSettings to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferTitleTranslation.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferTitleTranslation.java new file mode 100644 index 0000000..31785c7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferTitleTranslation.java @@ -0,0 +1,238 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferTranslationType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer title translation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferTitleTranslation { + public static final String SERIALIZED_NAME_TRANSLATION = "translation"; + @SerializedName(SERIALIZED_NAME_TRANSLATION) + @javax.annotation.Nullable + private String translation; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private OfferTranslationType type; + + public OfferTitleTranslation() { + } + + public OfferTitleTranslation translation(@javax.annotation.Nullable String translation) { + this.translation = translation; + return this; + } + + /** + * Offer title translation content + * @return translation + */ + @javax.annotation.Nullable + public String getTranslation() { + return translation; + } + + public void setTranslation(@javax.annotation.Nullable String translation) { + this.translation = translation; + } + + + public OfferTitleTranslation type(@javax.annotation.Nullable OfferTranslationType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public OfferTranslationType getType() { + return type; + } + + public void setType(@javax.annotation.Nullable OfferTranslationType type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferTitleTranslation offerTitleTranslation = (OfferTitleTranslation) o; + return Objects.equals(this.translation, offerTitleTranslation.translation) && + Objects.equals(this.type, offerTitleTranslation.type); + } + + @Override + public int hashCode() { + return Objects.hash(translation, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferTitleTranslation {\n"); + sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("translation"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferTitleTranslation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferTitleTranslation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferTitleTranslation is not found in the empty JSON string", OfferTitleTranslation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferTitleTranslation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferTitleTranslation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("translation") != null && !jsonObj.get("translation").isJsonNull()) && !jsonObj.get("translation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `translation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("translation").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + OfferTranslationType.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferTitleTranslation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferTitleTranslation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferTitleTranslation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferTitleTranslation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferTitleTranslation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferTitleTranslation given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferTitleTranslation + * @throws IOException if the JSON string is invalid with respect to OfferTitleTranslation + */ + public static OfferTitleTranslation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferTitleTranslation.class); + } + + /** + * Convert an instance of OfferTitleTranslation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslation.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslation.java new file mode 100644 index 0000000..8264c2e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslation.java @@ -0,0 +1,310 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferDescriptionTranslation; +import pl.wtx.allegro.api.client.model.OfferSafetyInformationTranslation; +import pl.wtx.allegro.api.client.model.OfferTitleTranslation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferTranslation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferTranslation { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private OfferDescriptionTranslation description; + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nonnull + private String language; + + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + @javax.annotation.Nullable + private OfferTitleTranslation title; + + public static final String SERIALIZED_NAME_SAFETY_INFORMATION = "safetyInformation"; + @SerializedName(SERIALIZED_NAME_SAFETY_INFORMATION) + @javax.annotation.Nullable + private OfferSafetyInformationTranslation safetyInformation; + + public OfferTranslation() { + } + + public OfferTranslation description(@javax.annotation.Nullable OfferDescriptionTranslation description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public OfferDescriptionTranslation getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable OfferDescriptionTranslation description) { + this.description = description; + } + + + public OfferTranslation language(@javax.annotation.Nonnull String language) { + this.language = language; + return this; + } + + /** + * Language of the translation. + * @return language + */ + @javax.annotation.Nonnull + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nonnull String language) { + this.language = language; + } + + + public OfferTranslation title(@javax.annotation.Nullable OfferTitleTranslation title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @javax.annotation.Nullable + public OfferTitleTranslation getTitle() { + return title; + } + + public void setTitle(@javax.annotation.Nullable OfferTitleTranslation title) { + this.title = title; + } + + + public OfferTranslation safetyInformation(@javax.annotation.Nullable OfferSafetyInformationTranslation safetyInformation) { + this.safetyInformation = safetyInformation; + return this; + } + + /** + * Get safetyInformation + * @return safetyInformation + */ + @javax.annotation.Nullable + public OfferSafetyInformationTranslation getSafetyInformation() { + return safetyInformation; + } + + public void setSafetyInformation(@javax.annotation.Nullable OfferSafetyInformationTranslation safetyInformation) { + this.safetyInformation = safetyInformation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferTranslation offerTranslation = (OfferTranslation) o; + return Objects.equals(this.description, offerTranslation.description) && + Objects.equals(this.language, offerTranslation.language) && + Objects.equals(this.title, offerTranslation.title) && + Objects.equals(this.safetyInformation, offerTranslation.safetyInformation); + } + + @Override + public int hashCode() { + return Objects.hash(description, language, title, safetyInformation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferTranslation {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" safetyInformation: ").append(toIndentedString(safetyInformation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("description"); + openapiFields.add("language"); + openapiFields.add("title"); + openapiFields.add("safetyInformation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("language"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferTranslation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferTranslation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferTranslation is not found in the empty JSON string", OfferTranslation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferTranslation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferTranslation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferTranslation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + OfferDescriptionTranslation.validateJsonElement(jsonObj.get("description")); + } + if (!jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + // validate the optional field `title` + if (jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) { + OfferTitleTranslation.validateJsonElement(jsonObj.get("title")); + } + // validate the optional field `safetyInformation` + if (jsonObj.get("safetyInformation") != null && !jsonObj.get("safetyInformation").isJsonNull()) { + OfferSafetyInformationTranslation.validateJsonElement(jsonObj.get("safetyInformation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferTranslation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferTranslation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferTranslation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferTranslation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferTranslation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferTranslation given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferTranslation + * @throws IOException if the JSON string is invalid with respect to OfferTranslation + */ + public static OfferTranslation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferTranslation.class); + } + + /** + * Convert an instance of OfferTranslation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslationType.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslationType.java new file mode 100644 index 0000000..6caab5e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslationType.java @@ -0,0 +1,80 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Type of content: BASE - initial content for offer in declared offer language. AUTO - automatic translation from BASE content. MANUAL - manual translation provided by the user. + */ +@JsonAdapter(OfferTranslationType.Adapter.class) +public enum OfferTranslationType { + + AUTO("AUTO"), + + MANUAL("MANUAL"), + + BASE("BASE"); + + private String value; + + OfferTranslationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OfferTranslationType fromValue(String value) { + for (OfferTranslationType b : OfferTranslationType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OfferTranslationType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OfferTranslationType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OfferTranslationType.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OfferTranslationType.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslationUpdatedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslationUpdatedEvent.java new file mode 100644 index 0000000..06fd8de --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslationUpdatedEvent.java @@ -0,0 +1,285 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ChangedTranslation; +import pl.wtx.allegro.api.client.model.OfferEventExternalOffer; +import pl.wtx.allegro.api.client.model.SellerOfferBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferTranslationUpdatedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferTranslationUpdatedEvent extends SellerOfferBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "OFFER_TRANSLATION_UPDATED"; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OfferEventExternalOffer offer; + + public static final String SERIALIZED_NAME_TRANSLATIONS = "translations"; + @SerializedName(SERIALIZED_NAME_TRANSLATIONS) + @javax.annotation.Nullable + private List translations = new ArrayList<>(); + + public OfferTranslationUpdatedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public OfferTranslationUpdatedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public OfferTranslationUpdatedEvent offer(@javax.annotation.Nonnull OfferEventExternalOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OfferEventExternalOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OfferEventExternalOffer offer) { + this.offer = offer; + } + + + public OfferTranslationUpdatedEvent translations(@javax.annotation.Nullable List translations) { + this.translations = translations; + return this; + } + + public OfferTranslationUpdatedEvent addTranslationsItem(ChangedTranslation translationsItem) { + if (this.translations == null) { + this.translations = new ArrayList<>(); + } + this.translations.add(translationsItem); + return this; + } + + /** + * Get translations + * @return translations + */ + @javax.annotation.Nullable + public List getTranslations() { + return translations; + } + + public void setTranslations(@javax.annotation.Nullable List translations) { + this.translations = translations; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferTranslationUpdatedEvent offerTranslationUpdatedEvent = (OfferTranslationUpdatedEvent) o; + return Objects.equals(this.type, offerTranslationUpdatedEvent.type) && + Objects.equals(this.offer, offerTranslationUpdatedEvent.offer) && + Objects.equals(this.translations, offerTranslationUpdatedEvent.translations) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, offer, translations, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferTranslationUpdatedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" translations: ").append(toIndentedString(translations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("offer"); + openapiFields.add("translations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferTranslationUpdatedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferTranslationUpdatedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferTranslationUpdatedEvent is not found in the empty JSON string", OfferTranslationUpdatedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferTranslationUpdatedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferTranslationUpdatedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferTranslationUpdatedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferTranslationUpdatedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferTranslationUpdatedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferTranslationUpdatedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferTranslationUpdatedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferTranslationUpdatedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferTranslationUpdatedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferTranslationUpdatedEvent + * @throws IOException if the JSON string is invalid with respect to OfferTranslationUpdatedEvent + */ + public static OfferTranslationUpdatedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferTranslationUpdatedEvent.class); + } + + /** + * Convert an instance of OfferTranslationUpdatedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslations.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslations.java new file mode 100644 index 0000000..d968ab2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferTranslations.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferTranslation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferTranslations + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferTranslations { + public static final String SERIALIZED_NAME_TRANSLATIONS = "translations"; + @SerializedName(SERIALIZED_NAME_TRANSLATIONS) + @javax.annotation.Nullable + private List translations = new ArrayList<>(); + + public OfferTranslations() { + } + + public OfferTranslations translations(@javax.annotation.Nullable List translations) { + this.translations = translations; + return this; + } + + public OfferTranslations addTranslationsItem(OfferTranslation translationsItem) { + if (this.translations == null) { + this.translations = new ArrayList<>(); + } + this.translations.add(translationsItem); + return this; + } + + /** + * Get translations + * @return translations + */ + @javax.annotation.Nullable + public List getTranslations() { + return translations; + } + + public void setTranslations(@javax.annotation.Nullable List translations) { + this.translations = translations; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferTranslations offerTranslations = (OfferTranslations) o; + return Objects.equals(this.translations, offerTranslations.translations); + } + + @Override + public int hashCode() { + return Objects.hash(translations); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferTranslations {\n"); + sb.append(" translations: ").append(toIndentedString(translations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("translations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferTranslations + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferTranslations.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferTranslations is not found in the empty JSON string", OfferTranslations.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferTranslations.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferTranslations` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("translations") != null && !jsonObj.get("translations").isJsonNull()) { + JsonArray jsonArraytranslations = jsonObj.getAsJsonArray("translations"); + if (jsonArraytranslations != null) { + // ensure the json data is an array + if (!jsonObj.get("translations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `translations` to be an array in the JSON string but got `%s`", jsonObj.get("translations").toString())); + } + + // validate the optional field `translations` (array) + for (int i = 0; i < jsonArraytranslations.size(); i++) { + OfferTranslation.validateJsonElement(jsonArraytranslations.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferTranslations.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferTranslations' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferTranslations.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferTranslations value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferTranslations read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferTranslations given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferTranslations + * @throws IOException if the JSON string is invalid with respect to OfferTranslations + */ + public static OfferTranslations fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferTranslations.class); + } + + /** + * Convert an instance of OfferTranslations to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferVendor.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferVendor.java new file mode 100644 index 0000000..1e54474 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferVendor.java @@ -0,0 +1,298 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * This section is available only for the charity, allegrolokalnie.pl, morizon.pl and ebilet.pl offers. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferVendor { + /** + * Identifier of the external service. + */ + @JsonAdapter(IdEnum.Adapter.class) + public enum IdEnum { + CHARYTATYWNI_ALLEGRO("CHARYTATYWNI_ALLEGRO"), + + ALLEGRO_LOKALNIE("ALLEGRO_LOKALNIE"), + + MORIZON("MORIZON"), + + EBILET("EBILET"), + + GRATKA("GRATKA"); + + private String value; + + IdEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static IdEnum fromValue(String value) { + for (IdEnum b : IdEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final IdEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public IdEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return IdEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + IdEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private IdEnum id; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable + private String url; + + public OfferVendor() { + } + + public OfferVendor id(@javax.annotation.Nullable IdEnum id) { + this.id = id; + return this; + } + + /** + * Identifier of the external service. + * @return id + */ + @javax.annotation.Nullable + public IdEnum getId() { + return id; + } + + public void setId(@javax.annotation.Nullable IdEnum id) { + this.id = id; + } + + + public OfferVendor url(@javax.annotation.Nullable String url) { + this.url = url; + return this; + } + + /** + * URL to the web page of the offer. + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nullable String url) { + this.url = url; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferVendor offerVendor = (OfferVendor) o; + return Objects.equals(this.id, offerVendor.id) && + Objects.equals(this.url, offerVendor.url); + } + + @Override + public int hashCode() { + return Objects.hash(id, url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferVendor {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferVendor + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferVendor.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferVendor is not found in the empty JSON string", OfferVendor.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferVendor.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferVendor` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `id` + if (jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) { + IdEnum.validateJsonElement(jsonObj.get("id")); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferVendor.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferVendor' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferVendor.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferVendor value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferVendor read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferVendor given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferVendor + * @throws IOException if the JSON string is invalid with respect to OfferVendor + */ + public static OfferVendor fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferVendor.class); + } + + /** + * Convert an instance of OfferVendor to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OfferVisibilityChangedEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/OfferVisibilityChangedEvent.java new file mode 100644 index 0000000..efb4de6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OfferVisibilityChangedEvent.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferEventExternalOfferWithPublication; +import pl.wtx.allegro.api.client.model.SellerOfferBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OfferVisibilityChangedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OfferVisibilityChangedEvent extends SellerOfferBaseEvent { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "OFFER_VISIBILITY_CHANGED"; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OfferEventExternalOfferWithPublication offer; + + public OfferVisibilityChangedEvent() { + this.type = this.getClass().getSimpleName(); + } + + public OfferVisibilityChangedEvent type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public OfferVisibilityChangedEvent offer(@javax.annotation.Nonnull OfferEventExternalOfferWithPublication offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OfferEventExternalOfferWithPublication getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OfferEventExternalOfferWithPublication offer) { + this.offer = offer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferVisibilityChangedEvent offerVisibilityChangedEvent = (OfferVisibilityChangedEvent) o; + return Objects.equals(this.type, offerVisibilityChangedEvent.type) && + Objects.equals(this.offer, offerVisibilityChangedEvent.offer) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, offer, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferVisibilityChangedEvent {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + openapiFields.add("offer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OfferVisibilityChangedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OfferVisibilityChangedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OfferVisibilityChangedEvent is not found in the empty JSON string", OfferVisibilityChangedEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OfferVisibilityChangedEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OfferVisibilityChangedEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OfferVisibilityChangedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OfferVisibilityChangedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OfferVisibilityChangedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OfferVisibilityChangedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OfferVisibilityChangedEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OfferVisibilityChangedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OfferVisibilityChangedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of OfferVisibilityChangedEvent + * @throws IOException if the JSON string is invalid with respect to OfferVisibilityChangedEvent + */ + public static OfferVisibilityChangedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OfferVisibilityChangedEvent.class); + } + + /** + * Convert an instance of OfferVisibilityChangedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OffersSearchResultDto.java b/src/main/java/pl/wtx/allegro/api/client/model/OffersSearchResultDto.java new file mode 100644 index 0000000..14d3f2a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OffersSearchResultDto.java @@ -0,0 +1,284 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferListingDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OffersSearchResultDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OffersSearchResultDto { + public static final String SERIALIZED_NAME_OFFERS = "offers"; + @SerializedName(SERIALIZED_NAME_OFFERS) + @javax.annotation.Nullable + private List offers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private Integer totalCount; + + public OffersSearchResultDto() { + } + + public OffersSearchResultDto offers(@javax.annotation.Nullable List offers) { + this.offers = offers; + return this; + } + + public OffersSearchResultDto addOffersItem(OfferListingDto offersItem) { + if (this.offers == null) { + this.offers = new ArrayList<>(); + } + this.offers.add(offersItem); + return this; + } + + /** + * The list of seller's offers matching the request's criteria. + * @return offers + */ + @javax.annotation.Nullable + public List getOffers() { + return offers; + } + + public void setOffers(@javax.annotation.Nullable List offers) { + this.offers = offers; + } + + + public OffersSearchResultDto count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Number of offers in the search result. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public OffersSearchResultDto totalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * The total number of offers matching the request's criteria. + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OffersSearchResultDto offersSearchResultDto = (OffersSearchResultDto) o; + return Objects.equals(this.offers, offersSearchResultDto.offers) && + Objects.equals(this.count, offersSearchResultDto.count) && + Objects.equals(this.totalCount, offersSearchResultDto.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(offers, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OffersSearchResultDto {\n"); + sb.append(" offers: ").append(toIndentedString(offers)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offers"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OffersSearchResultDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OffersSearchResultDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OffersSearchResultDto is not found in the empty JSON string", OffersSearchResultDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OffersSearchResultDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OffersSearchResultDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("offers") != null && !jsonObj.get("offers").isJsonNull()) { + JsonArray jsonArrayoffers = jsonObj.getAsJsonArray("offers"); + if (jsonArrayoffers != null) { + // ensure the json data is an array + if (!jsonObj.get("offers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offers` to be an array in the JSON string but got `%s`", jsonObj.get("offers").toString())); + } + + // validate the optional field `offers` (array) + for (int i = 0; i < jsonArrayoffers.size(); i++) { + OfferListingDto.validateJsonElement(jsonArrayoffers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OffersSearchResultDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OffersSearchResultDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OffersSearchResultDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OffersSearchResultDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OffersSearchResultDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OffersSearchResultDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of OffersSearchResultDto + * @throws IOException if the JSON string is invalid with respect to OffersSearchResultDto + */ + public static OffersSearchResultDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OffersSearchResultDto.class); + } + + /** + * Convert an instance of OffersSearchResultDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OpenHour.java b/src/main/java/pl/wtx/allegro/api/client/model/OpenHour.java new file mode 100644 index 0000000..6bbbb8a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OpenHour.java @@ -0,0 +1,276 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OpenHour + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OpenHour { + public static final String SERIALIZED_NAME_DAY_OF_WEEK = "dayOfWeek"; + @SerializedName(SERIALIZED_NAME_DAY_OF_WEEK) + @javax.annotation.Nonnull + private String dayOfWeek; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nonnull + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nonnull + private String to; + + public OpenHour() { + } + + public OpenHour dayOfWeek(@javax.annotation.Nonnull String dayOfWeek) { + this.dayOfWeek = dayOfWeek; + return this; + } + + /** + * Days of the week: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY. Date format ISO 8601 + * @return dayOfWeek + */ + @javax.annotation.Nonnull + public String getDayOfWeek() { + return dayOfWeek; + } + + public void setDayOfWeek(@javax.annotation.Nonnull String dayOfWeek) { + this.dayOfWeek = dayOfWeek; + } + + + public OpenHour from(@javax.annotation.Nonnull String from) { + this.from = from; + return this; + } + + /** + * Date format (ISO 8601) - HH:mm:ss.SSS + * @return from + */ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nonnull String from) { + this.from = from; + } + + + public OpenHour to(@javax.annotation.Nonnull String to) { + this.to = to; + return this; + } + + /** + * Date format (ISO 8601) - HH:mm:ss.SSS + * @return to + */ + @javax.annotation.Nonnull + public String getTo() { + return to; + } + + public void setTo(@javax.annotation.Nonnull String to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OpenHour openHour = (OpenHour) o; + return Objects.equals(this.dayOfWeek, openHour.dayOfWeek) && + Objects.equals(this.from, openHour.from) && + Objects.equals(this.to, openHour.to); + } + + @Override + public int hashCode() { + return Objects.hash(dayOfWeek, from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenHour {\n"); + sb.append(" dayOfWeek: ").append(toIndentedString(dayOfWeek)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("dayOfWeek"); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("dayOfWeek"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("to"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OpenHour + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OpenHour.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenHour is not found in the empty JSON string", OpenHour.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OpenHour.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OpenHour` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OpenHour.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("dayOfWeek").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `dayOfWeek` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dayOfWeek").toString())); + } + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OpenHour.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OpenHour' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OpenHour.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OpenHour value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OpenHour read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OpenHour given an JSON string + * + * @param jsonString JSON string + * @return An instance of OpenHour + * @throws IOException if the JSON string is invalid with respect to OpenHour + */ + public static OpenHour fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OpenHour.class); + } + + /** + * Convert an instance of OpenHour to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OperationParticipantAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/OperationParticipantAddress.java new file mode 100644 index 0000000..dbeeea5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OperationParticipantAddress.java @@ -0,0 +1,276 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Address. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OperationParticipantAddress { + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_POST_CODE = "postCode"; + @SerializedName(SERIALIZED_NAME_POST_CODE) + @javax.annotation.Nonnull + private String postCode; + + public OperationParticipantAddress() { + } + + public OperationParticipantAddress street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Street. + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public OperationParticipantAddress city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * City. + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public OperationParticipantAddress postCode(@javax.annotation.Nonnull String postCode) { + this.postCode = postCode; + return this; + } + + /** + * Postal code. + * @return postCode + */ + @javax.annotation.Nonnull + public String getPostCode() { + return postCode; + } + + public void setPostCode(@javax.annotation.Nonnull String postCode) { + this.postCode = postCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OperationParticipantAddress operationParticipantAddress = (OperationParticipantAddress) o; + return Objects.equals(this.street, operationParticipantAddress.street) && + Objects.equals(this.city, operationParticipantAddress.city) && + Objects.equals(this.postCode, operationParticipantAddress.postCode); + } + + @Override + public int hashCode() { + return Objects.hash(street, city, postCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OperationParticipantAddress {\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" postCode: ").append(toIndentedString(postCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("street"); + openapiFields.add("city"); + openapiFields.add("postCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("postCode"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OperationParticipantAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OperationParticipantAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OperationParticipantAddress is not found in the empty JSON string", OperationParticipantAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OperationParticipantAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OperationParticipantAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OperationParticipantAddress.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if (!jsonObj.get("postCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OperationParticipantAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OperationParticipantAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OperationParticipantAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OperationParticipantAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OperationParticipantAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OperationParticipantAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of OperationParticipantAddress + * @throws IOException if the JSON string is invalid with respect to OperationParticipantAddress + */ + public static OperationParticipantAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OperationParticipantAddress.class); + } + + /** + * Convert an instance of OperationParticipantAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OperationPayment.java b/src/main/java/pl/wtx/allegro/api/client/model/OperationPayment.java new file mode 100644 index 0000000..7ad513e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OperationPayment.java @@ -0,0 +1,215 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Payment. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OperationPayment { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public OperationPayment() { + } + + public OperationPayment id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * The payment ID. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OperationPayment operationPayment = (OperationPayment) o; + return Objects.equals(this.id, operationPayment.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OperationPayment {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OperationPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OperationPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OperationPayment is not found in the empty JSON string", OperationPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OperationPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OperationPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OperationPayment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OperationPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OperationPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OperationPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OperationPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OperationPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OperationPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of OperationPayment + * @throws IOException if the JSON string is invalid with respect to OperationPayment + */ + public static OperationPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OperationPayment.class); + } + + /** + * Convert an instance of OperationPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OperationValue.java b/src/main/java/pl/wtx/allegro/api/client/model/OperationValue.java new file mode 100644 index 0000000..37cc29d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OperationValue.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The operation value. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OperationValue { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public OperationValue() { + } + + public OperationValue amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public OperationValue currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OperationValue operationValue = (OperationValue) o; + return Objects.equals(this.amount, operationValue.amount) && + Objects.equals(this.currency, operationValue.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OperationValue {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OperationValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OperationValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OperationValue is not found in the empty JSON string", OperationValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OperationValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OperationValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OperationValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OperationValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OperationValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OperationValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OperationValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OperationValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OperationValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of OperationValue + * @throws IOException if the JSON string is invalid with respect to OperationValue + */ + public static OperationValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OperationValue.class); + } + + /** + * Convert an instance of OperationValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Order.java b/src/main/java/pl/wtx/allegro/api/client/model/Order.java new file mode 100644 index 0000000..75c3c4f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Order.java @@ -0,0 +1,263 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OrderOffersInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Order + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Order { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_OFFERS = "offers"; + @SerializedName(SERIALIZED_NAME_OFFERS) + @javax.annotation.Nonnull + private List offers = new ArrayList<>(); + + public Order() { + } + + public Order id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Order id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public Order offers(@javax.annotation.Nonnull List offers) { + this.offers = offers; + return this; + } + + public Order addOffersItem(OrderOffersInner offersItem) { + if (this.offers == null) { + this.offers = new ArrayList<>(); + } + this.offers.add(offersItem); + return this; + } + + /** + * List of order offers + * @return offers + */ + @javax.annotation.Nonnull + public List getOffers() { + return offers; + } + + public void setOffers(@javax.annotation.Nonnull List offers) { + this.offers = offers; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.offers, order.offers); + } + + @Override + public int hashCode() { + return Objects.hash(id, offers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" offers: ").append(toIndentedString(offers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("offers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("offers"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Order + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Order.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Order` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Order.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("offers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offers` to be an array in the JSON string but got `%s`", jsonObj.get("offers").toString())); + } + + JsonArray jsonArrayoffers = jsonObj.getAsJsonArray("offers"); + // validate the required field `offers` (array) + for (int i = 0; i < jsonArrayoffers.size(); i++) { + OrderOffersInner.validateJsonElement(jsonArrayoffers.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Order.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Order' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Order value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Order read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Order given an JSON string + * + * @param jsonString JSON string + * @return An instance of Order + * @throws IOException if the JSON string is invalid with respect to Order + */ + public static Order fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Order.class); + } + + /** + * Convert an instance of Order to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OrderEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/OrderEvent.java new file mode 100644 index 0000000..53d9ef1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OrderEvent.java @@ -0,0 +1,305 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OrderEventData; +import pl.wtx.allegro.api.client.model.OrderEventType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Order event + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OrderEvent { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + @javax.annotation.Nonnull + private OrderEventData order; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private OrderEventType type; + + public static final String SERIALIZED_NAME_OCCURRED_AT = "occurredAt"; + @SerializedName(SERIALIZED_NAME_OCCURRED_AT) + @javax.annotation.Nonnull + private OffsetDateTime occurredAt; + + public OrderEvent() { + } + + public OrderEvent id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * event id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public OrderEvent order(@javax.annotation.Nonnull OrderEventData order) { + this.order = order; + return this; + } + + /** + * Get order + * @return order + */ + @javax.annotation.Nonnull + public OrderEventData getOrder() { + return order; + } + + public void setOrder(@javax.annotation.Nonnull OrderEventData order) { + this.order = order; + } + + + public OrderEvent type(@javax.annotation.Nonnull OrderEventType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public OrderEventType getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull OrderEventType type) { + this.type = type; + } + + + public OrderEvent occurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + /** + * Date when the event occurred + * @return occurredAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getOccurredAt() { + return occurredAt; + } + + public void setOccurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrderEvent orderEvent = (OrderEvent) o; + return Objects.equals(this.id, orderEvent.id) && + Objects.equals(this.order, orderEvent.order) && + Objects.equals(this.type, orderEvent.type) && + Objects.equals(this.occurredAt, orderEvent.occurredAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, order, type, occurredAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrderEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" occurredAt: ").append(toIndentedString(occurredAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("order"); + openapiFields.add("type"); + openapiFields.add("occurredAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("order"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrderEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrderEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrderEvent is not found in the empty JSON string", OrderEvent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrderEvent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrderEvent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OrderEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `order` + OrderEventData.validateJsonElement(jsonObj.get("order")); + // validate the required field `type` + OrderEventType.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrderEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrderEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrderEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrderEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrderEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrderEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrderEvent + * @throws IOException if the JSON string is invalid with respect to OrderEvent + */ + public static OrderEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrderEvent.class); + } + + /** + * Convert an instance of OrderEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OrderEventData.java b/src/main/java/pl/wtx/allegro/api/client/model/OrderEventData.java new file mode 100644 index 0000000..c170418 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OrderEventData.java @@ -0,0 +1,358 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BuyerReference; +import pl.wtx.allegro.api.client.model.CheckoutFormReference; +import pl.wtx.allegro.api.client.model.OrderLineItem; +import pl.wtx.allegro.api.client.model.OrderMarketplace; +import pl.wtx.allegro.api.client.model.SellerReference; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Order event data + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OrderEventData { + public static final String SERIALIZED_NAME_SELLER = "seller"; + @SerializedName(SERIALIZED_NAME_SELLER) + @javax.annotation.Nonnull + private SellerReference seller; + + public static final String SERIALIZED_NAME_BUYER = "buyer"; + @SerializedName(SERIALIZED_NAME_BUYER) + @javax.annotation.Nonnull + private BuyerReference buyer; + + public static final String SERIALIZED_NAME_LINE_ITEMS = "lineItems"; + @SerializedName(SERIALIZED_NAME_LINE_ITEMS) + @javax.annotation.Nonnull + private List lineItems = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CHECKOUT_FORM = "checkoutForm"; + @SerializedName(SERIALIZED_NAME_CHECKOUT_FORM) + @javax.annotation.Nullable + private CheckoutFormReference checkoutForm; + + public static final String SERIALIZED_NAME_MARKETPLACE = "marketplace"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE) + @javax.annotation.Nullable + private OrderMarketplace marketplace; + + public OrderEventData() { + } + + public OrderEventData seller(@javax.annotation.Nonnull SellerReference seller) { + this.seller = seller; + return this; + } + + /** + * Get seller + * @return seller + */ + @javax.annotation.Nonnull + public SellerReference getSeller() { + return seller; + } + + public void setSeller(@javax.annotation.Nonnull SellerReference seller) { + this.seller = seller; + } + + + public OrderEventData buyer(@javax.annotation.Nonnull BuyerReference buyer) { + this.buyer = buyer; + return this; + } + + /** + * Get buyer + * @return buyer + */ + @javax.annotation.Nonnull + public BuyerReference getBuyer() { + return buyer; + } + + public void setBuyer(@javax.annotation.Nonnull BuyerReference buyer) { + this.buyer = buyer; + } + + + public OrderEventData lineItems(@javax.annotation.Nonnull List lineItems) { + this.lineItems = lineItems; + return this; + } + + public OrderEventData addLineItemsItem(OrderLineItem lineItemsItem) { + if (this.lineItems == null) { + this.lineItems = new ArrayList<>(); + } + this.lineItems.add(lineItemsItem); + return this; + } + + /** + * Get lineItems + * @return lineItems + */ + @javax.annotation.Nonnull + public List getLineItems() { + return lineItems; + } + + public void setLineItems(@javax.annotation.Nonnull List lineItems) { + this.lineItems = lineItems; + } + + + public OrderEventData checkoutForm(@javax.annotation.Nullable CheckoutFormReference checkoutForm) { + this.checkoutForm = checkoutForm; + return this; + } + + /** + * Get checkoutForm + * @return checkoutForm + */ + @javax.annotation.Nullable + public CheckoutFormReference getCheckoutForm() { + return checkoutForm; + } + + public void setCheckoutForm(@javax.annotation.Nullable CheckoutFormReference checkoutForm) { + this.checkoutForm = checkoutForm; + } + + + public OrderEventData marketplace(@javax.annotation.Nullable OrderMarketplace marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get marketplace + * @return marketplace + */ + @javax.annotation.Nullable + public OrderMarketplace getMarketplace() { + return marketplace; + } + + public void setMarketplace(@javax.annotation.Nullable OrderMarketplace marketplace) { + this.marketplace = marketplace; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrderEventData orderEventData = (OrderEventData) o; + return Objects.equals(this.seller, orderEventData.seller) && + Objects.equals(this.buyer, orderEventData.buyer) && + Objects.equals(this.lineItems, orderEventData.lineItems) && + Objects.equals(this.checkoutForm, orderEventData.checkoutForm) && + Objects.equals(this.marketplace, orderEventData.marketplace); + } + + @Override + public int hashCode() { + return Objects.hash(seller, buyer, lineItems, checkoutForm, marketplace); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrderEventData {\n"); + sb.append(" seller: ").append(toIndentedString(seller)).append("\n"); + sb.append(" buyer: ").append(toIndentedString(buyer)).append("\n"); + sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n"); + sb.append(" checkoutForm: ").append(toIndentedString(checkoutForm)).append("\n"); + sb.append(" marketplace: ").append(toIndentedString(marketplace)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("seller"); + openapiFields.add("buyer"); + openapiFields.add("lineItems"); + openapiFields.add("checkoutForm"); + openapiFields.add("marketplace"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("seller"); + openapiRequiredFields.add("buyer"); + openapiRequiredFields.add("lineItems"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrderEventData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrderEventData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrderEventData is not found in the empty JSON string", OrderEventData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrderEventData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrderEventData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OrderEventData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `seller` + SellerReference.validateJsonElement(jsonObj.get("seller")); + // validate the required field `buyer` + BuyerReference.validateJsonElement(jsonObj.get("buyer")); + // ensure the json data is an array + if (!jsonObj.get("lineItems").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `lineItems` to be an array in the JSON string but got `%s`", jsonObj.get("lineItems").toString())); + } + + JsonArray jsonArraylineItems = jsonObj.getAsJsonArray("lineItems"); + // validate the required field `lineItems` (array) + for (int i = 0; i < jsonArraylineItems.size(); i++) { + OrderLineItem.validateJsonElement(jsonArraylineItems.get(i)); + }; + // validate the optional field `checkoutForm` + if (jsonObj.get("checkoutForm") != null && !jsonObj.get("checkoutForm").isJsonNull()) { + CheckoutFormReference.validateJsonElement(jsonObj.get("checkoutForm")); + } + // validate the optional field `marketplace` + if (jsonObj.get("marketplace") != null && !jsonObj.get("marketplace").isJsonNull()) { + OrderMarketplace.validateJsonElement(jsonObj.get("marketplace")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrderEventData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrderEventData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrderEventData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrderEventData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrderEventData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrderEventData given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrderEventData + * @throws IOException if the JSON string is invalid with respect to OrderEventData + */ + public static OrderEventData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrderEventData.class); + } + + /** + * Convert an instance of OrderEventData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OrderEventStats.java b/src/main/java/pl/wtx/allegro/api/client/model/OrderEventStats.java new file mode 100644 index 0000000..0befee7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OrderEventStats.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.LatestOrderEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Event statistics, currently contains only basic information about the latest event. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OrderEventStats { + public static final String SERIALIZED_NAME_LATEST_EVENT = "latestEvent"; + @SerializedName(SERIALIZED_NAME_LATEST_EVENT) + @javax.annotation.Nullable + private LatestOrderEvent latestEvent; + + public OrderEventStats() { + } + + public OrderEventStats latestEvent(@javax.annotation.Nullable LatestOrderEvent latestEvent) { + this.latestEvent = latestEvent; + return this; + } + + /** + * Get latestEvent + * @return latestEvent + */ + @javax.annotation.Nullable + public LatestOrderEvent getLatestEvent() { + return latestEvent; + } + + public void setLatestEvent(@javax.annotation.Nullable LatestOrderEvent latestEvent) { + this.latestEvent = latestEvent; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrderEventStats orderEventStats = (OrderEventStats) o; + return Objects.equals(this.latestEvent, orderEventStats.latestEvent); + } + + @Override + public int hashCode() { + return Objects.hash(latestEvent); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrderEventStats {\n"); + sb.append(" latestEvent: ").append(toIndentedString(latestEvent)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("latestEvent"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrderEventStats + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrderEventStats.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrderEventStats is not found in the empty JSON string", OrderEventStats.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrderEventStats.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrderEventStats` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `latestEvent` + if (jsonObj.get("latestEvent") != null && !jsonObj.get("latestEvent").isJsonNull()) { + LatestOrderEvent.validateJsonElement(jsonObj.get("latestEvent")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrderEventStats.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrderEventStats' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrderEventStats.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrderEventStats value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrderEventStats read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrderEventStats given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrderEventStats + * @throws IOException if the JSON string is invalid with respect to OrderEventStats + */ + public static OrderEventStats fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrderEventStats.class); + } + + /** + * Convert an instance of OrderEventStats to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OrderEventType.java b/src/main/java/pl/wtx/allegro/api/client/model/OrderEventType.java new file mode 100644 index 0000000..6f357d4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OrderEventType.java @@ -0,0 +1,88 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Type of order event. * `BOUGHT` - purchase without checkout form filled in * `FILLED_IN` - checkout form filled in but payment is not completed yet so data could still change * `READY_FOR_PROCESSING` - payment completed. Purchase is ready for processing. * `BUYER_CANCELLED` - purchase cancelled by buyer * `FULFILLMENT_STATUS_CHANGED`: fulfillment status changed. * `BUYER_MODIFIED` - purchase modified by buyer * `AUTO_CANCELLED` - purchase cancelled automatically by Allegro + */ +@JsonAdapter(OrderEventType.Adapter.class) +public enum OrderEventType { + + BOUGHT("BOUGHT"), + + FILLED_IN("FILLED_IN"), + + READY_FOR_PROCESSING("READY_FOR_PROCESSING"), + + BUYER_CANCELLED("BUYER_CANCELLED"), + + FULFILLMENT_STATUS_CHANGED("FULFILLMENT_STATUS_CHANGED"), + + BUYER_MODIFIED("BUYER_MODIFIED"), + + AUTO_CANCELLED("AUTO_CANCELLED"); + + private String value; + + OrderEventType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OrderEventType fromValue(String value) { + for (OrderEventType b : OrderEventType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OrderEventType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OrderEventType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OrderEventType.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OrderEventType.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OrderEventsList.java b/src/main/java/pl/wtx/allegro/api/client/model/OrderEventsList.java new file mode 100644 index 0000000..e1e8153 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OrderEventsList.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OrderEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Order events list + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OrderEventsList { + public static final String SERIALIZED_NAME_EVENTS = "events"; + @SerializedName(SERIALIZED_NAME_EVENTS) + @javax.annotation.Nonnull + private List events = new ArrayList<>(); + + public OrderEventsList() { + } + + public OrderEventsList events(@javax.annotation.Nonnull List events) { + this.events = events; + return this; + } + + public OrderEventsList addEventsItem(OrderEvent eventsItem) { + if (this.events == null) { + this.events = new ArrayList<>(); + } + this.events.add(eventsItem); + return this; + } + + /** + * Get events + * @return events + */ + @javax.annotation.Nonnull + public List getEvents() { + return events; + } + + public void setEvents(@javax.annotation.Nonnull List events) { + this.events = events; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrderEventsList orderEventsList = (OrderEventsList) o; + return Objects.equals(this.events, orderEventsList.events); + } + + @Override + public int hashCode() { + return Objects.hash(events); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrderEventsList {\n"); + sb.append(" events: ").append(toIndentedString(events)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("events"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("events"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrderEventsList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrderEventsList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrderEventsList is not found in the empty JSON string", OrderEventsList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrderEventsList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrderEventsList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OrderEventsList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + + JsonArray jsonArrayevents = jsonObj.getAsJsonArray("events"); + // validate the required field `events` (array) + for (int i = 0; i < jsonArrayevents.size(); i++) { + OrderEvent.validateJsonElement(jsonArrayevents.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrderEventsList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrderEventsList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrderEventsList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrderEventsList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrderEventsList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrderEventsList given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrderEventsList + * @throws IOException if the JSON string is invalid with respect to OrderEventsList + */ + public static OrderEventsList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrderEventsList.class); + } + + /** + * Convert an instance of OrderEventsList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OrderLineItem.java b/src/main/java/pl/wtx/allegro/api/client/model/OrderLineItem.java new file mode 100644 index 0000000..5598cef --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OrderLineItem.java @@ -0,0 +1,366 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.OrderLineItemOfferReference; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Order item + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OrderLineItem { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nonnull + private OrderLineItemOfferReference offer; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nonnull + private BigDecimal quantity; + + public static final String SERIALIZED_NAME_ORIGINAL_PRICE = "originalPrice"; + @SerializedName(SERIALIZED_NAME_ORIGINAL_PRICE) + @javax.annotation.Nullable + private Price originalPrice; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nonnull + private Price price; + + public static final String SERIALIZED_NAME_BOUGHT_AT = "boughtAt"; + @SerializedName(SERIALIZED_NAME_BOUGHT_AT) + @javax.annotation.Nullable + private OffsetDateTime boughtAt; + + public OrderLineItem() { + } + + public OrderLineItem id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Order item identifier + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public OrderLineItem offer(@javax.annotation.Nonnull OrderLineItemOfferReference offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nonnull + public OrderLineItemOfferReference getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nonnull OrderLineItemOfferReference offer) { + this.offer = offer; + } + + + public OrderLineItem quantity(@javax.annotation.Nonnull BigDecimal quantity) { + this.quantity = quantity; + return this; + } + + /** + * quantity + * minimum: 0 + * @return quantity + */ + @javax.annotation.Nonnull + public BigDecimal getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nonnull BigDecimal quantity) { + this.quantity = quantity; + } + + + public OrderLineItem originalPrice(@javax.annotation.Nullable Price originalPrice) { + this.originalPrice = originalPrice; + return this; + } + + /** + * Get originalPrice + * @return originalPrice + */ + @javax.annotation.Nullable + public Price getOriginalPrice() { + return originalPrice; + } + + public void setOriginalPrice(@javax.annotation.Nullable Price originalPrice) { + this.originalPrice = originalPrice; + } + + + public OrderLineItem price(@javax.annotation.Nonnull Price price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nonnull + public Price getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nonnull Price price) { + this.price = price; + } + + + public OrderLineItem boughtAt(@javax.annotation.Nullable OffsetDateTime boughtAt) { + this.boughtAt = boughtAt; + return this; + } + + /** + * ISO date when offer was bought + * @return boughtAt + */ + @javax.annotation.Nullable + public OffsetDateTime getBoughtAt() { + return boughtAt; + } + + public void setBoughtAt(@javax.annotation.Nullable OffsetDateTime boughtAt) { + this.boughtAt = boughtAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrderLineItem orderLineItem = (OrderLineItem) o; + return Objects.equals(this.id, orderLineItem.id) && + Objects.equals(this.offer, orderLineItem.offer) && + Objects.equals(this.quantity, orderLineItem.quantity) && + Objects.equals(this.originalPrice, orderLineItem.originalPrice) && + Objects.equals(this.price, orderLineItem.price) && + Objects.equals(this.boughtAt, orderLineItem.boughtAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, offer, quantity, originalPrice, price, boughtAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrderLineItem {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" originalPrice: ").append(toIndentedString(originalPrice)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" boughtAt: ").append(toIndentedString(boughtAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("offer"); + openapiFields.add("quantity"); + openapiFields.add("originalPrice"); + openapiFields.add("price"); + openapiFields.add("boughtAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("offer"); + openapiRequiredFields.add("quantity"); + openapiRequiredFields.add("price"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrderLineItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrderLineItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrderLineItem is not found in the empty JSON string", OrderLineItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrderLineItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrderLineItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OrderLineItem.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `offer` + OrderLineItemOfferReference.validateJsonElement(jsonObj.get("offer")); + // validate the optional field `originalPrice` + if (jsonObj.get("originalPrice") != null && !jsonObj.get("originalPrice").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("originalPrice")); + } + // validate the required field `price` + Price.validateJsonElement(jsonObj.get("price")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrderLineItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrderLineItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrderLineItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrderLineItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrderLineItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrderLineItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrderLineItem + * @throws IOException if the JSON string is invalid with respect to OrderLineItem + */ + public static OrderLineItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrderLineItem.class); + } + + /** + * Convert an instance of OrderLineItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OrderLineItemOfferReference.java b/src/main/java/pl/wtx/allegro/api/client/model/OrderLineItemOfferReference.java new file mode 100644 index 0000000..a71c74d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OrderLineItemOfferReference.java @@ -0,0 +1,277 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ExternalId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer identifier. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OrderLineItemOfferReference { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nullable + private ExternalId external; + + public OrderLineItemOfferReference() { + } + + public OrderLineItemOfferReference id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public OrderLineItemOfferReference name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Offer name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public OrderLineItemOfferReference external(@javax.annotation.Nullable ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nullable + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nullable ExternalId external) { + this.external = external; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrderLineItemOfferReference orderLineItemOfferReference = (OrderLineItemOfferReference) o; + return Objects.equals(this.id, orderLineItemOfferReference.id) && + Objects.equals(this.name, orderLineItemOfferReference.name) && + Objects.equals(this.external, orderLineItemOfferReference.external); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, external); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrderLineItemOfferReference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("external"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrderLineItemOfferReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrderLineItemOfferReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrderLineItemOfferReference is not found in the empty JSON string", OrderLineItemOfferReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrderLineItemOfferReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrderLineItemOfferReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OrderLineItemOfferReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `external` + if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { + ExternalId.validateJsonElement(jsonObj.get("external")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrderLineItemOfferReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrderLineItemOfferReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrderLineItemOfferReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrderLineItemOfferReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrderLineItemOfferReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrderLineItemOfferReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrderLineItemOfferReference + * @throws IOException if the JSON string is invalid with respect to OrderLineItemOfferReference + */ + public static OrderLineItemOfferReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrderLineItemOfferReference.class); + } + + /** + * Convert an instance of OrderLineItemOfferReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OrderMarketplace.java b/src/main/java/pl/wtx/allegro/api/client/model/OrderMarketplace.java new file mode 100644 index 0000000..511567b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OrderMarketplace.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OrderMarketplace + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OrderMarketplace { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public OrderMarketplace() { + } + + public OrderMarketplace id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Id of the purchase marketplace + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrderMarketplace orderMarketplace = (OrderMarketplace) o; + return Objects.equals(this.id, orderMarketplace.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrderMarketplace {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrderMarketplace + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrderMarketplace.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrderMarketplace is not found in the empty JSON string", OrderMarketplace.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrderMarketplace.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrderMarketplace` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OrderMarketplace.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrderMarketplace.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrderMarketplace' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrderMarketplace.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrderMarketplace value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrderMarketplace read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrderMarketplace given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrderMarketplace + * @throws IOException if the JSON string is invalid with respect to OrderMarketplace + */ + public static OrderMarketplace fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrderMarketplace.class); + } + + /** + * Convert an instance of OrderMarketplace to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OrderOffersInner.java b/src/main/java/pl/wtx/allegro/api/client/model/OrderOffersInner.java new file mode 100644 index 0000000..d622046 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OrderOffersInner.java @@ -0,0 +1,275 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OrderOffersInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OrderOffersInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + @javax.annotation.Nonnull + private String title; + + public static final String SERIALIZED_NAME_SNAPSHOT = "snapshot"; + @SerializedName(SERIALIZED_NAME_SNAPSHOT) + @javax.annotation.Nullable + private String snapshot; + + public OrderOffersInner() { + } + + public OrderOffersInner id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Offer ID + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public OrderOffersInner title(@javax.annotation.Nonnull String title) { + this.title = title; + return this; + } + + /** + * Offer title + * @return title + */ + @javax.annotation.Nonnull + public String getTitle() { + return title; + } + + public void setTitle(@javax.annotation.Nonnull String title) { + this.title = title; + } + + + public OrderOffersInner snapshot(@javax.annotation.Nullable String snapshot) { + this.snapshot = snapshot; + return this; + } + + /** + * Offer snapshot URL parameter pointing to historical offer view + * @return snapshot + */ + @javax.annotation.Nullable + public String getSnapshot() { + return snapshot; + } + + public void setSnapshot(@javax.annotation.Nullable String snapshot) { + this.snapshot = snapshot; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrderOffersInner orderOffersInner = (OrderOffersInner) o; + return Objects.equals(this.id, orderOffersInner.id) && + Objects.equals(this.title, orderOffersInner.title) && + Objects.equals(this.snapshot, orderOffersInner.snapshot); + } + + @Override + public int hashCode() { + return Objects.hash(id, title, snapshot); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrderOffersInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" snapshot: ").append(toIndentedString(snapshot)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("title"); + openapiFields.add("snapshot"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("title"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrderOffersInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrderOffersInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrderOffersInner is not found in the empty JSON string", OrderOffersInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrderOffersInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrderOffersInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OrderOffersInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); + } + if ((jsonObj.get("snapshot") != null && !jsonObj.get("snapshot").isJsonNull()) && !jsonObj.get("snapshot").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `snapshot` to be a primitive type in the JSON string but got `%s`", jsonObj.get("snapshot").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrderOffersInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrderOffersInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrderOffersInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrderOffersInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrderOffersInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrderOffersInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrderOffersInner + * @throws IOException if the JSON string is invalid with respect to OrderOffersInner + */ + public static OrderOffersInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrderOffersInner.class); + } + + /** + * Convert an instance of OrderOffersInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OrdersShippingCarrier.java b/src/main/java/pl/wtx/allegro/api/client/model/OrdersShippingCarrier.java new file mode 100644 index 0000000..5b1b475 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OrdersShippingCarrier.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OrdersShippingCarrier + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OrdersShippingCarrier { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public OrdersShippingCarrier() { + } + + public OrdersShippingCarrier id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Identifier of a carrier - unique to every carrier. It’s highly recommended to use an identifier different from `OTHER`, because its parcel status may be updated automatically. Carrier identifier `OTHER` is reserved for cases when seller uses a custom carrier or not yet integrated with Allegro. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public OrdersShippingCarrier name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of a carrier. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrdersShippingCarrier ordersShippingCarrier = (OrdersShippingCarrier) o; + return Objects.equals(this.id, ordersShippingCarrier.id) && + Objects.equals(this.name, ordersShippingCarrier.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrdersShippingCarrier {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrdersShippingCarrier + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrdersShippingCarrier.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrdersShippingCarrier is not found in the empty JSON string", OrdersShippingCarrier.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrdersShippingCarrier.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrdersShippingCarrier` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrdersShippingCarrier.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrdersShippingCarrier' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrdersShippingCarrier.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrdersShippingCarrier value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrdersShippingCarrier read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrdersShippingCarrier given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrdersShippingCarrier + * @throws IOException if the JSON string is invalid with respect to OrdersShippingCarrier + */ + public static OrdersShippingCarrier fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrdersShippingCarrier.class); + } + + /** + * Convert an instance of OrdersShippingCarrier to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OrdersShippingCarriersResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/OrdersShippingCarriersResponse.java new file mode 100644 index 0000000..3e3802a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OrdersShippingCarriersResponse.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OrdersShippingCarrier; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OrdersShippingCarriersResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OrdersShippingCarriersResponse { + public static final String SERIALIZED_NAME_CARRIERS = "carriers"; + @SerializedName(SERIALIZED_NAME_CARRIERS) + @javax.annotation.Nullable + private List carriers = new ArrayList<>(); + + public OrdersShippingCarriersResponse() { + } + + public OrdersShippingCarriersResponse carriers(@javax.annotation.Nullable List carriers) { + this.carriers = carriers; + return this; + } + + public OrdersShippingCarriersResponse addCarriersItem(OrdersShippingCarrier carriersItem) { + if (this.carriers == null) { + this.carriers = new ArrayList<>(); + } + this.carriers.add(carriersItem); + return this; + } + + /** + * List of shipping carriers. + * @return carriers + */ + @javax.annotation.Nullable + public List getCarriers() { + return carriers; + } + + public void setCarriers(@javax.annotation.Nullable List carriers) { + this.carriers = carriers; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrdersShippingCarriersResponse ordersShippingCarriersResponse = (OrdersShippingCarriersResponse) o; + return Objects.equals(this.carriers, ordersShippingCarriersResponse.carriers); + } + + @Override + public int hashCode() { + return Objects.hash(carriers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrdersShippingCarriersResponse {\n"); + sb.append(" carriers: ").append(toIndentedString(carriers)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("carriers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrdersShippingCarriersResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrdersShippingCarriersResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrdersShippingCarriersResponse is not found in the empty JSON string", OrdersShippingCarriersResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OrdersShippingCarriersResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OrdersShippingCarriersResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("carriers") != null && !jsonObj.get("carriers").isJsonNull()) { + JsonArray jsonArraycarriers = jsonObj.getAsJsonArray("carriers"); + if (jsonArraycarriers != null) { + // ensure the json data is an array + if (!jsonObj.get("carriers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `carriers` to be an array in the JSON string but got `%s`", jsonObj.get("carriers").toString())); + } + + // validate the optional field `carriers` (array) + for (int i = 0; i < jsonArraycarriers.size(); i++) { + OrdersShippingCarrier.validateJsonElement(jsonArraycarriers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrdersShippingCarriersResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrdersShippingCarriersResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrdersShippingCarriersResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrdersShippingCarriersResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OrdersShippingCarriersResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrdersShippingCarriersResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrdersShippingCarriersResponse + * @throws IOException if the JSON string is invalid with respect to OrdersShippingCarriersResponse + */ + public static OrdersShippingCarriersResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrdersShippingCarriersResponse.class); + } + + /** + * Convert an instance of OrdersShippingCarriersResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/OwnTransportShipping.java b/src/main/java/pl/wtx/allegro/api/client/model/OwnTransportShipping.java new file mode 100644 index 0000000..b25f562 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/OwnTransportShipping.java @@ -0,0 +1,288 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Shipping; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * OwnTransportShipping + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class OwnTransportShipping extends Shipping { + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + @javax.annotation.Nullable + protected String method = "OWN_TRANSPORT"; + + public static final String SERIALIZED_NAME_TRUCK_LICENCE_PLATE = "truckLicencePlate"; + @SerializedName(SERIALIZED_NAME_TRUCK_LICENCE_PLATE) + @javax.annotation.Nullable + private String truckLicencePlate; + + public static final String SERIALIZED_NAME_ESTIMATED_TIME_OF_ARRIVAL = "estimatedTimeOfArrival"; + @SerializedName(SERIALIZED_NAME_ESTIMATED_TIME_OF_ARRIVAL) + @javax.annotation.Nullable + private OffsetDateTime estimatedTimeOfArrival; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode; + + public OwnTransportShipping() { + this.method = this.getClass().getSimpleName(); + } + + public OwnTransportShipping method(@javax.annotation.Nullable String method) { + this.method = method; + return this; + } + + /** + * Get method + * @return method + */ + @javax.annotation.Nullable + public String getMethod() { + return method; + } + + public void setMethod(@javax.annotation.Nullable String method) { + this.method = method; + } + + + public OwnTransportShipping truckLicencePlate(@javax.annotation.Nullable String truckLicencePlate) { + this.truckLicencePlate = truckLicencePlate; + return this; + } + + /** + * The licence plate of the truck that will deliver the shipment. + * @return truckLicencePlate + */ + @javax.annotation.Nullable + public String getTruckLicencePlate() { + return truckLicencePlate; + } + + public void setTruckLicencePlate(@javax.annotation.Nullable String truckLicencePlate) { + this.truckLicencePlate = truckLicencePlate; + } + + + public OwnTransportShipping estimatedTimeOfArrival(@javax.annotation.Nullable OffsetDateTime estimatedTimeOfArrival) { + this.estimatedTimeOfArrival = estimatedTimeOfArrival; + return this; + } + + /** + * The estimated date and time of Advance Ship Notice arrival in the warehouse. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601). + * @return estimatedTimeOfArrival + */ + @javax.annotation.Nullable + public OffsetDateTime getEstimatedTimeOfArrival() { + return estimatedTimeOfArrival; + } + + public void setEstimatedTimeOfArrival(@javax.annotation.Nullable OffsetDateTime estimatedTimeOfArrival) { + this.estimatedTimeOfArrival = estimatedTimeOfArrival; + } + + + public OwnTransportShipping countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code in ISO 3166-1 alpha-2 format (two-letter code), which means the country from which Advance Ship Notice is sent. + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnTransportShipping ownTransportShipping = (OwnTransportShipping) o; + return Objects.equals(this.method, ownTransportShipping.method) && + Objects.equals(this.truckLicencePlate, ownTransportShipping.truckLicencePlate) && + Objects.equals(this.estimatedTimeOfArrival, ownTransportShipping.estimatedTimeOfArrival) && + Objects.equals(this.countryCode, ownTransportShipping.countryCode) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(method, truckLicencePlate, estimatedTimeOfArrival, countryCode, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnTransportShipping {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" truckLicencePlate: ").append(toIndentedString(truckLicencePlate)).append("\n"); + sb.append(" estimatedTimeOfArrival: ").append(toIndentedString(estimatedTimeOfArrival)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("method"); + openapiFields.add("truckLicencePlate"); + openapiFields.add("estimatedTimeOfArrival"); + openapiFields.add("countryCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OwnTransportShipping + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OwnTransportShipping.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OwnTransportShipping is not found in the empty JSON string", OwnTransportShipping.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OwnTransportShipping.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OwnTransportShipping` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OwnTransportShipping.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OwnTransportShipping' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OwnTransportShipping.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OwnTransportShipping value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OwnTransportShipping read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OwnTransportShipping given an JSON string + * + * @param jsonString JSON string + * @return An instance of OwnTransportShipping + * @throws IOException if the JSON string is invalid with respect to OwnTransportShipping + */ + public static OwnTransportShipping fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OwnTransportShipping.class); + } + + /** + * Convert an instance of OwnTransportShipping to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PackageDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PackageDto.java new file mode 100644 index 0000000..449fcca --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PackageDto.java @@ -0,0 +1,452 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DimensionValue; +import pl.wtx.allegro.api.client.model.WeightValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PackageDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PackageDto { + public static final String SERIALIZED_NAME_WAYBILL = "waybill"; + @SerializedName(SERIALIZED_NAME_WAYBILL) + @javax.annotation.Nullable + private String waybill; + + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + DOX("DOX"), + + PACKAGE("PACKAGE"), + + PALLET("PALLET"), + + OTHER("OTHER"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String SERIALIZED_NAME_LENGTH = "length"; + @SerializedName(SERIALIZED_NAME_LENGTH) + @javax.annotation.Nullable + private DimensionValue length; + + public static final String SERIALIZED_NAME_WIDTH = "width"; + @SerializedName(SERIALIZED_NAME_WIDTH) + @javax.annotation.Nullable + private DimensionValue width; + + public static final String SERIALIZED_NAME_HEIGHT = "height"; + @SerializedName(SERIALIZED_NAME_HEIGHT) + @javax.annotation.Nullable + private DimensionValue height; + + public static final String SERIALIZED_NAME_WEIGHT = "weight"; + @SerializedName(SERIALIZED_NAME_WEIGHT) + @javax.annotation.Nullable + private WeightValue weight; + + public static final String SERIALIZED_NAME_TEXT_ON_LABEL = "textOnLabel"; + @SerializedName(SERIALIZED_NAME_TEXT_ON_LABEL) + @javax.annotation.Nullable + private String textOnLabel; + + public PackageDto() { + } + + public PackageDto waybill(@javax.annotation.Nullable String waybill) { + this.waybill = waybill; + return this; + } + + /** + * Waybill number (carrier tracking number). + * @return waybill + */ + @javax.annotation.Nullable + public String getWaybill() { + return waybill; + } + + public void setWaybill(@javax.annotation.Nullable String waybill) { + this.waybill = waybill; + } + + + public PackageDto type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public PackageDto length(@javax.annotation.Nullable DimensionValue length) { + this.length = length; + return this; + } + + /** + * Get length + * @return length + */ + @javax.annotation.Nullable + public DimensionValue getLength() { + return length; + } + + public void setLength(@javax.annotation.Nullable DimensionValue length) { + this.length = length; + } + + + public PackageDto width(@javax.annotation.Nullable DimensionValue width) { + this.width = width; + return this; + } + + /** + * Get width + * @return width + */ + @javax.annotation.Nullable + public DimensionValue getWidth() { + return width; + } + + public void setWidth(@javax.annotation.Nullable DimensionValue width) { + this.width = width; + } + + + public PackageDto height(@javax.annotation.Nullable DimensionValue height) { + this.height = height; + return this; + } + + /** + * Get height + * @return height + */ + @javax.annotation.Nullable + public DimensionValue getHeight() { + return height; + } + + public void setHeight(@javax.annotation.Nullable DimensionValue height) { + this.height = height; + } + + + public PackageDto weight(@javax.annotation.Nullable WeightValue weight) { + this.weight = weight; + return this; + } + + /** + * Get weight + * @return weight + */ + @javax.annotation.Nullable + public WeightValue getWeight() { + return weight; + } + + public void setWeight(@javax.annotation.Nullable WeightValue weight) { + this.weight = weight; + } + + + public PackageDto textOnLabel(@javax.annotation.Nullable String textOnLabel) { + this.textOnLabel = textOnLabel; + return this; + } + + /** + * Additional information on the package label. + * @return textOnLabel + */ + @javax.annotation.Nullable + public String getTextOnLabel() { + return textOnLabel; + } + + public void setTextOnLabel(@javax.annotation.Nullable String textOnLabel) { + this.textOnLabel = textOnLabel; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PackageDto packageDto = (PackageDto) o; + return Objects.equals(this.waybill, packageDto.waybill) && + Objects.equals(this.type, packageDto.type) && + Objects.equals(this.length, packageDto.length) && + Objects.equals(this.width, packageDto.width) && + Objects.equals(this.height, packageDto.height) && + Objects.equals(this.weight, packageDto.weight) && + Objects.equals(this.textOnLabel, packageDto.textOnLabel); + } + + @Override + public int hashCode() { + return Objects.hash(waybill, type, length, width, height, weight, textOnLabel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PackageDto {\n"); + sb.append(" waybill: ").append(toIndentedString(waybill)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" length: ").append(toIndentedString(length)).append("\n"); + sb.append(" width: ").append(toIndentedString(width)).append("\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append(" textOnLabel: ").append(toIndentedString(textOnLabel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("waybill"); + openapiFields.add("type"); + openapiFields.add("length"); + openapiFields.add("width"); + openapiFields.add("height"); + openapiFields.add("weight"); + openapiFields.add("textOnLabel"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PackageDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PackageDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PackageDto is not found in the empty JSON string", PackageDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PackageDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PackageDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("waybill") != null && !jsonObj.get("waybill").isJsonNull()) && !jsonObj.get("waybill").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `waybill` to be a primitive type in the JSON string but got `%s`", jsonObj.get("waybill").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + // validate the optional field `length` + if (jsonObj.get("length") != null && !jsonObj.get("length").isJsonNull()) { + DimensionValue.validateJsonElement(jsonObj.get("length")); + } + // validate the optional field `width` + if (jsonObj.get("width") != null && !jsonObj.get("width").isJsonNull()) { + DimensionValue.validateJsonElement(jsonObj.get("width")); + } + // validate the optional field `height` + if (jsonObj.get("height") != null && !jsonObj.get("height").isJsonNull()) { + DimensionValue.validateJsonElement(jsonObj.get("height")); + } + // validate the optional field `weight` + if (jsonObj.get("weight") != null && !jsonObj.get("weight").isJsonNull()) { + WeightValue.validateJsonElement(jsonObj.get("weight")); + } + if ((jsonObj.get("textOnLabel") != null && !jsonObj.get("textOnLabel").isJsonNull()) && !jsonObj.get("textOnLabel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `textOnLabel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("textOnLabel").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PackageDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PackageDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PackageDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PackageDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PackageDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PackageDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PackageDto + * @throws IOException if the JSON string is invalid with respect to PackageDto + */ + public static PackageDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PackageDto.class); + } + + /** + * Convert an instance of PackageDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PackageRequestDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PackageRequestDto.java new file mode 100644 index 0000000..2ade801 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PackageRequestDto.java @@ -0,0 +1,366 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.DimensionValue; +import pl.wtx.allegro.api.client.model.WeightValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PackageRequestDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PackageRequestDto { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_LENGTH = "length"; + @SerializedName(SERIALIZED_NAME_LENGTH) + @javax.annotation.Nonnull + private DimensionValue length; + + public static final String SERIALIZED_NAME_WIDTH = "width"; + @SerializedName(SERIALIZED_NAME_WIDTH) + @javax.annotation.Nonnull + private DimensionValue width; + + public static final String SERIALIZED_NAME_HEIGHT = "height"; + @SerializedName(SERIALIZED_NAME_HEIGHT) + @javax.annotation.Nonnull + private DimensionValue height; + + public static final String SERIALIZED_NAME_WEIGHT = "weight"; + @SerializedName(SERIALIZED_NAME_WEIGHT) + @javax.annotation.Nonnull + private WeightValue weight; + + public static final String SERIALIZED_NAME_TEXT_ON_LABEL = "textOnLabel"; + @SerializedName(SERIALIZED_NAME_TEXT_ON_LABEL) + @javax.annotation.Nullable + private String textOnLabel; + + public PackageRequestDto() { + } + + public PackageRequestDto type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Available values: PACKAGE|DOX|PALLET|OTHER + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public PackageRequestDto length(@javax.annotation.Nonnull DimensionValue length) { + this.length = length; + return this; + } + + /** + * Get length + * @return length + */ + @javax.annotation.Nonnull + public DimensionValue getLength() { + return length; + } + + public void setLength(@javax.annotation.Nonnull DimensionValue length) { + this.length = length; + } + + + public PackageRequestDto width(@javax.annotation.Nonnull DimensionValue width) { + this.width = width; + return this; + } + + /** + * Get width + * @return width + */ + @javax.annotation.Nonnull + public DimensionValue getWidth() { + return width; + } + + public void setWidth(@javax.annotation.Nonnull DimensionValue width) { + this.width = width; + } + + + public PackageRequestDto height(@javax.annotation.Nonnull DimensionValue height) { + this.height = height; + return this; + } + + /** + * Get height + * @return height + */ + @javax.annotation.Nonnull + public DimensionValue getHeight() { + return height; + } + + public void setHeight(@javax.annotation.Nonnull DimensionValue height) { + this.height = height; + } + + + public PackageRequestDto weight(@javax.annotation.Nonnull WeightValue weight) { + this.weight = weight; + return this; + } + + /** + * Get weight + * @return weight + */ + @javax.annotation.Nonnull + public WeightValue getWeight() { + return weight; + } + + public void setWeight(@javax.annotation.Nonnull WeightValue weight) { + this.weight = weight; + } + + + public PackageRequestDto textOnLabel(@javax.annotation.Nullable String textOnLabel) { + this.textOnLabel = textOnLabel; + return this; + } + + /** + * Additional information on the package label. + * @return textOnLabel + */ + @javax.annotation.Nullable + public String getTextOnLabel() { + return textOnLabel; + } + + public void setTextOnLabel(@javax.annotation.Nullable String textOnLabel) { + this.textOnLabel = textOnLabel; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PackageRequestDto packageRequestDto = (PackageRequestDto) o; + return Objects.equals(this.type, packageRequestDto.type) && + Objects.equals(this.length, packageRequestDto.length) && + Objects.equals(this.width, packageRequestDto.width) && + Objects.equals(this.height, packageRequestDto.height) && + Objects.equals(this.weight, packageRequestDto.weight) && + Objects.equals(this.textOnLabel, packageRequestDto.textOnLabel); + } + + @Override + public int hashCode() { + return Objects.hash(type, length, width, height, weight, textOnLabel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PackageRequestDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" length: ").append(toIndentedString(length)).append("\n"); + sb.append(" width: ").append(toIndentedString(width)).append("\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append(" textOnLabel: ").append(toIndentedString(textOnLabel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("length"); + openapiFields.add("width"); + openapiFields.add("height"); + openapiFields.add("weight"); + openapiFields.add("textOnLabel"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("length"); + openapiRequiredFields.add("width"); + openapiRequiredFields.add("height"); + openapiRequiredFields.add("weight"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PackageRequestDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PackageRequestDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PackageRequestDto is not found in the empty JSON string", PackageRequestDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PackageRequestDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PackageRequestDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PackageRequestDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `length` + DimensionValue.validateJsonElement(jsonObj.get("length")); + // validate the required field `width` + DimensionValue.validateJsonElement(jsonObj.get("width")); + // validate the required field `height` + DimensionValue.validateJsonElement(jsonObj.get("height")); + // validate the required field `weight` + WeightValue.validateJsonElement(jsonObj.get("weight")); + if ((jsonObj.get("textOnLabel") != null && !jsonObj.get("textOnLabel").isJsonNull()) && !jsonObj.get("textOnLabel").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `textOnLabel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("textOnLabel").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PackageRequestDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PackageRequestDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PackageRequestDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PackageRequestDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PackageRequestDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PackageRequestDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PackageRequestDto + * @throws IOException if the JSON string is invalid with respect to PackageRequestDto + */ + public static PackageRequestDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PackageRequestDto.class); + } + + /** + * Convert an instance of PackageRequestDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Parameter.java b/src/main/java/pl/wtx/allegro/api/client/model/Parameter.java new file mode 100644 index 0000000..4d118ea --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Parameter.java @@ -0,0 +1,326 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParameterRangeValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer's parameter. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Parameter { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_RANGE_VALUE = "rangeValue"; + @SerializedName(SERIALIZED_NAME_RANGE_VALUE) + @javax.annotation.Nullable + private ParameterRangeValue rangeValue; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALUES_IDS = "valuesIds"; + @SerializedName(SERIALIZED_NAME_VALUES_IDS) + @javax.annotation.Nullable + private List valuesIds = new ArrayList<>(); + + public Parameter() { + } + + public Parameter id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public Parameter rangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + return this; + } + + /** + * Get rangeValue + * @return rangeValue + */ + @javax.annotation.Nullable + public ParameterRangeValue getRangeValue() { + return rangeValue; + } + + public void setRangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + } + + + public Parameter values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public Parameter addValuesItem(String valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Get values + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + public Parameter valuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + return this; + } + + public Parameter addValuesIdsItem(String valuesIdsItem) { + if (this.valuesIds == null) { + this.valuesIds = new ArrayList<>(); + } + this.valuesIds.add(valuesIdsItem); + return this; + } + + /** + * Get valuesIds + * @return valuesIds + */ + @javax.annotation.Nullable + public List getValuesIds() { + return valuesIds; + } + + public void setValuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Parameter parameter = (Parameter) o; + return Objects.equals(this.id, parameter.id) && + Objects.equals(this.rangeValue, parameter.rangeValue) && + Objects.equals(this.values, parameter.values) && + Objects.equals(this.valuesIds, parameter.valuesIds); + } + + @Override + public int hashCode() { + return Objects.hash(id, rangeValue, values, valuesIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Parameter {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" rangeValue: ").append(toIndentedString(rangeValue)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" valuesIds: ").append(toIndentedString(valuesIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("rangeValue"); + openapiFields.add("values"); + openapiFields.add("valuesIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Parameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Parameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Parameter is not found in the empty JSON string", Parameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Parameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Parameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Parameter.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `rangeValue` + if (jsonObj.get("rangeValue") != null && !jsonObj.get("rangeValue").isJsonNull()) { + ParameterRangeValue.validateJsonElement(jsonObj.get("rangeValue")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("valuesIds") != null && !jsonObj.get("valuesIds").isJsonNull() && !jsonObj.get("valuesIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `valuesIds` to be an array in the JSON string but got `%s`", jsonObj.get("valuesIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Parameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Parameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Parameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Parameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Parameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Parameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of Parameter + * @throws IOException if the JSON string is invalid with respect to Parameter + */ + public static Parameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Parameter.class); + } + + /** + * Convert an instance of Parameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParameterProductOfferRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ParameterProductOfferRequest.java new file mode 100644 index 0000000..7f12695 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParameterProductOfferRequest.java @@ -0,0 +1,348 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParameterRangeValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer's parameter. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParameterProductOfferRequest { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_RANGE_VALUE = "rangeValue"; + @SerializedName(SERIALIZED_NAME_RANGE_VALUE) + @javax.annotation.Nullable + private ParameterRangeValue rangeValue; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALUES_IDS = "valuesIds"; + @SerializedName(SERIALIZED_NAME_VALUES_IDS) + @javax.annotation.Nullable + private List valuesIds = new ArrayList<>(); + + public ParameterProductOfferRequest() { + } + + public ParameterProductOfferRequest id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ParameterProductOfferRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of the parameter. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ParameterProductOfferRequest rangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + return this; + } + + /** + * Get rangeValue + * @return rangeValue + */ + @javax.annotation.Nullable + public ParameterRangeValue getRangeValue() { + return rangeValue; + } + + public void setRangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + } + + + public ParameterProductOfferRequest values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public ParameterProductOfferRequest addValuesItem(String valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Get values + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + public ParameterProductOfferRequest valuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + return this; + } + + public ParameterProductOfferRequest addValuesIdsItem(String valuesIdsItem) { + if (this.valuesIds == null) { + this.valuesIds = new ArrayList<>(); + } + this.valuesIds.add(valuesIdsItem); + return this; + } + + /** + * Get valuesIds + * @return valuesIds + */ + @javax.annotation.Nullable + public List getValuesIds() { + return valuesIds; + } + + public void setValuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParameterProductOfferRequest parameterProductOfferRequest = (ParameterProductOfferRequest) o; + return Objects.equals(this.id, parameterProductOfferRequest.id) && + Objects.equals(this.name, parameterProductOfferRequest.name) && + Objects.equals(this.rangeValue, parameterProductOfferRequest.rangeValue) && + Objects.equals(this.values, parameterProductOfferRequest.values) && + Objects.equals(this.valuesIds, parameterProductOfferRequest.valuesIds); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, rangeValue, values, valuesIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParameterProductOfferRequest {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" rangeValue: ").append(toIndentedString(rangeValue)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" valuesIds: ").append(toIndentedString(valuesIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("rangeValue"); + openapiFields.add("values"); + openapiFields.add("valuesIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParameterProductOfferRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParameterProductOfferRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParameterProductOfferRequest is not found in the empty JSON string", ParameterProductOfferRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParameterProductOfferRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParameterProductOfferRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `rangeValue` + if (jsonObj.get("rangeValue") != null && !jsonObj.get("rangeValue").isJsonNull()) { + ParameterRangeValue.validateJsonElement(jsonObj.get("rangeValue")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("valuesIds") != null && !jsonObj.get("valuesIds").isJsonNull() && !jsonObj.get("valuesIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `valuesIds` to be an array in the JSON string but got `%s`", jsonObj.get("valuesIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParameterProductOfferRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParameterProductOfferRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParameterProductOfferRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParameterProductOfferRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParameterProductOfferRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParameterProductOfferRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParameterProductOfferRequest + * @throws IOException if the JSON string is invalid with respect to ParameterProductOfferRequest + */ + public static ParameterProductOfferRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParameterProductOfferRequest.class); + } + + /** + * Convert an instance of ParameterProductOfferRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParameterProductOfferResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ParameterProductOfferResponse.java new file mode 100644 index 0000000..1ae465b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParameterProductOfferResponse.java @@ -0,0 +1,348 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParameterRangeValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Parameter. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParameterProductOfferResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_RANGE_VALUE = "rangeValue"; + @SerializedName(SERIALIZED_NAME_RANGE_VALUE) + @javax.annotation.Nullable + private ParameterRangeValue rangeValue; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALUES_IDS = "valuesIds"; + @SerializedName(SERIALIZED_NAME_VALUES_IDS) + @javax.annotation.Nullable + private List valuesIds = new ArrayList<>(); + + public ParameterProductOfferResponse() { + } + + public ParameterProductOfferResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ParameterProductOfferResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of the parameter. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ParameterProductOfferResponse rangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + return this; + } + + /** + * Get rangeValue + * @return rangeValue + */ + @javax.annotation.Nullable + public ParameterRangeValue getRangeValue() { + return rangeValue; + } + + public void setRangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + } + + + public ParameterProductOfferResponse values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public ParameterProductOfferResponse addValuesItem(String valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Get values + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + public ParameterProductOfferResponse valuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + return this; + } + + public ParameterProductOfferResponse addValuesIdsItem(String valuesIdsItem) { + if (this.valuesIds == null) { + this.valuesIds = new ArrayList<>(); + } + this.valuesIds.add(valuesIdsItem); + return this; + } + + /** + * Get valuesIds + * @return valuesIds + */ + @javax.annotation.Nullable + public List getValuesIds() { + return valuesIds; + } + + public void setValuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParameterProductOfferResponse parameterProductOfferResponse = (ParameterProductOfferResponse) o; + return Objects.equals(this.id, parameterProductOfferResponse.id) && + Objects.equals(this.name, parameterProductOfferResponse.name) && + Objects.equals(this.rangeValue, parameterProductOfferResponse.rangeValue) && + Objects.equals(this.values, parameterProductOfferResponse.values) && + Objects.equals(this.valuesIds, parameterProductOfferResponse.valuesIds); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, rangeValue, values, valuesIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParameterProductOfferResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" rangeValue: ").append(toIndentedString(rangeValue)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" valuesIds: ").append(toIndentedString(valuesIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("rangeValue"); + openapiFields.add("values"); + openapiFields.add("valuesIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParameterProductOfferResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParameterProductOfferResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParameterProductOfferResponse is not found in the empty JSON string", ParameterProductOfferResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParameterProductOfferResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParameterProductOfferResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `rangeValue` + if (jsonObj.get("rangeValue") != null && !jsonObj.get("rangeValue").isJsonNull()) { + ParameterRangeValue.validateJsonElement(jsonObj.get("rangeValue")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("valuesIds") != null && !jsonObj.get("valuesIds").isJsonNull() && !jsonObj.get("valuesIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `valuesIds` to be an array in the JSON string but got `%s`", jsonObj.get("valuesIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParameterProductOfferResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParameterProductOfferResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParameterProductOfferResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParameterProductOfferResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParameterProductOfferResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParameterProductOfferResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParameterProductOfferResponse + * @throws IOException if the JSON string is invalid with respect to ParameterProductOfferResponse + */ + public static ParameterProductOfferResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParameterProductOfferResponse.class); + } + + /** + * Convert an instance of ParameterProductOfferResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParameterRangeValue.java b/src/main/java/pl/wtx/allegro/api/client/model/ParameterRangeValue.java new file mode 100644 index 0000000..a795d0c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParameterRangeValue.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Parameter's range value + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParameterRangeValue { + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nonnull + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nonnull + private String to; + + public ParameterRangeValue() { + } + + public ParameterRangeValue from(@javax.annotation.Nonnull String from) { + this.from = from; + return this; + } + + /** + * Get from + * @return from + */ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nonnull String from) { + this.from = from; + } + + + public ParameterRangeValue to(@javax.annotation.Nonnull String to) { + this.to = to; + return this; + } + + /** + * Get to + * @return to + */ + @javax.annotation.Nonnull + public String getTo() { + return to; + } + + public void setTo(@javax.annotation.Nonnull String to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParameterRangeValue parameterRangeValue = (ParameterRangeValue) o; + return Objects.equals(this.from, parameterRangeValue.from) && + Objects.equals(this.to, parameterRangeValue.to); + } + + @Override + public int hashCode() { + return Objects.hash(from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParameterRangeValue {\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("to"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParameterRangeValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParameterRangeValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParameterRangeValue is not found in the empty JSON string", ParameterRangeValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParameterRangeValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParameterRangeValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ParameterRangeValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParameterRangeValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParameterRangeValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParameterRangeValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParameterRangeValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParameterRangeValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParameterRangeValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParameterRangeValue + * @throws IOException if the JSON string is invalid with respect to ParameterRangeValue + */ + public static ParameterRangeValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParameterRangeValue.class); + } + + /** + * Convert an instance of ParameterRangeValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParametersForPreviewPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/ParametersForPreviewPrice.java new file mode 100644 index 0000000..f5e6fc7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParametersForPreviewPrice.java @@ -0,0 +1,844 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Category; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ParametersForPreviewPrice + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParametersForPreviewPrice { + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nonnull + private Category category; + + /** + * Offer condition, if is new, used or other. + */ + @JsonAdapter(ConditionEnum.Adapter.class) + public enum ConditionEnum { + NEW("NEW"), + + USED("USED"), + + OTHER("OTHER"); + + private String value; + + ConditionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ConditionEnum fromValue(String value) { + for (ConditionEnum b : ConditionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ConditionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ConditionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ConditionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ConditionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CONDITION = "condition"; + @SerializedName(SERIALIZED_NAME_CONDITION) + @javax.annotation.Nullable + private ConditionEnum condition; + + /** + * Gets or Sets duration + */ + @JsonAdapter(DurationEnum.Adapter.class) + public enum DurationEnum { + PT72_H("PT72H"), + + PT120_H("PT120H"), + + PT168_H("PT168H"), + + PT240_H("PT240H"), + + PT336_H("PT336H"), + + PT480_H("PT480H"), + + PT720_H("PT720H"); + + private String value; + + DurationEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DurationEnum fromValue(String value) { + for (DurationEnum b : DurationEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DurationEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DurationEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DurationEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + DurationEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + @javax.annotation.Nullable + private DurationEnum duration; + + public static final String SERIALIZED_NAME_HAS_ANY_QUANTITY = "hasAnyQuantity"; + @SerializedName(SERIALIZED_NAME_HAS_ANY_QUANTITY) + @javax.annotation.Nullable + private Boolean hasAnyQuantity; + + public static final String SERIALIZED_NAME_NUMBER_OF_BIG_PHOTOS = "numberOfBigPhotos"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_BIG_PHOTOS) + @javax.annotation.Nullable + private Integer numberOfBigPhotos; + + public static final String SERIALIZED_NAME_NUMBER_OF_PHOTOS = "numberOfPhotos"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_PHOTOS) + @javax.annotation.Nullable + private Integer numberOfPhotos; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_SHOP = "shop"; + @SerializedName(SERIALIZED_NAME_SHOP) + @javax.annotation.Nullable + private Boolean shop; + + public static final String SERIALIZED_NAME_SOLD_QUANTITY = "soldQuantity"; + @SerializedName(SERIALIZED_NAME_SOLD_QUANTITY) + @javax.annotation.Nullable + private Integer soldQuantity; + + /** + * Offer type. 'type' or 'shop' fields must be provided. Takes precedence over 'shop' field. **Note:** if type = 'advertisement' then either 'quantity' or 'soldQuantity' field must be set. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + SHOP("shop"), + + OFFER("offer"), + + ADVERTISEMENT("advertisement"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public static final String SERIALIZED_NAME_UNIT_PRICE = "unitPrice"; + @SerializedName(SERIALIZED_NAME_UNIT_PRICE) + @javax.annotation.Nonnull + private BigDecimal unitPrice; + + public static final String SERIALIZED_NAME_BOLD = "bold"; + @SerializedName(SERIALIZED_NAME_BOLD) + @javax.annotation.Nullable + private Boolean bold; + + public static final String SERIALIZED_NAME_HIGHLIGHT = "highlight"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT) + @javax.annotation.Nullable + private Boolean highlight; + + public static final String SERIALIZED_NAME_DEPARTMENT_PAGE = "departmentPage"; + @SerializedName(SERIALIZED_NAME_DEPARTMENT_PAGE) + @javax.annotation.Nullable + private Boolean departmentPage; + + public static final String SERIALIZED_NAME_EMPHASIZED = "emphasized"; + @SerializedName(SERIALIZED_NAME_EMPHASIZED) + @javax.annotation.Nullable + private Boolean emphasized; + + public static final String SERIALIZED_NAME_EMPHASIZED_HIGHLIGHT_BOLD_PACKAGE = "emphasizedHighlightBoldPackage"; + @SerializedName(SERIALIZED_NAME_EMPHASIZED_HIGHLIGHT_BOLD_PACKAGE) + @javax.annotation.Nullable + private Boolean emphasizedHighlightBoldPackage; + + public static final String SERIALIZED_NAME_MULTI_VARIANT = "multiVariant"; + @SerializedName(SERIALIZED_NAME_MULTI_VARIANT) + @javax.annotation.Nullable + private Boolean multiVariant; + + public ParametersForPreviewPrice() { + } + + public ParametersForPreviewPrice category(@javax.annotation.Nonnull Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nonnull + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nonnull Category category) { + this.category = category; + } + + + public ParametersForPreviewPrice condition(@javax.annotation.Nullable ConditionEnum condition) { + this.condition = condition; + return this; + } + + /** + * Offer condition, if is new, used or other. + * @return condition + */ + @javax.annotation.Nullable + public ConditionEnum getCondition() { + return condition; + } + + public void setCondition(@javax.annotation.Nullable ConditionEnum condition) { + this.condition = condition; + } + + + public ParametersForPreviewPrice duration(@javax.annotation.Nullable DurationEnum duration) { + this.duration = duration; + return this; + } + + /** + * Get duration + * @return duration + */ + @javax.annotation.Nullable + public DurationEnum getDuration() { + return duration; + } + + public void setDuration(@javax.annotation.Nullable DurationEnum duration) { + this.duration = duration; + } + + + public ParametersForPreviewPrice hasAnyQuantity(@javax.annotation.Nullable Boolean hasAnyQuantity) { + this.hasAnyQuantity = hasAnyQuantity; + return this; + } + + /** + * Get hasAnyQuantity + * @return hasAnyQuantity + */ + @javax.annotation.Nullable + public Boolean getHasAnyQuantity() { + return hasAnyQuantity; + } + + public void setHasAnyQuantity(@javax.annotation.Nullable Boolean hasAnyQuantity) { + this.hasAnyQuantity = hasAnyQuantity; + } + + + public ParametersForPreviewPrice numberOfBigPhotos(@javax.annotation.Nullable Integer numberOfBigPhotos) { + this.numberOfBigPhotos = numberOfBigPhotos; + return this; + } + + /** + * If set, minimum value 0 + * minimum: 0 + * @return numberOfBigPhotos + */ + @javax.annotation.Nullable + public Integer getNumberOfBigPhotos() { + return numberOfBigPhotos; + } + + public void setNumberOfBigPhotos(@javax.annotation.Nullable Integer numberOfBigPhotos) { + this.numberOfBigPhotos = numberOfBigPhotos; + } + + + public ParametersForPreviewPrice numberOfPhotos(@javax.annotation.Nullable Integer numberOfPhotos) { + this.numberOfPhotos = numberOfPhotos; + return this; + } + + /** + * If set, minimum value 0 + * minimum: 0 + * @return numberOfPhotos + */ + @javax.annotation.Nullable + public Integer getNumberOfPhotos() { + return numberOfPhotos; + } + + public void setNumberOfPhotos(@javax.annotation.Nullable Integer numberOfPhotos) { + this.numberOfPhotos = numberOfPhotos; + } + + + public ParametersForPreviewPrice quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Quantity of items to be sold. If set, minimum value 1 + * minimum: 1 + * @return quantity + */ + @javax.annotation.Nullable + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public ParametersForPreviewPrice shop(@javax.annotation.Nullable Boolean shop) { + this.shop = shop; + return this; + } + + /** + * Deprecated. Value 'true' sets the 'offer.type' field to 'shop', value 'false' to 'offer'. This field is ignored if 'offer.type' field is set. + * @return shop + */ + @javax.annotation.Nullable + public Boolean getShop() { + return shop; + } + + public void setShop(@javax.annotation.Nullable Boolean shop) { + this.shop = shop; + } + + + public ParametersForPreviewPrice soldQuantity(@javax.annotation.Nullable Integer soldQuantity) { + this.soldQuantity = soldQuantity; + return this; + } + + /** + * Quantity of sold items. Relates to commission success fee. If set, minimum value 1 + * minimum: 0 + * @return soldQuantity + */ + @javax.annotation.Nullable + public Integer getSoldQuantity() { + return soldQuantity; + } + + public void setSoldQuantity(@javax.annotation.Nullable Integer soldQuantity) { + this.soldQuantity = soldQuantity; + } + + + public ParametersForPreviewPrice type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Offer type. 'type' or 'shop' fields must be provided. Takes precedence over 'shop' field. **Note:** if type = 'advertisement' then either 'quantity' or 'soldQuantity' field must be set. + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public ParametersForPreviewPrice unitPrice(@javax.annotation.Nonnull BigDecimal unitPrice) { + this.unitPrice = unitPrice; + return this; + } + + /** + * Get unitPrice + * minimum: 0 + * @return unitPrice + */ + @javax.annotation.Nonnull + public BigDecimal getUnitPrice() { + return unitPrice; + } + + public void setUnitPrice(@javax.annotation.Nonnull BigDecimal unitPrice) { + this.unitPrice = unitPrice; + } + + + public ParametersForPreviewPrice bold(@javax.annotation.Nullable Boolean bold) { + this.bold = bold; + return this; + } + + /** + * Get bold + * @return bold + */ + @javax.annotation.Nullable + public Boolean getBold() { + return bold; + } + + public void setBold(@javax.annotation.Nullable Boolean bold) { + this.bold = bold; + } + + + public ParametersForPreviewPrice highlight(@javax.annotation.Nullable Boolean highlight) { + this.highlight = highlight; + return this; + } + + /** + * Get highlight + * @return highlight + */ + @javax.annotation.Nullable + public Boolean getHighlight() { + return highlight; + } + + public void setHighlight(@javax.annotation.Nullable Boolean highlight) { + this.highlight = highlight; + } + + + public ParametersForPreviewPrice departmentPage(@javax.annotation.Nullable Boolean departmentPage) { + this.departmentPage = departmentPage; + return this; + } + + /** + * Get departmentPage + * @return departmentPage + */ + @javax.annotation.Nullable + public Boolean getDepartmentPage() { + return departmentPage; + } + + public void setDepartmentPage(@javax.annotation.Nullable Boolean departmentPage) { + this.departmentPage = departmentPage; + } + + + public ParametersForPreviewPrice emphasized(@javax.annotation.Nullable Boolean emphasized) { + this.emphasized = emphasized; + return this; + } + + /** + * Get emphasized + * @return emphasized + */ + @javax.annotation.Nullable + public Boolean getEmphasized() { + return emphasized; + } + + public void setEmphasized(@javax.annotation.Nullable Boolean emphasized) { + this.emphasized = emphasized; + } + + + public ParametersForPreviewPrice emphasizedHighlightBoldPackage(@javax.annotation.Nullable Boolean emphasizedHighlightBoldPackage) { + this.emphasizedHighlightBoldPackage = emphasizedHighlightBoldPackage; + return this; + } + + /** + * Get emphasizedHighlightBoldPackage + * @return emphasizedHighlightBoldPackage + */ + @javax.annotation.Nullable + public Boolean getEmphasizedHighlightBoldPackage() { + return emphasizedHighlightBoldPackage; + } + + public void setEmphasizedHighlightBoldPackage(@javax.annotation.Nullable Boolean emphasizedHighlightBoldPackage) { + this.emphasizedHighlightBoldPackage = emphasizedHighlightBoldPackage; + } + + + public ParametersForPreviewPrice multiVariant(@javax.annotation.Nullable Boolean multiVariant) { + this.multiVariant = multiVariant; + return this; + } + + /** + * Get multiVariant + * @return multiVariant + */ + @javax.annotation.Nullable + public Boolean getMultiVariant() { + return multiVariant; + } + + public void setMultiVariant(@javax.annotation.Nullable Boolean multiVariant) { + this.multiVariant = multiVariant; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParametersForPreviewPrice parametersForPreviewPrice = (ParametersForPreviewPrice) o; + return Objects.equals(this.category, parametersForPreviewPrice.category) && + Objects.equals(this.condition, parametersForPreviewPrice.condition) && + Objects.equals(this.duration, parametersForPreviewPrice.duration) && + Objects.equals(this.hasAnyQuantity, parametersForPreviewPrice.hasAnyQuantity) && + Objects.equals(this.numberOfBigPhotos, parametersForPreviewPrice.numberOfBigPhotos) && + Objects.equals(this.numberOfPhotos, parametersForPreviewPrice.numberOfPhotos) && + Objects.equals(this.quantity, parametersForPreviewPrice.quantity) && + Objects.equals(this.shop, parametersForPreviewPrice.shop) && + Objects.equals(this.soldQuantity, parametersForPreviewPrice.soldQuantity) && + Objects.equals(this.type, parametersForPreviewPrice.type) && + Objects.equals(this.unitPrice, parametersForPreviewPrice.unitPrice) && + Objects.equals(this.bold, parametersForPreviewPrice.bold) && + Objects.equals(this.highlight, parametersForPreviewPrice.highlight) && + Objects.equals(this.departmentPage, parametersForPreviewPrice.departmentPage) && + Objects.equals(this.emphasized, parametersForPreviewPrice.emphasized) && + Objects.equals(this.emphasizedHighlightBoldPackage, parametersForPreviewPrice.emphasizedHighlightBoldPackage) && + Objects.equals(this.multiVariant, parametersForPreviewPrice.multiVariant); + } + + @Override + public int hashCode() { + return Objects.hash(category, condition, duration, hasAnyQuantity, numberOfBigPhotos, numberOfPhotos, quantity, shop, soldQuantity, type, unitPrice, bold, highlight, departmentPage, emphasized, emphasizedHighlightBoldPackage, multiVariant); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParametersForPreviewPrice {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" condition: ").append(toIndentedString(condition)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" hasAnyQuantity: ").append(toIndentedString(hasAnyQuantity)).append("\n"); + sb.append(" numberOfBigPhotos: ").append(toIndentedString(numberOfBigPhotos)).append("\n"); + sb.append(" numberOfPhotos: ").append(toIndentedString(numberOfPhotos)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shop: ").append(toIndentedString(shop)).append("\n"); + sb.append(" soldQuantity: ").append(toIndentedString(soldQuantity)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" unitPrice: ").append(toIndentedString(unitPrice)).append("\n"); + sb.append(" bold: ").append(toIndentedString(bold)).append("\n"); + sb.append(" highlight: ").append(toIndentedString(highlight)).append("\n"); + sb.append(" departmentPage: ").append(toIndentedString(departmentPage)).append("\n"); + sb.append(" emphasized: ").append(toIndentedString(emphasized)).append("\n"); + sb.append(" emphasizedHighlightBoldPackage: ").append(toIndentedString(emphasizedHighlightBoldPackage)).append("\n"); + sb.append(" multiVariant: ").append(toIndentedString(multiVariant)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("category"); + openapiFields.add("condition"); + openapiFields.add("duration"); + openapiFields.add("hasAnyQuantity"); + openapiFields.add("numberOfBigPhotos"); + openapiFields.add("numberOfPhotos"); + openapiFields.add("quantity"); + openapiFields.add("shop"); + openapiFields.add("soldQuantity"); + openapiFields.add("type"); + openapiFields.add("unitPrice"); + openapiFields.add("bold"); + openapiFields.add("highlight"); + openapiFields.add("departmentPage"); + openapiFields.add("emphasized"); + openapiFields.add("emphasizedHighlightBoldPackage"); + openapiFields.add("multiVariant"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("category"); + openapiRequiredFields.add("unitPrice"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParametersForPreviewPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParametersForPreviewPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParametersForPreviewPrice is not found in the empty JSON string", ParametersForPreviewPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParametersForPreviewPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParametersForPreviewPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ParametersForPreviewPrice.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `category` + Category.validateJsonElement(jsonObj.get("category")); + if ((jsonObj.get("condition") != null && !jsonObj.get("condition").isJsonNull()) && !jsonObj.get("condition").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `condition` to be a primitive type in the JSON string but got `%s`", jsonObj.get("condition").toString())); + } + // validate the optional field `condition` + if (jsonObj.get("condition") != null && !jsonObj.get("condition").isJsonNull()) { + ConditionEnum.validateJsonElement(jsonObj.get("condition")); + } + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + // validate the optional field `duration` + if (jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) { + DurationEnum.validateJsonElement(jsonObj.get("duration")); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParametersForPreviewPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParametersForPreviewPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParametersForPreviewPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParametersForPreviewPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParametersForPreviewPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParametersForPreviewPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParametersForPreviewPrice + * @throws IOException if the JSON string is invalid with respect to ParametersForPreviewPrice + */ + public static ParametersForPreviewPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParametersForPreviewPrice.class); + } + + /** + * Convert an instance of ParametersForPreviewPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesAvailability.java b/src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesAvailability.java new file mode 100644 index 0000000..1f84af8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesAvailability.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParcelAdditionalServicesCashOnDeliveryAvailability; +import pl.wtx.allegro.api.client.model.ParcelAdditionalServicesOptionAvailability; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ParcelAdditionalServicesAvailability + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParcelAdditionalServicesAvailability { + public static final String SERIALIZED_NAME_CASH_ON_DELIVERY = "cashOnDelivery"; + @SerializedName(SERIALIZED_NAME_CASH_ON_DELIVERY) + @javax.annotation.Nullable + private ParcelAdditionalServicesCashOnDeliveryAvailability cashOnDelivery; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + @SerializedName(SERIALIZED_NAME_OPTIONS) + @javax.annotation.Nullable + private List options = new ArrayList<>(); + + public ParcelAdditionalServicesAvailability() { + } + + public ParcelAdditionalServicesAvailability cashOnDelivery(@javax.annotation.Nullable ParcelAdditionalServicesCashOnDeliveryAvailability cashOnDelivery) { + this.cashOnDelivery = cashOnDelivery; + return this; + } + + /** + * Get cashOnDelivery + * @return cashOnDelivery + */ + @javax.annotation.Nullable + public ParcelAdditionalServicesCashOnDeliveryAvailability getCashOnDelivery() { + return cashOnDelivery; + } + + public void setCashOnDelivery(@javax.annotation.Nullable ParcelAdditionalServicesCashOnDeliveryAvailability cashOnDelivery) { + this.cashOnDelivery = cashOnDelivery; + } + + + public ParcelAdditionalServicesAvailability options(@javax.annotation.Nullable List options) { + this.options = options; + return this; + } + + public ParcelAdditionalServicesAvailability addOptionsItem(ParcelAdditionalServicesOptionAvailability optionsItem) { + if (this.options == null) { + this.options = new ArrayList<>(); + } + this.options.add(optionsItem); + return this; + } + + /** + * Delivery services. + * @return options + */ + @javax.annotation.Nullable + public List getOptions() { + return options; + } + + public void setOptions(@javax.annotation.Nullable List options) { + this.options = options; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParcelAdditionalServicesAvailability parcelAdditionalServicesAvailability = (ParcelAdditionalServicesAvailability) o; + return Objects.equals(this.cashOnDelivery, parcelAdditionalServicesAvailability.cashOnDelivery) && + Objects.equals(this.options, parcelAdditionalServicesAvailability.options); + } + + @Override + public int hashCode() { + return Objects.hash(cashOnDelivery, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParcelAdditionalServicesAvailability {\n"); + sb.append(" cashOnDelivery: ").append(toIndentedString(cashOnDelivery)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("cashOnDelivery"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParcelAdditionalServicesAvailability + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParcelAdditionalServicesAvailability.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParcelAdditionalServicesAvailability is not found in the empty JSON string", ParcelAdditionalServicesAvailability.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParcelAdditionalServicesAvailability.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParcelAdditionalServicesAvailability` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `cashOnDelivery` + if (jsonObj.get("cashOnDelivery") != null && !jsonObj.get("cashOnDelivery").isJsonNull()) { + ParcelAdditionalServicesCashOnDeliveryAvailability.validateJsonElement(jsonObj.get("cashOnDelivery")); + } + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { + JsonArray jsonArrayoptions = jsonObj.getAsJsonArray("options"); + if (jsonArrayoptions != null) { + // ensure the json data is an array + if (!jsonObj.get("options").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `options` to be an array in the JSON string but got `%s`", jsonObj.get("options").toString())); + } + + // validate the optional field `options` (array) + for (int i = 0; i < jsonArrayoptions.size(); i++) { + ParcelAdditionalServicesOptionAvailability.validateJsonElement(jsonArrayoptions.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParcelAdditionalServicesAvailability.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParcelAdditionalServicesAvailability' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParcelAdditionalServicesAvailability.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParcelAdditionalServicesAvailability value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParcelAdditionalServicesAvailability read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParcelAdditionalServicesAvailability given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParcelAdditionalServicesAvailability + * @throws IOException if the JSON string is invalid with respect to ParcelAdditionalServicesAvailability + */ + public static ParcelAdditionalServicesAvailability fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParcelAdditionalServicesAvailability.class); + } + + /** + * Convert an instance of ParcelAdditionalServicesAvailability to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesCashOnDeliveryAvailability.java b/src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesCashOnDeliveryAvailability.java new file mode 100644 index 0000000..eb8a381 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesCashOnDeliveryAvailability.java @@ -0,0 +1,230 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ParcelAdditionalServicesCashOnDeliveryAvailability + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParcelAdditionalServicesCashOnDeliveryAvailability { + public static final String SERIALIZED_NAME_AVAILABLE = "available"; + @SerializedName(SERIALIZED_NAME_AVAILABLE) + @javax.annotation.Nullable + private Boolean available; + + public static final String SERIALIZED_NAME_EXPRESS_AVAILABLE = "expressAvailable"; + @SerializedName(SERIALIZED_NAME_EXPRESS_AVAILABLE) + @javax.annotation.Nullable + private Boolean expressAvailable; + + public ParcelAdditionalServicesCashOnDeliveryAvailability() { + } + + public ParcelAdditionalServicesCashOnDeliveryAvailability available(@javax.annotation.Nullable Boolean available) { + this.available = available; + return this; + } + + /** + * Indicates if Cash On Delivery is available as part of Additional Services for parcel creation for carrier. + * @return available + */ + @javax.annotation.Nullable + public Boolean getAvailable() { + return available; + } + + public void setAvailable(@javax.annotation.Nullable Boolean available) { + this.available = available; + } + + + public ParcelAdditionalServicesCashOnDeliveryAvailability expressAvailable(@javax.annotation.Nullable Boolean expressAvailable) { + this.expressAvailable = expressAvailable; + return this; + } + + /** + * Postpaid Express service available. Postpaid value is send to parcel sender in one business day after delivery. + * @return expressAvailable + */ + @javax.annotation.Nullable + public Boolean getExpressAvailable() { + return expressAvailable; + } + + public void setExpressAvailable(@javax.annotation.Nullable Boolean expressAvailable) { + this.expressAvailable = expressAvailable; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParcelAdditionalServicesCashOnDeliveryAvailability parcelAdditionalServicesCashOnDeliveryAvailability = (ParcelAdditionalServicesCashOnDeliveryAvailability) o; + return Objects.equals(this.available, parcelAdditionalServicesCashOnDeliveryAvailability.available) && + Objects.equals(this.expressAvailable, parcelAdditionalServicesCashOnDeliveryAvailability.expressAvailable); + } + + @Override + public int hashCode() { + return Objects.hash(available, expressAvailable); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParcelAdditionalServicesCashOnDeliveryAvailability {\n"); + sb.append(" available: ").append(toIndentedString(available)).append("\n"); + sb.append(" expressAvailable: ").append(toIndentedString(expressAvailable)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("available"); + openapiFields.add("expressAvailable"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParcelAdditionalServicesCashOnDeliveryAvailability + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParcelAdditionalServicesCashOnDeliveryAvailability.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParcelAdditionalServicesCashOnDeliveryAvailability is not found in the empty JSON string", ParcelAdditionalServicesCashOnDeliveryAvailability.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParcelAdditionalServicesCashOnDeliveryAvailability.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParcelAdditionalServicesCashOnDeliveryAvailability` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParcelAdditionalServicesCashOnDeliveryAvailability.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParcelAdditionalServicesCashOnDeliveryAvailability' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParcelAdditionalServicesCashOnDeliveryAvailability.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParcelAdditionalServicesCashOnDeliveryAvailability value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParcelAdditionalServicesCashOnDeliveryAvailability read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParcelAdditionalServicesCashOnDeliveryAvailability given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParcelAdditionalServicesCashOnDeliveryAvailability + * @throws IOException if the JSON string is invalid with respect to ParcelAdditionalServicesCashOnDeliveryAvailability + */ + public static ParcelAdditionalServicesCashOnDeliveryAvailability fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParcelAdditionalServicesCashOnDeliveryAvailability.class); + } + + /** + * Convert an instance of ParcelAdditionalServicesCashOnDeliveryAvailability to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesOptionAvailability.java b/src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesOptionAvailability.java new file mode 100644 index 0000000..1b09903 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParcelAdditionalServicesOptionAvailability.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ParcelAdditionalServicesOptionAvailability + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParcelAdditionalServicesOptionAvailability { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public ParcelAdditionalServicesOptionAvailability() { + } + + public ParcelAdditionalServicesOptionAvailability name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of option that can be passed to additionalServices for parcel creation. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ParcelAdditionalServicesOptionAvailability description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Brief description of option. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParcelAdditionalServicesOptionAvailability parcelAdditionalServicesOptionAvailability = (ParcelAdditionalServicesOptionAvailability) o; + return Objects.equals(this.name, parcelAdditionalServicesOptionAvailability.name) && + Objects.equals(this.description, parcelAdditionalServicesOptionAvailability.description); + } + + @Override + public int hashCode() { + return Objects.hash(name, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParcelAdditionalServicesOptionAvailability {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParcelAdditionalServicesOptionAvailability + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParcelAdditionalServicesOptionAvailability.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParcelAdditionalServicesOptionAvailability is not found in the empty JSON string", ParcelAdditionalServicesOptionAvailability.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParcelAdditionalServicesOptionAvailability.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParcelAdditionalServicesOptionAvailability` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParcelAdditionalServicesOptionAvailability.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParcelAdditionalServicesOptionAvailability' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParcelAdditionalServicesOptionAvailability.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParcelAdditionalServicesOptionAvailability value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParcelAdditionalServicesOptionAvailability read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParcelAdditionalServicesOptionAvailability given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParcelAdditionalServicesOptionAvailability + * @throws IOException if the JSON string is invalid with respect to ParcelAdditionalServicesOptionAvailability + */ + public static ParcelAdditionalServicesOptionAvailability fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParcelAdditionalServicesOptionAvailability.class); + } + + /** + * Convert an instance of ParcelAdditionalServicesOptionAvailability to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParcelCreationAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/ParcelCreationAddress.java new file mode 100644 index 0000000..db4dc55 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParcelCreationAddress.java @@ -0,0 +1,326 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Address data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParcelCreationAddress { + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nullable + private String street; + + public static final String SERIALIZED_NAME_POST_CODE = "postCode"; + @SerializedName(SERIALIZED_NAME_POST_CODE) + @javax.annotation.Nullable + private String postCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nullable + private String city; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode = "PL"; + + public static final String SERIALIZED_NAME_COUNTY = "county"; + @SerializedName(SERIALIZED_NAME_COUNTY) + @javax.annotation.Nullable + private String county; + + public ParcelCreationAddress() { + } + + public ParcelCreationAddress street(@javax.annotation.Nullable String street) { + this.street = street; + return this; + } + + /** + * Get street + * @return street + */ + @javax.annotation.Nullable + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nullable String street) { + this.street = street; + } + + + public ParcelCreationAddress postCode(@javax.annotation.Nullable String postCode) { + this.postCode = postCode; + return this; + } + + /** + * Get postCode + * @return postCode + */ + @javax.annotation.Nullable + public String getPostCode() { + return postCode; + } + + public void setPostCode(@javax.annotation.Nullable String postCode) { + this.postCode = postCode; + } + + + public ParcelCreationAddress city(@javax.annotation.Nullable String city) { + this.city = city; + return this; + } + + /** + * Get city + * @return city + */ + @javax.annotation.Nullable + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nullable String city) { + this.city = city; + } + + + public ParcelCreationAddress countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code in ISO 3166-1 alfa-2 format (two-letter code). + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + public ParcelCreationAddress county(@javax.annotation.Nullable String county) { + this.county = county; + return this; + } + + /** + * Required for shipments to Irleand ( county name ), United States ( state abbreviation / ISO code ), Canada ( province postal code / ISO code ) + * @return county + */ + @javax.annotation.Nullable + public String getCounty() { + return county; + } + + public void setCounty(@javax.annotation.Nullable String county) { + this.county = county; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParcelCreationAddress parcelCreationAddress = (ParcelCreationAddress) o; + return Objects.equals(this.street, parcelCreationAddress.street) && + Objects.equals(this.postCode, parcelCreationAddress.postCode) && + Objects.equals(this.city, parcelCreationAddress.city) && + Objects.equals(this.countryCode, parcelCreationAddress.countryCode) && + Objects.equals(this.county, parcelCreationAddress.county); + } + + @Override + public int hashCode() { + return Objects.hash(street, postCode, city, countryCode, county); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParcelCreationAddress {\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postCode: ").append(toIndentedString(postCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" county: ").append(toIndentedString(county)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("street"); + openapiFields.add("postCode"); + openapiFields.add("city"); + openapiFields.add("countryCode"); + openapiFields.add("county"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParcelCreationAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParcelCreationAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParcelCreationAddress is not found in the empty JSON string", ParcelCreationAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParcelCreationAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParcelCreationAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("street") != null && !jsonObj.get("street").isJsonNull()) && !jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if ((jsonObj.get("postCode") != null && !jsonObj.get("postCode").isJsonNull()) && !jsonObj.get("postCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postCode").toString())); + } + if ((jsonObj.get("city") != null && !jsonObj.get("city").isJsonNull()) && !jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if ((jsonObj.get("countryCode") != null && !jsonObj.get("countryCode").isJsonNull()) && !jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if ((jsonObj.get("county") != null && !jsonObj.get("county").isJsonNull()) && !jsonObj.get("county").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `county` to be a primitive type in the JSON string but got `%s`", jsonObj.get("county").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParcelCreationAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParcelCreationAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParcelCreationAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParcelCreationAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParcelCreationAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParcelCreationAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParcelCreationAddress + * @throws IOException if the JSON string is invalid with respect to ParcelCreationAddress + */ + public static ParcelCreationAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParcelCreationAddress.class); + } + + /** + * Convert an instance of ParcelCreationAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParcelCreationAddressWithMandatoryPlace.java b/src/main/java/pl/wtx/allegro/api/client/model/ParcelCreationAddressWithMandatoryPlace.java new file mode 100644 index 0000000..851794a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParcelCreationAddressWithMandatoryPlace.java @@ -0,0 +1,336 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Address data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParcelCreationAddressWithMandatoryPlace { + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_POST_CODE = "postCode"; + @SerializedName(SERIALIZED_NAME_POST_CODE) + @javax.annotation.Nonnull + private String postCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode = "PL"; + + public static final String SERIALIZED_NAME_COUNTY = "county"; + @SerializedName(SERIALIZED_NAME_COUNTY) + @javax.annotation.Nullable + private String county; + + public ParcelCreationAddressWithMandatoryPlace() { + } + + public ParcelCreationAddressWithMandatoryPlace street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Street. + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public ParcelCreationAddressWithMandatoryPlace postCode(@javax.annotation.Nonnull String postCode) { + this.postCode = postCode; + return this; + } + + /** + * Post code. + * @return postCode + */ + @javax.annotation.Nonnull + public String getPostCode() { + return postCode; + } + + public void setPostCode(@javax.annotation.Nonnull String postCode) { + this.postCode = postCode; + } + + + public ParcelCreationAddressWithMandatoryPlace city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * City. + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public ParcelCreationAddressWithMandatoryPlace countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code in ISO 3166-1 alfa-2 format (two-letter code). + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + public ParcelCreationAddressWithMandatoryPlace county(@javax.annotation.Nullable String county) { + this.county = county; + return this; + } + + /** + * Required for shipments to Irleand ( county name ), United States ( state abbreviation / ISO code ), Canada ( province postal code / ISO code ) + * @return county + */ + @javax.annotation.Nullable + public String getCounty() { + return county; + } + + public void setCounty(@javax.annotation.Nullable String county) { + this.county = county; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParcelCreationAddressWithMandatoryPlace parcelCreationAddressWithMandatoryPlace = (ParcelCreationAddressWithMandatoryPlace) o; + return Objects.equals(this.street, parcelCreationAddressWithMandatoryPlace.street) && + Objects.equals(this.postCode, parcelCreationAddressWithMandatoryPlace.postCode) && + Objects.equals(this.city, parcelCreationAddressWithMandatoryPlace.city) && + Objects.equals(this.countryCode, parcelCreationAddressWithMandatoryPlace.countryCode) && + Objects.equals(this.county, parcelCreationAddressWithMandatoryPlace.county); + } + + @Override + public int hashCode() { + return Objects.hash(street, postCode, city, countryCode, county); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParcelCreationAddressWithMandatoryPlace {\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postCode: ").append(toIndentedString(postCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" county: ").append(toIndentedString(county)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("street"); + openapiFields.add("postCode"); + openapiFields.add("city"); + openapiFields.add("countryCode"); + openapiFields.add("county"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("postCode"); + openapiRequiredFields.add("city"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParcelCreationAddressWithMandatoryPlace + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParcelCreationAddressWithMandatoryPlace.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParcelCreationAddressWithMandatoryPlace is not found in the empty JSON string", ParcelCreationAddressWithMandatoryPlace.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParcelCreationAddressWithMandatoryPlace.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParcelCreationAddressWithMandatoryPlace` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ParcelCreationAddressWithMandatoryPlace.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("postCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postCode").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if ((jsonObj.get("countryCode") != null && !jsonObj.get("countryCode").isJsonNull()) && !jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if ((jsonObj.get("county") != null && !jsonObj.get("county").isJsonNull()) && !jsonObj.get("county").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `county` to be a primitive type in the JSON string but got `%s`", jsonObj.get("county").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParcelCreationAddressWithMandatoryPlace.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParcelCreationAddressWithMandatoryPlace' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParcelCreationAddressWithMandatoryPlace.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParcelCreationAddressWithMandatoryPlace value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParcelCreationAddressWithMandatoryPlace read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParcelCreationAddressWithMandatoryPlace given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParcelCreationAddressWithMandatoryPlace + * @throws IOException if the JSON string is invalid with respect to ParcelCreationAddressWithMandatoryPlace + */ + public static ParcelCreationAddressWithMandatoryPlace fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParcelCreationAddressWithMandatoryPlace.class); + } + + /** + * Convert an instance of ParcelCreationAddressWithMandatoryPlace to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingHistory.java b/src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingHistory.java new file mode 100644 index 0000000..1bcc2a7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingHistory.java @@ -0,0 +1,246 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ParcelTrackingHistoryTrackingDetails; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ParcelTrackingHistory + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParcelTrackingHistory { + public static final String SERIALIZED_NAME_WAYBILL = "waybill"; + @SerializedName(SERIALIZED_NAME_WAYBILL) + @javax.annotation.Nonnull + private String waybill; + + public static final String SERIALIZED_NAME_TRACKING_DETAILS = "trackingDetails"; + @SerializedName(SERIALIZED_NAME_TRACKING_DETAILS) + @javax.annotation.Nullable + private ParcelTrackingHistoryTrackingDetails trackingDetails; + + public ParcelTrackingHistory() { + } + + public ParcelTrackingHistory waybill(@javax.annotation.Nonnull String waybill) { + this.waybill = waybill; + return this; + } + + /** + * Waybill number (parcel tracking number). + * @return waybill + */ + @javax.annotation.Nonnull + public String getWaybill() { + return waybill; + } + + public void setWaybill(@javax.annotation.Nonnull String waybill) { + this.waybill = waybill; + } + + + public ParcelTrackingHistory trackingDetails(@javax.annotation.Nullable ParcelTrackingHistoryTrackingDetails trackingDetails) { + this.trackingDetails = trackingDetails; + return this; + } + + /** + * Get trackingDetails + * @return trackingDetails + */ + @javax.annotation.Nullable + public ParcelTrackingHistoryTrackingDetails getTrackingDetails() { + return trackingDetails; + } + + public void setTrackingDetails(@javax.annotation.Nullable ParcelTrackingHistoryTrackingDetails trackingDetails) { + this.trackingDetails = trackingDetails; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParcelTrackingHistory parcelTrackingHistory = (ParcelTrackingHistory) o; + return Objects.equals(this.waybill, parcelTrackingHistory.waybill) && + Objects.equals(this.trackingDetails, parcelTrackingHistory.trackingDetails); + } + + @Override + public int hashCode() { + return Objects.hash(waybill, trackingDetails); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParcelTrackingHistory {\n"); + sb.append(" waybill: ").append(toIndentedString(waybill)).append("\n"); + sb.append(" trackingDetails: ").append(toIndentedString(trackingDetails)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("waybill"); + openapiFields.add("trackingDetails"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("waybill"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParcelTrackingHistory + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParcelTrackingHistory.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParcelTrackingHistory is not found in the empty JSON string", ParcelTrackingHistory.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParcelTrackingHistory.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParcelTrackingHistory` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ParcelTrackingHistory.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("waybill").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `waybill` to be a primitive type in the JSON string but got `%s`", jsonObj.get("waybill").toString())); + } + // validate the optional field `trackingDetails` + if (jsonObj.get("trackingDetails") != null && !jsonObj.get("trackingDetails").isJsonNull()) { + ParcelTrackingHistoryTrackingDetails.validateJsonElement(jsonObj.get("trackingDetails")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParcelTrackingHistory.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParcelTrackingHistory' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParcelTrackingHistory.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParcelTrackingHistory value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParcelTrackingHistory read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParcelTrackingHistory given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParcelTrackingHistory + * @throws IOException if the JSON string is invalid with respect to ParcelTrackingHistory + */ + public static ParcelTrackingHistory fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParcelTrackingHistory.class); + } + + /** + * Convert an instance of ParcelTrackingHistory to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingHistoryTrackingDetails.java b/src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingHistoryTrackingDetails.java new file mode 100644 index 0000000..bc4a081 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingHistoryTrackingDetails.java @@ -0,0 +1,289 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParcelTrackingStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Parcel tracking history if available. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParcelTrackingHistoryTrackingDetails { + public static final String SERIALIZED_NAME_STATUSES = "statuses"; + @SerializedName(SERIALIZED_NAME_STATUSES) + @javax.annotation.Nonnull + private List statuses = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime updatedAt; + + public ParcelTrackingHistoryTrackingDetails() { + } + + public ParcelTrackingHistoryTrackingDetails statuses(@javax.annotation.Nonnull List statuses) { + this.statuses = statuses; + return this; + } + + public ParcelTrackingHistoryTrackingDetails addStatusesItem(ParcelTrackingStatus statusesItem) { + if (this.statuses == null) { + this.statuses = new ArrayList<>(); + } + this.statuses.add(statusesItem); + return this; + } + + /** + * List of parcel shipping statuses + * @return statuses + */ + @javax.annotation.Nonnull + public List getStatuses() { + return statuses; + } + + public void setStatuses(@javax.annotation.Nonnull List statuses) { + this.statuses = statuses; + } + + + public ParcelTrackingHistoryTrackingDetails createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The start time parcel tracking recording in ISO 8601 format + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ParcelTrackingHistoryTrackingDetails updatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Time of registration of the last shipment status change in ISO 8601 format + * @return updatedAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nonnull OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParcelTrackingHistoryTrackingDetails parcelTrackingHistoryTrackingDetails = (ParcelTrackingHistoryTrackingDetails) o; + return Objects.equals(this.statuses, parcelTrackingHistoryTrackingDetails.statuses) && + Objects.equals(this.createdAt, parcelTrackingHistoryTrackingDetails.createdAt) && + Objects.equals(this.updatedAt, parcelTrackingHistoryTrackingDetails.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(statuses, createdAt, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParcelTrackingHistoryTrackingDetails {\n"); + sb.append(" statuses: ").append(toIndentedString(statuses)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("statuses"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("statuses"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("updatedAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParcelTrackingHistoryTrackingDetails + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParcelTrackingHistoryTrackingDetails.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParcelTrackingHistoryTrackingDetails is not found in the empty JSON string", ParcelTrackingHistoryTrackingDetails.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParcelTrackingHistoryTrackingDetails.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParcelTrackingHistoryTrackingDetails` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ParcelTrackingHistoryTrackingDetails.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("statuses").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `statuses` to be an array in the JSON string but got `%s`", jsonObj.get("statuses").toString())); + } + + JsonArray jsonArraystatuses = jsonObj.getAsJsonArray("statuses"); + // validate the required field `statuses` (array) + for (int i = 0; i < jsonArraystatuses.size(); i++) { + ParcelTrackingStatus.validateJsonElement(jsonArraystatuses.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParcelTrackingHistoryTrackingDetails.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParcelTrackingHistoryTrackingDetails' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParcelTrackingHistoryTrackingDetails.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParcelTrackingHistoryTrackingDetails value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParcelTrackingHistoryTrackingDetails read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParcelTrackingHistoryTrackingDetails given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParcelTrackingHistoryTrackingDetails + * @throws IOException if the JSON string is invalid with respect to ParcelTrackingHistoryTrackingDetails + */ + public static ParcelTrackingHistoryTrackingDetails fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParcelTrackingHistoryTrackingDetails.class); + } + + /** + * Convert an instance of ParcelTrackingHistoryTrackingDetails to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingStatus.java b/src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingStatus.java new file mode 100644 index 0000000..2dd260b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ParcelTrackingStatus.java @@ -0,0 +1,339 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ParcelTrackingStatus + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ParcelTrackingStatus { + public static final String SERIALIZED_NAME_OCCURRED_AT = "occurredAt"; + @SerializedName(SERIALIZED_NAME_OCCURRED_AT) + @javax.annotation.Nonnull + private OffsetDateTime occurredAt; + + /** + * Status of the shipment. - `AVAILABLE_FOR_PICKUP` - The parcel is awaiting for pickup. - `DELIVERED` - The parcel was delivered to the receiver / collected by the receiver. - `IN_TRANSIT` - The parcel is on its way to the receiver. The status includes events such as acceptance of the shipment by the carrier, arriving at the hub or redirecting to another address. - `ISSUE` - Problem with shipment. It includes events such as the parcel was refused by the receiver or was lost. - `NOTICE_LEFT` - A notice was left because of an unsuccessful delivery attempt (for example, due to nobody was at the delivery address). - `PENDING` - The shipment has been prepared and it is awaiting to be sent. - `RELEASED_FOR_DELIVERY` - The parcel has been released for delivery to its final destination. - `RETURNED` - The parcel is being or has been returned to the sender. + */ + @JsonAdapter(CodeEnum.Adapter.class) + public enum CodeEnum { + AVAILABLE_FOR_PICKUP("AVAILABLE_FOR_PICKUP"), + + DELIVERED("DELIVERED"), + + IN_TRANSIT("IN_TRANSIT"), + + ISSUE("ISSUE"), + + NOTICE_LEFT("NOTICE_LEFT"), + + PENDING("PENDING"), + + RELEASED_FOR_DELIVERY("RELEASED_FOR_DELIVERY"), + + RETURNED("RETURNED"); + + private String value; + + CodeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CodeEnum fromValue(String value) { + for (CodeEnum b : CodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CodeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CodeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CodeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CodeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private CodeEnum code; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public ParcelTrackingStatus() { + } + + public ParcelTrackingStatus occurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + /** + * Actual shipment status change time in ISO 8601 format + * @return occurredAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getOccurredAt() { + return occurredAt; + } + + public void setOccurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + } + + + public ParcelTrackingStatus code(@javax.annotation.Nonnull CodeEnum code) { + this.code = code; + return this; + } + + /** + * Status of the shipment. - `AVAILABLE_FOR_PICKUP` - The parcel is awaiting for pickup. - `DELIVERED` - The parcel was delivered to the receiver / collected by the receiver. - `IN_TRANSIT` - The parcel is on its way to the receiver. The status includes events such as acceptance of the shipment by the carrier, arriving at the hub or redirecting to another address. - `ISSUE` - Problem with shipment. It includes events such as the parcel was refused by the receiver or was lost. - `NOTICE_LEFT` - A notice was left because of an unsuccessful delivery attempt (for example, due to nobody was at the delivery address). - `PENDING` - The shipment has been prepared and it is awaiting to be sent. - `RELEASED_FOR_DELIVERY` - The parcel has been released for delivery to its final destination. - `RETURNED` - The parcel is being or has been returned to the sender. + * @return code + */ + @javax.annotation.Nonnull + public CodeEnum getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull CodeEnum code) { + this.code = code; + } + + + public ParcelTrackingStatus description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Optional description for a given status, mainly intended to describe the problem with the shipment + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParcelTrackingStatus parcelTrackingStatus = (ParcelTrackingStatus) o; + return Objects.equals(this.occurredAt, parcelTrackingStatus.occurredAt) && + Objects.equals(this.code, parcelTrackingStatus.code) && + Objects.equals(this.description, parcelTrackingStatus.description); + } + + @Override + public int hashCode() { + return Objects.hash(occurredAt, code, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParcelTrackingStatus {\n"); + sb.append(" occurredAt: ").append(toIndentedString(occurredAt)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("occurredAt"); + openapiFields.add("code"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("occurredAt"); + openapiRequiredFields.add("code"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ParcelTrackingStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ParcelTrackingStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ParcelTrackingStatus is not found in the empty JSON string", ParcelTrackingStatus.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ParcelTrackingStatus.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParcelTrackingStatus` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ParcelTrackingStatus.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + // validate the required field `code` + CodeEnum.validateJsonElement(jsonObj.get("code")); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ParcelTrackingStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ParcelTrackingStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ParcelTrackingStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ParcelTrackingStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ParcelTrackingStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ParcelTrackingStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of ParcelTrackingStatus + * @throws IOException if the JSON string is invalid with respect to ParcelTrackingStatus + */ + public static ParcelTrackingStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ParcelTrackingStatus.class); + } + + /** + * Convert an instance of ParcelTrackingStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Participant.java b/src/main/java/pl/wtx/allegro/api/client/model/Participant.java new file mode 100644 index 0000000..5e2cbb6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Participant.java @@ -0,0 +1,338 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OperationParticipantAddress; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Participant + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Participant { + public static final String SERIALIZED_NAME_COMPANY_NAME = "companyName"; + @SerializedName(SERIALIZED_NAME_COMPANY_NAME) + @javax.annotation.Nullable + private String companyName; + + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nonnull + private String login; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nonnull + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nonnull + private String lastName; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private OperationParticipantAddress address; + + public Participant() { + } + + public Participant companyName(@javax.annotation.Nullable String companyName) { + this.companyName = companyName; + return this; + } + + /** + * Company name. + * @return companyName + */ + @javax.annotation.Nullable + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(@javax.annotation.Nullable String companyName) { + this.companyName = companyName; + } + + + public Participant login(@javax.annotation.Nonnull String login) { + this.login = login; + return this; + } + + /** + * Login. + * @return login + */ + @javax.annotation.Nonnull + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nonnull String login) { + this.login = login; + } + + + public Participant firstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + return this; + } + + /** + * First name. + * @return firstName + */ + @javax.annotation.Nonnull + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + } + + + public Participant lastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Last name. + * @return lastName + */ + @javax.annotation.Nonnull + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + } + + + public Participant address(@javax.annotation.Nullable OperationParticipantAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public OperationParticipantAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable OperationParticipantAddress address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Participant participant = (Participant) o; + return Objects.equals(this.companyName, participant.companyName) && + Objects.equals(this.login, participant.login) && + Objects.equals(this.firstName, participant.firstName) && + Objects.equals(this.lastName, participant.lastName) && + Objects.equals(this.address, participant.address); + } + + @Override + public int hashCode() { + return Objects.hash(companyName, login, firstName, lastName, address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Participant {\n"); + sb.append(" companyName: ").append(toIndentedString(companyName)).append("\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("companyName"); + openapiFields.add("login"); + openapiFields.add("firstName"); + openapiFields.add("lastName"); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("login"); + openapiRequiredFields.add("firstName"); + openapiRequiredFields.add("lastName"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Participant + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Participant.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Participant is not found in the empty JSON string", Participant.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Participant.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Participant` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Participant.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("companyName") != null && !jsonObj.get("companyName").isJsonNull()) && !jsonObj.get("companyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `companyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("companyName").toString())); + } + if (!jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + if (!jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if (!jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + OperationParticipantAddress.validateJsonElement(jsonObj.get("address")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Participant.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Participant' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Participant.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Participant value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Participant read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Participant given an JSON string + * + * @param jsonString JSON string + * @return An instance of Participant + * @throws IOException if the JSON string is invalid with respect to Participant + */ + public static Participant fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Participant.class); + } + + /** + * Convert an instance of Participant to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PatchBadge202Response.java b/src/main/java/pl/wtx/allegro/api/client/model/PatchBadge202Response.java new file mode 100644 index 0000000..ae0806a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PatchBadge202Response.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PatchBadge202Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PatchBadge202Response { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public PatchBadge202Response() { + } + + public PatchBadge202Response id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Operation Id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchBadge202Response patchBadge202Response = (PatchBadge202Response) o; + return Objects.equals(this.id, patchBadge202Response.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchBadge202Response {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatchBadge202Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchBadge202Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatchBadge202Response is not found in the empty JSON string", PatchBadge202Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatchBadge202Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatchBadge202Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchBadge202Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchBadge202Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchBadge202Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchBadge202Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PatchBadge202Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PatchBadge202Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchBadge202Response + * @throws IOException if the JSON string is invalid with respect to PatchBadge202Response + */ + public static PatchBadge202Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchBadge202Response.class); + } + + /** + * Convert an instance of PatchBadge202Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Payment.java b/src/main/java/pl/wtx/allegro/api/client/model/Payment.java new file mode 100644 index 0000000..db32976 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Payment.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Payment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Payment { + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + @javax.annotation.Nonnull + private String method; + + public Payment() { + } + + public Payment method(@javax.annotation.Nonnull String method) { + this.method = method; + return this; + } + + /** + * Available forms of payment: CASH - cash, CARD - card. + * @return method + */ + @javax.annotation.Nonnull + public String getMethod() { + return method; + } + + public void setMethod(@javax.annotation.Nonnull String method) { + this.method = method; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Payment payment = (Payment) o; + return Objects.equals(this.method, payment.method); + } + + @Override + public int hashCode() { + return Objects.hash(method); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Payment {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("method"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("method"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Payment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Payment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Payment is not found in the empty JSON string", Payment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Payment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Payment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Payment.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("method").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `method` to be a primitive type in the JSON string but got `%s`", jsonObj.get("method").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Payment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Payment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Payment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Payment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Payment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Payment given an JSON string + * + * @param jsonString JSON string + * @return An instance of Payment + * @throws IOException if the JSON string is invalid with respect to Payment + */ + public static Payment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Payment.class); + } + + /** + * Convert an instance of Payment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PaymentOperations.java b/src/main/java/pl/wtx/allegro/api/client/model/PaymentOperations.java new file mode 100644 index 0000000..f6bc05d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PaymentOperations.java @@ -0,0 +1,290 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BaseOperation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PaymentOperations + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PaymentOperations { + public static final String SERIALIZED_NAME_PAYMENT_OPERATIONS = "paymentOperations"; + @SerializedName(SERIALIZED_NAME_PAYMENT_OPERATIONS) + @javax.annotation.Nonnull + private List paymentOperations = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nonnull + private Integer count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nonnull + private Integer totalCount; + + public PaymentOperations() { + } + + public PaymentOperations paymentOperations(@javax.annotation.Nonnull List paymentOperations) { + this.paymentOperations = paymentOperations; + return this; + } + + public PaymentOperations addPaymentOperationsItem(BaseOperation paymentOperationsItem) { + if (this.paymentOperations == null) { + this.paymentOperations = new ArrayList<>(); + } + this.paymentOperations.add(paymentOperationsItem); + return this; + } + + /** + * Collection of payment operations. + * @return paymentOperations + */ + @javax.annotation.Nonnull + public List getPaymentOperations() { + return paymentOperations; + } + + public void setPaymentOperations(@javax.annotation.Nonnull List paymentOperations) { + this.paymentOperations = paymentOperations; + } + + + public PaymentOperations count(@javax.annotation.Nonnull Integer count) { + this.count = count; + return this; + } + + /** + * Number of payment operations returned in search result for the given parameters. + * minimum: 0 + * @return count + */ + @javax.annotation.Nonnull + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nonnull Integer count) { + this.count = count; + } + + + public PaymentOperations totalCount(@javax.annotation.Nonnull Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of payment operations for the given parameters. + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nonnull + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nonnull Integer totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentOperations paymentOperations = (PaymentOperations) o; + return Objects.equals(this.paymentOperations, paymentOperations.paymentOperations) && + Objects.equals(this.count, paymentOperations.count) && + Objects.equals(this.totalCount, paymentOperations.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(paymentOperations, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentOperations {\n"); + sb.append(" paymentOperations: ").append(toIndentedString(paymentOperations)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("paymentOperations"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("paymentOperations"); + openapiRequiredFields.add("count"); + openapiRequiredFields.add("totalCount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PaymentOperations + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PaymentOperations.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PaymentOperations is not found in the empty JSON string", PaymentOperations.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PaymentOperations.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PaymentOperations` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PaymentOperations.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("paymentOperations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `paymentOperations` to be an array in the JSON string but got `%s`", jsonObj.get("paymentOperations").toString())); + } + + JsonArray jsonArraypaymentOperations = jsonObj.getAsJsonArray("paymentOperations"); + // validate the required field `paymentOperations` (array) + for (int i = 0; i < jsonArraypaymentOperations.size(); i++) { + BaseOperation.validateJsonElement(jsonArraypaymentOperations.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PaymentOperations.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PaymentOperations' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PaymentOperations.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PaymentOperations value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PaymentOperations read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PaymentOperations given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaymentOperations + * @throws IOException if the JSON string is invalid with respect to PaymentOperations + */ + public static PaymentOperations fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PaymentOperations.class); + } + + /** + * Convert an instance of PaymentOperations to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Payments.java b/src/main/java/pl/wtx/allegro/api/client/model/Payments.java new file mode 100644 index 0000000..0b2ff6e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Payments.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Payments + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Payments { + /** + * Invoice type + */ + @JsonAdapter(InvoiceEnum.Adapter.class) + public enum InvoiceEnum { + VAT("VAT"), + + VAT_MARGIN("VAT_MARGIN"), + + WITHOUT_VAT("WITHOUT_VAT"), + + NO_INVOICE("NO_INVOICE"); + + private String value; + + InvoiceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static InvoiceEnum fromValue(String value) { + for (InvoiceEnum b : InvoiceEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final InvoiceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public InvoiceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return InvoiceEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + InvoiceEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_INVOICE = "invoice"; + @SerializedName(SERIALIZED_NAME_INVOICE) + @javax.annotation.Nullable + private InvoiceEnum invoice; + + public Payments() { + } + + public Payments invoice(@javax.annotation.Nullable InvoiceEnum invoice) { + this.invoice = invoice; + return this; + } + + /** + * Invoice type + * @return invoice + */ + @javax.annotation.Nullable + public InvoiceEnum getInvoice() { + return invoice; + } + + public void setInvoice(@javax.annotation.Nullable InvoiceEnum invoice) { + this.invoice = invoice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Payments payments = (Payments) o; + return Objects.equals(this.invoice, payments.invoice); + } + + @Override + public int hashCode() { + return Objects.hash(invoice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Payments {\n"); + sb.append(" invoice: ").append(toIndentedString(invoice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("invoice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Payments + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Payments.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Payments is not found in the empty JSON string", Payments.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Payments.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Payments` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("invoice") != null && !jsonObj.get("invoice").isJsonNull()) && !jsonObj.get("invoice").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `invoice` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoice").toString())); + } + // validate the optional field `invoice` + if (jsonObj.get("invoice") != null && !jsonObj.get("invoice").isJsonNull()) { + InvoiceEnum.validateJsonElement(jsonObj.get("invoice")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Payments.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Payments' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Payments.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Payments value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Payments read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Payments given an JSON string + * + * @param jsonString JSON string + * @return An instance of Payments + * @throws IOException if the JSON string is invalid with respect to Payments + */ + public static Payments fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Payments.class); + } + + /** + * Convert an instance of Payments to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PaymentsSurcharge.java b/src/main/java/pl/wtx/allegro/api/client/model/PaymentsSurcharge.java new file mode 100644 index 0000000..ecfe882 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PaymentsSurcharge.java @@ -0,0 +1,239 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.RefundSurchargeValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PaymentsSurcharge + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PaymentsSurcharge { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private RefundSurchargeValue value; + + public PaymentsSurcharge() { + } + + public PaymentsSurcharge id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The payment identifier. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public PaymentsSurcharge value(@javax.annotation.Nullable RefundSurchargeValue value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public RefundSurchargeValue getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable RefundSurchargeValue value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaymentsSurcharge paymentsSurcharge = (PaymentsSurcharge) o; + return Objects.equals(this.id, paymentsSurcharge.id) && + Objects.equals(this.value, paymentsSurcharge.value); + } + + @Override + public int hashCode() { + return Objects.hash(id, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaymentsSurcharge {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PaymentsSurcharge + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PaymentsSurcharge.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PaymentsSurcharge is not found in the empty JSON string", PaymentsSurcharge.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PaymentsSurcharge.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PaymentsSurcharge` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `value` + if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { + RefundSurchargeValue.validateJsonElement(jsonObj.get("value")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PaymentsSurcharge.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PaymentsSurcharge' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PaymentsSurcharge.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PaymentsSurcharge value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PaymentsSurcharge read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PaymentsSurcharge given an JSON string + * + * @param jsonString JSON string + * @return An instance of PaymentsSurcharge + * @throws IOException if the JSON string is invalid with respect to PaymentsSurcharge + */ + public static PaymentsSurcharge fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PaymentsSurcharge.class); + } + + /** + * Convert an instance of PaymentsSurcharge to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Payout.java b/src/main/java/pl/wtx/allegro/api/client/model/Payout.java new file mode 100644 index 0000000..cc974d0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Payout.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Payout. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Payout { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public Payout() { + } + + public Payout id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The payout ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Payout payout = (Payout) o; + return Objects.equals(this.id, payout.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Payout {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Payout + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Payout.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Payout is not found in the empty JSON string", Payout.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Payout.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Payout` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Payout.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Payout.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Payout' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Payout.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Payout value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Payout read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Payout given an JSON string + * + * @param jsonString JSON string + * @return An instance of Payout + * @throws IOException if the JSON string is invalid with respect to Payout + */ + public static Payout fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Payout.class); + } + + /** + * Convert an instance of Payout to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PayoutOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/PayoutOperation.java new file mode 100644 index 0000000..087125b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PayoutOperation.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Payout; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PayoutOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PayoutOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "PAYOUT"; + + public static final String SERIALIZED_NAME_PAYOUT = "payout"; + @SerializedName(SERIALIZED_NAME_PAYOUT) + @javax.annotation.Nonnull + private Payout payout; + + public PayoutOperation() { + this.type = this.getClass().getSimpleName(); + } + + public PayoutOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public PayoutOperation payout(@javax.annotation.Nonnull Payout payout) { + this.payout = payout; + return this; + } + + /** + * Get payout + * @return payout + */ + @javax.annotation.Nonnull + public Payout getPayout() { + return payout; + } + + public void setPayout(@javax.annotation.Nonnull Payout payout) { + this.payout = payout; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayoutOperation payoutOperation = (PayoutOperation) o; + return Objects.equals(this.type, payoutOperation.type) && + Objects.equals(this.payout, payoutOperation.payout) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, payout, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayoutOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" payout: ").append(toIndentedString(payout)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("payout"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payout"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PayoutOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PayoutOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PayoutOperation is not found in the empty JSON string", PayoutOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PayoutOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PayoutOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PayoutOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PayoutOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PayoutOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PayoutOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PayoutOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PayoutOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PayoutOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of PayoutOperation + * @throws IOException if the JSON string is invalid with respect to PayoutOperation + */ + public static PayoutOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PayoutOperation.class); + } + + /** + * Convert an instance of PayoutOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PayoutOperationCancel.java b/src/main/java/pl/wtx/allegro/api/client/model/PayoutOperationCancel.java new file mode 100644 index 0000000..08fc83a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PayoutOperationCancel.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Payout; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PayoutOperationCancel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PayoutOperationCancel extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "PAYOUT_CANCEL"; + + public static final String SERIALIZED_NAME_PAYOUT = "payout"; + @SerializedName(SERIALIZED_NAME_PAYOUT) + @javax.annotation.Nonnull + private Payout payout; + + public PayoutOperationCancel() { + this.type = this.getClass().getSimpleName(); + } + + public PayoutOperationCancel type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public PayoutOperationCancel payout(@javax.annotation.Nonnull Payout payout) { + this.payout = payout; + return this; + } + + /** + * Get payout + * @return payout + */ + @javax.annotation.Nonnull + public Payout getPayout() { + return payout; + } + + public void setPayout(@javax.annotation.Nonnull Payout payout) { + this.payout = payout; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PayoutOperationCancel payoutOperationCancel = (PayoutOperationCancel) o; + return Objects.equals(this.type, payoutOperationCancel.type) && + Objects.equals(this.payout, payoutOperationCancel.payout) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, payout, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PayoutOperationCancel {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" payout: ").append(toIndentedString(payout)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("payout"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payout"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PayoutOperationCancel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PayoutOperationCancel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PayoutOperationCancel is not found in the empty JSON string", PayoutOperationCancel.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PayoutOperationCancel.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PayoutOperationCancel` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PayoutOperationCancel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PayoutOperationCancel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PayoutOperationCancel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PayoutOperationCancel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PayoutOperationCancel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PayoutOperationCancel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PayoutOperationCancel given an JSON string + * + * @param jsonString JSON string + * @return An instance of PayoutOperationCancel + * @throws IOException if the JSON string is invalid with respect to PayoutOperationCancel + */ + public static PayoutOperationCancel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PayoutOperationCancel.class); + } + + /** + * Convert an instance of PayoutOperationCancel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PhoneNumberWithCountryCode.java b/src/main/java/pl/wtx/allegro/api/client/model/PhoneNumberWithCountryCode.java new file mode 100644 index 0000000..02a3927 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PhoneNumberWithCountryCode.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents international phone number with country code. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PhoneNumberWithCountryCode { + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + @javax.annotation.Nonnull + private String number; + + public PhoneNumberWithCountryCode() { + } + + public PhoneNumberWithCountryCode countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code without neither + nor 0 prefix. + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + public PhoneNumberWithCountryCode number(@javax.annotation.Nonnull String number) { + this.number = number; + return this; + } + + /** + * Local phone number without prefix. + * @return number + */ + @javax.annotation.Nonnull + public String getNumber() { + return number; + } + + public void setNumber(@javax.annotation.Nonnull String number) { + this.number = number; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PhoneNumberWithCountryCode phoneNumberWithCountryCode = (PhoneNumberWithCountryCode) o; + return Objects.equals(this.countryCode, phoneNumberWithCountryCode.countryCode) && + Objects.equals(this.number, phoneNumberWithCountryCode.number); + } + + @Override + public int hashCode() { + return Objects.hash(countryCode, number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PhoneNumberWithCountryCode {\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("countryCode"); + openapiFields.add("number"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("countryCode"); + openapiRequiredFields.add("number"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PhoneNumberWithCountryCode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PhoneNumberWithCountryCode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PhoneNumberWithCountryCode is not found in the empty JSON string", PhoneNumberWithCountryCode.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PhoneNumberWithCountryCode.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PhoneNumberWithCountryCode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PhoneNumberWithCountryCode.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if (!jsonObj.get("number").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("number").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PhoneNumberWithCountryCode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PhoneNumberWithCountryCode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PhoneNumberWithCountryCode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PhoneNumberWithCountryCode value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PhoneNumberWithCountryCode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PhoneNumberWithCountryCode given an JSON string + * + * @param jsonString JSON string + * @return An instance of PhoneNumberWithCountryCode + * @throws IOException if the JSON string is invalid with respect to PhoneNumberWithCountryCode + */ + public static PhoneNumberWithCountryCode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PhoneNumberWithCountryCode.class); + } + + /** + * Convert an instance of PhoneNumberWithCountryCode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PhonesRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/PhonesRequest.java new file mode 100644 index 0000000..ce3cbea --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PhonesRequest.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PhonesRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PhonesRequest { + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + @javax.annotation.Nullable + private String number; + + public PhonesRequest() { + } + + public PhonesRequest number(@javax.annotation.Nullable String number) { + this.number = number; + return this; + } + + /** + * A valid phone number + * @return number + */ + @javax.annotation.Nullable + public String getNumber() { + return number; + } + + public void setNumber(@javax.annotation.Nullable String number) { + this.number = number; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PhonesRequest phonesRequest = (PhonesRequest) o; + return Objects.equals(this.number, phonesRequest.number); + } + + @Override + public int hashCode() { + return Objects.hash(number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PhonesRequest {\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("number"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PhonesRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PhonesRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PhonesRequest is not found in the empty JSON string", PhonesRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PhonesRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PhonesRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("number") != null && !jsonObj.get("number").isJsonNull()) && !jsonObj.get("number").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("number").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PhonesRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PhonesRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PhonesRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PhonesRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PhonesRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PhonesRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of PhonesRequest + * @throws IOException if the JSON string is invalid with respect to PhonesRequest + */ + public static PhonesRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PhonesRequest.class); + } + + /** + * Convert an instance of PhonesRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PhonesResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/PhonesResponse.java new file mode 100644 index 0000000..869193d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PhonesResponse.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PhonesResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PhonesResponse { + public static final String SERIALIZED_NAME_NUMBER = "number"; + @SerializedName(SERIALIZED_NAME_NUMBER) + @javax.annotation.Nullable + private String number; + + public PhonesResponse() { + } + + public PhonesResponse number(@javax.annotation.Nullable String number) { + this.number = number; + return this; + } + + /** + * Get number + * @return number + */ + @javax.annotation.Nullable + public String getNumber() { + return number; + } + + public void setNumber(@javax.annotation.Nullable String number) { + this.number = number; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PhonesResponse phonesResponse = (PhonesResponse) o; + return Objects.equals(this.number, phonesResponse.number); + } + + @Override + public int hashCode() { + return Objects.hash(number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PhonesResponse {\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("number"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PhonesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PhonesResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PhonesResponse is not found in the empty JSON string", PhonesResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PhonesResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PhonesResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("number") != null && !jsonObj.get("number").isJsonNull()) && !jsonObj.get("number").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("number").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PhonesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PhonesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PhonesResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PhonesResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PhonesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PhonesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of PhonesResponse + * @throws IOException if the JSON string is invalid with respect to PhonesResponse + */ + public static PhonesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PhonesResponse.class); + } + + /** + * Convert an instance of PhonesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PickupAddressDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PickupAddressDto.java new file mode 100644 index 0000000..9bb8774 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PickupAddressDto.java @@ -0,0 +1,489 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Optional pickup address with optional drop-off point. If empty, then pickup address from Shipment object will be used. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PickupAddressDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_COMPANY = "company"; + @SerializedName(SERIALIZED_NAME_COMPANY) + @javax.annotation.Nullable + private String company; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_POSTAL_CODE = "postalCode"; + @SerializedName(SERIALIZED_NAME_POSTAL_CODE) + @javax.annotation.Nonnull + private String postalCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nullable + private String state; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode = "PL"; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nonnull + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nonnull + private String phone; + + public static final String SERIALIZED_NAME_POINT = "point"; + @SerializedName(SERIALIZED_NAME_POINT) + @javax.annotation.Nullable + private String point; + + public PickupAddressDto() { + } + + public PickupAddressDto name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Person name. Name or Company are required. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public PickupAddressDto company(@javax.annotation.Nullable String company) { + this.company = company; + return this; + } + + /** + * Company name. Name or Company are required. + * @return company + */ + @javax.annotation.Nullable + public String getCompany() { + return company; + } + + public void setCompany(@javax.annotation.Nullable String company) { + this.company = company; + } + + + public PickupAddressDto street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Get street + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public PickupAddressDto postalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * Get postalCode + * @return postalCode + */ + @javax.annotation.Nonnull + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + } + + + public PickupAddressDto city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * Get city + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public PickupAddressDto state(@javax.annotation.Nullable String state) { + this.state = state; + return this; + } + + /** + * Required for shipments to Ireland( county name ), United States ( state abbreviation / ISO code ), Canada ( province postal code / ISO code ) + * @return state + */ + @javax.annotation.Nullable + public String getState() { + return state; + } + + public void setState(@javax.annotation.Nullable String state) { + this.state = state; + } + + + public PickupAddressDto countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code in ISO 3166-1 alfa-2 format (two-letter code). + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + public PickupAddressDto email(@javax.annotation.Nonnull String email) { + this.email = email; + return this; + } + + /** + * Email address. For receiver, must be a valid buyer email generated by Allegro (eg. hamu7udk3p+17454c1b6@allegromail.pl). + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nonnull String email) { + this.email = email; + } + + + public PickupAddressDto phone(@javax.annotation.Nonnull String phone) { + this.phone = phone; + return this; + } + + /** + * Cell phone + * @return phone + */ + @javax.annotation.Nonnull + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nonnull String phone) { + this.phone = phone; + } + + + public PickupAddressDto point(@javax.annotation.Nullable String point) { + this.point = point; + return this; + } + + /** + * Drop off point id. You can get it directly from courier service. + * @return point + */ + @javax.annotation.Nullable + public String getPoint() { + return point; + } + + public void setPoint(@javax.annotation.Nullable String point) { + this.point = point; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PickupAddressDto pickupAddressDto = (PickupAddressDto) o; + return Objects.equals(this.name, pickupAddressDto.name) && + Objects.equals(this.company, pickupAddressDto.company) && + Objects.equals(this.street, pickupAddressDto.street) && + Objects.equals(this.postalCode, pickupAddressDto.postalCode) && + Objects.equals(this.city, pickupAddressDto.city) && + Objects.equals(this.state, pickupAddressDto.state) && + Objects.equals(this.countryCode, pickupAddressDto.countryCode) && + Objects.equals(this.email, pickupAddressDto.email) && + Objects.equals(this.phone, pickupAddressDto.phone) && + Objects.equals(this.point, pickupAddressDto.point); + } + + @Override + public int hashCode() { + return Objects.hash(name, company, street, postalCode, city, state, countryCode, email, phone, point); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PickupAddressDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" company: ").append(toIndentedString(company)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" point: ").append(toIndentedString(point)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("company"); + openapiFields.add("street"); + openapiFields.add("postalCode"); + openapiFields.add("city"); + openapiFields.add("state"); + openapiFields.add("countryCode"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("point"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("postalCode"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("countryCode"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PickupAddressDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PickupAddressDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PickupAddressDto is not found in the empty JSON string", PickupAddressDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PickupAddressDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PickupAddressDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PickupAddressDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("company") != null && !jsonObj.get("company").isJsonNull()) && !jsonObj.get("company").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `company` to be a primitive type in the JSON string but got `%s`", jsonObj.get("company").toString())); + } + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("postalCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postalCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postalCode").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + if ((jsonObj.get("point") != null && !jsonObj.get("point").isJsonNull()) && !jsonObj.get("point").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `point` to be a primitive type in the JSON string but got `%s`", jsonObj.get("point").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PickupAddressDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PickupAddressDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PickupAddressDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PickupAddressDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PickupAddressDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PickupAddressDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PickupAddressDto + * @throws IOException if the JSON string is invalid with respect to PickupAddressDto + */ + public static PickupAddressDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PickupAddressDto.class); + } + + /** + * Convert an instance of PickupAddressDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PickupCreateCommandDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PickupCreateCommandDto.java new file mode 100644 index 0000000..0333e77 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PickupCreateCommandDto.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.PickupCreateRequestDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PickupCreateCommandDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PickupCreateCommandDto { + public static final String SERIALIZED_NAME_COMMAND_ID = "commandId"; + @SerializedName(SERIALIZED_NAME_COMMAND_ID) + @javax.annotation.Nullable + private String commandId; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nonnull + private PickupCreateRequestDto input; + + public PickupCreateCommandDto() { + } + + public PickupCreateCommandDto commandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + return this; + } + + /** + * Command UUID. If empty, then system generate new one. + * @return commandId + */ + @javax.annotation.Nullable + public String getCommandId() { + return commandId; + } + + public void setCommandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + } + + + public PickupCreateCommandDto input(@javax.annotation.Nonnull PickupCreateRequestDto input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nonnull + public PickupCreateRequestDto getInput() { + return input; + } + + public void setInput(@javax.annotation.Nonnull PickupCreateRequestDto input) { + this.input = input; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PickupCreateCommandDto pickupCreateCommandDto = (PickupCreateCommandDto) o; + return Objects.equals(this.commandId, pickupCreateCommandDto.commandId) && + Objects.equals(this.input, pickupCreateCommandDto.input); + } + + @Override + public int hashCode() { + return Objects.hash(commandId, input); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PickupCreateCommandDto {\n"); + sb.append(" commandId: ").append(toIndentedString(commandId)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("commandId"); + openapiFields.add("input"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("input"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PickupCreateCommandDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PickupCreateCommandDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PickupCreateCommandDto is not found in the empty JSON string", PickupCreateCommandDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PickupCreateCommandDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PickupCreateCommandDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PickupCreateCommandDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("commandId") != null && !jsonObj.get("commandId").isJsonNull()) && !jsonObj.get("commandId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commandId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commandId").toString())); + } + // validate the required field `input` + PickupCreateRequestDto.validateJsonElement(jsonObj.get("input")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PickupCreateCommandDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PickupCreateCommandDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PickupCreateCommandDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PickupCreateCommandDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PickupCreateCommandDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PickupCreateCommandDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PickupCreateCommandDto + * @throws IOException if the JSON string is invalid with respect to PickupCreateCommandDto + */ + public static PickupCreateCommandDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PickupCreateCommandDto.class); + } + + /** + * Convert an instance of PickupCreateCommandDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PickupCreateRequestDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PickupCreateRequestDto.java new file mode 100644 index 0000000..ab11c88 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PickupCreateRequestDto.java @@ -0,0 +1,290 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.PickupAddressDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PickupCreateRequestDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PickupCreateRequestDto { + public static final String SERIALIZED_NAME_SHIPMENT_IDS = "shipmentIds"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_IDS) + @javax.annotation.Nonnull + private List shipmentIds = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PICKUP_DATE_PROPOSAL_ID = "pickupDateProposalId"; + @SerializedName(SERIALIZED_NAME_PICKUP_DATE_PROPOSAL_ID) + @javax.annotation.Nonnull + private String pickupDateProposalId; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private PickupAddressDto address; + + public PickupCreateRequestDto() { + } + + public PickupCreateRequestDto shipmentIds(@javax.annotation.Nonnull List shipmentIds) { + this.shipmentIds = shipmentIds; + return this; + } + + public PickupCreateRequestDto addShipmentIdsItem(String shipmentIdsItem) { + if (this.shipmentIds == null) { + this.shipmentIds = new ArrayList<>(); + } + this.shipmentIds.add(shipmentIdsItem); + return this; + } + + /** + * Get shipmentIds + * @return shipmentIds + */ + @javax.annotation.Nonnull + public List getShipmentIds() { + return shipmentIds; + } + + public void setShipmentIds(@javax.annotation.Nonnull List shipmentIds) { + this.shipmentIds = shipmentIds; + } + + + public PickupCreateRequestDto pickupDateProposalId(@javax.annotation.Nonnull String pickupDateProposalId) { + this.pickupDateProposalId = pickupDateProposalId; + return this; + } + + /** + * Internal pickup proposal ID + * @return pickupDateProposalId + */ + @javax.annotation.Nonnull + public String getPickupDateProposalId() { + return pickupDateProposalId; + } + + public void setPickupDateProposalId(@javax.annotation.Nonnull String pickupDateProposalId) { + this.pickupDateProposalId = pickupDateProposalId; + } + + + public PickupCreateRequestDto address(@javax.annotation.Nullable PickupAddressDto address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public PickupAddressDto getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable PickupAddressDto address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PickupCreateRequestDto pickupCreateRequestDto = (PickupCreateRequestDto) o; + return Objects.equals(this.shipmentIds, pickupCreateRequestDto.shipmentIds) && + Objects.equals(this.pickupDateProposalId, pickupCreateRequestDto.pickupDateProposalId) && + Objects.equals(this.address, pickupCreateRequestDto.address); + } + + @Override + public int hashCode() { + return Objects.hash(shipmentIds, pickupDateProposalId, address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PickupCreateRequestDto {\n"); + sb.append(" shipmentIds: ").append(toIndentedString(shipmentIds)).append("\n"); + sb.append(" pickupDateProposalId: ").append(toIndentedString(pickupDateProposalId)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shipmentIds"); + openapiFields.add("pickupDateProposalId"); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("shipmentIds"); + openapiRequiredFields.add("pickupDateProposalId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PickupCreateRequestDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PickupCreateRequestDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PickupCreateRequestDto is not found in the empty JSON string", PickupCreateRequestDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PickupCreateRequestDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PickupCreateRequestDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PickupCreateRequestDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("shipmentIds") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("shipmentIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `shipmentIds` to be an array in the JSON string but got `%s`", jsonObj.get("shipmentIds").toString())); + } + if (!jsonObj.get("pickupDateProposalId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `pickupDateProposalId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pickupDateProposalId").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + PickupAddressDto.validateJsonElement(jsonObj.get("address")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PickupCreateRequestDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PickupCreateRequestDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PickupCreateRequestDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PickupCreateRequestDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PickupCreateRequestDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PickupCreateRequestDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PickupCreateRequestDto + * @throws IOException if the JSON string is invalid with respect to PickupCreateRequestDto + */ + public static PickupCreateRequestDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PickupCreateRequestDto.class); + } + + /** + * Convert an instance of PickupCreateRequestDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PickupDateProposalDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PickupDateProposalDto.java new file mode 100644 index 0000000..28817b0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PickupDateProposalDto.java @@ -0,0 +1,275 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PickupDateProposalDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PickupDateProposalDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public PickupDateProposalDto() { + } + + public PickupDateProposalDto id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Internal pickup proposal ID + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public PickupDateProposalDto name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Human readable name of pickup proposal + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PickupDateProposalDto description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Additional information for pickup proposal + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PickupDateProposalDto pickupDateProposalDto = (PickupDateProposalDto) o; + return Objects.equals(this.id, pickupDateProposalDto.id) && + Objects.equals(this.name, pickupDateProposalDto.name) && + Objects.equals(this.description, pickupDateProposalDto.description); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PickupDateProposalDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PickupDateProposalDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PickupDateProposalDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PickupDateProposalDto is not found in the empty JSON string", PickupDateProposalDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PickupDateProposalDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PickupDateProposalDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PickupDateProposalDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PickupDateProposalDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PickupDateProposalDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PickupDateProposalDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PickupDateProposalDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PickupDateProposalDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PickupDateProposalDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PickupDateProposalDto + * @throws IOException if the JSON string is invalid with respect to PickupDateProposalDto + */ + public static PickupDateProposalDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PickupDateProposalDto.class); + } + + /** + * Convert an instance of PickupDateProposalDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PickupDateProposalsDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PickupDateProposalsDto.java new file mode 100644 index 0000000..455b94c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PickupDateProposalsDto.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.PickupDateProposalDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PickupDateProposalsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PickupDateProposalsDto { + public static final String SERIALIZED_NAME_SHIPMENT_ID = "shipmentId"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_ID) + @javax.annotation.Nullable + private String shipmentId; + + public static final String SERIALIZED_NAME_PROPOSAL_ITEMS = "proposalItems"; + @SerializedName(SERIALIZED_NAME_PROPOSAL_ITEMS) + @javax.annotation.Nullable + private List proposalItems = new ArrayList<>(); + + public PickupDateProposalsDto() { + } + + public PickupDateProposalsDto shipmentId(@javax.annotation.Nullable String shipmentId) { + this.shipmentId = shipmentId; + return this; + } + + /** + * Get shipmentId + * @return shipmentId + */ + @javax.annotation.Nullable + public String getShipmentId() { + return shipmentId; + } + + public void setShipmentId(@javax.annotation.Nullable String shipmentId) { + this.shipmentId = shipmentId; + } + + + public PickupDateProposalsDto proposalItems(@javax.annotation.Nullable List proposalItems) { + this.proposalItems = proposalItems; + return this; + } + + public PickupDateProposalsDto addProposalItemsItem(PickupDateProposalDto proposalItemsItem) { + if (this.proposalItems == null) { + this.proposalItems = new ArrayList<>(); + } + this.proposalItems.add(proposalItemsItem); + return this; + } + + /** + * Get proposalItems + * @return proposalItems + */ + @javax.annotation.Nullable + public List getProposalItems() { + return proposalItems; + } + + public void setProposalItems(@javax.annotation.Nullable List proposalItems) { + this.proposalItems = proposalItems; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PickupDateProposalsDto pickupDateProposalsDto = (PickupDateProposalsDto) o; + return Objects.equals(this.shipmentId, pickupDateProposalsDto.shipmentId) && + Objects.equals(this.proposalItems, pickupDateProposalsDto.proposalItems); + } + + @Override + public int hashCode() { + return Objects.hash(shipmentId, proposalItems); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PickupDateProposalsDto {\n"); + sb.append(" shipmentId: ").append(toIndentedString(shipmentId)).append("\n"); + sb.append(" proposalItems: ").append(toIndentedString(proposalItems)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shipmentId"); + openapiFields.add("proposalItems"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PickupDateProposalsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PickupDateProposalsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PickupDateProposalsDto is not found in the empty JSON string", PickupDateProposalsDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PickupDateProposalsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PickupDateProposalsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("shipmentId") != null && !jsonObj.get("shipmentId").isJsonNull()) && !jsonObj.get("shipmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `shipmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shipmentId").toString())); + } + if (jsonObj.get("proposalItems") != null && !jsonObj.get("proposalItems").isJsonNull()) { + JsonArray jsonArrayproposalItems = jsonObj.getAsJsonArray("proposalItems"); + if (jsonArrayproposalItems != null) { + // ensure the json data is an array + if (!jsonObj.get("proposalItems").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `proposalItems` to be an array in the JSON string but got `%s`", jsonObj.get("proposalItems").toString())); + } + + // validate the optional field `proposalItems` (array) + for (int i = 0; i < jsonArrayproposalItems.size(); i++) { + PickupDateProposalDto.validateJsonElement(jsonArrayproposalItems.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PickupDateProposalsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PickupDateProposalsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PickupDateProposalsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PickupDateProposalsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PickupDateProposalsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PickupDateProposalsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PickupDateProposalsDto + * @throws IOException if the JSON string is invalid with respect to PickupDateProposalsDto + */ + public static PickupDateProposalsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PickupDateProposalsDto.class); + } + + /** + * Convert an instance of PickupDateProposalsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PickupProposalsRequestDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PickupProposalsRequestDto.java new file mode 100644 index 0000000..0f02c8b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PickupProposalsRequestDto.java @@ -0,0 +1,289 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.PickupAddressDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PickupProposalsRequestDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PickupProposalsRequestDto { + public static final String SERIALIZED_NAME_SHIPMENT_IDS = "shipmentIds"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_IDS) + @javax.annotation.Nonnull + private List shipmentIds = new ArrayList<>(); + + public static final String SERIALIZED_NAME_READY_DATE = "readyDate"; + @SerializedName(SERIALIZED_NAME_READY_DATE) + @javax.annotation.Nullable + private String readyDate; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private PickupAddressDto address; + + public PickupProposalsRequestDto() { + } + + public PickupProposalsRequestDto shipmentIds(@javax.annotation.Nonnull List shipmentIds) { + this.shipmentIds = shipmentIds; + return this; + } + + public PickupProposalsRequestDto addShipmentIdsItem(String shipmentIdsItem) { + if (this.shipmentIds == null) { + this.shipmentIds = new ArrayList<>(); + } + this.shipmentIds.add(shipmentIdsItem); + return this; + } + + /** + * Get shipmentIds + * @return shipmentIds + */ + @javax.annotation.Nonnull + public List getShipmentIds() { + return shipmentIds; + } + + public void setShipmentIds(@javax.annotation.Nonnull List shipmentIds) { + this.shipmentIds = shipmentIds; + } + + + public PickupProposalsRequestDto readyDate(@javax.annotation.Nullable String readyDate) { + this.readyDate = readyDate; + return this; + } + + /** + * Date when shipments will be ready. + * @return readyDate + */ + @javax.annotation.Nullable + public String getReadyDate() { + return readyDate; + } + + public void setReadyDate(@javax.annotation.Nullable String readyDate) { + this.readyDate = readyDate; + } + + + public PickupProposalsRequestDto address(@javax.annotation.Nullable PickupAddressDto address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public PickupAddressDto getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable PickupAddressDto address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PickupProposalsRequestDto pickupProposalsRequestDto = (PickupProposalsRequestDto) o; + return Objects.equals(this.shipmentIds, pickupProposalsRequestDto.shipmentIds) && + Objects.equals(this.readyDate, pickupProposalsRequestDto.readyDate) && + Objects.equals(this.address, pickupProposalsRequestDto.address); + } + + @Override + public int hashCode() { + return Objects.hash(shipmentIds, readyDate, address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PickupProposalsRequestDto {\n"); + sb.append(" shipmentIds: ").append(toIndentedString(shipmentIds)).append("\n"); + sb.append(" readyDate: ").append(toIndentedString(readyDate)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shipmentIds"); + openapiFields.add("readyDate"); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("shipmentIds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PickupProposalsRequestDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PickupProposalsRequestDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PickupProposalsRequestDto is not found in the empty JSON string", PickupProposalsRequestDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PickupProposalsRequestDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PickupProposalsRequestDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PickupProposalsRequestDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("shipmentIds") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("shipmentIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `shipmentIds` to be an array in the JSON string but got `%s`", jsonObj.get("shipmentIds").toString())); + } + if ((jsonObj.get("readyDate") != null && !jsonObj.get("readyDate").isJsonNull()) && !jsonObj.get("readyDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `readyDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("readyDate").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + PickupAddressDto.validateJsonElement(jsonObj.get("address")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PickupProposalsRequestDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PickupProposalsRequestDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PickupProposalsRequestDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PickupProposalsRequestDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PickupProposalsRequestDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PickupProposalsRequestDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PickupProposalsRequestDto + * @throws IOException if the JSON string is invalid with respect to PickupProposalsRequestDto + */ + public static PickupProposalsRequestDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PickupProposalsRequestDto.class); + } + + /** + * Convert an instance of PickupProposalsRequestDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PickupProposalsResponseDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PickupProposalsResponseDto.java new file mode 100644 index 0000000..6031494 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PickupProposalsResponseDto.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.PickupAddressDto; +import pl.wtx.allegro.api.client.model.PickupDateProposalsDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PickupProposalsResponseDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PickupProposalsResponseDto { + public static final String SERIALIZED_NAME_PROPOSALS = "proposals"; + @SerializedName(SERIALIZED_NAME_PROPOSALS) + @javax.annotation.Nullable + private List proposals = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private PickupAddressDto address; + + public PickupProposalsResponseDto() { + } + + public PickupProposalsResponseDto proposals(@javax.annotation.Nullable List proposals) { + this.proposals = proposals; + return this; + } + + public PickupProposalsResponseDto addProposalsItem(PickupDateProposalsDto proposalsItem) { + if (this.proposals == null) { + this.proposals = new ArrayList<>(); + } + this.proposals.add(proposalsItem); + return this; + } + + /** + * Get proposals + * @return proposals + */ + @javax.annotation.Nullable + public List getProposals() { + return proposals; + } + + public void setProposals(@javax.annotation.Nullable List proposals) { + this.proposals = proposals; + } + + + public PickupProposalsResponseDto address(@javax.annotation.Nullable PickupAddressDto address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public PickupAddressDto getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable PickupAddressDto address) { + this.address = address; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PickupProposalsResponseDto pickupProposalsResponseDto = (PickupProposalsResponseDto) o; + return Objects.equals(this.proposals, pickupProposalsResponseDto.proposals) && + Objects.equals(this.address, pickupProposalsResponseDto.address); + } + + @Override + public int hashCode() { + return Objects.hash(proposals, address); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PickupProposalsResponseDto {\n"); + sb.append(" proposals: ").append(toIndentedString(proposals)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("proposals"); + openapiFields.add("address"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PickupProposalsResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PickupProposalsResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PickupProposalsResponseDto is not found in the empty JSON string", PickupProposalsResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PickupProposalsResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PickupProposalsResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("proposals") != null && !jsonObj.get("proposals").isJsonNull()) { + JsonArray jsonArrayproposals = jsonObj.getAsJsonArray("proposals"); + if (jsonArrayproposals != null) { + // ensure the json data is an array + if (!jsonObj.get("proposals").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `proposals` to be an array in the JSON string but got `%s`", jsonObj.get("proposals").toString())); + } + + // validate the optional field `proposals` (array) + for (int i = 0; i < jsonArrayproposals.size(); i++) { + PickupDateProposalsDto.validateJsonElement(jsonArrayproposals.get(i)); + }; + } + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + PickupAddressDto.validateJsonElement(jsonObj.get("address")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PickupProposalsResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PickupProposalsResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PickupProposalsResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PickupProposalsResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PickupProposalsResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PickupProposalsResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PickupProposalsResponseDto + * @throws IOException if the JSON string is invalid with respect to PickupProposalsResponseDto + */ + public static PickupProposalsResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PickupProposalsResponseDto.class); + } + + /** + * Convert an instance of PickupProposalsResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Pos.java b/src/main/java/pl/wtx/allegro/api/client/model/Pos.java new file mode 100644 index 0000000..3abc951 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Pos.java @@ -0,0 +1,729 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Address; +import pl.wtx.allegro.api.client.model.OpenHour; +import pl.wtx.allegro.api.client.model.Payment; +import pl.wtx.allegro.api.client.model.PosLocation; +import pl.wtx.allegro.api.client.model.Seller; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Pos + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Pos { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_EXTERNAL_ID = "externalId"; + @SerializedName(SERIALIZED_NAME_EXTERNAL_ID) + @javax.annotation.Nullable + private String externalId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_SELLER = "seller"; + @SerializedName(SERIALIZED_NAME_SELLER) + @javax.annotation.Nullable + private Seller seller; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nonnull + private Address address; + + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nullable + private String phoneNumber; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_LOCATIONS = "locations"; + @SerializedName(SERIALIZED_NAME_LOCATIONS) + @javax.annotation.Nullable + private List locations = new ArrayList<>(); + + public static final String SERIALIZED_NAME_OPEN_HOURS = "openHours"; + @SerializedName(SERIALIZED_NAME_OPEN_HOURS) + @javax.annotation.Nonnull + private List openHours = new ArrayList<>(); + + public static final String SERIALIZED_NAME_SERVICE_TIME = "serviceTime"; + @SerializedName(SERIALIZED_NAME_SERVICE_TIME) + @javax.annotation.Nullable + private String serviceTime; + + public static final String SERIALIZED_NAME_PAYMENTS = "payments"; + @SerializedName(SERIALIZED_NAME_PAYMENTS) + @javax.annotation.Nullable + private List payments = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CONFIRMATION_TYPE = "confirmationType"; + @SerializedName(SERIALIZED_NAME_CONFIRMATION_TYPE) + @javax.annotation.Nonnull + private String confirmationType; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private String createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private String updatedAt; + + public Pos() { + } + + public Pos id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * UUID. When creating a point of service (Post) the field is ignored. It is required when updating (Put) a point of service. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public Pos externalId(@javax.annotation.Nullable String externalId) { + this.externalId = externalId; + return this; + } + + /** + * ID from external client system. + * @return externalId + */ + @javax.annotation.Nullable + public String getExternalId() { + return externalId; + } + + public void setExternalId(@javax.annotation.Nullable String externalId) { + this.externalId = externalId; + } + + + public Pos name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public Pos seller(@javax.annotation.Nullable Seller seller) { + this.seller = seller; + return this; + } + + /** + * Get seller + * @return seller + */ + @javax.annotation.Nullable + public Seller getSeller() { + return seller; + } + + public void setSeller(@javax.annotation.Nullable Seller seller) { + this.seller = seller; + } + + + public Pos type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Indicates point type. The only valid value so far is PICKUP_POINT. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public Pos address(@javax.annotation.Nonnull Address address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nonnull + public Address getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nonnull Address address) { + this.address = address; + } + + + public Pos phoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get phoneNumber + * @return phoneNumber + */ + @javax.annotation.Nullable + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public Pos email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public Pos locations(@javax.annotation.Nullable List locations) { + this.locations = locations; + return this; + } + + public Pos addLocationsItem(PosLocation locationsItem) { + if (this.locations == null) { + this.locations = new ArrayList<>(); + } + this.locations.add(locationsItem); + return this; + } + + /** + * IDs for a location. When creating (Post) or updating (Put) a point of service the field is ignored. + * @return locations + */ + @javax.annotation.Nullable + public List getLocations() { + return locations; + } + + public void setLocations(@javax.annotation.Nullable List locations) { + this.locations = locations; + } + + + public Pos openHours(@javax.annotation.Nonnull List openHours) { + this.openHours = openHours; + return this; + } + + public Pos addOpenHoursItem(OpenHour openHoursItem) { + if (this.openHours == null) { + this.openHours = new ArrayList<>(); + } + this.openHours.add(openHoursItem); + return this; + } + + /** + * Possible empty list of opening hours. + * @return openHours + */ + @javax.annotation.Nonnull + public List getOpenHours() { + return openHours; + } + + public void setOpenHours(@javax.annotation.Nonnull List openHours) { + this.openHours = openHours; + } + + + public Pos serviceTime(@javax.annotation.Nullable String serviceTime) { + this.serviceTime = serviceTime; + return this; + } + + /** + * Delivery time / Time period for receipt. Date format ISO 8601 e.g. 'PT24H' + * @return serviceTime + */ + @javax.annotation.Nullable + public String getServiceTime() { + return serviceTime; + } + + public void setServiceTime(@javax.annotation.Nullable String serviceTime) { + this.serviceTime = serviceTime; + } + + + public Pos payments(@javax.annotation.Nullable List payments) { + this.payments = payments; + return this; + } + + public Pos addPaymentsItem(Payment paymentsItem) { + if (this.payments == null) { + this.payments = new ArrayList<>(); + } + this.payments.add(paymentsItem); + return this; + } + + /** + * An empty list of payment types is available. + * @return payments + */ + @javax.annotation.Nullable + public List getPayments() { + return payments; + } + + public void setPayments(@javax.annotation.Nullable List payments) { + this.payments = payments; + } + + + public Pos confirmationType(@javax.annotation.Nonnull String confirmationType) { + this.confirmationType = confirmationType; + return this; + } + + /** + * Confirmation method: AWAIT_CONTACT - We will inform you about the time of receipt, CALL_US - Please make an appointment, CONTACT_NOT_REQUIRED - Contact is not required. + * @return confirmationType + */ + @javax.annotation.Nonnull + public String getConfirmationType() { + return confirmationType; + } + + public void setConfirmationType(@javax.annotation.Nonnull String confirmationType) { + this.confirmationType = confirmationType; + } + + + public Pos status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Point of service status: ACTIVE - active, TEMPORARILY_CLOSED - temporarily closed, CLOSED_DOWN - closed down, DELETED - deleted. + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + + public Pos createdAt(@javax.annotation.Nullable String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation date. Date format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ When creating (Post) or updating (Put) a point of service the field is ignored. + * @return createdAt + */ + @javax.annotation.Nullable + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable String createdAt) { + this.createdAt = createdAt; + } + + + public Pos updatedAt(@javax.annotation.Nullable String updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Modification date. Date format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ When creating (Post) or updating (Put) a point of service the field is ignored. + * @return updatedAt + */ + @javax.annotation.Nullable + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable String updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pos pos = (Pos) o; + return Objects.equals(this.id, pos.id) && + Objects.equals(this.externalId, pos.externalId) && + Objects.equals(this.name, pos.name) && + Objects.equals(this.seller, pos.seller) && + Objects.equals(this.type, pos.type) && + Objects.equals(this.address, pos.address) && + Objects.equals(this.phoneNumber, pos.phoneNumber) && + Objects.equals(this.email, pos.email) && + Objects.equals(this.locations, pos.locations) && + Objects.equals(this.openHours, pos.openHours) && + Objects.equals(this.serviceTime, pos.serviceTime) && + Objects.equals(this.payments, pos.payments) && + Objects.equals(this.confirmationType, pos.confirmationType) && + Objects.equals(this.status, pos.status) && + Objects.equals(this.createdAt, pos.createdAt) && + Objects.equals(this.updatedAt, pos.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, externalId, name, seller, type, address, phoneNumber, email, locations, openHours, serviceTime, payments, confirmationType, status, createdAt, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pos {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" seller: ").append(toIndentedString(seller)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" locations: ").append(toIndentedString(locations)).append("\n"); + sb.append(" openHours: ").append(toIndentedString(openHours)).append("\n"); + sb.append(" serviceTime: ").append(toIndentedString(serviceTime)).append("\n"); + sb.append(" payments: ").append(toIndentedString(payments)).append("\n"); + sb.append(" confirmationType: ").append(toIndentedString(confirmationType)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("externalId"); + openapiFields.add("name"); + openapiFields.add("seller"); + openapiFields.add("type"); + openapiFields.add("address"); + openapiFields.add("phoneNumber"); + openapiFields.add("email"); + openapiFields.add("locations"); + openapiFields.add("openHours"); + openapiFields.add("serviceTime"); + openapiFields.add("payments"); + openapiFields.add("confirmationType"); + openapiFields.add("status"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("openHours"); + openapiRequiredFields.add("confirmationType"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Pos + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Pos.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Pos is not found in the empty JSON string", Pos.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Pos.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Pos` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Pos.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("externalId") != null && !jsonObj.get("externalId").isJsonNull()) && !jsonObj.get("externalId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `externalId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("externalId").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `seller` + if (jsonObj.get("seller") != null && !jsonObj.get("seller").isJsonNull()) { + Seller.validateJsonElement(jsonObj.get("seller")); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `address` + Address.validateJsonElement(jsonObj.get("address")); + if ((jsonObj.get("phoneNumber") != null && !jsonObj.get("phoneNumber").isJsonNull()) && !jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (jsonObj.get("locations") != null && !jsonObj.get("locations").isJsonNull()) { + JsonArray jsonArraylocations = jsonObj.getAsJsonArray("locations"); + if (jsonArraylocations != null) { + // ensure the json data is an array + if (!jsonObj.get("locations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `locations` to be an array in the JSON string but got `%s`", jsonObj.get("locations").toString())); + } + + // validate the optional field `locations` (array) + for (int i = 0; i < jsonArraylocations.size(); i++) { + PosLocation.validateJsonElement(jsonArraylocations.get(i)); + }; + } + } + // ensure the json data is an array + if (!jsonObj.get("openHours").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `openHours` to be an array in the JSON string but got `%s`", jsonObj.get("openHours").toString())); + } + + JsonArray jsonArrayopenHours = jsonObj.getAsJsonArray("openHours"); + // validate the required field `openHours` (array) + for (int i = 0; i < jsonArrayopenHours.size(); i++) { + OpenHour.validateJsonElement(jsonArrayopenHours.get(i)); + }; + if ((jsonObj.get("serviceTime") != null && !jsonObj.get("serviceTime").isJsonNull()) && !jsonObj.get("serviceTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `serviceTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("serviceTime").toString())); + } + if (jsonObj.get("payments") != null && !jsonObj.get("payments").isJsonNull()) { + JsonArray jsonArraypayments = jsonObj.getAsJsonArray("payments"); + if (jsonArraypayments != null) { + // ensure the json data is an array + if (!jsonObj.get("payments").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `payments` to be an array in the JSON string but got `%s`", jsonObj.get("payments").toString())); + } + + // validate the optional field `payments` (array) + for (int i = 0; i < jsonArraypayments.size(); i++) { + Payment.validateJsonElement(jsonArraypayments.get(i)); + }; + } + } + if (!jsonObj.get("confirmationType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `confirmationType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("confirmationType").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("createdAt") != null && !jsonObj.get("createdAt").isJsonNull()) && !jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); + } + if ((jsonObj.get("updatedAt") != null && !jsonObj.get("updatedAt").isJsonNull()) && !jsonObj.get("updatedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `updatedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Pos.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Pos' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Pos.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Pos value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Pos read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Pos given an JSON string + * + * @param jsonString JSON string + * @return An instance of Pos + * @throws IOException if the JSON string is invalid with respect to Pos + */ + public static Pos fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Pos.class); + } + + /** + * Convert an instance of Pos to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PosLocation.java b/src/main/java/pl/wtx/allegro/api/client/model/PosLocation.java new file mode 100644 index 0000000..57128f8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PosLocation.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PosLocation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PosLocation { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public PosLocation() { + } + + public PosLocation id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PosLocation posLocation = (PosLocation) o; + return Objects.equals(this.id, posLocation.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PosLocation {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PosLocation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PosLocation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PosLocation is not found in the empty JSON string", PosLocation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PosLocation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PosLocation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PosLocation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PosLocation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PosLocation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PosLocation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PosLocation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PosLocation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PosLocation given an JSON string + * + * @param jsonString JSON string + * @return An instance of PosLocation + * @throws IOException if the JSON string is invalid with respect to PosLocation + */ + public static PosLocation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PosLocation.class); + } + + /** + * Convert an instance of PosLocation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Price.java b/src/main/java/pl/wtx/allegro/api/client/model/Price.java new file mode 100644 index 0000000..5eb3b14 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Price.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The price data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Price { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public Price() { + } + + public Price amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public Price currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Price price = (Price) o; + return Objects.equals(this.amount, price.amount) && + Objects.equals(this.currency, price.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Price {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Price + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Price.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Price is not found in the empty JSON string", Price.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Price.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Price` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Price.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Price.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Price' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Price.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Price value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Price read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Price given an JSON string + * + * @param jsonString JSON string + * @return An instance of Price + * @throws IOException if the JSON string is invalid with respect to Price + */ + public static Price fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Price.class); + } + + /** + * Convert an instance of Price to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PriceAutomation.java b/src/main/java/pl/wtx/allegro/api/client/model/PriceAutomation.java new file mode 100644 index 0000000..2c86b71 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PriceAutomation.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.PriceAutomationRule; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The automatic pricing rule. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PriceAutomation { + public static final String SERIALIZED_NAME_RULE = "rule"; + @SerializedName(SERIALIZED_NAME_RULE) + @javax.annotation.Nullable + private PriceAutomationRule rule; + + public PriceAutomation() { + } + + public PriceAutomation rule(@javax.annotation.Nullable PriceAutomationRule rule) { + this.rule = rule; + return this; + } + + /** + * Get rule + * @return rule + */ + @javax.annotation.Nullable + public PriceAutomationRule getRule() { + return rule; + } + + public void setRule(@javax.annotation.Nullable PriceAutomationRule rule) { + this.rule = rule; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PriceAutomation priceAutomation = (PriceAutomation) o; + return Objects.equals(this.rule, priceAutomation.rule); + } + + @Override + public int hashCode() { + return Objects.hash(rule); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PriceAutomation {\n"); + sb.append(" rule: ").append(toIndentedString(rule)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rule"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PriceAutomation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PriceAutomation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PriceAutomation is not found in the empty JSON string", PriceAutomation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PriceAutomation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PriceAutomation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `rule` + if (jsonObj.get("rule") != null && !jsonObj.get("rule").isJsonNull()) { + PriceAutomationRule.validateJsonElement(jsonObj.get("rule")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PriceAutomation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PriceAutomation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PriceAutomation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PriceAutomation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PriceAutomation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PriceAutomation given an JSON string + * + * @param jsonString JSON string + * @return An instance of PriceAutomation + * @throws IOException if the JSON string is invalid with respect to PriceAutomation + */ + public static PriceAutomation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PriceAutomation.class); + } + + /** + * Convert an instance of PriceAutomation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PriceAutomationRule.java b/src/main/java/pl/wtx/allegro/api/client/model/PriceAutomationRule.java new file mode 100644 index 0000000..055feb1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PriceAutomationRule.java @@ -0,0 +1,238 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AutomaticPricingRuleType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PriceAutomationRule + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PriceAutomationRule { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private AutomaticPricingRuleType type; + + public PriceAutomationRule() { + } + + public PriceAutomationRule id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Identifier of a automatic pricing rule. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public PriceAutomationRule type(@javax.annotation.Nullable AutomaticPricingRuleType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public AutomaticPricingRuleType getType() { + return type; + } + + public void setType(@javax.annotation.Nullable AutomaticPricingRuleType type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PriceAutomationRule priceAutomationRule = (PriceAutomationRule) o; + return Objects.equals(this.id, priceAutomationRule.id) && + Objects.equals(this.type, priceAutomationRule.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PriceAutomationRule {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PriceAutomationRule + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PriceAutomationRule.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PriceAutomationRule is not found in the empty JSON string", PriceAutomationRule.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PriceAutomationRule.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PriceAutomationRule` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + AutomaticPricingRuleType.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PriceAutomationRule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PriceAutomationRule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PriceAutomationRule.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PriceAutomationRule value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PriceAutomationRule read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PriceAutomationRule given an JSON string + * + * @param jsonString JSON string + * @return An instance of PriceAutomationRule + * @throws IOException if the JSON string is invalid with respect to PriceAutomationRule + */ + public static PriceAutomationRule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PriceAutomationRule.class); + } + + /** + * Convert an instance of PriceAutomationRule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PriceModification.java b/src/main/java/pl/wtx/allegro/api/client/model/PriceModification.java new file mode 100644 index 0000000..3c6ee80 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PriceModification.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The way the offer price should be changed. One of three ways is possible: new price, increase/decrease price, percentage change and only one can be chosen at once. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PriceModification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + public PriceModification() { + this.type = this.getClass().getSimpleName(); + } + + public PriceModification type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Type of the modification. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public PriceModification marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * The marketplace on which the price of the offer should be changed. If omitted, the price will be changed on the base marketplace of the offer. + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PriceModification priceModification = (PriceModification) o; + return Objects.equals(this.type, priceModification.type) && + Objects.equals(this.marketplaceId, priceModification.marketplaceId); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, marketplaceId); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PriceModification {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("marketplaceId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PriceModification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PriceModification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PriceModification is not found in the empty JSON string", PriceModification.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "DECREASE_PERCENTAGE": + PriceModificationPercentageChangeDecrease.validateJsonElement(jsonElement); + break; + case "DECREASE_PRICE": + PriceModificationValueChangeDecrease.validateJsonElement(jsonElement); + break; + case "FIXED_PRICE": + PriceModificationFixedPrice.validateJsonElement(jsonElement); + break; + case "INCREASE_PERCENTAGE": + PriceModificationPercentageChangeIncrease.validateJsonElement(jsonElement); + break; + case "INCREASE_PRICE": + PriceModificationValueChangeIncrease.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of PriceModification given an JSON string + * + * @param jsonString JSON string + * @return An instance of PriceModification + * @throws IOException if the JSON string is invalid with respect to PriceModification + */ + public static PriceModification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PriceModification.class); + } + + /** + * Convert an instance of PriceModification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationFixedPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationFixedPrice.java new file mode 100644 index 0000000..c2f2940 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationFixedPrice.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.PriceModification; +import pl.wtx.allegro.api.client.model.PriceModificationFixedPriceHolder; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PriceModificationFixedPrice + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PriceModificationFixedPrice extends PriceModification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "FIXED_PRICE"; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private PriceModificationFixedPriceHolder price; + + public PriceModificationFixedPrice() { + this.type = this.getClass().getSimpleName(); + } + + public PriceModificationFixedPrice type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public PriceModificationFixedPrice price(@javax.annotation.Nullable PriceModificationFixedPriceHolder price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nullable + public PriceModificationFixedPriceHolder getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable PriceModificationFixedPriceHolder price) { + this.price = price; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PriceModificationFixedPrice priceModificationFixedPrice = (PriceModificationFixedPrice) o; + return Objects.equals(this.type, priceModificationFixedPrice.type) && + Objects.equals(this.price, priceModificationFixedPrice.price) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, price, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PriceModificationFixedPrice {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("marketplaceId"); + openapiFields.add("price"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PriceModificationFixedPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PriceModificationFixedPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PriceModificationFixedPrice is not found in the empty JSON string", PriceModificationFixedPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PriceModificationFixedPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PriceModificationFixedPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PriceModificationFixedPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PriceModificationFixedPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PriceModificationFixedPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PriceModificationFixedPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PriceModificationFixedPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PriceModificationFixedPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of PriceModificationFixedPrice + * @throws IOException if the JSON string is invalid with respect to PriceModificationFixedPrice + */ + public static PriceModificationFixedPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PriceModificationFixedPrice.class); + } + + /** + * Convert an instance of PriceModificationFixedPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationFixedPriceHolder.java b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationFixedPriceHolder.java new file mode 100644 index 0000000..adc99bd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationFixedPriceHolder.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * New offer buy now price, related to type FIXED_PRICE. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PriceModificationFixedPriceHolder { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public PriceModificationFixedPriceHolder() { + } + + public PriceModificationFixedPriceHolder amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public PriceModificationFixedPriceHolder currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PriceModificationFixedPriceHolder priceModificationFixedPriceHolder = (PriceModificationFixedPriceHolder) o; + return Objects.equals(this.amount, priceModificationFixedPriceHolder.amount) && + Objects.equals(this.currency, priceModificationFixedPriceHolder.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PriceModificationFixedPriceHolder {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PriceModificationFixedPriceHolder + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PriceModificationFixedPriceHolder.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PriceModificationFixedPriceHolder is not found in the empty JSON string", PriceModificationFixedPriceHolder.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PriceModificationFixedPriceHolder.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PriceModificationFixedPriceHolder` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PriceModificationFixedPriceHolder.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PriceModificationFixedPriceHolder.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PriceModificationFixedPriceHolder' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PriceModificationFixedPriceHolder.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PriceModificationFixedPriceHolder value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PriceModificationFixedPriceHolder read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PriceModificationFixedPriceHolder given an JSON string + * + * @param jsonString JSON string + * @return An instance of PriceModificationFixedPriceHolder + * @throws IOException if the JSON string is invalid with respect to PriceModificationFixedPriceHolder + */ + public static PriceModificationFixedPriceHolder fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PriceModificationFixedPriceHolder.class); + } + + /** + * Convert an instance of PriceModificationFixedPriceHolder to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationPercentageChangeDecrease.java b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationPercentageChangeDecrease.java new file mode 100644 index 0000000..234456a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationPercentageChangeDecrease.java @@ -0,0 +1,246 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.PriceModification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PriceModificationPercentageChangeDecrease + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PriceModificationPercentageChangeDecrease extends PriceModification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "DECREASE_PERCENTAGE"; + + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + @javax.annotation.Nullable + private String percentage; + + public PriceModificationPercentageChangeDecrease() { + this.type = this.getClass().getSimpleName(); + } + + public PriceModificationPercentageChangeDecrease type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public PriceModificationPercentageChangeDecrease percentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + return this; + } + + /** + * Percentage change of offer buy now price, related to types: INCREASE_PERCENTAGE, DECREASE_PERCENTAGE. Provided in a string format to avoid rounding errors. + * @return percentage + */ + @javax.annotation.Nullable + public String getPercentage() { + return percentage; + } + + public void setPercentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PriceModificationPercentageChangeDecrease priceModificationPercentageChangeDecrease = (PriceModificationPercentageChangeDecrease) o; + return Objects.equals(this.type, priceModificationPercentageChangeDecrease.type) && + Objects.equals(this.percentage, priceModificationPercentageChangeDecrease.percentage) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, percentage, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PriceModificationPercentageChangeDecrease {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("marketplaceId"); + openapiFields.add("percentage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PriceModificationPercentageChangeDecrease + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PriceModificationPercentageChangeDecrease.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PriceModificationPercentageChangeDecrease is not found in the empty JSON string", PriceModificationPercentageChangeDecrease.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PriceModificationPercentageChangeDecrease.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PriceModificationPercentageChangeDecrease` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PriceModificationPercentageChangeDecrease.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PriceModificationPercentageChangeDecrease' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PriceModificationPercentageChangeDecrease.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PriceModificationPercentageChangeDecrease value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PriceModificationPercentageChangeDecrease read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PriceModificationPercentageChangeDecrease given an JSON string + * + * @param jsonString JSON string + * @return An instance of PriceModificationPercentageChangeDecrease + * @throws IOException if the JSON string is invalid with respect to PriceModificationPercentageChangeDecrease + */ + public static PriceModificationPercentageChangeDecrease fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PriceModificationPercentageChangeDecrease.class); + } + + /** + * Convert an instance of PriceModificationPercentageChangeDecrease to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationPercentageChangeIncrease.java b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationPercentageChangeIncrease.java new file mode 100644 index 0000000..df44516 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationPercentageChangeIncrease.java @@ -0,0 +1,246 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.PriceModification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PriceModificationPercentageChangeIncrease + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PriceModificationPercentageChangeIncrease extends PriceModification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "INCREASE_PERCENTAGE"; + + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + @javax.annotation.Nullable + private String percentage; + + public PriceModificationPercentageChangeIncrease() { + this.type = this.getClass().getSimpleName(); + } + + public PriceModificationPercentageChangeIncrease type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public PriceModificationPercentageChangeIncrease percentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + return this; + } + + /** + * Percentage change of offer buy now price, related to types: INCREASE_PERCENTAGE, DECREASE_PERCENTAGE. Provided in a string format to avoid rounding errors. + * @return percentage + */ + @javax.annotation.Nullable + public String getPercentage() { + return percentage; + } + + public void setPercentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PriceModificationPercentageChangeIncrease priceModificationPercentageChangeIncrease = (PriceModificationPercentageChangeIncrease) o; + return Objects.equals(this.type, priceModificationPercentageChangeIncrease.type) && + Objects.equals(this.percentage, priceModificationPercentageChangeIncrease.percentage) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, percentage, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PriceModificationPercentageChangeIncrease {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("marketplaceId"); + openapiFields.add("percentage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PriceModificationPercentageChangeIncrease + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PriceModificationPercentageChangeIncrease.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PriceModificationPercentageChangeIncrease is not found in the empty JSON string", PriceModificationPercentageChangeIncrease.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PriceModificationPercentageChangeIncrease.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PriceModificationPercentageChangeIncrease` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PriceModificationPercentageChangeIncrease.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PriceModificationPercentageChangeIncrease' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PriceModificationPercentageChangeIncrease.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PriceModificationPercentageChangeIncrease value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PriceModificationPercentageChangeIncrease read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PriceModificationPercentageChangeIncrease given an JSON string + * + * @param jsonString JSON string + * @return An instance of PriceModificationPercentageChangeIncrease + * @throws IOException if the JSON string is invalid with respect to PriceModificationPercentageChangeIncrease + */ + public static PriceModificationPercentageChangeIncrease fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PriceModificationPercentageChangeIncrease.class); + } + + /** + * Convert an instance of PriceModificationPercentageChangeIncrease to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeDecrease.java b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeDecrease.java new file mode 100644 index 0000000..925c7ce --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeDecrease.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.PriceModification; +import pl.wtx.allegro.api.client.model.PriceModificationValueChangeHolder; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PriceModificationValueChangeDecrease + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PriceModificationValueChangeDecrease extends PriceModification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "DECREASE_PRICE"; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private PriceModificationValueChangeHolder value; + + public PriceModificationValueChangeDecrease() { + this.type = this.getClass().getSimpleName(); + } + + public PriceModificationValueChangeDecrease type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public PriceModificationValueChangeDecrease value(@javax.annotation.Nullable PriceModificationValueChangeHolder value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public PriceModificationValueChangeHolder getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable PriceModificationValueChangeHolder value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PriceModificationValueChangeDecrease priceModificationValueChangeDecrease = (PriceModificationValueChangeDecrease) o; + return Objects.equals(this.type, priceModificationValueChangeDecrease.type) && + Objects.equals(this.value, priceModificationValueChangeDecrease.value) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, value, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PriceModificationValueChangeDecrease {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("marketplaceId"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PriceModificationValueChangeDecrease + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PriceModificationValueChangeDecrease.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PriceModificationValueChangeDecrease is not found in the empty JSON string", PriceModificationValueChangeDecrease.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PriceModificationValueChangeDecrease.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PriceModificationValueChangeDecrease` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PriceModificationValueChangeDecrease.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PriceModificationValueChangeDecrease' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PriceModificationValueChangeDecrease.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PriceModificationValueChangeDecrease value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PriceModificationValueChangeDecrease read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PriceModificationValueChangeDecrease given an JSON string + * + * @param jsonString JSON string + * @return An instance of PriceModificationValueChangeDecrease + * @throws IOException if the JSON string is invalid with respect to PriceModificationValueChangeDecrease + */ + public static PriceModificationValueChangeDecrease fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PriceModificationValueChangeDecrease.class); + } + + /** + * Convert an instance of PriceModificationValueChangeDecrease to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeHolder.java b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeHolder.java new file mode 100644 index 0000000..40238f4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeHolder.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Change of offer buy now price, related to types: INCREASE_PRICE, DECREASE_PRICE. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PriceModificationValueChangeHolder { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public PriceModificationValueChangeHolder() { + } + + public PriceModificationValueChangeHolder amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public PriceModificationValueChangeHolder currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PriceModificationValueChangeHolder priceModificationValueChangeHolder = (PriceModificationValueChangeHolder) o; + return Objects.equals(this.amount, priceModificationValueChangeHolder.amount) && + Objects.equals(this.currency, priceModificationValueChangeHolder.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PriceModificationValueChangeHolder {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PriceModificationValueChangeHolder + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PriceModificationValueChangeHolder.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PriceModificationValueChangeHolder is not found in the empty JSON string", PriceModificationValueChangeHolder.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PriceModificationValueChangeHolder.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PriceModificationValueChangeHolder` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PriceModificationValueChangeHolder.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PriceModificationValueChangeHolder.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PriceModificationValueChangeHolder' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PriceModificationValueChangeHolder.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PriceModificationValueChangeHolder value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PriceModificationValueChangeHolder read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PriceModificationValueChangeHolder given an JSON string + * + * @param jsonString JSON string + * @return An instance of PriceModificationValueChangeHolder + * @throws IOException if the JSON string is invalid with respect to PriceModificationValueChangeHolder + */ + public static PriceModificationValueChangeHolder fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PriceModificationValueChangeHolder.class); + } + + /** + * Convert an instance of PriceModificationValueChangeHolder to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeIncrease.java b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeIncrease.java new file mode 100644 index 0000000..6474d6f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PriceModificationValueChangeIncrease.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.PriceModification; +import pl.wtx.allegro.api.client.model.PriceModificationValueChangeHolder; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PriceModificationValueChangeIncrease + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PriceModificationValueChangeIncrease extends PriceModification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "INCREASE_PRICE"; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private PriceModificationValueChangeHolder value; + + public PriceModificationValueChangeIncrease() { + this.type = this.getClass().getSimpleName(); + } + + public PriceModificationValueChangeIncrease type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public PriceModificationValueChangeIncrease value(@javax.annotation.Nullable PriceModificationValueChangeHolder value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public PriceModificationValueChangeHolder getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable PriceModificationValueChangeHolder value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PriceModificationValueChangeIncrease priceModificationValueChangeIncrease = (PriceModificationValueChangeIncrease) o; + return Objects.equals(this.type, priceModificationValueChangeIncrease.type) && + Objects.equals(this.value, priceModificationValueChangeIncrease.value) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, value, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PriceModificationValueChangeIncrease {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("marketplaceId"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PriceModificationValueChangeIncrease + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PriceModificationValueChangeIncrease.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PriceModificationValueChangeIncrease is not found in the empty JSON string", PriceModificationValueChangeIncrease.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PriceModificationValueChangeIncrease.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PriceModificationValueChangeIncrease` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PriceModificationValueChangeIncrease.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PriceModificationValueChangeIncrease' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PriceModificationValueChangeIncrease.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PriceModificationValueChangeIncrease value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PriceModificationValueChangeIncrease read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PriceModificationValueChangeIncrease given an JSON string + * + * @param jsonString JSON string + * @return An instance of PriceModificationValueChangeIncrease + * @throws IOException if the JSON string is invalid with respect to PriceModificationValueChangeIncrease + */ + public static PriceModificationValueChangeIncrease fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PriceModificationValueChangeIncrease.class); + } + + /** + * Convert an instance of PriceModificationValueChangeIncrease to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PricingOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/PricingOffer.java new file mode 100644 index 0000000..0fbecef --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PricingOffer.java @@ -0,0 +1,418 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Category; +import pl.wtx.allegro.api.client.model.JustId; +import pl.wtx.allegro.api.client.model.Parameter; +import pl.wtx.allegro.api.client.model.PricingPublication; +import pl.wtx.allegro.api.client.model.Promotion; +import pl.wtx.allegro.api.client.model.SellingModeWithNetPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Single offer data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PricingOffer { + public static final String SERIALIZED_NAME_FUNDRAISING_CAMPAIGN = "fundraisingCampaign"; + @SerializedName(SERIALIZED_NAME_FUNDRAISING_CAMPAIGN) + @javax.annotation.Nullable + private JustId fundraisingCampaign; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Category category; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PROMOTION = "promotion"; + @SerializedName(SERIALIZED_NAME_PROMOTION) + @javax.annotation.Nullable + private Promotion promotion; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private PricingPublication publication; + + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private SellingModeWithNetPrice sellingMode; + + public PricingOffer() { + } + + public PricingOffer fundraisingCampaign(@javax.annotation.Nullable JustId fundraisingCampaign) { + this.fundraisingCampaign = fundraisingCampaign; + return this; + } + + /** + * Get fundraisingCampaign + * @return fundraisingCampaign + */ + @javax.annotation.Nullable + public JustId getFundraisingCampaign() { + return fundraisingCampaign; + } + + public void setFundraisingCampaign(@javax.annotation.Nullable JustId fundraisingCampaign) { + this.fundraisingCampaign = fundraisingCampaign; + } + + + public PricingOffer id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public PricingOffer category(@javax.annotation.Nullable Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + public Category getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Category category) { + this.category = category; + } + + + public PricingOffer parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public PricingOffer addParametersItem(Parameter parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Get parameters + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public PricingOffer promotion(@javax.annotation.Nullable Promotion promotion) { + this.promotion = promotion; + return this; + } + + /** + * Get promotion + * @return promotion + */ + @javax.annotation.Nullable + public Promotion getPromotion() { + return promotion; + } + + public void setPromotion(@javax.annotation.Nullable Promotion promotion) { + this.promotion = promotion; + } + + + public PricingOffer publication(@javax.annotation.Nullable PricingPublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public PricingPublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable PricingPublication publication) { + this.publication = publication; + } + + + public PricingOffer sellingMode(@javax.annotation.Nullable SellingModeWithNetPrice sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public SellingModeWithNetPrice getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable SellingModeWithNetPrice sellingMode) { + this.sellingMode = sellingMode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PricingOffer pricingOffer = (PricingOffer) o; + return Objects.equals(this.fundraisingCampaign, pricingOffer.fundraisingCampaign) && + Objects.equals(this.id, pricingOffer.id) && + Objects.equals(this.category, pricingOffer.category) && + Objects.equals(this.parameters, pricingOffer.parameters) && + Objects.equals(this.promotion, pricingOffer.promotion) && + Objects.equals(this.publication, pricingOffer.publication) && + Objects.equals(this.sellingMode, pricingOffer.sellingMode); + } + + @Override + public int hashCode() { + return Objects.hash(fundraisingCampaign, id, category, parameters, promotion, publication, sellingMode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PricingOffer {\n"); + sb.append(" fundraisingCampaign: ").append(toIndentedString(fundraisingCampaign)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" promotion: ").append(toIndentedString(promotion)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fundraisingCampaign"); + openapiFields.add("id"); + openapiFields.add("category"); + openapiFields.add("parameters"); + openapiFields.add("promotion"); + openapiFields.add("publication"); + openapiFields.add("sellingMode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PricingOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PricingOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PricingOffer is not found in the empty JSON string", PricingOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PricingOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `fundraisingCampaign` + if (jsonObj.get("fundraisingCampaign") != null && !jsonObj.get("fundraisingCampaign").isJsonNull()) { + JustId.validateJsonElement(jsonObj.get("fundraisingCampaign")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + Category.validateJsonElement(jsonObj.get("category")); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + Parameter.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + // validate the optional field `promotion` + if (jsonObj.get("promotion") != null && !jsonObj.get("promotion").isJsonNull()) { + Promotion.validateJsonElement(jsonObj.get("promotion")); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + PricingPublication.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + SellingModeWithNetPrice.validateJsonElement(jsonObj.get("sellingMode")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PricingOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PricingOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PricingOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PricingOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PricingOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PricingOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of PricingOffer + * @throws IOException if the JSON string is invalid with respect to PricingOffer + */ + public static PricingOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PricingOffer.class); + } + + /** + * Convert an instance of PricingOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PricingPublication.java b/src/main/java/pl/wtx/allegro/api/client/model/PricingPublication.java new file mode 100644 index 0000000..f11c4dd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PricingPublication.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PricingPublication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PricingPublication { + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + @javax.annotation.Nullable + private String duration; + + public PricingPublication() { + } + + public PricingPublication duration(@javax.annotation.Nullable String duration) { + this.duration = duration; + return this; + } + + /** + * This field must be set to one of the following:<br/> - for auctions: 1 day, 3 days, 5 days, 7 days, 10 days<br/> - for buy-now offers: 3 days, 5 days, 7 days, 10 days, 20 days, 30 days<br/> - for advertisements: 10 days, 20 days, 30 days.<br/> The value is in ISO 8601 format (example: PT24H, PT72H). + * @return duration + */ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + public void setDuration(@javax.annotation.Nullable String duration) { + this.duration = duration; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PricingPublication pricingPublication = (PricingPublication) o; + return Objects.equals(this.duration, pricingPublication.duration); + } + + @Override + public int hashCode() { + return Objects.hash(duration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PricingPublication {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("duration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PricingPublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PricingPublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PricingPublication is not found in the empty JSON string", PricingPublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PricingPublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingPublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PricingPublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PricingPublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PricingPublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PricingPublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PricingPublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PricingPublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of PricingPublication + * @throws IOException if the JSON string is invalid with respect to PricingPublication + */ + public static PricingPublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PricingPublication.class); + } + + /** + * Convert an instance of PricingPublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProcessingStatus.java b/src/main/java/pl/wtx/allegro/api/client/model/ProcessingStatus.java new file mode 100644 index 0000000..148390c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProcessingStatus.java @@ -0,0 +1,88 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The processing status of the command. + */ +@JsonAdapter(ProcessingStatus.Adapter.class) +public enum ProcessingStatus { + + QUEUEING("QUEUEING"), + + RUNNING("RUNNING"), + + VALIDATED_AND_RUNNING("VALIDATED_AND_RUNNING"), + + RUNNING_BUT_WITH_ERRORS("RUNNING_BUT_WITH_ERRORS"), + + SUCCESSFUL("SUCCESSFUL"), + + PARTIAL_SUCCESS("PARTIAL_SUCCESS"), + + ERROR("ERROR"); + + private String value; + + ProcessingStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ProcessingStatus fromValue(String value) { + for (ProcessingStatus b : ProcessingStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ProcessingStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ProcessingStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ProcessingStatus.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ProcessingStatus.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Product.java b/src/main/java/pl/wtx/allegro/api/client/model/Product.java new file mode 100644 index 0000000..a906075 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Product.java @@ -0,0 +1,215 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The product data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Product { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public Product() { + } + + public Product id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * The product identifier. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Product product = (Product) o; + return Objects.equals(this.id, product.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Product {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Product + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Product.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Product is not found in the empty JSON string", Product.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Product.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Product` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Product.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Product.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Product' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Product.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Product value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Product read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Product given an JSON string + * + * @param jsonString JSON string + * @return An instance of Product + * @throws IOException if the JSON string is invalid with respect to Product + */ + public static Product fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Product.class); + } + + /** + * Convert an instance of Product to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductCategory.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductCategory.java new file mode 100644 index 0000000..456dc8c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductCategory.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Product category + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductCategory { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ProductCategory() { + } + + public ProductCategory id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Category identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductCategory productCategory = (ProductCategory) o; + return Objects.equals(this.id, productCategory.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductCategory {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductCategory + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductCategory.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductCategory is not found in the empty JSON string", ProductCategory.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductCategory.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductCategory` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductCategory.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductCategory' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductCategory.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductCategory value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductCategory read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductCategory given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductCategory + * @throws IOException if the JSON string is invalid with respect to ProductCategory + */ + public static ProductCategory fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductCategory.class); + } + + /** + * Convert an instance of ProductCategory to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductCategoryProposal.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductCategoryProposal.java new file mode 100644 index 0000000..ac5b0fe --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductCategoryProposal.java @@ -0,0 +1,354 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Name proposal status. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductCategoryProposal { + public static final String SERIALIZED_NAME_CURRENT = "current"; + @SerializedName(SERIALIZED_NAME_CURRENT) + @javax.annotation.Nullable + private String current; + + public static final String SERIALIZED_NAME_PROPOSAL = "proposal"; + @SerializedName(SERIALIZED_NAME_PROPOSAL) + @javax.annotation.Nullable + private String proposal; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nullable + private String reason; + + /** + * Verification resolution type. + */ + @JsonAdapter(ResolutionTypeEnum.Adapter.class) + public enum ResolutionTypeEnum { + UNRESOLVED("UNRESOLVED"), + + ACCEPTED("ACCEPTED"), + + REJECTED("REJECTED"); + + private String value; + + ResolutionTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ResolutionTypeEnum fromValue(String value) { + for (ResolutionTypeEnum b : ResolutionTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ResolutionTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ResolutionTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ResolutionTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ResolutionTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_RESOLUTION_TYPE = "resolutionType"; + @SerializedName(SERIALIZED_NAME_RESOLUTION_TYPE) + @javax.annotation.Nullable + private ResolutionTypeEnum resolutionType; + + public ProductCategoryProposal() { + } + + public ProductCategoryProposal current(@javax.annotation.Nullable String current) { + this.current = current; + return this; + } + + /** + * Current product category identifier. + * @return current + */ + @javax.annotation.Nullable + public String getCurrent() { + return current; + } + + public void setCurrent(@javax.annotation.Nullable String current) { + this.current = current; + } + + + public ProductCategoryProposal proposal(@javax.annotation.Nullable String proposal) { + this.proposal = proposal; + return this; + } + + /** + * Proposed product category identifier. + * @return proposal + */ + @javax.annotation.Nullable + public String getProposal() { + return proposal; + } + + public void setProposal(@javax.annotation.Nullable String proposal) { + this.proposal = proposal; + } + + + public ProductCategoryProposal reason(@javax.annotation.Nullable String reason) { + this.reason = reason; + return this; + } + + /** + * Verification message. + * @return reason + */ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nullable String reason) { + this.reason = reason; + } + + + public ProductCategoryProposal resolutionType(@javax.annotation.Nullable ResolutionTypeEnum resolutionType) { + this.resolutionType = resolutionType; + return this; + } + + /** + * Verification resolution type. + * @return resolutionType + */ + @javax.annotation.Nullable + public ResolutionTypeEnum getResolutionType() { + return resolutionType; + } + + public void setResolutionType(@javax.annotation.Nullable ResolutionTypeEnum resolutionType) { + this.resolutionType = resolutionType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductCategoryProposal productCategoryProposal = (ProductCategoryProposal) o; + return Objects.equals(this.current, productCategoryProposal.current) && + Objects.equals(this.proposal, productCategoryProposal.proposal) && + Objects.equals(this.reason, productCategoryProposal.reason) && + Objects.equals(this.resolutionType, productCategoryProposal.resolutionType); + } + + @Override + public int hashCode() { + return Objects.hash(current, proposal, reason, resolutionType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductCategoryProposal {\n"); + sb.append(" current: ").append(toIndentedString(current)).append("\n"); + sb.append(" proposal: ").append(toIndentedString(proposal)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" resolutionType: ").append(toIndentedString(resolutionType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("current"); + openapiFields.add("proposal"); + openapiFields.add("reason"); + openapiFields.add("resolutionType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductCategoryProposal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductCategoryProposal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductCategoryProposal is not found in the empty JSON string", ProductCategoryProposal.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductCategoryProposal.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductCategoryProposal` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("current") != null && !jsonObj.get("current").isJsonNull()) && !jsonObj.get("current").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `current` to be a primitive type in the JSON string but got `%s`", jsonObj.get("current").toString())); + } + if ((jsonObj.get("proposal") != null && !jsonObj.get("proposal").isJsonNull()) && !jsonObj.get("proposal").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `proposal` to be a primitive type in the JSON string but got `%s`", jsonObj.get("proposal").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("resolutionType") != null && !jsonObj.get("resolutionType").isJsonNull()) && !jsonObj.get("resolutionType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `resolutionType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resolutionType").toString())); + } + // validate the optional field `resolutionType` + if (jsonObj.get("resolutionType") != null && !jsonObj.get("resolutionType").isJsonNull()) { + ResolutionTypeEnum.validateJsonElement(jsonObj.get("resolutionType")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductCategoryProposal.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductCategoryProposal' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductCategoryProposal.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductCategoryProposal value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductCategoryProposal read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductCategoryProposal given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductCategoryProposal + * @throws IOException if the JSON string is invalid with respect to ProductCategoryProposal + */ + public static ProductCategoryProposal fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductCategoryProposal.class); + } + + /** + * Convert an instance of ProductCategoryProposal to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductCategoryWithPath.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductCategoryWithPath.java new file mode 100644 index 0000000..73e8fbb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductCategoryWithPath.java @@ -0,0 +1,308 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ProductSimilarCategoryWithPath; +import pl.wtx.allegro.api.client.model.ProductsCategoryPath; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Category in which the product can be listed for sale + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductCategoryWithPath { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private List path = new ArrayList<>(); + + public static final String SERIALIZED_NAME_SIMILAR = "similar"; + @SerializedName(SERIALIZED_NAME_SIMILAR) + @javax.annotation.Nullable + private List similar = new ArrayList<>(); + + public ProductCategoryWithPath() { + } + + public ProductCategoryWithPath id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Category identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductCategoryWithPath path(@javax.annotation.Nullable List path) { + this.path = path; + return this; + } + + public ProductCategoryWithPath addPathItem(ProductsCategoryPath pathItem) { + if (this.path == null) { + this.path = new ArrayList<>(); + } + this.path.add(pathItem); + return this; + } + + /** + * Get path + * @return path + */ + @javax.annotation.Nullable + public List getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable List path) { + this.path = path; + } + + + public ProductCategoryWithPath similar(@javax.annotation.Nullable List similar) { + this.similar = similar; + return this; + } + + public ProductCategoryWithPath addSimilarItem(ProductSimilarCategoryWithPath similarItem) { + if (this.similar == null) { + this.similar = new ArrayList<>(); + } + this.similar.add(similarItem); + return this; + } + + /** + * A list of similar categories in which you can sell this product. + * @return similar + */ + @javax.annotation.Nullable + public List getSimilar() { + return similar; + } + + public void setSimilar(@javax.annotation.Nullable List similar) { + this.similar = similar; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductCategoryWithPath productCategoryWithPath = (ProductCategoryWithPath) o; + return Objects.equals(this.id, productCategoryWithPath.id) && + Objects.equals(this.path, productCategoryWithPath.path) && + Objects.equals(this.similar, productCategoryWithPath.similar); + } + + @Override + public int hashCode() { + return Objects.hash(id, path, similar); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductCategoryWithPath {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" similar: ").append(toIndentedString(similar)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("path"); + openapiFields.add("similar"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductCategoryWithPath + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductCategoryWithPath.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductCategoryWithPath is not found in the empty JSON string", ProductCategoryWithPath.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductCategoryWithPath.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductCategoryWithPath` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) { + JsonArray jsonArraypath = jsonObj.getAsJsonArray("path"); + if (jsonArraypath != null) { + // ensure the json data is an array + if (!jsonObj.get("path").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be an array in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + + // validate the optional field `path` (array) + for (int i = 0; i < jsonArraypath.size(); i++) { + ProductsCategoryPath.validateJsonElement(jsonArraypath.get(i)); + }; + } + } + if (jsonObj.get("similar") != null && !jsonObj.get("similar").isJsonNull()) { + JsonArray jsonArraysimilar = jsonObj.getAsJsonArray("similar"); + if (jsonArraysimilar != null) { + // ensure the json data is an array + if (!jsonObj.get("similar").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `similar` to be an array in the JSON string but got `%s`", jsonObj.get("similar").toString())); + } + + // validate the optional field `similar` (array) + for (int i = 0; i < jsonArraysimilar.size(); i++) { + ProductSimilarCategoryWithPath.validateJsonElement(jsonArraysimilar.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductCategoryWithPath.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductCategoryWithPath' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductCategoryWithPath.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductCategoryWithPath value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductCategoryWithPath read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductCategoryWithPath given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductCategoryWithPath + * @throws IOException if the JSON string is invalid with respect to ProductCategoryWithPath + */ + public static ProductCategoryWithPath fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductCategoryWithPath.class); + } + + /** + * Convert an instance of ProductCategoryWithPath to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeDto.java new file mode 100644 index 0000000..5153b8b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeDto.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ChangedParameterDto; +import pl.wtx.allegro.api.client.model.ProductChangeDtoProduct; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductChangeDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductChangeDto { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + @javax.annotation.Nullable + private ProductChangeDtoProduct product; + + public static final String SERIALIZED_NAME_CHANGED_PARAMETERS = "changedParameters"; + @SerializedName(SERIALIZED_NAME_CHANGED_PARAMETERS) + @javax.annotation.Nullable + private List changedParameters = new ArrayList<>(); + + public ProductChangeDto() { + } + + public ProductChangeDto product(@javax.annotation.Nullable ProductChangeDtoProduct product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public ProductChangeDtoProduct getProduct() { + return product; + } + + public void setProduct(@javax.annotation.Nullable ProductChangeDtoProduct product) { + this.product = product; + } + + + public ProductChangeDto changedParameters(@javax.annotation.Nullable List changedParameters) { + this.changedParameters = changedParameters; + return this; + } + + public ProductChangeDto addChangedParametersItem(ChangedParameterDto changedParametersItem) { + if (this.changedParameters == null) { + this.changedParameters = new ArrayList<>(); + } + this.changedParameters.add(changedParametersItem); + return this; + } + + /** + * List of changed product parameters. + * @return changedParameters + */ + @javax.annotation.Nullable + public List getChangedParameters() { + return changedParameters; + } + + public void setChangedParameters(@javax.annotation.Nullable List changedParameters) { + this.changedParameters = changedParameters; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductChangeDto productChangeDto = (ProductChangeDto) o; + return Objects.equals(this.product, productChangeDto.product) && + Objects.equals(this.changedParameters, productChangeDto.changedParameters); + } + + @Override + public int hashCode() { + return Objects.hash(product, changedParameters); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductChangeDto {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" changedParameters: ").append(toIndentedString(changedParameters)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("changedParameters"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductChangeDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductChangeDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductChangeDto is not found in the empty JSON string", ProductChangeDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductChangeDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductChangeDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductChangeDtoProduct.validateJsonElement(jsonObj.get("product")); + } + if (jsonObj.get("changedParameters") != null && !jsonObj.get("changedParameters").isJsonNull()) { + JsonArray jsonArraychangedParameters = jsonObj.getAsJsonArray("changedParameters"); + if (jsonArraychangedParameters != null) { + // ensure the json data is an array + if (!jsonObj.get("changedParameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `changedParameters` to be an array in the JSON string but got `%s`", jsonObj.get("changedParameters").toString())); + } + + // validate the optional field `changedParameters` (array) + for (int i = 0; i < jsonArraychangedParameters.size(); i++) { + ChangedParameterDto.validateJsonElement(jsonArraychangedParameters.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductChangeDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductChangeDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductChangeDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductChangeDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductChangeDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductChangeDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductChangeDto + * @throws IOException if the JSON string is invalid with respect to ProductChangeDto + */ + public static ProductChangeDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductChangeDto.class); + } + + /** + * Convert an instance of ProductChangeDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeDtoProduct.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeDtoProduct.java new file mode 100644 index 0000000..546d8a6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeDtoProduct.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductChangeDtoProduct + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductChangeDtoProduct { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ProductChangeDtoProduct() { + } + + public ProductChangeDtoProduct id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Product id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductChangeDtoProduct productChangeDtoProduct = (ProductChangeDtoProduct) o; + return Objects.equals(this.id, productChangeDtoProduct.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductChangeDtoProduct {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductChangeDtoProduct + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductChangeDtoProduct.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductChangeDtoProduct is not found in the empty JSON string", ProductChangeDtoProduct.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductChangeDtoProduct.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductChangeDtoProduct` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductChangeDtoProduct.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductChangeDtoProduct' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductChangeDtoProduct.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductChangeDtoProduct value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductChangeDtoProduct read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductChangeDtoProduct given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductChangeDtoProduct + * @throws IOException if the JSON string is invalid with respect to ProductChangeDtoProduct + */ + public static ProductChangeDtoProduct fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductChangeDtoProduct.class); + } + + /** + * Convert an instance of ProductChangeDtoProduct to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeProposalDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeProposalDto.java new file mode 100644 index 0000000..4dd11b5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeProposalDto.java @@ -0,0 +1,459 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ProductCategoryProposal; +import pl.wtx.allegro.api.client.model.ProductImageProposal; +import pl.wtx.allegro.api.client.model.ProductNameProposal; +import pl.wtx.allegro.api.client.model.ProductParameterProposal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductChangeProposalDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductChangeProposalDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private ProductNameProposal name; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private ProductCategoryProposal category; + + public static final String SERIALIZED_NAME_NOTE = "note"; + @SerializedName(SERIALIZED_NAME_NOTE) + @javax.annotation.Nullable + private String note; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NOTIFY_VIA_EMAIL_AFTER_VERIFICATION = "notifyViaEmailAfterVerification"; + @SerializedName(SERIALIZED_NAME_NOTIFY_VIA_EMAIL_AFTER_VERIFICATION) + @javax.annotation.Nullable + private Boolean notifyViaEmailAfterVerification; + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nullable + private String language; + + public ProductChangeProposalDto() { + } + + public ProductChangeProposalDto id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Product change proposal id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductChangeProposalDto name(@javax.annotation.Nullable ProductNameProposal name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public ProductNameProposal getName() { + return name; + } + + public void setName(@javax.annotation.Nullable ProductNameProposal name) { + this.name = name; + } + + + public ProductChangeProposalDto category(@javax.annotation.Nullable ProductCategoryProposal category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + public ProductCategoryProposal getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable ProductCategoryProposal category) { + this.category = category; + } + + + public ProductChangeProposalDto note(@javax.annotation.Nullable String note) { + this.note = note; + return this; + } + + /** + * Note about product changes proposal. + * @return note + */ + @javax.annotation.Nullable + public String getNote() { + return note; + } + + public void setNote(@javax.annotation.Nullable String note) { + this.note = note; + } + + + public ProductChangeProposalDto images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public ProductChangeProposalDto addImagesItem(ProductImageProposal imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * List of proposed image change statuses. + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public ProductChangeProposalDto parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public ProductChangeProposalDto addParametersItem(ProductParameterProposal parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * List of proposed product parameter change statuses. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public ProductChangeProposalDto notifyViaEmailAfterVerification(@javax.annotation.Nullable Boolean notifyViaEmailAfterVerification) { + this.notifyViaEmailAfterVerification = notifyViaEmailAfterVerification; + return this; + } + + /** + * Receive an email notification after product changes proposal resolution. + * @return notifyViaEmailAfterVerification + */ + @javax.annotation.Nullable + public Boolean getNotifyViaEmailAfterVerification() { + return notifyViaEmailAfterVerification; + } + + public void setNotifyViaEmailAfterVerification(@javax.annotation.Nullable Boolean notifyViaEmailAfterVerification) { + this.notifyViaEmailAfterVerification = notifyViaEmailAfterVerification; + } + + + public ProductChangeProposalDto language(@javax.annotation.Nullable String language) { + this.language = language; + return this; + } + + /** + * Language of provided suggestion data. + * @return language + */ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nullable String language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductChangeProposalDto productChangeProposalDto = (ProductChangeProposalDto) o; + return Objects.equals(this.id, productChangeProposalDto.id) && + Objects.equals(this.name, productChangeProposalDto.name) && + Objects.equals(this.category, productChangeProposalDto.category) && + Objects.equals(this.note, productChangeProposalDto.note) && + Objects.equals(this.images, productChangeProposalDto.images) && + Objects.equals(this.parameters, productChangeProposalDto.parameters) && + Objects.equals(this.notifyViaEmailAfterVerification, productChangeProposalDto.notifyViaEmailAfterVerification) && + Objects.equals(this.language, productChangeProposalDto.language); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, category, note, images, parameters, notifyViaEmailAfterVerification, language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductChangeProposalDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" note: ").append(toIndentedString(note)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" notifyViaEmailAfterVerification: ").append(toIndentedString(notifyViaEmailAfterVerification)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("category"); + openapiFields.add("note"); + openapiFields.add("images"); + openapiFields.add("parameters"); + openapiFields.add("notifyViaEmailAfterVerification"); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductChangeProposalDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductChangeProposalDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductChangeProposalDto is not found in the empty JSON string", ProductChangeProposalDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductChangeProposalDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductChangeProposalDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `name` + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) { + ProductNameProposal.validateJsonElement(jsonObj.get("name")); + } + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + ProductCategoryProposal.validateJsonElement(jsonObj.get("category")); + } + if ((jsonObj.get("note") != null && !jsonObj.get("note").isJsonNull()) && !jsonObj.get("note").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `note` to be a primitive type in the JSON string but got `%s`", jsonObj.get("note").toString())); + } + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull()) { + JsonArray jsonArrayimages = jsonObj.getAsJsonArray("images"); + if (jsonArrayimages != null) { + // ensure the json data is an array + if (!jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + + // validate the optional field `images` (array) + for (int i = 0; i < jsonArrayimages.size(); i++) { + ProductImageProposal.validateJsonElement(jsonArrayimages.get(i)); + }; + } + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ProductParameterProposal.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductChangeProposalDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductChangeProposalDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductChangeProposalDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductChangeProposalDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductChangeProposalDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductChangeProposalDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductChangeProposalDto + * @throws IOException if the JSON string is invalid with respect to ProductChangeProposalDto + */ + public static ProductChangeProposalDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductChangeProposalDto.class); + } + + /** + * Convert an instance of ProductChangeProposalDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeProposalRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeProposalRequest.java new file mode 100644 index 0000000..5858051 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductChangeProposalRequest.java @@ -0,0 +1,429 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ImageUrl; +import pl.wtx.allegro.api.client.model.ProductCategory; +import pl.wtx.allegro.api.client.model.ProductParameter; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductChangeProposalRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductChangeProposalRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NOTE = "note"; + @SerializedName(SERIALIZED_NAME_NOTE) + @javax.annotation.Nullable + private String note; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nonnull + private ProductCategory category; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nonnull + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nonnull + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NOTIFY_VIA_EMAIL_AFTER_VERIFICATION = "notifyViaEmailAfterVerification"; + @SerializedName(SERIALIZED_NAME_NOTIFY_VIA_EMAIL_AFTER_VERIFICATION) + @javax.annotation.Nullable + private Boolean notifyViaEmailAfterVerification; + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nonnull + private String language = "pl-PL"; + + public ProductChangeProposalRequest() { + } + + public ProductChangeProposalRequest name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Proposed product name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ProductChangeProposalRequest note(@javax.annotation.Nullable String note) { + this.note = note; + return this; + } + + /** + * Note about product changes proposal. + * @return note + */ + @javax.annotation.Nullable + public String getNote() { + return note; + } + + public void setNote(@javax.annotation.Nullable String note) { + this.note = note; + } + + + public ProductChangeProposalRequest category(@javax.annotation.Nonnull ProductCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nonnull + public ProductCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nonnull ProductCategory category) { + this.category = category; + } + + + public ProductChangeProposalRequest images(@javax.annotation.Nonnull List images) { + this.images = images; + return this; + } + + public ProductChangeProposalRequest addImagesItem(ImageUrl imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * List of product images. At least one image is required. + * @return images + */ + @javax.annotation.Nonnull + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nonnull List images) { + this.images = images; + } + + + public ProductChangeProposalRequest parameters(@javax.annotation.Nonnull List parameters) { + this.parameters = parameters; + return this; + } + + public ProductChangeProposalRequest addParametersItem(ProductParameter parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * List of product parameters. + * @return parameters + */ + @javax.annotation.Nonnull + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nonnull List parameters) { + this.parameters = parameters; + } + + + public ProductChangeProposalRequest notifyViaEmailAfterVerification(@javax.annotation.Nullable Boolean notifyViaEmailAfterVerification) { + this.notifyViaEmailAfterVerification = notifyViaEmailAfterVerification; + return this; + } + + /** + * Receive an email notification after product changes proposal resolution. + * @return notifyViaEmailAfterVerification + */ + @javax.annotation.Nullable + public Boolean getNotifyViaEmailAfterVerification() { + return notifyViaEmailAfterVerification; + } + + public void setNotifyViaEmailAfterVerification(@javax.annotation.Nullable Boolean notifyViaEmailAfterVerification) { + this.notifyViaEmailAfterVerification = notifyViaEmailAfterVerification; + } + + + public ProductChangeProposalRequest language(@javax.annotation.Nonnull String language) { + this.language = language; + return this; + } + + /** + * Language of provided proposal data. + * @return language + */ + @javax.annotation.Nonnull + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nonnull String language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductChangeProposalRequest productChangeProposalRequest = (ProductChangeProposalRequest) o; + return Objects.equals(this.name, productChangeProposalRequest.name) && + Objects.equals(this.note, productChangeProposalRequest.note) && + Objects.equals(this.category, productChangeProposalRequest.category) && + Objects.equals(this.images, productChangeProposalRequest.images) && + Objects.equals(this.parameters, productChangeProposalRequest.parameters) && + Objects.equals(this.notifyViaEmailAfterVerification, productChangeProposalRequest.notifyViaEmailAfterVerification) && + Objects.equals(this.language, productChangeProposalRequest.language); + } + + @Override + public int hashCode() { + return Objects.hash(name, note, category, images, parameters, notifyViaEmailAfterVerification, language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductChangeProposalRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" note: ").append(toIndentedString(note)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" notifyViaEmailAfterVerification: ").append(toIndentedString(notifyViaEmailAfterVerification)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("note"); + openapiFields.add("category"); + openapiFields.add("images"); + openapiFields.add("parameters"); + openapiFields.add("notifyViaEmailAfterVerification"); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("category"); + openapiRequiredFields.add("images"); + openapiRequiredFields.add("parameters"); + openapiRequiredFields.add("language"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductChangeProposalRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductChangeProposalRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductChangeProposalRequest is not found in the empty JSON string", ProductChangeProposalRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductChangeProposalRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductChangeProposalRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProductChangeProposalRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("note") != null && !jsonObj.get("note").isJsonNull()) && !jsonObj.get("note").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `note` to be a primitive type in the JSON string but got `%s`", jsonObj.get("note").toString())); + } + // validate the required field `category` + ProductCategory.validateJsonElement(jsonObj.get("category")); + // ensure the json data is an array + if (!jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + + JsonArray jsonArrayimages = jsonObj.getAsJsonArray("images"); + // validate the required field `images` (array) + for (int i = 0; i < jsonArrayimages.size(); i++) { + ImageUrl.validateJsonElement(jsonArrayimages.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + // validate the required field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ProductParameter.validateJsonElement(jsonArrayparameters.get(i)); + }; + if (!jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductChangeProposalRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductChangeProposalRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductChangeProposalRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductChangeProposalRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductChangeProposalRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductChangeProposalRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductChangeProposalRequest + * @throws IOException if the JSON string is invalid with respect to ProductChangeProposalRequest + */ + public static ProductChangeProposalRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductChangeProposalRequest.class); + } + + /** + * Convert an instance of ProductChangeProposalRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductChangesResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductChangesResponse.java new file mode 100644 index 0000000..b89483e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductChangesResponse.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ProductChangeDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductChangesResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductChangesResponse { + public static final String SERIALIZED_NAME_PRODUCT_CHANGES = "productChanges"; + @SerializedName(SERIALIZED_NAME_PRODUCT_CHANGES) + @javax.annotation.Nullable + private List productChanges = new ArrayList<>(); + + public ProductChangesResponse() { + } + + public ProductChangesResponse productChanges(@javax.annotation.Nullable List productChanges) { + this.productChanges = productChanges; + return this; + } + + public ProductChangesResponse addProductChangesItem(ProductChangeDto productChangesItem) { + if (this.productChanges == null) { + this.productChanges = new ArrayList<>(); + } + this.productChanges.add(productChangesItem); + return this; + } + + /** + * List of requested product changes. + * @return productChanges + */ + @javax.annotation.Nullable + public List getProductChanges() { + return productChanges; + } + + public void setProductChanges(@javax.annotation.Nullable List productChanges) { + this.productChanges = productChanges; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductChangesResponse productChangesResponse = (ProductChangesResponse) o; + return Objects.equals(this.productChanges, productChangesResponse.productChanges); + } + + @Override + public int hashCode() { + return Objects.hash(productChanges); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductChangesResponse {\n"); + sb.append(" productChanges: ").append(toIndentedString(productChanges)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("productChanges"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductChangesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductChangesResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductChangesResponse is not found in the empty JSON string", ProductChangesResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductChangesResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductChangesResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("productChanges") != null && !jsonObj.get("productChanges").isJsonNull()) { + JsonArray jsonArrayproductChanges = jsonObj.getAsJsonArray("productChanges"); + if (jsonArrayproductChanges != null) { + // ensure the json data is an array + if (!jsonObj.get("productChanges").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `productChanges` to be an array in the JSON string but got `%s`", jsonObj.get("productChanges").toString())); + } + + // validate the optional field `productChanges` (array) + for (int i = 0; i < jsonArrayproductChanges.size(); i++) { + ProductChangeDto.validateJsonElement(jsonArrayproductChanges.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductChangesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductChangesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductChangesResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductChangesResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductChangesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductChangesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductChangesResponse + * @throws IOException if the JSON string is invalid with respect to ProductChangesResponse + */ + public static ProductChangesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductChangesResponse.class); + } + + /** + * Convert an instance of ProductChangesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductImageProposal.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductImageProposal.java new file mode 100644 index 0000000..74667ee --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductImageProposal.java @@ -0,0 +1,354 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Image proposal. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductImageProposal { + public static final String SERIALIZED_NAME_CURRENT = "current"; + @SerializedName(SERIALIZED_NAME_CURRENT) + @javax.annotation.Nullable + private String current; + + public static final String SERIALIZED_NAME_PROPOSAL = "proposal"; + @SerializedName(SERIALIZED_NAME_PROPOSAL) + @javax.annotation.Nullable + private String proposal; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nullable + private String reason; + + /** + * Verification resolution type. + */ + @JsonAdapter(ResolutionTypeEnum.Adapter.class) + public enum ResolutionTypeEnum { + UNRESOLVED("UNRESOLVED"), + + ACCEPTED("ACCEPTED"), + + REJECTED("REJECTED"); + + private String value; + + ResolutionTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ResolutionTypeEnum fromValue(String value) { + for (ResolutionTypeEnum b : ResolutionTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ResolutionTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ResolutionTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ResolutionTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ResolutionTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_RESOLUTION_TYPE = "resolutionType"; + @SerializedName(SERIALIZED_NAME_RESOLUTION_TYPE) + @javax.annotation.Nullable + private ResolutionTypeEnum resolutionType; + + public ProductImageProposal() { + } + + public ProductImageProposal current(@javax.annotation.Nullable String current) { + this.current = current; + return this; + } + + /** + * Current product image url. + * @return current + */ + @javax.annotation.Nullable + public String getCurrent() { + return current; + } + + public void setCurrent(@javax.annotation.Nullable String current) { + this.current = current; + } + + + public ProductImageProposal proposal(@javax.annotation.Nullable String proposal) { + this.proposal = proposal; + return this; + } + + /** + * Proposed product image url. + * @return proposal + */ + @javax.annotation.Nullable + public String getProposal() { + return proposal; + } + + public void setProposal(@javax.annotation.Nullable String proposal) { + this.proposal = proposal; + } + + + public ProductImageProposal reason(@javax.annotation.Nullable String reason) { + this.reason = reason; + return this; + } + + /** + * Verification message. + * @return reason + */ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nullable String reason) { + this.reason = reason; + } + + + public ProductImageProposal resolutionType(@javax.annotation.Nullable ResolutionTypeEnum resolutionType) { + this.resolutionType = resolutionType; + return this; + } + + /** + * Verification resolution type. + * @return resolutionType + */ + @javax.annotation.Nullable + public ResolutionTypeEnum getResolutionType() { + return resolutionType; + } + + public void setResolutionType(@javax.annotation.Nullable ResolutionTypeEnum resolutionType) { + this.resolutionType = resolutionType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductImageProposal productImageProposal = (ProductImageProposal) o; + return Objects.equals(this.current, productImageProposal.current) && + Objects.equals(this.proposal, productImageProposal.proposal) && + Objects.equals(this.reason, productImageProposal.reason) && + Objects.equals(this.resolutionType, productImageProposal.resolutionType); + } + + @Override + public int hashCode() { + return Objects.hash(current, proposal, reason, resolutionType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductImageProposal {\n"); + sb.append(" current: ").append(toIndentedString(current)).append("\n"); + sb.append(" proposal: ").append(toIndentedString(proposal)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" resolutionType: ").append(toIndentedString(resolutionType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("current"); + openapiFields.add("proposal"); + openapiFields.add("reason"); + openapiFields.add("resolutionType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductImageProposal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductImageProposal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductImageProposal is not found in the empty JSON string", ProductImageProposal.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductImageProposal.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductImageProposal` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("current") != null && !jsonObj.get("current").isJsonNull()) && !jsonObj.get("current").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `current` to be a primitive type in the JSON string but got `%s`", jsonObj.get("current").toString())); + } + if ((jsonObj.get("proposal") != null && !jsonObj.get("proposal").isJsonNull()) && !jsonObj.get("proposal").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `proposal` to be a primitive type in the JSON string but got `%s`", jsonObj.get("proposal").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("resolutionType") != null && !jsonObj.get("resolutionType").isJsonNull()) && !jsonObj.get("resolutionType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `resolutionType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resolutionType").toString())); + } + // validate the optional field `resolutionType` + if (jsonObj.get("resolutionType") != null && !jsonObj.get("resolutionType").isJsonNull()) { + ResolutionTypeEnum.validateJsonElement(jsonObj.get("resolutionType")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductImageProposal.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductImageProposal' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductImageProposal.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductImageProposal value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductImageProposal read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductImageProposal given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductImageProposal + * @throws IOException if the JSON string is invalid with respect to ProductImageProposal + */ + public static ProductImageProposal fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductImageProposal.class); + } + + /** + * Convert an instance of ProductImageProposal to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductItem.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductItem.java new file mode 100644 index 0000000..f058838 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductItem.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Product; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Groups together product and quantity. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductItem { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + @javax.annotation.Nonnull + private Product product; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nonnull + private BigDecimal quantity; + + public ProductItem() { + } + + public ProductItem product(@javax.annotation.Nonnull Product product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nonnull + public Product getProduct() { + return product; + } + + public void setProduct(@javax.annotation.Nonnull Product product) { + this.product = product; + } + + + public ProductItem quantity(@javax.annotation.Nonnull BigDecimal quantity) { + this.quantity = quantity; + return this; + } + + /** + * The quantity of the product. + * minimum: 1 + * maximum: 1000000 + * @return quantity + */ + @javax.annotation.Nonnull + public BigDecimal getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nonnull BigDecimal quantity) { + this.quantity = quantity; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductItem productItem = (ProductItem) o; + return Objects.equals(this.product, productItem.product) && + Objects.equals(this.quantity, productItem.quantity); + } + + @Override + public int hashCode() { + return Objects.hash(product, quantity); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductItem {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("quantity"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("product"); + openapiRequiredFields.add("quantity"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductItem is not found in the empty JSON string", ProductItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProductItem.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `product` + Product.validateJsonElement(jsonObj.get("product")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductItem + * @throws IOException if the JSON string is invalid with respect to ProductItem + */ + public static ProductItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductItem.class); + } + + /** + * Convert an instance of ProductItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductNameProposal.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductNameProposal.java new file mode 100644 index 0000000..e7525d6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductNameProposal.java @@ -0,0 +1,354 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Name proposal status. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductNameProposal { + public static final String SERIALIZED_NAME_CURRENT = "current"; + @SerializedName(SERIALIZED_NAME_CURRENT) + @javax.annotation.Nullable + private String current; + + public static final String SERIALIZED_NAME_PROPOSAL = "proposal"; + @SerializedName(SERIALIZED_NAME_PROPOSAL) + @javax.annotation.Nullable + private String proposal; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nullable + private String reason; + + /** + * Verification resolution type. + */ + @JsonAdapter(ResolutionTypeEnum.Adapter.class) + public enum ResolutionTypeEnum { + UNRESOLVED("UNRESOLVED"), + + ACCEPTED("ACCEPTED"), + + REJECTED("REJECTED"); + + private String value; + + ResolutionTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ResolutionTypeEnum fromValue(String value) { + for (ResolutionTypeEnum b : ResolutionTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ResolutionTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ResolutionTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ResolutionTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ResolutionTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_RESOLUTION_TYPE = "resolutionType"; + @SerializedName(SERIALIZED_NAME_RESOLUTION_TYPE) + @javax.annotation.Nullable + private ResolutionTypeEnum resolutionType; + + public ProductNameProposal() { + } + + public ProductNameProposal current(@javax.annotation.Nullable String current) { + this.current = current; + return this; + } + + /** + * Current product name. + * @return current + */ + @javax.annotation.Nullable + public String getCurrent() { + return current; + } + + public void setCurrent(@javax.annotation.Nullable String current) { + this.current = current; + } + + + public ProductNameProposal proposal(@javax.annotation.Nullable String proposal) { + this.proposal = proposal; + return this; + } + + /** + * Proposed product name. + * @return proposal + */ + @javax.annotation.Nullable + public String getProposal() { + return proposal; + } + + public void setProposal(@javax.annotation.Nullable String proposal) { + this.proposal = proposal; + } + + + public ProductNameProposal reason(@javax.annotation.Nullable String reason) { + this.reason = reason; + return this; + } + + /** + * Verification message. + * @return reason + */ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nullable String reason) { + this.reason = reason; + } + + + public ProductNameProposal resolutionType(@javax.annotation.Nullable ResolutionTypeEnum resolutionType) { + this.resolutionType = resolutionType; + return this; + } + + /** + * Verification resolution type. + * @return resolutionType + */ + @javax.annotation.Nullable + public ResolutionTypeEnum getResolutionType() { + return resolutionType; + } + + public void setResolutionType(@javax.annotation.Nullable ResolutionTypeEnum resolutionType) { + this.resolutionType = resolutionType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductNameProposal productNameProposal = (ProductNameProposal) o; + return Objects.equals(this.current, productNameProposal.current) && + Objects.equals(this.proposal, productNameProposal.proposal) && + Objects.equals(this.reason, productNameProposal.reason) && + Objects.equals(this.resolutionType, productNameProposal.resolutionType); + } + + @Override + public int hashCode() { + return Objects.hash(current, proposal, reason, resolutionType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductNameProposal {\n"); + sb.append(" current: ").append(toIndentedString(current)).append("\n"); + sb.append(" proposal: ").append(toIndentedString(proposal)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" resolutionType: ").append(toIndentedString(resolutionType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("current"); + openapiFields.add("proposal"); + openapiFields.add("reason"); + openapiFields.add("resolutionType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductNameProposal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductNameProposal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductNameProposal is not found in the empty JSON string", ProductNameProposal.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductNameProposal.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductNameProposal` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("current") != null && !jsonObj.get("current").isJsonNull()) && !jsonObj.get("current").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `current` to be a primitive type in the JSON string but got `%s`", jsonObj.get("current").toString())); + } + if ((jsonObj.get("proposal") != null && !jsonObj.get("proposal").isJsonNull()) && !jsonObj.get("proposal").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `proposal` to be a primitive type in the JSON string but got `%s`", jsonObj.get("proposal").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("resolutionType") != null && !jsonObj.get("resolutionType").isJsonNull()) && !jsonObj.get("resolutionType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `resolutionType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resolutionType").toString())); + } + // validate the optional field `resolutionType` + if (jsonObj.get("resolutionType") != null && !jsonObj.get("resolutionType").isJsonNull()) { + ResolutionTypeEnum.validateJsonElement(jsonObj.get("resolutionType")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductNameProposal.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductNameProposal' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductNameProposal.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductNameProposal value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductNameProposal read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductNameProposal given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductNameProposal + * @throws IOException if the JSON string is invalid with respect to ProductNameProposal + */ + public static ProductNameProposal fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductNameProposal.class); + } + + /** + * Convert an instance of ProductNameProposal to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductOffer.java new file mode 100644 index 0000000..69bac74 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductOffer.java @@ -0,0 +1,445 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParameterProductOfferRequest; +import pl.wtx.allegro.api.client.model.ProductCategory; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductOffer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + /** + * Type of id. This field is optional. It helps in finding products more accurately. If an idType is not set, a given id is understood as a product's id. - `GTIN` - restricts the search filtering to GTINs (Global Trade Item Number), e.g. EAN, ISBN, UPC. - `MPN` - restricts the search filtering to MPNs (Manufacturer Part Number). + */ + @JsonAdapter(IdTypeEnum.Adapter.class) + public enum IdTypeEnum { + GTIN("GTIN"), + + MPN("MPN"); + + private String value; + + IdTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static IdTypeEnum fromValue(String value) { + for (IdTypeEnum b : IdTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final IdTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public IdTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return IdTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + IdTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ID_TYPE = "idType"; + @SerializedName(SERIALIZED_NAME_ID_TYPE) + @javax.annotation.Nullable + private IdTypeEnum idType; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private ProductCategory category; + + public ProductOffer() { + } + + public ProductOffer id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Product id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductOffer idType(@javax.annotation.Nullable IdTypeEnum idType) { + this.idType = idType; + return this; + } + + /** + * Type of id. This field is optional. It helps in finding products more accurately. If an idType is not set, a given id is understood as a product's id. - `GTIN` - restricts the search filtering to GTINs (Global Trade Item Number), e.g. EAN, ISBN, UPC. - `MPN` - restricts the search filtering to MPNs (Manufacturer Part Number). + * @return idType + */ + @javax.annotation.Nullable + public IdTypeEnum getIdType() { + return idType; + } + + public void setIdType(@javax.annotation.Nullable IdTypeEnum idType) { + this.idType = idType; + } + + + public ProductOffer parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public ProductOffer addParametersItem(ParameterProductOfferRequest parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * List of product parameters. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public ProductOffer images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public ProductOffer addImagesItem(String imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * List of product images. + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public ProductOffer name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Product name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ProductOffer category(@javax.annotation.Nullable ProductCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + public ProductCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable ProductCategory category) { + this.category = category; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOffer productOffer = (ProductOffer) o; + return Objects.equals(this.id, productOffer.id) && + Objects.equals(this.idType, productOffer.idType) && + Objects.equals(this.parameters, productOffer.parameters) && + Objects.equals(this.images, productOffer.images) && + Objects.equals(this.name, productOffer.name) && + Objects.equals(this.category, productOffer.category); + } + + @Override + public int hashCode() { + return Objects.hash(id, idType, parameters, images, name, category); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" idType: ").append(toIndentedString(idType)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("idType"); + openapiFields.add("parameters"); + openapiFields.add("images"); + openapiFields.add("name"); + openapiFields.add("category"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductOffer is not found in the empty JSON string", ProductOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("idType") != null && !jsonObj.get("idType").isJsonNull()) && !jsonObj.get("idType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idType").toString())); + } + // validate the optional field `idType` + if (jsonObj.get("idType") != null && !jsonObj.get("idType").isJsonNull()) { + IdTypeEnum.validateJsonElement(jsonObj.get("idType")); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ParameterProductOfferRequest.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull() && !jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + ProductCategory.validateJsonElement(jsonObj.get("category")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductOffer + * @throws IOException if the JSON string is invalid with respect to ProductOffer + */ + public static ProductOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductOffer.class); + } + + /** + * Convert an instance of ProductOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAdditionalServicesRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAdditionalServicesRequest.java new file mode 100644 index 0000000..7ab0192 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAdditionalServicesRequest.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer additional services. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductOfferAdditionalServicesRequest { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public ProductOfferAdditionalServicesRequest() { + } + + public ProductOfferAdditionalServicesRequest id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of additional services. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductOfferAdditionalServicesRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of additional services. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOfferAdditionalServicesRequest productOfferAdditionalServicesRequest = (ProductOfferAdditionalServicesRequest) o; + return Objects.equals(this.id, productOfferAdditionalServicesRequest.id) && + Objects.equals(this.name, productOfferAdditionalServicesRequest.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOfferAdditionalServicesRequest {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductOfferAdditionalServicesRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductOfferAdditionalServicesRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductOfferAdditionalServicesRequest is not found in the empty JSON string", ProductOfferAdditionalServicesRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductOfferAdditionalServicesRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductOfferAdditionalServicesRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductOfferAdditionalServicesRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductOfferAdditionalServicesRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductOfferAdditionalServicesRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductOfferAdditionalServicesRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductOfferAdditionalServicesRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductOfferAdditionalServicesRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductOfferAdditionalServicesRequest + * @throws IOException if the JSON string is invalid with respect to ProductOfferAdditionalServicesRequest + */ + public static ProductOfferAdditionalServicesRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductOfferAdditionalServicesRequest.class); + } + + /** + * Convert an instance of ProductOfferAdditionalServicesRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAdditionalServicesResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAdditionalServicesResponse.java new file mode 100644 index 0000000..7f12efd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAdditionalServicesResponse.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductOfferAdditionalServicesResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductOfferAdditionalServicesResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ProductOfferAdditionalServicesResponse() { + } + + public ProductOfferAdditionalServicesResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of additional services. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOfferAdditionalServicesResponse productOfferAdditionalServicesResponse = (ProductOfferAdditionalServicesResponse) o; + return Objects.equals(this.id, productOfferAdditionalServicesResponse.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOfferAdditionalServicesResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductOfferAdditionalServicesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductOfferAdditionalServicesResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductOfferAdditionalServicesResponse is not found in the empty JSON string", ProductOfferAdditionalServicesResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductOfferAdditionalServicesResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductOfferAdditionalServicesResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductOfferAdditionalServicesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductOfferAdditionalServicesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductOfferAdditionalServicesResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductOfferAdditionalServicesResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductOfferAdditionalServicesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductOfferAdditionalServicesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductOfferAdditionalServicesResponse + * @throws IOException if the JSON string is invalid with respect to ProductOfferAdditionalServicesResponse + */ + public static ProductOfferAdditionalServicesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductOfferAdditionalServicesResponse.class); + } + + /** + * Convert an instance of ProductOfferAdditionalServicesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAttachmentInner.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAttachmentInner.java new file mode 100644 index 0000000..b746dea --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferAttachmentInner.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductOfferAttachmentInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductOfferAttachmentInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ProductOfferAttachmentInner() { + } + + public ProductOfferAttachmentInner id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of attachment. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOfferAttachmentInner productOfferAttachmentInner = (ProductOfferAttachmentInner) o; + return Objects.equals(this.id, productOfferAttachmentInner.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOfferAttachmentInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductOfferAttachmentInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductOfferAttachmentInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductOfferAttachmentInner is not found in the empty JSON string", ProductOfferAttachmentInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductOfferAttachmentInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductOfferAttachmentInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductOfferAttachmentInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductOfferAttachmentInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductOfferAttachmentInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductOfferAttachmentInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductOfferAttachmentInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductOfferAttachmentInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductOfferAttachmentInner + * @throws IOException if the JSON string is invalid with respect to ProductOfferAttachmentInner + */ + public static ProductOfferAttachmentInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductOfferAttachmentInner.class); + } + + /** + * Convert an instance of ProductOfferAttachmentInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferBase.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferBase.java new file mode 100644 index 0000000..e5cedce --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferBase.java @@ -0,0 +1,383 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParameterProductOfferRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductOfferBase + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductOfferBase { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + /** + * Type of id. This field is optional. It helps in finding products more accurately. If an idType is not set, a given id is understood as a product's id. - `GTIN` - restricts the search filtering to GTINs (Global Trade Item Number), e.g. EAN, ISBN, UPC. - `MPN` - restricts the search filtering to MPNs (Manufacturer Part Number). + */ + @JsonAdapter(IdTypeEnum.Adapter.class) + public enum IdTypeEnum { + GTIN("GTIN"), + + MPN("MPN"); + + private String value; + + IdTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static IdTypeEnum fromValue(String value) { + for (IdTypeEnum b : IdTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final IdTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public IdTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return IdTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + IdTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ID_TYPE = "idType"; + @SerializedName(SERIALIZED_NAME_ID_TYPE) + @javax.annotation.Nullable + private IdTypeEnum idType; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public ProductOfferBase() { + } + + public ProductOfferBase id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Product id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductOfferBase idType(@javax.annotation.Nullable IdTypeEnum idType) { + this.idType = idType; + return this; + } + + /** + * Type of id. This field is optional. It helps in finding products more accurately. If an idType is not set, a given id is understood as a product's id. - `GTIN` - restricts the search filtering to GTINs (Global Trade Item Number), e.g. EAN, ISBN, UPC. - `MPN` - restricts the search filtering to MPNs (Manufacturer Part Number). + * @return idType + */ + @javax.annotation.Nullable + public IdTypeEnum getIdType() { + return idType; + } + + public void setIdType(@javax.annotation.Nullable IdTypeEnum idType) { + this.idType = idType; + } + + + public ProductOfferBase parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public ProductOfferBase addParametersItem(ParameterProductOfferRequest parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * List of product parameters. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public ProductOfferBase images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public ProductOfferBase addImagesItem(String imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * List of product images. + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOfferBase productOfferBase = (ProductOfferBase) o; + return Objects.equals(this.id, productOfferBase.id) && + Objects.equals(this.idType, productOfferBase.idType) && + Objects.equals(this.parameters, productOfferBase.parameters) && + Objects.equals(this.images, productOfferBase.images); + } + + @Override + public int hashCode() { + return Objects.hash(id, idType, parameters, images); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOfferBase {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" idType: ").append(toIndentedString(idType)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("idType"); + openapiFields.add("parameters"); + openapiFields.add("images"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductOfferBase + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductOfferBase.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductOfferBase is not found in the empty JSON string", ProductOfferBase.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductOfferBase.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductOfferBase` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("idType") != null && !jsonObj.get("idType").isJsonNull()) && !jsonObj.get("idType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `idType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("idType").toString())); + } + // validate the optional field `idType` + if (jsonObj.get("idType") != null && !jsonObj.get("idType").isJsonNull()) { + IdTypeEnum.validateJsonElement(jsonObj.get("idType")); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ParameterProductOfferRequest.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull() && !jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductOfferBase.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductOfferBase' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductOfferBase.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductOfferBase value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductOfferBase read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductOfferBase given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductOfferBase + * @throws IOException if the JSON string is invalid with respect to ProductOfferBase + */ + public static ProductOfferBase fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductOfferBase.class); + } + + /** + * Convert an instance of ProductOfferBase to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferFundraisingCampaignRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferFundraisingCampaignRequest.java new file mode 100644 index 0000000..f19a091 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferFundraisingCampaignRequest.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductOfferFundraisingCampaignRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductOfferFundraisingCampaignRequest { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public ProductOfferFundraisingCampaignRequest() { + } + + public ProductOfferFundraisingCampaignRequest id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of fundraising campaign. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductOfferFundraisingCampaignRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of fundraising campaign. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOfferFundraisingCampaignRequest productOfferFundraisingCampaignRequest = (ProductOfferFundraisingCampaignRequest) o; + return Objects.equals(this.id, productOfferFundraisingCampaignRequest.id) && + Objects.equals(this.name, productOfferFundraisingCampaignRequest.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOfferFundraisingCampaignRequest {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductOfferFundraisingCampaignRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductOfferFundraisingCampaignRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductOfferFundraisingCampaignRequest is not found in the empty JSON string", ProductOfferFundraisingCampaignRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductOfferFundraisingCampaignRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductOfferFundraisingCampaignRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductOfferFundraisingCampaignRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductOfferFundraisingCampaignRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductOfferFundraisingCampaignRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductOfferFundraisingCampaignRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductOfferFundraisingCampaignRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductOfferFundraisingCampaignRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductOfferFundraisingCampaignRequest + * @throws IOException if the JSON string is invalid with respect to ProductOfferFundraisingCampaignRequest + */ + public static ProductOfferFundraisingCampaignRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductOfferFundraisingCampaignRequest.class); + } + + /** + * Convert an instance of ProductOfferFundraisingCampaignRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferFundraisingCampaignResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferFundraisingCampaignResponse.java new file mode 100644 index 0000000..964d2e7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferFundraisingCampaignResponse.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductOfferFundraisingCampaignResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductOfferFundraisingCampaignResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ProductOfferFundraisingCampaignResponse() { + } + + public ProductOfferFundraisingCampaignResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of fundraising campaign. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOfferFundraisingCampaignResponse productOfferFundraisingCampaignResponse = (ProductOfferFundraisingCampaignResponse) o; + return Objects.equals(this.id, productOfferFundraisingCampaignResponse.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOfferFundraisingCampaignResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductOfferFundraisingCampaignResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductOfferFundraisingCampaignResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductOfferFundraisingCampaignResponse is not found in the empty JSON string", ProductOfferFundraisingCampaignResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductOfferFundraisingCampaignResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductOfferFundraisingCampaignResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductOfferFundraisingCampaignResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductOfferFundraisingCampaignResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductOfferFundraisingCampaignResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductOfferFundraisingCampaignResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductOfferFundraisingCampaignResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductOfferFundraisingCampaignResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductOfferFundraisingCampaignResponse + * @throws IOException if the JSON string is invalid with respect to ProductOfferFundraisingCampaignResponse + */ + public static ProductOfferFundraisingCampaignResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductOfferFundraisingCampaignResponse.class); + } + + /** + * Convert an instance of ProductOfferFundraisingCampaignResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferResponse.java new file mode 100644 index 0000000..b935812 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferResponse.java @@ -0,0 +1,238 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ProductOfferResponsePublication; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductOfferResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductOfferResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private ProductOfferResponsePublication publication; + + public ProductOfferResponse() { + } + + public ProductOfferResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Product id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductOfferResponse publication(@javax.annotation.Nullable ProductOfferResponsePublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public ProductOfferResponsePublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable ProductOfferResponsePublication publication) { + this.publication = publication; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOfferResponse productOfferResponse = (ProductOfferResponse) o; + return Objects.equals(this.id, productOfferResponse.id) && + Objects.equals(this.publication, productOfferResponse.publication); + } + + @Override + public int hashCode() { + return Objects.hash(id, publication); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOfferResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("publication"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductOfferResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductOfferResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductOfferResponse is not found in the empty JSON string", ProductOfferResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductOfferResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductOfferResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + ProductOfferResponsePublication.validateJsonElement(jsonObj.get("publication")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductOfferResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductOfferResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductOfferResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductOfferResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductOfferResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductOfferResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductOfferResponse + * @throws IOException if the JSON string is invalid with respect to ProductOfferResponse + */ + public static ProductOfferResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductOfferResponse.class); + } + + /** + * Convert an instance of ProductOfferResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferResponsePublication.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferResponsePublication.java new file mode 100644 index 0000000..1d3bd06 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductOfferResponsePublication.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductOfferResponsePublication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductOfferResponsePublication { + /** + * The publication status of the product assigned to the offer: - `PROPOSED` - a new product proposal was created or an existing product in the review process was selected and assigned to the offer - `LISTED` - a reviewed product from our database was identified and assigned to the offer - `NOT_LISTED` - no new product proposal was created nor an existing product from database was assigned to the offer - `REMOVED` - the product review was negative or the product was merged with another product. This means that the product will soon be removed from the offer and you can assign a correct product. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PROPOSED("PROPOSED"), + + LISTED("LISTED"), + + NOT_LISTED("NOT_LISTED"), + + REMOVED("REMOVED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public ProductOfferResponsePublication() { + } + + public ProductOfferResponsePublication status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * The publication status of the product assigned to the offer: - `PROPOSED` - a new product proposal was created or an existing product in the review process was selected and assigned to the offer - `LISTED` - a reviewed product from our database was identified and assigned to the offer - `NOT_LISTED` - no new product proposal was created nor an existing product from database was assigned to the offer - `REMOVED` - the product review was negative or the product was merged with another product. This means that the product will soon be removed from the offer and you can assign a correct product. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOfferResponsePublication productOfferResponsePublication = (ProductOfferResponsePublication) o; + return Objects.equals(this.status, productOfferResponsePublication.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOfferResponsePublication {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductOfferResponsePublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductOfferResponsePublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductOfferResponsePublication is not found in the empty JSON string", ProductOfferResponsePublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductOfferResponsePublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductOfferResponsePublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductOfferResponsePublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductOfferResponsePublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductOfferResponsePublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductOfferResponsePublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductOfferResponsePublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductOfferResponsePublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductOfferResponsePublication + * @throws IOException if the JSON string is invalid with respect to ProductOfferResponsePublication + */ + public static ProductOfferResponsePublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductOfferResponsePublication.class); + } + + /** + * Convert an instance of ProductOfferResponsePublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameter.java new file mode 100644 index 0000000..470c98f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameter.java @@ -0,0 +1,427 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParameterRangeValue; +import pl.wtx.allegro.api.client.model.ProductParameterOptions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Product's parameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductParameter { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_RANGE_VALUE = "rangeValue"; + @SerializedName(SERIALIZED_NAME_RANGE_VALUE) + @javax.annotation.Nullable + private ParameterRangeValue rangeValue; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALUES_IDS = "valuesIds"; + @SerializedName(SERIALIZED_NAME_VALUES_IDS) + @javax.annotation.Nullable + private List valuesIds = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALUES_LABELS = "valuesLabels"; + @SerializedName(SERIALIZED_NAME_VALUES_LABELS) + @javax.annotation.Nullable + private List valuesLabels = new ArrayList<>(); + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private String unit; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + @SerializedName(SERIALIZED_NAME_OPTIONS) + @javax.annotation.Nullable + private ProductParameterOptions options; + + public ProductParameter() { + } + + public ProductParameter id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public ProductParameter rangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + return this; + } + + /** + * Get rangeValue + * @return rangeValue + */ + @javax.annotation.Nullable + public ParameterRangeValue getRangeValue() { + return rangeValue; + } + + public void setRangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + } + + + public ProductParameter values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public ProductParameter addValuesItem(String valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Get values + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + public ProductParameter valuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + return this; + } + + public ProductParameter addValuesIdsItem(String valuesIdsItem) { + if (this.valuesIds == null) { + this.valuesIds = new ArrayList<>(); + } + this.valuesIds.add(valuesIdsItem); + return this; + } + + /** + * Get valuesIds + * @return valuesIds + */ + @javax.annotation.Nullable + public List getValuesIds() { + return valuesIds; + } + + public void setValuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + } + + + public ProductParameter valuesLabels(@javax.annotation.Nullable List valuesLabels) { + this.valuesLabels = valuesLabels; + return this; + } + + public ProductParameter addValuesLabelsItem(String valuesLabelsItem) { + if (this.valuesLabels == null) { + this.valuesLabels = new ArrayList<>(); + } + this.valuesLabels.add(valuesLabelsItem); + return this; + } + + /** + * Get valuesLabels + * @return valuesLabels + */ + @javax.annotation.Nullable + public List getValuesLabels() { + return valuesLabels; + } + + public void setValuesLabels(@javax.annotation.Nullable List valuesLabels) { + this.valuesLabels = valuesLabels; + } + + + public ProductParameter unit(@javax.annotation.Nullable String unit) { + this.unit = unit; + return this; + } + + /** + * Get unit + * @return unit + */ + @javax.annotation.Nullable + public String getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable String unit) { + this.unit = unit; + } + + + public ProductParameter options(@javax.annotation.Nullable ProductParameterOptions options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + public ProductParameterOptions getOptions() { + return options; + } + + public void setOptions(@javax.annotation.Nullable ProductParameterOptions options) { + this.options = options; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductParameter productParameter = (ProductParameter) o; + return Objects.equals(this.id, productParameter.id) && + Objects.equals(this.rangeValue, productParameter.rangeValue) && + Objects.equals(this.values, productParameter.values) && + Objects.equals(this.valuesIds, productParameter.valuesIds) && + Objects.equals(this.valuesLabels, productParameter.valuesLabels) && + Objects.equals(this.unit, productParameter.unit) && + Objects.equals(this.options, productParameter.options); + } + + @Override + public int hashCode() { + return Objects.hash(id, rangeValue, values, valuesIds, valuesLabels, unit, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductParameter {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" rangeValue: ").append(toIndentedString(rangeValue)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" valuesIds: ").append(toIndentedString(valuesIds)).append("\n"); + sb.append(" valuesLabels: ").append(toIndentedString(valuesLabels)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("rangeValue"); + openapiFields.add("values"); + openapiFields.add("valuesIds"); + openapiFields.add("valuesLabels"); + openapiFields.add("unit"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductParameter is not found in the empty JSON string", ProductParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProductParameter.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `rangeValue` + if (jsonObj.get("rangeValue") != null && !jsonObj.get("rangeValue").isJsonNull()) { + ParameterRangeValue.validateJsonElement(jsonObj.get("rangeValue")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("valuesIds") != null && !jsonObj.get("valuesIds").isJsonNull() && !jsonObj.get("valuesIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `valuesIds` to be an array in the JSON string but got `%s`", jsonObj.get("valuesIds").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("valuesLabels") != null && !jsonObj.get("valuesLabels").isJsonNull() && !jsonObj.get("valuesLabels").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `valuesLabels` to be an array in the JSON string but got `%s`", jsonObj.get("valuesLabels").toString())); + } + if ((jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) && !jsonObj.get("unit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unit").toString())); + } + // validate the optional field `options` + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { + ProductParameterOptions.validateJsonElement(jsonObj.get("options")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductParameter + * @throws IOException if the JSON string is invalid with respect to ProductParameter + */ + public static ProductParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductParameter.class); + } + + /** + * Convert an instance of ProductParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterDto.java new file mode 100644 index 0000000..97bba17 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterDto.java @@ -0,0 +1,457 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParameterRangeValue; +import pl.wtx.allegro.api.client.model.ProductParameterDtoOptions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Product's parameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductParameterDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_RANGE_VALUE = "rangeValue"; + @SerializedName(SERIALIZED_NAME_RANGE_VALUE) + @javax.annotation.Nullable + private ParameterRangeValue rangeValue; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALUES_IDS = "valuesIds"; + @SerializedName(SERIALIZED_NAME_VALUES_IDS) + @javax.annotation.Nullable + private List valuesIds = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALUES_LABELS = "valuesLabels"; + @SerializedName(SERIALIZED_NAME_VALUES_LABELS) + @javax.annotation.Nullable + private List valuesLabels = new ArrayList<>(); + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private String unit; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + @SerializedName(SERIALIZED_NAME_OPTIONS) + @javax.annotation.Nullable + private ProductParameterDtoOptions options; + + public ProductParameterDto() { + } + + public ProductParameterDto id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public ProductParameterDto name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ProductParameterDto rangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + return this; + } + + /** + * Get rangeValue + * @return rangeValue + */ + @javax.annotation.Nullable + public ParameterRangeValue getRangeValue() { + return rangeValue; + } + + public void setRangeValue(@javax.annotation.Nullable ParameterRangeValue rangeValue) { + this.rangeValue = rangeValue; + } + + + public ProductParameterDto values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public ProductParameterDto addValuesItem(String valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Get values + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + public ProductParameterDto valuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + return this; + } + + public ProductParameterDto addValuesIdsItem(String valuesIdsItem) { + if (this.valuesIds == null) { + this.valuesIds = new ArrayList<>(); + } + this.valuesIds.add(valuesIdsItem); + return this; + } + + /** + * Get valuesIds + * @return valuesIds + */ + @javax.annotation.Nullable + public List getValuesIds() { + return valuesIds; + } + + public void setValuesIds(@javax.annotation.Nullable List valuesIds) { + this.valuesIds = valuesIds; + } + + + public ProductParameterDto valuesLabels(@javax.annotation.Nullable List valuesLabels) { + this.valuesLabels = valuesLabels; + return this; + } + + public ProductParameterDto addValuesLabelsItem(String valuesLabelsItem) { + if (this.valuesLabels == null) { + this.valuesLabels = new ArrayList<>(); + } + this.valuesLabels.add(valuesLabelsItem); + return this; + } + + /** + * Get valuesLabels + * @return valuesLabels + */ + @javax.annotation.Nullable + public List getValuesLabels() { + return valuesLabels; + } + + public void setValuesLabels(@javax.annotation.Nullable List valuesLabels) { + this.valuesLabels = valuesLabels; + } + + + public ProductParameterDto unit(@javax.annotation.Nullable String unit) { + this.unit = unit; + return this; + } + + /** + * Get unit + * @return unit + */ + @javax.annotation.Nullable + public String getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable String unit) { + this.unit = unit; + } + + + public ProductParameterDto options(@javax.annotation.Nullable ProductParameterDtoOptions options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + public ProductParameterDtoOptions getOptions() { + return options; + } + + public void setOptions(@javax.annotation.Nullable ProductParameterDtoOptions options) { + this.options = options; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductParameterDto productParameterDto = (ProductParameterDto) o; + return Objects.equals(this.id, productParameterDto.id) && + Objects.equals(this.name, productParameterDto.name) && + Objects.equals(this.rangeValue, productParameterDto.rangeValue) && + Objects.equals(this.values, productParameterDto.values) && + Objects.equals(this.valuesIds, productParameterDto.valuesIds) && + Objects.equals(this.valuesLabels, productParameterDto.valuesLabels) && + Objects.equals(this.unit, productParameterDto.unit) && + Objects.equals(this.options, productParameterDto.options); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, rangeValue, values, valuesIds, valuesLabels, unit, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductParameterDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" rangeValue: ").append(toIndentedString(rangeValue)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" valuesIds: ").append(toIndentedString(valuesIds)).append("\n"); + sb.append(" valuesLabels: ").append(toIndentedString(valuesLabels)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("rangeValue"); + openapiFields.add("values"); + openapiFields.add("valuesIds"); + openapiFields.add("valuesLabels"); + openapiFields.add("unit"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductParameterDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductParameterDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductParameterDto is not found in the empty JSON string", ProductParameterDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductParameterDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductParameterDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProductParameterDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `rangeValue` + if (jsonObj.get("rangeValue") != null && !jsonObj.get("rangeValue").isJsonNull()) { + ParameterRangeValue.validateJsonElement(jsonObj.get("rangeValue")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("valuesIds") != null && !jsonObj.get("valuesIds").isJsonNull() && !jsonObj.get("valuesIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `valuesIds` to be an array in the JSON string but got `%s`", jsonObj.get("valuesIds").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("valuesLabels") != null && !jsonObj.get("valuesLabels").isJsonNull() && !jsonObj.get("valuesLabels").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `valuesLabels` to be an array in the JSON string but got `%s`", jsonObj.get("valuesLabels").toString())); + } + if ((jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) && !jsonObj.get("unit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unit").toString())); + } + // validate the optional field `options` + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { + ProductParameterDtoOptions.validateJsonElement(jsonObj.get("options")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductParameterDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductParameterDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductParameterDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductParameterDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductParameterDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductParameterDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductParameterDto + * @throws IOException if the JSON string is invalid with respect to ProductParameterDto + */ + public static ProductParameterDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductParameterDto.class); + } + + /** + * Convert an instance of ProductParameterDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterDtoOptions.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterDtoOptions.java new file mode 100644 index 0000000..f76c0d8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterDtoOptions.java @@ -0,0 +1,265 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductParameterDtoOptions + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductParameterDtoOptions { + public static final String SERIALIZED_NAME_IDENTIFIES_PRODUCT = "identifiesProduct"; + @SerializedName(SERIALIZED_NAME_IDENTIFIES_PRODUCT) + @javax.annotation.Nonnull + private Boolean identifiesProduct; + + public static final String SERIALIZED_NAME_IS_G_T_I_N = "isGTIN"; + @SerializedName(SERIALIZED_NAME_IS_G_T_I_N) + @javax.annotation.Nullable + private Boolean isGTIN; + + public static final String SERIALIZED_NAME_IS_TRUSTED = "isTrusted"; + @SerializedName(SERIALIZED_NAME_IS_TRUSTED) + @javax.annotation.Nullable + private Boolean isTrusted; + + public ProductParameterDtoOptions() { + } + + public ProductParameterDtoOptions identifiesProduct(@javax.annotation.Nonnull Boolean identifiesProduct) { + this.identifiesProduct = identifiesProduct; + return this; + } + + /** + * Get identifiesProduct + * @return identifiesProduct + */ + @javax.annotation.Nonnull + public Boolean getIdentifiesProduct() { + return identifiesProduct; + } + + public void setIdentifiesProduct(@javax.annotation.Nonnull Boolean identifiesProduct) { + this.identifiesProduct = identifiesProduct; + } + + + public ProductParameterDtoOptions isGTIN(@javax.annotation.Nullable Boolean isGTIN) { + this.isGTIN = isGTIN; + return this; + } + + /** + * Get isGTIN + * @return isGTIN + */ + @javax.annotation.Nullable + public Boolean getIsGTIN() { + return isGTIN; + } + + public void setIsGTIN(@javax.annotation.Nullable Boolean isGTIN) { + this.isGTIN = isGTIN; + } + + + public ProductParameterDtoOptions isTrusted(@javax.annotation.Nullable Boolean isTrusted) { + this.isTrusted = isTrusted; + return this; + } + + /** + * Parameter values originate directly from the manufacturer, its representative, or a trusted source. + * @return isTrusted + */ + @javax.annotation.Nullable + public Boolean getIsTrusted() { + return isTrusted; + } + + public void setIsTrusted(@javax.annotation.Nullable Boolean isTrusted) { + this.isTrusted = isTrusted; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductParameterDtoOptions productParameterDtoOptions = (ProductParameterDtoOptions) o; + return Objects.equals(this.identifiesProduct, productParameterDtoOptions.identifiesProduct) && + Objects.equals(this.isGTIN, productParameterDtoOptions.isGTIN) && + Objects.equals(this.isTrusted, productParameterDtoOptions.isTrusted); + } + + @Override + public int hashCode() { + return Objects.hash(identifiesProduct, isGTIN, isTrusted); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductParameterDtoOptions {\n"); + sb.append(" identifiesProduct: ").append(toIndentedString(identifiesProduct)).append("\n"); + sb.append(" isGTIN: ").append(toIndentedString(isGTIN)).append("\n"); + sb.append(" isTrusted: ").append(toIndentedString(isTrusted)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("identifiesProduct"); + openapiFields.add("isGTIN"); + openapiFields.add("isTrusted"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("identifiesProduct"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductParameterDtoOptions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductParameterDtoOptions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductParameterDtoOptions is not found in the empty JSON string", ProductParameterDtoOptions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductParameterDtoOptions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductParameterDtoOptions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProductParameterDtoOptions.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductParameterDtoOptions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductParameterDtoOptions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductParameterDtoOptions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductParameterDtoOptions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductParameterDtoOptions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductParameterDtoOptions given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductParameterDtoOptions + * @throws IOException if the JSON string is invalid with respect to ProductParameterDtoOptions + */ + public static ProductParameterDtoOptions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductParameterDtoOptions.class); + } + + /** + * Convert an instance of ProductParameterDtoOptions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterOptions.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterOptions.java new file mode 100644 index 0000000..d4aa3c4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterOptions.java @@ -0,0 +1,203 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductParameterOptions + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductParameterOptions { + public static final String SERIALIZED_NAME_IDENTIFIES_PRODUCT = "identifiesProduct"; + @SerializedName(SERIALIZED_NAME_IDENTIFIES_PRODUCT) + @javax.annotation.Nullable + private Boolean identifiesProduct; + + public ProductParameterOptions() { + } + + public ProductParameterOptions identifiesProduct(@javax.annotation.Nullable Boolean identifiesProduct) { + this.identifiesProduct = identifiesProduct; + return this; + } + + /** + * Get identifiesProduct + * @return identifiesProduct + */ + @javax.annotation.Nullable + public Boolean getIdentifiesProduct() { + return identifiesProduct; + } + + public void setIdentifiesProduct(@javax.annotation.Nullable Boolean identifiesProduct) { + this.identifiesProduct = identifiesProduct; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductParameterOptions productParameterOptions = (ProductParameterOptions) o; + return Objects.equals(this.identifiesProduct, productParameterOptions.identifiesProduct); + } + + @Override + public int hashCode() { + return Objects.hash(identifiesProduct); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductParameterOptions {\n"); + sb.append(" identifiesProduct: ").append(toIndentedString(identifiesProduct)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("identifiesProduct"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductParameterOptions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductParameterOptions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductParameterOptions is not found in the empty JSON string", ProductParameterOptions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductParameterOptions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductParameterOptions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductParameterOptions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductParameterOptions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductParameterOptions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductParameterOptions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductParameterOptions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductParameterOptions given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductParameterOptions + * @throws IOException if the JSON string is invalid with respect to ProductParameterOptions + */ + public static ProductParameterOptions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductParameterOptions.class); + } + + /** + * Convert an instance of ProductParameterOptions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterProposal.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterProposal.java new file mode 100644 index 0000000..b700ce5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterProposal.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ProductParameterValueProposal; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Product parameter values proposal status. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductParameterProposal { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public ProductParameterProposal() { + } + + public ProductParameterProposal id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Parameter identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductParameterProposal values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public ProductParameterProposal addValuesItem(ProductParameterValueProposal valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * List of proposed product parameter change statuses. + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductParameterProposal productParameterProposal = (ProductParameterProposal) o; + return Objects.equals(this.id, productParameterProposal.id) && + Objects.equals(this.values, productParameterProposal.values); + } + + @Override + public int hashCode() { + return Objects.hash(id, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductParameterProposal {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("values"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductParameterProposal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductParameterProposal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductParameterProposal is not found in the empty JSON string", ProductParameterProposal.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductParameterProposal.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductParameterProposal` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull()) { + JsonArray jsonArrayvalues = jsonObj.getAsJsonArray("values"); + if (jsonArrayvalues != null) { + // ensure the json data is an array + if (!jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + + // validate the optional field `values` (array) + for (int i = 0; i < jsonArrayvalues.size(); i++) { + ProductParameterValueProposal.validateJsonElement(jsonArrayvalues.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductParameterProposal.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductParameterProposal' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductParameterProposal.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductParameterProposal value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductParameterProposal read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductParameterProposal given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductParameterProposal + * @throws IOException if the JSON string is invalid with respect to ProductParameterProposal + */ + public static ProductParameterProposal fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductParameterProposal.class); + } + + /** + * Convert an instance of ProductParameterProposal to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterValueProposal.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterValueProposal.java new file mode 100644 index 0000000..a2257a5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductParameterValueProposal.java @@ -0,0 +1,354 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Parameter value proposal status. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductParameterValueProposal { + public static final String SERIALIZED_NAME_CURRENT = "current"; + @SerializedName(SERIALIZED_NAME_CURRENT) + @javax.annotation.Nullable + private String current; + + public static final String SERIALIZED_NAME_PROPOSAL = "proposal"; + @SerializedName(SERIALIZED_NAME_PROPOSAL) + @javax.annotation.Nullable + private String proposal; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nullable + private String reason; + + /** + * Verification resolution type. + */ + @JsonAdapter(ResolutionTypeEnum.Adapter.class) + public enum ResolutionTypeEnum { + UNRESOLVED("UNRESOLVED"), + + ACCEPTED("ACCEPTED"), + + REJECTED("REJECTED"); + + private String value; + + ResolutionTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ResolutionTypeEnum fromValue(String value) { + for (ResolutionTypeEnum b : ResolutionTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ResolutionTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ResolutionTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ResolutionTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ResolutionTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_RESOLUTION_TYPE = "resolutionType"; + @SerializedName(SERIALIZED_NAME_RESOLUTION_TYPE) + @javax.annotation.Nullable + private ResolutionTypeEnum resolutionType; + + public ProductParameterValueProposal() { + } + + public ProductParameterValueProposal current(@javax.annotation.Nullable String current) { + this.current = current; + return this; + } + + /** + * Current product parameter value. + * @return current + */ + @javax.annotation.Nullable + public String getCurrent() { + return current; + } + + public void setCurrent(@javax.annotation.Nullable String current) { + this.current = current; + } + + + public ProductParameterValueProposal proposal(@javax.annotation.Nullable String proposal) { + this.proposal = proposal; + return this; + } + + /** + * Proposed product parameter value. + * @return proposal + */ + @javax.annotation.Nullable + public String getProposal() { + return proposal; + } + + public void setProposal(@javax.annotation.Nullable String proposal) { + this.proposal = proposal; + } + + + public ProductParameterValueProposal reason(@javax.annotation.Nullable String reason) { + this.reason = reason; + return this; + } + + /** + * Verification message. + * @return reason + */ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nullable String reason) { + this.reason = reason; + } + + + public ProductParameterValueProposal resolutionType(@javax.annotation.Nullable ResolutionTypeEnum resolutionType) { + this.resolutionType = resolutionType; + return this; + } + + /** + * Verification resolution type. + * @return resolutionType + */ + @javax.annotation.Nullable + public ResolutionTypeEnum getResolutionType() { + return resolutionType; + } + + public void setResolutionType(@javax.annotation.Nullable ResolutionTypeEnum resolutionType) { + this.resolutionType = resolutionType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductParameterValueProposal productParameterValueProposal = (ProductParameterValueProposal) o; + return Objects.equals(this.current, productParameterValueProposal.current) && + Objects.equals(this.proposal, productParameterValueProposal.proposal) && + Objects.equals(this.reason, productParameterValueProposal.reason) && + Objects.equals(this.resolutionType, productParameterValueProposal.resolutionType); + } + + @Override + public int hashCode() { + return Objects.hash(current, proposal, reason, resolutionType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductParameterValueProposal {\n"); + sb.append(" current: ").append(toIndentedString(current)).append("\n"); + sb.append(" proposal: ").append(toIndentedString(proposal)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" resolutionType: ").append(toIndentedString(resolutionType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("current"); + openapiFields.add("proposal"); + openapiFields.add("reason"); + openapiFields.add("resolutionType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductParameterValueProposal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductParameterValueProposal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductParameterValueProposal is not found in the empty JSON string", ProductParameterValueProposal.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductParameterValueProposal.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductParameterValueProposal` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("current") != null && !jsonObj.get("current").isJsonNull()) && !jsonObj.get("current").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `current` to be a primitive type in the JSON string but got `%s`", jsonObj.get("current").toString())); + } + if ((jsonObj.get("proposal") != null && !jsonObj.get("proposal").isJsonNull()) && !jsonObj.get("proposal").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `proposal` to be a primitive type in the JSON string but got `%s`", jsonObj.get("proposal").toString())); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("resolutionType") != null && !jsonObj.get("resolutionType").isJsonNull()) && !jsonObj.get("resolutionType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `resolutionType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resolutionType").toString())); + } + // validate the optional field `resolutionType` + if (jsonObj.get("resolutionType") != null && !jsonObj.get("resolutionType").isJsonNull()) { + ResolutionTypeEnum.validateJsonElement(jsonObj.get("resolutionType")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductParameterValueProposal.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductParameterValueProposal' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductParameterValueProposal.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductParameterValueProposal value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductParameterValueProposal read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductParameterValueProposal given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductParameterValueProposal + * @throws IOException if the JSON string is invalid with respect to ProductParameterValueProposal + */ + public static ProductParameterValueProposal fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductParameterValueProposal.class); + } + + /** + * Convert an instance of ProductParameterValueProposal to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsRequest.java new file mode 100644 index 0000000..19710f6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsRequest.java @@ -0,0 +1,404 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ImageUrl; +import pl.wtx.allegro.api.client.model.ProductCategory; +import pl.wtx.allegro.api.client.model.ProductParameter; +import pl.wtx.allegro.api.client.model.StandardizedDescription; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductProposalsRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductProposalsRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nonnull + private ProductCategory category; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nonnull + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nonnull + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private StandardizedDescription description; + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nonnull + private String language; + + public ProductProposalsRequest() { + } + + public ProductProposalsRequest name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Suggested product name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ProductProposalsRequest category(@javax.annotation.Nonnull ProductCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nonnull + public ProductCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nonnull ProductCategory category) { + this.category = category; + } + + + public ProductProposalsRequest images(@javax.annotation.Nonnull List images) { + this.images = images; + return this; + } + + public ProductProposalsRequest addImagesItem(ImageUrl imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * List of product images. At least one image is required. + * @return images + */ + @javax.annotation.Nonnull + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nonnull List images) { + this.images = images; + } + + + public ProductProposalsRequest parameters(@javax.annotation.Nonnull List parameters) { + this.parameters = parameters; + return this; + } + + public ProductProposalsRequest addParametersItem(ProductParameter parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * List of product parameters. + * @return parameters + */ + @javax.annotation.Nonnull + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nonnull List parameters) { + this.parameters = parameters; + } + + + public ProductProposalsRequest description(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public StandardizedDescription getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + } + + + public ProductProposalsRequest language(@javax.annotation.Nonnull String language) { + this.language = language; + return this; + } + + /** + * Language of provided product data (name, description, parameters's values). + * @return language + */ + @javax.annotation.Nonnull + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nonnull String language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductProposalsRequest productProposalsRequest = (ProductProposalsRequest) o; + return Objects.equals(this.name, productProposalsRequest.name) && + Objects.equals(this.category, productProposalsRequest.category) && + Objects.equals(this.images, productProposalsRequest.images) && + Objects.equals(this.parameters, productProposalsRequest.parameters) && + Objects.equals(this.description, productProposalsRequest.description) && + Objects.equals(this.language, productProposalsRequest.language); + } + + @Override + public int hashCode() { + return Objects.hash(name, category, images, parameters, description, language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductProposalsRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("category"); + openapiFields.add("images"); + openapiFields.add("parameters"); + openapiFields.add("description"); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("category"); + openapiRequiredFields.add("images"); + openapiRequiredFields.add("parameters"); + openapiRequiredFields.add("language"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductProposalsRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductProposalsRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductProposalsRequest is not found in the empty JSON string", ProductProposalsRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductProposalsRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductProposalsRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProductProposalsRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the required field `category` + ProductCategory.validateJsonElement(jsonObj.get("category")); + // ensure the json data is an array + if (!jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + + JsonArray jsonArrayimages = jsonObj.getAsJsonArray("images"); + // validate the required field `images` (array) + for (int i = 0; i < jsonArrayimages.size(); i++) { + ImageUrl.validateJsonElement(jsonArrayimages.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + // validate the required field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ProductParameter.validateJsonElement(jsonArrayparameters.get(i)); + }; + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + StandardizedDescription.validateJsonElement(jsonObj.get("description")); + } + if (!jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductProposalsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductProposalsRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductProposalsRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductProposalsRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductProposalsRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductProposalsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductProposalsRequest + * @throws IOException if the JSON string is invalid with respect to ProductProposalsRequest + */ + public static ProductProposalsRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductProposalsRequest.class); + } + + /** + * Convert an instance of ProductProposalsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponse.java new file mode 100644 index 0000000..338a237 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponse.java @@ -0,0 +1,526 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ImageUrl; +import pl.wtx.allegro.api.client.model.NewProductParameterDto; +import pl.wtx.allegro.api.client.model.ProductProposalsResponseCategory; +import pl.wtx.allegro.api.client.model.ProductProposalsResponsePublication; +import pl.wtx.allegro.api.client.model.StandardizedDescription; +import pl.wtx.allegro.api.client.model.SupplierDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductProposalsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductProposalsResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private ProductProposalsResponseCategory category; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private StandardizedDescription description; + + public static final String SERIALIZED_NAME_SUPPLIER = "supplier"; + @SerializedName(SERIALIZED_NAME_SUPPLIER) + @javax.annotation.Nullable + private SupplierDto supplier; + + public static final String SERIALIZED_NAME_OFFER_ID = "offerId"; + @SerializedName(SERIALIZED_NAME_OFFER_ID) + @javax.annotation.Nullable + private String offerId; + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nullable + private String language; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private ProductProposalsResponsePublication publication; + + public ProductProposalsResponse() { + } + + public ProductProposalsResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Product id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductProposalsResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Product name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ProductProposalsResponse category(@javax.annotation.Nullable ProductProposalsResponseCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + public ProductProposalsResponseCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable ProductProposalsResponseCategory category) { + this.category = category; + } + + + public ProductProposalsResponse images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public ProductProposalsResponse addImagesItem(ImageUrl imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * List of product images. + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public ProductProposalsResponse parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public ProductProposalsResponse addParametersItem(NewProductParameterDto parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * List of product parameters. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public ProductProposalsResponse description(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public StandardizedDescription getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + } + + + public ProductProposalsResponse supplier(@javax.annotation.Nullable SupplierDto supplier) { + this.supplier = supplier; + return this; + } + + /** + * Get supplier + * @return supplier + */ + @javax.annotation.Nullable + public SupplierDto getSupplier() { + return supplier; + } + + public void setSupplier(@javax.annotation.Nullable SupplierDto supplier) { + this.supplier = supplier; + } + + + public ProductProposalsResponse offerId(@javax.annotation.Nullable String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Offer id. + * @return offerId + */ + @javax.annotation.Nullable + public String getOfferId() { + return offerId; + } + + public void setOfferId(@javax.annotation.Nullable String offerId) { + this.offerId = offerId; + } + + + public ProductProposalsResponse language(@javax.annotation.Nullable String language) { + this.language = language; + return this; + } + + /** + * Language of product data (name, description, parameters's values). + * @return language + */ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nullable String language) { + this.language = language; + } + + + public ProductProposalsResponse publication(@javax.annotation.Nullable ProductProposalsResponsePublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public ProductProposalsResponsePublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable ProductProposalsResponsePublication publication) { + this.publication = publication; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductProposalsResponse productProposalsResponse = (ProductProposalsResponse) o; + return Objects.equals(this.id, productProposalsResponse.id) && + Objects.equals(this.name, productProposalsResponse.name) && + Objects.equals(this.category, productProposalsResponse.category) && + Objects.equals(this.images, productProposalsResponse.images) && + Objects.equals(this.parameters, productProposalsResponse.parameters) && + Objects.equals(this.description, productProposalsResponse.description) && + Objects.equals(this.supplier, productProposalsResponse.supplier) && + Objects.equals(this.offerId, productProposalsResponse.offerId) && + Objects.equals(this.language, productProposalsResponse.language) && + Objects.equals(this.publication, productProposalsResponse.publication); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, category, images, parameters, description, supplier, offerId, language, publication); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductProposalsResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" supplier: ").append(toIndentedString(supplier)).append("\n"); + sb.append(" offerId: ").append(toIndentedString(offerId)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("category"); + openapiFields.add("images"); + openapiFields.add("parameters"); + openapiFields.add("description"); + openapiFields.add("supplier"); + openapiFields.add("offerId"); + openapiFields.add("language"); + openapiFields.add("publication"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductProposalsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductProposalsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductProposalsResponse is not found in the empty JSON string", ProductProposalsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductProposalsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductProposalsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + ProductProposalsResponseCategory.validateJsonElement(jsonObj.get("category")); + } + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull()) { + JsonArray jsonArrayimages = jsonObj.getAsJsonArray("images"); + if (jsonArrayimages != null) { + // ensure the json data is an array + if (!jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + + // validate the optional field `images` (array) + for (int i = 0; i < jsonArrayimages.size(); i++) { + ImageUrl.validateJsonElement(jsonArrayimages.get(i)); + }; + } + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + NewProductParameterDto.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + StandardizedDescription.validateJsonElement(jsonObj.get("description")); + } + // validate the optional field `supplier` + if (jsonObj.get("supplier") != null && !jsonObj.get("supplier").isJsonNull()) { + SupplierDto.validateJsonElement(jsonObj.get("supplier")); + } + if ((jsonObj.get("offerId") != null && !jsonObj.get("offerId").isJsonNull()) && !jsonObj.get("offerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `offerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("offerId").toString())); + } + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + ProductProposalsResponsePublication.validateJsonElement(jsonObj.get("publication")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductProposalsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductProposalsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductProposalsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductProposalsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductProposalsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductProposalsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductProposalsResponse + * @throws IOException if the JSON string is invalid with respect to ProductProposalsResponse + */ + public static ProductProposalsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductProposalsResponse.class); + } + + /** + * Convert an instance of ProductProposalsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponseCategory.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponseCategory.java new file mode 100644 index 0000000..0026281 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponseCategory.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Category; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductProposalsResponseCategory + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductProposalsResponseCategory { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_SIMILAR = "similar"; + @SerializedName(SERIALIZED_NAME_SIMILAR) + @javax.annotation.Nullable + private List similar = new ArrayList<>(); + + public ProductProposalsResponseCategory() { + } + + public ProductProposalsResponseCategory id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Category identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductProposalsResponseCategory similar(@javax.annotation.Nullable List similar) { + this.similar = similar; + return this; + } + + public ProductProposalsResponseCategory addSimilarItem(Category similarItem) { + if (this.similar == null) { + this.similar = new ArrayList<>(); + } + this.similar.add(similarItem); + return this; + } + + /** + * A list of similar categories in which you can sell this product. + * @return similar + */ + @javax.annotation.Nullable + public List getSimilar() { + return similar; + } + + public void setSimilar(@javax.annotation.Nullable List similar) { + this.similar = similar; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductProposalsResponseCategory productProposalsResponseCategory = (ProductProposalsResponseCategory) o; + return Objects.equals(this.id, productProposalsResponseCategory.id) && + Objects.equals(this.similar, productProposalsResponseCategory.similar); + } + + @Override + public int hashCode() { + return Objects.hash(id, similar); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductProposalsResponseCategory {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" similar: ").append(toIndentedString(similar)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("similar"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductProposalsResponseCategory + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductProposalsResponseCategory.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductProposalsResponseCategory is not found in the empty JSON string", ProductProposalsResponseCategory.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductProposalsResponseCategory.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductProposalsResponseCategory` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (jsonObj.get("similar") != null && !jsonObj.get("similar").isJsonNull()) { + JsonArray jsonArraysimilar = jsonObj.getAsJsonArray("similar"); + if (jsonArraysimilar != null) { + // ensure the json data is an array + if (!jsonObj.get("similar").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `similar` to be an array in the JSON string but got `%s`", jsonObj.get("similar").toString())); + } + + // validate the optional field `similar` (array) + for (int i = 0; i < jsonArraysimilar.size(); i++) { + Category.validateJsonElement(jsonArraysimilar.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductProposalsResponseCategory.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductProposalsResponseCategory' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductProposalsResponseCategory.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductProposalsResponseCategory value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductProposalsResponseCategory read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductProposalsResponseCategory given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductProposalsResponseCategory + * @throws IOException if the JSON string is invalid with respect to ProductProposalsResponseCategory + */ + public static ProductProposalsResponseCategory fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductProposalsResponseCategory.class); + } + + /** + * Convert an instance of ProductProposalsResponseCategory to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponsePublication.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponsePublication.java new file mode 100644 index 0000000..a123a4e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductProposalsResponsePublication.java @@ -0,0 +1,262 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductProposalsResponsePublication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductProposalsResponsePublication { + /** + * The publication status of the submitted product: - `PROPOSED` - a new product proposal was created and can be reviewed + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PROPOSED("PROPOSED"), + + LISTED("LISTED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public ProductProposalsResponsePublication() { + } + + public ProductProposalsResponsePublication status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * The publication status of the submitted product: - `PROPOSED` - a new product proposal was created and can be reviewed + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductProposalsResponsePublication productProposalsResponsePublication = (ProductProposalsResponsePublication) o; + return Objects.equals(this.status, productProposalsResponsePublication.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductProposalsResponsePublication {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductProposalsResponsePublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductProposalsResponsePublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductProposalsResponsePublication is not found in the empty JSON string", ProductProposalsResponsePublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductProposalsResponsePublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductProposalsResponsePublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductProposalsResponsePublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductProposalsResponsePublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductProposalsResponsePublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductProposalsResponsePublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductProposalsResponsePublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductProposalsResponsePublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductProposalsResponsePublication + * @throws IOException if the JSON string is invalid with respect to ProductProposalsResponsePublication + */ + public static ProductProposalsResponsePublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductProposalsResponsePublication.class); + } + + /** + * Convert an instance of ProductProposalsResponsePublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSafetyDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSafetyDto.java new file mode 100644 index 0000000..0169ede --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSafetyDto.java @@ -0,0 +1,299 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.ProductSetElementSafetyInformation; +import pl.wtx.allegro.api.client.model.ResponsibleProducerResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Suggested product safety data in accordance with GPSR. **Note:** Allegro does not assume responsibility for the accuracy of this data. It is the merchant's responsibility to verify its applicability to their product. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSafetyDto { + public static final String SERIALIZED_NAME_RESPONSIBLE_PRODUCERS = "responsibleProducers"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PRODUCERS) + @javax.annotation.Nullable + private List responsibleProducers; + + public static final String SERIALIZED_NAME_SAFETY_INFORMATION = "safetyInformation"; + @SerializedName(SERIALIZED_NAME_SAFETY_INFORMATION) + @javax.annotation.Nullable + private ProductSetElementSafetyInformation safetyInformation; + + public static final String SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION = "marketedBeforeGPSRObligation"; + @SerializedName(SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION) + @javax.annotation.Nullable + private Boolean marketedBeforeGPSRObligation; + + public ProductSafetyDto() { + } + + public ProductSafetyDto responsibleProducers(@javax.annotation.Nullable List responsibleProducers) { + this.responsibleProducers = responsibleProducers; + return this; + } + + public ProductSafetyDto addResponsibleProducersItem(ResponsibleProducerResponse responsibleProducersItem) { + if (this.responsibleProducers == null) { + this.responsibleProducers = new ArrayList<>(); + } + this.responsibleProducers.add(responsibleProducersItem); + return this; + } + + /** + * Get responsibleProducers + * @return responsibleProducers + */ + @javax.annotation.Nullable + public List getResponsibleProducers() { + return responsibleProducers; + } + + public void setResponsibleProducers(@javax.annotation.Nullable List responsibleProducers) { + this.responsibleProducers = responsibleProducers; + } + + + public ProductSafetyDto safetyInformation(@javax.annotation.Nullable ProductSetElementSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + return this; + } + + /** + * Get safetyInformation + * @return safetyInformation + */ + @javax.annotation.Nullable + public ProductSetElementSafetyInformation getSafetyInformation() { + return safetyInformation; + } + + public void setSafetyInformation(@javax.annotation.Nullable ProductSetElementSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + } + + + public ProductSafetyDto marketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + return this; + } + + /** + * Get marketedBeforeGPSRObligation + * @return marketedBeforeGPSRObligation + */ + @javax.annotation.Nullable + public Boolean getMarketedBeforeGPSRObligation() { + return marketedBeforeGPSRObligation; + } + + public void setMarketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSafetyDto productSafetyDto = (ProductSafetyDto) o; + return Objects.equals(this.responsibleProducers, productSafetyDto.responsibleProducers) && + Objects.equals(this.safetyInformation, productSafetyDto.safetyInformation) && + Objects.equals(this.marketedBeforeGPSRObligation, productSafetyDto.marketedBeforeGPSRObligation); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleProducers, safetyInformation, marketedBeforeGPSRObligation); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSafetyDto {\n"); + sb.append(" responsibleProducers: ").append(toIndentedString(responsibleProducers)).append("\n"); + sb.append(" safetyInformation: ").append(toIndentedString(safetyInformation)).append("\n"); + sb.append(" marketedBeforeGPSRObligation: ").append(toIndentedString(marketedBeforeGPSRObligation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("responsibleProducers"); + openapiFields.add("safetyInformation"); + openapiFields.add("marketedBeforeGPSRObligation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSafetyDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSafetyDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSafetyDto is not found in the empty JSON string", ProductSafetyDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSafetyDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSafetyDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("responsibleProducers") != null && !jsonObj.get("responsibleProducers").isJsonNull()) { + JsonArray jsonArrayresponsibleProducers = jsonObj.getAsJsonArray("responsibleProducers"); + if (jsonArrayresponsibleProducers != null) { + // ensure the json data is an array + if (!jsonObj.get("responsibleProducers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `responsibleProducers` to be an array in the JSON string but got `%s`", jsonObj.get("responsibleProducers").toString())); + } + + // validate the optional field `responsibleProducers` (array) + for (int i = 0; i < jsonArrayresponsibleProducers.size(); i++) { + ResponsibleProducerResponse.validateJsonElement(jsonArrayresponsibleProducers.get(i)); + }; + } + } + // validate the optional field `safetyInformation` + if (jsonObj.get("safetyInformation") != null && !jsonObj.get("safetyInformation").isJsonNull()) { + ProductSetElementSafetyInformation.validateJsonElement(jsonObj.get("safetyInformation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSafetyDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSafetyDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSafetyDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSafetyDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSafetyDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSafetyDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSafetyDto + * @throws IOException if the JSON string is invalid with respect to ProductSafetyDto + */ + public static ProductSafetyDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSafetyDto.class); + } + + /** + * Convert an instance of ProductSafetyDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSafetyInformationDescription.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSafetyInformationDescription.java new file mode 100644 index 0000000..cc6192e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSafetyInformationDescription.java @@ -0,0 +1,269 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.OfferTranslationType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSafetyInformationDescription + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSafetyInformationDescription { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_TRANSLATION = "translation"; + @SerializedName(SERIALIZED_NAME_TRANSLATION) + @javax.annotation.Nullable + private String translation; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private OfferTranslationType type; + + public ProductSafetyInformationDescription() { + } + + public ProductSafetyInformationDescription id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public ProductSafetyInformationDescription translation(@javax.annotation.Nullable String translation) { + this.translation = translation; + return this; + } + + /** + * Product safety information translation content + * @return translation + */ + @javax.annotation.Nullable + public String getTranslation() { + return translation; + } + + public void setTranslation(@javax.annotation.Nullable String translation) { + this.translation = translation; + } + + + public ProductSafetyInformationDescription type(@javax.annotation.Nullable OfferTranslationType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public OfferTranslationType getType() { + return type; + } + + public void setType(@javax.annotation.Nullable OfferTranslationType type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSafetyInformationDescription productSafetyInformationDescription = (ProductSafetyInformationDescription) o; + return Objects.equals(this.id, productSafetyInformationDescription.id) && + Objects.equals(this.translation, productSafetyInformationDescription.translation) && + Objects.equals(this.type, productSafetyInformationDescription.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, translation, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSafetyInformationDescription {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("translation"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSafetyInformationDescription + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSafetyInformationDescription.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSafetyInformationDescription is not found in the empty JSON string", ProductSafetyInformationDescription.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSafetyInformationDescription.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSafetyInformationDescription` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("translation") != null && !jsonObj.get("translation").isJsonNull()) && !jsonObj.get("translation").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `translation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("translation").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + OfferTranslationType.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSafetyInformationDescription.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSafetyInformationDescription' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSafetyInformationDescription.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSafetyInformationDescription value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSafetyInformationDescription read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSafetyInformationDescription given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSafetyInformationDescription + * @throws IOException if the JSON string is invalid with respect to ProductSafetyInformationDescription + */ + public static ProductSafetyInformationDescription fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSafetyInformationDescription.class); + } + + /** + * Convert an instance of ProductSafetyInformationDescription to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElement.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElement.java new file mode 100644 index 0000000..f81ef22 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElement.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ProductOffer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSetElement + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElement { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + @javax.annotation.Nullable + private ProductOffer product; + + public ProductSetElement() { + } + + public ProductSetElement product(@javax.annotation.Nullable ProductOffer product) { + this.product = product; + return this; + } + + /** + * You should enter the product identifier (UUID or EAN) or a complete product definition. + * @return product + */ + @javax.annotation.Nullable + public ProductOffer getProduct() { + return product; + } + + public void setProduct(@javax.annotation.Nullable ProductOffer product) { + this.product = product; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElement productSetElement = (ProductSetElement) o; + return Objects.equals(this.product, productSetElement.product); + } + + @Override + public int hashCode() { + return Objects.hash(product); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElement {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElement + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElement.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElement is not found in the empty JSON string", ProductSetElement.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElement.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElement` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductOffer.validateJsonElement(jsonObj.get("product")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElement.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElement' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElement.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElement value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElement read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElement given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElement + * @throws IOException if the JSON string is invalid with respect to ProductSetElement + */ + public static ProductSetElement fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElement.class); + } + + /** + * Convert an instance of ProductSetElement to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementAttachmentSafetyInformation.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementAttachmentSafetyInformation.java new file mode 100644 index 0000000..d2860d1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementAttachmentSafetyInformation.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ProductSetElementAttachmentSafetyInformationAllOfAttachments; +import pl.wtx.allegro.api.client.model.ProductSetElementSafetyInformation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSetElementAttachmentSafetyInformation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementAttachmentSafetyInformation extends ProductSetElementSafetyInformation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type; + + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nullable + private List attachments = new ArrayList<>(); + + public ProductSetElementAttachmentSafetyInformation() { + this.type = this.getClass().getSimpleName(); + } + + public ProductSetElementAttachmentSafetyInformation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ProductSetElementAttachmentSafetyInformation attachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + return this; + } + + public ProductSetElementAttachmentSafetyInformation addAttachmentsItem(ProductSetElementAttachmentSafetyInformationAllOfAttachments attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * Get attachments + * @return attachments + */ + @javax.annotation.Nullable + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementAttachmentSafetyInformation productSetElementAttachmentSafetyInformation = (ProductSetElementAttachmentSafetyInformation) o; + return Objects.equals(this.type, productSetElementAttachmentSafetyInformation.type) && + Objects.equals(this.attachments, productSetElementAttachmentSafetyInformation.attachments) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, attachments, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementAttachmentSafetyInformation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("attachments"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementAttachmentSafetyInformation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementAttachmentSafetyInformation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementAttachmentSafetyInformation is not found in the empty JSON string", ProductSetElementAttachmentSafetyInformation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementAttachmentSafetyInformation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementAttachmentSafetyInformation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementAttachmentSafetyInformation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementAttachmentSafetyInformation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementAttachmentSafetyInformation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementAttachmentSafetyInformation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementAttachmentSafetyInformation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementAttachmentSafetyInformation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementAttachmentSafetyInformation + * @throws IOException if the JSON string is invalid with respect to ProductSetElementAttachmentSafetyInformation + */ + public static ProductSetElementAttachmentSafetyInformation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementAttachmentSafetyInformation.class); + } + + /** + * Convert an instance of ProductSetElementAttachmentSafetyInformation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementAttachmentSafetyInformationAllOfAttachments.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementAttachmentSafetyInformationAllOfAttachments.java new file mode 100644 index 0000000..5867bdc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementAttachmentSafetyInformationAllOfAttachments.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSetElementAttachmentSafetyInformationAllOfAttachments + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementAttachmentSafetyInformationAllOfAttachments { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ProductSetElementAttachmentSafetyInformationAllOfAttachments() { + } + + public ProductSetElementAttachmentSafetyInformationAllOfAttachments id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of the attachment. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementAttachmentSafetyInformationAllOfAttachments productSetElementAttachmentSafetyInformationAllOfAttachments = (ProductSetElementAttachmentSafetyInformationAllOfAttachments) o; + return Objects.equals(this.id, productSetElementAttachmentSafetyInformationAllOfAttachments.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementAttachmentSafetyInformationAllOfAttachments {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementAttachmentSafetyInformationAllOfAttachments + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementAttachmentSafetyInformationAllOfAttachments.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementAttachmentSafetyInformationAllOfAttachments is not found in the empty JSON string", ProductSetElementAttachmentSafetyInformationAllOfAttachments.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementAttachmentSafetyInformationAllOfAttachments.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementAttachmentSafetyInformationAllOfAttachments` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementAttachmentSafetyInformationAllOfAttachments.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementAttachmentSafetyInformationAllOfAttachments' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementAttachmentSafetyInformationAllOfAttachments.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementAttachmentSafetyInformationAllOfAttachments value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementAttachmentSafetyInformationAllOfAttachments read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementAttachmentSafetyInformationAllOfAttachments given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementAttachmentSafetyInformationAllOfAttachments + * @throws IOException if the JSON string is invalid with respect to ProductSetElementAttachmentSafetyInformationAllOfAttachments + */ + public static ProductSetElementAttachmentSafetyInformationAllOfAttachments fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementAttachmentSafetyInformationAllOfAttachments.class); + } + + /** + * Convert an instance of ProductSetElementAttachmentSafetyInformationAllOfAttachments to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementNoSafetyInformation.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementNoSafetyInformation.java new file mode 100644 index 0000000..e853829 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementNoSafetyInformation.java @@ -0,0 +1,211 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ProductSetElementSafetyInformation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSetElementNoSafetyInformation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementNoSafetyInformation extends ProductSetElementSafetyInformation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @Deprecated + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type; + + public ProductSetElementNoSafetyInformation() { + this.type = this.getClass().getSimpleName(); + } + + @Deprecated + public ProductSetElementNoSafetyInformation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * The option is deprecated and will be removed in the future. + * @return type + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public String getType() { + return type; + } + + @Deprecated + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementNoSafetyInformation productSetElementNoSafetyInformation = (ProductSetElementNoSafetyInformation) o; + return Objects.equals(this.type, productSetElementNoSafetyInformation.type) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementNoSafetyInformation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementNoSafetyInformation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementNoSafetyInformation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementNoSafetyInformation is not found in the empty JSON string", ProductSetElementNoSafetyInformation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementNoSafetyInformation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementNoSafetyInformation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementNoSafetyInformation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementNoSafetyInformation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementNoSafetyInformation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementNoSafetyInformation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementNoSafetyInformation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementNoSafetyInformation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementNoSafetyInformation + * @throws IOException if the JSON string is invalid with respect to ProductSetElementNoSafetyInformation + */ + public static ProductSetElementNoSafetyInformation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementNoSafetyInformation.class); + } + + /** + * Convert an instance of ProductSetElementNoSafetyInformation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementQuantity.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementQuantity.java new file mode 100644 index 0000000..550a40e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementQuantity.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ProductSetElementQuantityQuantity; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSetElementQuantity + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementQuantity { + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private ProductSetElementQuantityQuantity quantity; + + public ProductSetElementQuantity() { + } + + public ProductSetElementQuantity quantity(@javax.annotation.Nullable ProductSetElementQuantityQuantity quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + public ProductSetElementQuantityQuantity getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable ProductSetElementQuantityQuantity quantity) { + this.quantity = quantity; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementQuantity productSetElementQuantity = (ProductSetElementQuantity) o; + return Objects.equals(this.quantity, productSetElementQuantity.quantity); + } + + @Override + public int hashCode() { + return Objects.hash(quantity); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementQuantity {\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("quantity"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementQuantity + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementQuantity.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementQuantity is not found in the empty JSON string", ProductSetElementQuantity.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementQuantity.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementQuantity` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `quantity` + if (jsonObj.get("quantity") != null && !jsonObj.get("quantity").isJsonNull()) { + ProductSetElementQuantityQuantity.validateJsonElement(jsonObj.get("quantity")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementQuantity.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementQuantity' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementQuantity.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementQuantity value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementQuantity read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementQuantity given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementQuantity + * @throws IOException if the JSON string is invalid with respect to ProductSetElementQuantity + */ + public static ProductSetElementQuantity fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementQuantity.class); + } + + /** + * Convert an instance of ProductSetElementQuantity to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementQuantityQuantity.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementQuantityQuantity.java new file mode 100644 index 0000000..d7052af --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementQuantityQuantity.java @@ -0,0 +1,204 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The number of a given product included in a single offer sold as an element of a product set. <small>**Note:** For number of sets available in stock, use `stock.available` property.</small> + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementQuantityQuantity { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private Integer value; + + public ProductSetElementQuantityQuantity() { + } + + public ProductSetElementQuantityQuantity value(@javax.annotation.Nullable Integer value) { + this.value = value; + return this; + } + + /** + * Get value + * minimum: 1 + * @return value + */ + @javax.annotation.Nullable + public Integer getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable Integer value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementQuantityQuantity productSetElementQuantityQuantity = (ProductSetElementQuantityQuantity) o; + return Objects.equals(this.value, productSetElementQuantityQuantity.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementQuantityQuantity {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementQuantityQuantity + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementQuantityQuantity.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementQuantityQuantity is not found in the empty JSON string", ProductSetElementQuantityQuantity.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementQuantityQuantity.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementQuantityQuantity` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementQuantityQuantity.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementQuantityQuantity' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementQuantityQuantity.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementQuantityQuantity value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementQuantityQuantity read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementQuantityQuantity given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementQuantityQuantity + * @throws IOException if the JSON string is invalid with respect to ProductSetElementQuantityQuantity + */ + public static ProductSetElementQuantityQuantity fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementQuantityQuantity.class); + } + + /** + * Convert an instance of ProductSetElementQuantityQuantity to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsiblePersonRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsiblePersonRequest.java new file mode 100644 index 0000000..f3bcd81 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsiblePersonRequest.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ProductSetElementResponsiblePersonRequestResponsiblePerson; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSetElementResponsiblePersonRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementResponsiblePersonRequest { + public static final String SERIALIZED_NAME_RESPONSIBLE_PERSON = "responsiblePerson"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PERSON) + @javax.annotation.Nullable + private ProductSetElementResponsiblePersonRequestResponsiblePerson responsiblePerson; + + public ProductSetElementResponsiblePersonRequest() { + } + + public ProductSetElementResponsiblePersonRequest responsiblePerson(@javax.annotation.Nullable ProductSetElementResponsiblePersonRequestResponsiblePerson responsiblePerson) { + this.responsiblePerson = responsiblePerson; + return this; + } + + /** + * Get responsiblePerson + * @return responsiblePerson + */ + @javax.annotation.Nullable + public ProductSetElementResponsiblePersonRequestResponsiblePerson getResponsiblePerson() { + return responsiblePerson; + } + + public void setResponsiblePerson(@javax.annotation.Nullable ProductSetElementResponsiblePersonRequestResponsiblePerson responsiblePerson) { + this.responsiblePerson = responsiblePerson; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementResponsiblePersonRequest productSetElementResponsiblePersonRequest = (ProductSetElementResponsiblePersonRequest) o; + return Objects.equals(this.responsiblePerson, productSetElementResponsiblePersonRequest.responsiblePerson); + } + + @Override + public int hashCode() { + return Objects.hash(responsiblePerson); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementResponsiblePersonRequest {\n"); + sb.append(" responsiblePerson: ").append(toIndentedString(responsiblePerson)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("responsiblePerson"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementResponsiblePersonRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementResponsiblePersonRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementResponsiblePersonRequest is not found in the empty JSON string", ProductSetElementResponsiblePersonRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementResponsiblePersonRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementResponsiblePersonRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `responsiblePerson` + if (jsonObj.get("responsiblePerson") != null && !jsonObj.get("responsiblePerson").isJsonNull()) { + ProductSetElementResponsiblePersonRequestResponsiblePerson.validateJsonElement(jsonObj.get("responsiblePerson")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementResponsiblePersonRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementResponsiblePersonRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementResponsiblePersonRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementResponsiblePersonRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementResponsiblePersonRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementResponsiblePersonRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementResponsiblePersonRequest + * @throws IOException if the JSON string is invalid with respect to ProductSetElementResponsiblePersonRequest + */ + public static ProductSetElementResponsiblePersonRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementResponsiblePersonRequest.class); + } + + /** + * Convert an instance of ProductSetElementResponsiblePersonRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsiblePersonRequestResponsiblePerson.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsiblePersonRequestResponsiblePerson.java new file mode 100644 index 0000000..da055a3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsiblePersonRequestResponsiblePerson.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Reference to the responsible person configured using <a href=\"https://developer.allegro.pl/documentation#tag/Responsible-persons\">Responsible Persons API</a>. Provide either id or name - id will be used if both are provided. Setting this object to null will result in no responsible person assigned to this product. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementResponsiblePersonRequestResponsiblePerson { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public ProductSetElementResponsiblePersonRequestResponsiblePerson() { + } + + public ProductSetElementResponsiblePersonRequestResponsiblePerson id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Identifier of a responsible person. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductSetElementResponsiblePersonRequestResponsiblePerson name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of a responsible person. Note that this references name of the person object, not the name in their personal data section. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementResponsiblePersonRequestResponsiblePerson productSetElementResponsiblePersonRequestResponsiblePerson = (ProductSetElementResponsiblePersonRequestResponsiblePerson) o; + return Objects.equals(this.id, productSetElementResponsiblePersonRequestResponsiblePerson.id) && + Objects.equals(this.name, productSetElementResponsiblePersonRequestResponsiblePerson.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementResponsiblePersonRequestResponsiblePerson {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementResponsiblePersonRequestResponsiblePerson + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementResponsiblePersonRequestResponsiblePerson.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementResponsiblePersonRequestResponsiblePerson is not found in the empty JSON string", ProductSetElementResponsiblePersonRequestResponsiblePerson.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementResponsiblePersonRequestResponsiblePerson.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementResponsiblePersonRequestResponsiblePerson` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementResponsiblePersonRequestResponsiblePerson.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementResponsiblePersonRequestResponsiblePerson' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementResponsiblePersonRequestResponsiblePerson.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementResponsiblePersonRequestResponsiblePerson value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementResponsiblePersonRequestResponsiblePerson read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementResponsiblePersonRequestResponsiblePerson given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementResponsiblePersonRequestResponsiblePerson + * @throws IOException if the JSON string is invalid with respect to ProductSetElementResponsiblePersonRequestResponsiblePerson + */ + public static ProductSetElementResponsiblePersonRequestResponsiblePerson fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementResponsiblePersonRequestResponsiblePerson.class); + } + + /** + * Convert an instance of ProductSetElementResponsiblePersonRequestResponsiblePerson to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerIdRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerIdRequest.java new file mode 100644 index 0000000..b5c559f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerIdRequest.java @@ -0,0 +1,233 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSetElementResponsibleProducerIdRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementResponsibleProducerIdRequest extends ProductSetElementResponsibleProducerRequest { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ProductSetElementResponsibleProducerIdRequest() { + this.type = this.getClass().getSimpleName(); + } + + public ProductSetElementResponsibleProducerIdRequest type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ProductSetElementResponsibleProducerIdRequest id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of responsible producer + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementResponsibleProducerIdRequest productSetElementResponsibleProducerIdRequest = (ProductSetElementResponsibleProducerIdRequest) o; + return Objects.equals(this.type, productSetElementResponsibleProducerIdRequest.type) && + Objects.equals(this.id, productSetElementResponsibleProducerIdRequest.id) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementResponsibleProducerIdRequest {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementResponsibleProducerIdRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementResponsibleProducerIdRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementResponsibleProducerIdRequest is not found in the empty JSON string", ProductSetElementResponsibleProducerIdRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementResponsibleProducerIdRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementResponsibleProducerIdRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementResponsibleProducerIdRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementResponsibleProducerIdRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementResponsibleProducerIdRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementResponsibleProducerIdRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementResponsibleProducerIdRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementResponsibleProducerIdRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementResponsibleProducerIdRequest + * @throws IOException if the JSON string is invalid with respect to ProductSetElementResponsibleProducerIdRequest + */ + public static ProductSetElementResponsibleProducerIdRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementResponsibleProducerIdRequest.class); + } + + /** + * Convert an instance of ProductSetElementResponsibleProducerIdRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerNameRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerNameRequest.java new file mode 100644 index 0000000..174e110 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerNameRequest.java @@ -0,0 +1,233 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSetElementResponsibleProducerNameRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementResponsibleProducerNameRequest extends ProductSetElementResponsibleProducerRequest { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public ProductSetElementResponsibleProducerNameRequest() { + this.type = this.getClass().getSimpleName(); + } + + public ProductSetElementResponsibleProducerNameRequest type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ProductSetElementResponsibleProducerNameRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of responsible producer. **Note:** This refers to the <code>name</code> property and not the <code>producerData.tradeName</code> property of responsible producer defined using <a href=\"https://developer.allegro.pl/documentation#tag/Responsible-producers\">Responsible Producers API</a>. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementResponsibleProducerNameRequest productSetElementResponsibleProducerNameRequest = (ProductSetElementResponsibleProducerNameRequest) o; + return Objects.equals(this.type, productSetElementResponsibleProducerNameRequest.type) && + Objects.equals(this.name, productSetElementResponsibleProducerNameRequest.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, name, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementResponsibleProducerNameRequest {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementResponsibleProducerNameRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementResponsibleProducerNameRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementResponsibleProducerNameRequest is not found in the empty JSON string", ProductSetElementResponsibleProducerNameRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementResponsibleProducerNameRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementResponsibleProducerNameRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementResponsibleProducerNameRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementResponsibleProducerNameRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementResponsibleProducerNameRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementResponsibleProducerNameRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementResponsibleProducerNameRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementResponsibleProducerNameRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementResponsibleProducerNameRequest + * @throws IOException if the JSON string is invalid with respect to ProductSetElementResponsibleProducerNameRequest + */ + public static ProductSetElementResponsibleProducerNameRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementResponsibleProducerNameRequest.class); + } + + /** + * Convert an instance of ProductSetElementResponsibleProducerNameRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerRequest.java new file mode 100644 index 0000000..c0c3b75 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerRequest.java @@ -0,0 +1,180 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Reference to the responsible producer configured using <a href=\"https://developer.allegro.pl/documentation#tag/Responsible-producers\">Responsible Producers API</a>. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementResponsibleProducerRequest { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type = "ID"; + + public ProductSetElementResponsibleProducerRequest() { + this.type = this.getClass().getSimpleName(); + } + + public ProductSetElementResponsibleProducerRequest type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementResponsibleProducerRequest productSetElementResponsibleProducerRequest = (ProductSetElementResponsibleProducerRequest) o; + return Objects.equals(this.type, productSetElementResponsibleProducerRequest.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementResponsibleProducerRequest {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementResponsibleProducerRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementResponsibleProducerRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementResponsibleProducerRequest is not found in the empty JSON string", ProductSetElementResponsibleProducerRequest.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "ID": + ProductSetElementResponsibleProducerIdRequest.validateJsonElement(jsonElement); + break; + case "NAME": + ProductSetElementResponsibleProducerNameRequest.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of ProductSetElementResponsibleProducerRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementResponsibleProducerRequest + * @throws IOException if the JSON string is invalid with respect to ProductSetElementResponsibleProducerRequest + */ + public static ProductSetElementResponsibleProducerRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementResponsibleProducerRequest.class); + } + + /** + * Convert an instance of ProductSetElementResponsibleProducerRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerRequestWrapper.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerRequestWrapper.java new file mode 100644 index 0000000..240a5c8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementResponsibleProducerRequestWrapper.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSetElementResponsibleProducerRequestWrapper + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementResponsibleProducerRequestWrapper { + public static final String SERIALIZED_NAME_RESPONSIBLE_PRODUCER = "responsibleProducer"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PRODUCER) + @javax.annotation.Nullable + private ProductSetElementResponsibleProducerRequest responsibleProducer; + + public ProductSetElementResponsibleProducerRequestWrapper() { + } + + public ProductSetElementResponsibleProducerRequestWrapper responsibleProducer(@javax.annotation.Nullable ProductSetElementResponsibleProducerRequest responsibleProducer) { + this.responsibleProducer = responsibleProducer; + return this; + } + + /** + * Get responsibleProducer + * @return responsibleProducer + */ + @javax.annotation.Nullable + public ProductSetElementResponsibleProducerRequest getResponsibleProducer() { + return responsibleProducer; + } + + public void setResponsibleProducer(@javax.annotation.Nullable ProductSetElementResponsibleProducerRequest responsibleProducer) { + this.responsibleProducer = responsibleProducer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementResponsibleProducerRequestWrapper productSetElementResponsibleProducerRequestWrapper = (ProductSetElementResponsibleProducerRequestWrapper) o; + return Objects.equals(this.responsibleProducer, productSetElementResponsibleProducerRequestWrapper.responsibleProducer); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleProducer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementResponsibleProducerRequestWrapper {\n"); + sb.append(" responsibleProducer: ").append(toIndentedString(responsibleProducer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("responsibleProducer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementResponsibleProducerRequestWrapper + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementResponsibleProducerRequestWrapper.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementResponsibleProducerRequestWrapper is not found in the empty JSON string", ProductSetElementResponsibleProducerRequestWrapper.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementResponsibleProducerRequestWrapper.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementResponsibleProducerRequestWrapper` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `responsibleProducer` + if (jsonObj.get("responsibleProducer") != null && !jsonObj.get("responsibleProducer").isJsonNull()) { + ProductSetElementResponsibleProducerRequest.validateJsonElement(jsonObj.get("responsibleProducer")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementResponsibleProducerRequestWrapper.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementResponsibleProducerRequestWrapper' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementResponsibleProducerRequestWrapper.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementResponsibleProducerRequestWrapper value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementResponsibleProducerRequestWrapper read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementResponsibleProducerRequestWrapper given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementResponsibleProducerRequestWrapper + * @throws IOException if the JSON string is invalid with respect to ProductSetElementResponsibleProducerRequestWrapper + */ + public static ProductSetElementResponsibleProducerRequestWrapper fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementResponsibleProducerRequestWrapper.class); + } + + /** + * Convert an instance of ProductSetElementResponsibleProducerRequestWrapper to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementSafetyInformation.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementSafetyInformation.java new file mode 100644 index 0000000..bca5186 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementSafetyInformation.java @@ -0,0 +1,183 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contains information about product's safety. Reference <a href=\"https://developer.allegro.pl/documentation#operation/createOfferAttachmentUsingPOST\">Docs</a> + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementSafetyInformation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + public ProductSetElementSafetyInformation() { + this.type = this.getClass().getSimpleName(); + } + + public ProductSetElementSafetyInformation type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementSafetyInformation productSetElementSafetyInformation = (ProductSetElementSafetyInformation) o; + return Objects.equals(this.type, productSetElementSafetyInformation.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementSafetyInformation {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementSafetyInformation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementSafetyInformation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementSafetyInformation is not found in the empty JSON string", ProductSetElementSafetyInformation.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "ATTACHMENTS": + ProductSetElementAttachmentSafetyInformation.validateJsonElement(jsonElement); + break; + case "NO_SAFETY_INFORMATION": + ProductSetElementNoSafetyInformation.validateJsonElement(jsonElement); + break; + case "TEXT": + ProductSetElementTextSafetyInformation.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of ProductSetElementSafetyInformation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementSafetyInformation + * @throws IOException if the JSON string is invalid with respect to ProductSetElementSafetyInformation + */ + public static ProductSetElementSafetyInformation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementSafetyInformation.class); + } + + /** + * Convert an instance of ProductSetElementSafetyInformation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementSafetyInformationWrapper.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementSafetyInformationWrapper.java new file mode 100644 index 0000000..997532a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementSafetyInformationWrapper.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ProductSetElementSafetyInformation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSetElementSafetyInformationWrapper + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementSafetyInformationWrapper { + public static final String SERIALIZED_NAME_SAFETY_INFORMATION = "safetyInformation"; + @SerializedName(SERIALIZED_NAME_SAFETY_INFORMATION) + @javax.annotation.Nullable + private ProductSetElementSafetyInformation safetyInformation; + + public ProductSetElementSafetyInformationWrapper() { + } + + public ProductSetElementSafetyInformationWrapper safetyInformation(@javax.annotation.Nullable ProductSetElementSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + return this; + } + + /** + * Get safetyInformation + * @return safetyInformation + */ + @javax.annotation.Nullable + public ProductSetElementSafetyInformation getSafetyInformation() { + return safetyInformation; + } + + public void setSafetyInformation(@javax.annotation.Nullable ProductSetElementSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementSafetyInformationWrapper productSetElementSafetyInformationWrapper = (ProductSetElementSafetyInformationWrapper) o; + return Objects.equals(this.safetyInformation, productSetElementSafetyInformationWrapper.safetyInformation); + } + + @Override + public int hashCode() { + return Objects.hash(safetyInformation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementSafetyInformationWrapper {\n"); + sb.append(" safetyInformation: ").append(toIndentedString(safetyInformation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("safetyInformation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementSafetyInformationWrapper + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementSafetyInformationWrapper.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementSafetyInformationWrapper is not found in the empty JSON string", ProductSetElementSafetyInformationWrapper.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementSafetyInformationWrapper.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementSafetyInformationWrapper` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `safetyInformation` + if (jsonObj.get("safetyInformation") != null && !jsonObj.get("safetyInformation").isJsonNull()) { + ProductSetElementSafetyInformation.validateJsonElement(jsonObj.get("safetyInformation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementSafetyInformationWrapper.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementSafetyInformationWrapper' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementSafetyInformationWrapper.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementSafetyInformationWrapper value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementSafetyInformationWrapper read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementSafetyInformationWrapper given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementSafetyInformationWrapper + * @throws IOException if the JSON string is invalid with respect to ProductSetElementSafetyInformationWrapper + */ + public static ProductSetElementSafetyInformationWrapper fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementSafetyInformationWrapper.class); + } + + /** + * Convert an instance of ProductSetElementSafetyInformationWrapper to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementTextSafetyInformation.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementTextSafetyInformation.java new file mode 100644 index 0000000..49edbc5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSetElementTextSafetyInformation.java @@ -0,0 +1,233 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ProductSetElementSafetyInformation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductSetElementTextSafetyInformation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSetElementTextSafetyInformation extends ProductSetElementSafetyInformation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public ProductSetElementTextSafetyInformation() { + this.type = this.getClass().getSimpleName(); + } + + public ProductSetElementTextSafetyInformation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ProductSetElementTextSafetyInformation description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Safety warnings and instructions for the product in plain text form, if the information cannot be provided through attachments. Text can't be longer than 5000 characters. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSetElementTextSafetyInformation productSetElementTextSafetyInformation = (ProductSetElementTextSafetyInformation) o; + return Objects.equals(this.type, productSetElementTextSafetyInformation.type) && + Objects.equals(this.description, productSetElementTextSafetyInformation.description) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, description, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSetElementTextSafetyInformation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSetElementTextSafetyInformation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSetElementTextSafetyInformation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSetElementTextSafetyInformation is not found in the empty JSON string", ProductSetElementTextSafetyInformation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSetElementTextSafetyInformation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSetElementTextSafetyInformation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSetElementTextSafetyInformation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSetElementTextSafetyInformation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSetElementTextSafetyInformation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSetElementTextSafetyInformation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSetElementTextSafetyInformation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSetElementTextSafetyInformation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSetElementTextSafetyInformation + * @throws IOException if the JSON string is invalid with respect to ProductSetElementTextSafetyInformation + */ + public static ProductSetElementTextSafetyInformation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSetElementTextSafetyInformation.class); + } + + /** + * Convert an instance of ProductSetElementTextSafetyInformation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductSimilarCategoryWithPath.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductSimilarCategoryWithPath.java new file mode 100644 index 0000000..c6131e6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductSimilarCategoryWithPath.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ProductsCategoryPath; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Category in which the product can be listed for sale + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductSimilarCategoryWithPath { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private List path = new ArrayList<>(); + + public ProductSimilarCategoryWithPath() { + } + + public ProductSimilarCategoryWithPath id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Category identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductSimilarCategoryWithPath path(@javax.annotation.Nullable List path) { + this.path = path; + return this; + } + + public ProductSimilarCategoryWithPath addPathItem(ProductsCategoryPath pathItem) { + if (this.path == null) { + this.path = new ArrayList<>(); + } + this.path.add(pathItem); + return this; + } + + /** + * Get path + * @return path + */ + @javax.annotation.Nullable + public List getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable List path) { + this.path = path; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductSimilarCategoryWithPath productSimilarCategoryWithPath = (ProductSimilarCategoryWithPath) o; + return Objects.equals(this.id, productSimilarCategoryWithPath.id) && + Objects.equals(this.path, productSimilarCategoryWithPath.path); + } + + @Override + public int hashCode() { + return Objects.hash(id, path); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductSimilarCategoryWithPath {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("path"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductSimilarCategoryWithPath + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductSimilarCategoryWithPath.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductSimilarCategoryWithPath is not found in the empty JSON string", ProductSimilarCategoryWithPath.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductSimilarCategoryWithPath.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductSimilarCategoryWithPath` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) { + JsonArray jsonArraypath = jsonObj.getAsJsonArray("path"); + if (jsonArraypath != null) { + // ensure the json data is an array + if (!jsonObj.get("path").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be an array in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + + // validate the optional field `path` (array) + for (int i = 0; i < jsonArraypath.size(); i++) { + ProductsCategoryPath.validateJsonElement(jsonArraypath.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductSimilarCategoryWithPath.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductSimilarCategoryWithPath' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductSimilarCategoryWithPath.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductSimilarCategoryWithPath value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductSimilarCategoryWithPath read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductSimilarCategoryWithPath given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductSimilarCategoryWithPath + * @throws IOException if the JSON string is invalid with respect to ProductSimilarCategoryWithPath + */ + public static ProductSimilarCategoryWithPath fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductSimilarCategoryWithPath.class); + } + + /** + * Convert an instance of ProductSimilarCategoryWithPath to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductsCategoryPath.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductsCategoryPath.java new file mode 100644 index 0000000..7272782 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductsCategoryPath.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductsCategoryPath + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductsCategoryPath { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public ProductsCategoryPath() { + } + + public ProductsCategoryPath id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Category id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductsCategoryPath name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Category name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductsCategoryPath productsCategoryPath = (ProductsCategoryPath) o; + return Objects.equals(this.id, productsCategoryPath.id) && + Objects.equals(this.name, productsCategoryPath.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductsCategoryPath {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductsCategoryPath + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductsCategoryPath.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductsCategoryPath is not found in the empty JSON string", ProductsCategoryPath.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductsCategoryPath.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductsCategoryPath` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductsCategoryPath.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductsCategoryPath' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductsCategoryPath.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductsCategoryPath value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductsCategoryPath read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductsCategoryPath given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductsCategoryPath + * @throws IOException if the JSON string is invalid with respect to ProductsCategoryPath + */ + public static ProductsCategoryPath fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductsCategoryPath.class); + } + + /** + * Convert an instance of ProductsCategoryPath to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProductsCategorySubcategories.java b/src/main/java/pl/wtx/allegro/api/client/model/ProductsCategorySubcategories.java new file mode 100644 index 0000000..dd2d5c5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProductsCategorySubcategories.java @@ -0,0 +1,264 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProductsCategorySubcategories + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProductsCategorySubcategories { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public ProductsCategorySubcategories() { + } + + public ProductsCategorySubcategories id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Category id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ProductsCategorySubcategories name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Category name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ProductsCategorySubcategories count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Total number of products matching query criteria in this category. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductsCategorySubcategories productsCategorySubcategories = (ProductsCategorySubcategories) o; + return Objects.equals(this.id, productsCategorySubcategories.id) && + Objects.equals(this.name, productsCategorySubcategories.name) && + Objects.equals(this.count, productsCategorySubcategories.count); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, count); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductsCategorySubcategories {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("count"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductsCategorySubcategories + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductsCategorySubcategories.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductsCategorySubcategories is not found in the empty JSON string", ProductsCategorySubcategories.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProductsCategorySubcategories.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProductsCategorySubcategories` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductsCategorySubcategories.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductsCategorySubcategories' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductsCategorySubcategories.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductsCategorySubcategories value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProductsCategorySubcategories read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProductsCategorySubcategories given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductsCategorySubcategories + * @throws IOException if the JSON string is invalid with respect to ProductsCategorySubcategories + */ + public static ProductsCategorySubcategories fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductsCategorySubcategories.class); + } + + /** + * Convert an instance of ProductsCategorySubcategories to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromoGeneralReport.java b/src/main/java/pl/wtx/allegro/api/client/model/PromoGeneralReport.java new file mode 100644 index 0000000..3d349de --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromoGeneralReport.java @@ -0,0 +1,238 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.TaskCount; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Command execution summary + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromoGeneralReport { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_TASK_COUNT = "taskCount"; + @SerializedName(SERIALIZED_NAME_TASK_COUNT) + @javax.annotation.Nullable + private TaskCount taskCount; + + public PromoGeneralReport() { + } + + public PromoGeneralReport id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Command ID + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public PromoGeneralReport taskCount(@javax.annotation.Nullable TaskCount taskCount) { + this.taskCount = taskCount; + return this; + } + + /** + * Get taskCount + * @return taskCount + */ + @javax.annotation.Nullable + public TaskCount getTaskCount() { + return taskCount; + } + + public void setTaskCount(@javax.annotation.Nullable TaskCount taskCount) { + this.taskCount = taskCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromoGeneralReport promoGeneralReport = (PromoGeneralReport) o; + return Objects.equals(this.id, promoGeneralReport.id) && + Objects.equals(this.taskCount, promoGeneralReport.taskCount); + } + + @Override + public int hashCode() { + return Objects.hash(id, taskCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromoGeneralReport {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" taskCount: ").append(toIndentedString(taskCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("taskCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromoGeneralReport + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromoGeneralReport.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromoGeneralReport is not found in the empty JSON string", PromoGeneralReport.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromoGeneralReport.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromoGeneralReport` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `taskCount` + if (jsonObj.get("taskCount") != null && !jsonObj.get("taskCount").isJsonNull()) { + TaskCount.validateJsonElement(jsonObj.get("taskCount")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromoGeneralReport.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromoGeneralReport' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromoGeneralReport.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromoGeneralReport value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromoGeneralReport read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromoGeneralReport given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromoGeneralReport + * @throws IOException if the JSON string is invalid with respect to PromoGeneralReport + */ + public static PromoGeneralReport fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromoGeneralReport.class); + } + + /** + * Convert an instance of PromoGeneralReport to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromoModificationReport.java b/src/main/java/pl/wtx/allegro/api/client/model/PromoModificationReport.java new file mode 100644 index 0000000..1043355 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromoModificationReport.java @@ -0,0 +1,310 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacePromoOptionsCommandModification; +import pl.wtx.allegro.api.client.model.PromoModificationTask; +import pl.wtx.allegro.api.client.model.PromoOptionsCommandModification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PromoModificationReport + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromoModificationReport { + public static final String SERIALIZED_NAME_TASKS = "tasks"; + @SerializedName(SERIALIZED_NAME_TASKS) + @javax.annotation.Nullable + private List tasks = new ArrayList<>(); + + public static final String SERIALIZED_NAME_MODIFICATION = "modification"; + @SerializedName(SERIALIZED_NAME_MODIFICATION) + @javax.annotation.Nullable + private PromoOptionsCommandModification modification; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private List additionalMarketplaces = new ArrayList<>(); + + public PromoModificationReport() { + } + + public PromoModificationReport tasks(@javax.annotation.Nullable List tasks) { + this.tasks = tasks; + return this; + } + + public PromoModificationReport addTasksItem(PromoModificationTask tasksItem) { + if (this.tasks == null) { + this.tasks = new ArrayList<>(); + } + this.tasks.add(tasksItem); + return this; + } + + /** + * Offer promotion modification tasks. + * @return tasks + */ + @javax.annotation.Nullable + public List getTasks() { + return tasks; + } + + public void setTasks(@javax.annotation.Nullable List tasks) { + this.tasks = tasks; + } + + + public PromoModificationReport modification(@javax.annotation.Nullable PromoOptionsCommandModification modification) { + this.modification = modification; + return this; + } + + /** + * Get modification + * @return modification + */ + @javax.annotation.Nullable + public PromoOptionsCommandModification getModification() { + return modification; + } + + public void setModification(@javax.annotation.Nullable PromoOptionsCommandModification modification) { + this.modification = modification; + } + + + public PromoModificationReport additionalMarketplaces(@javax.annotation.Nullable List additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public PromoModificationReport addAdditionalMarketplacesItem(AdditionalMarketplacePromoOptionsCommandModification additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new ArrayList<>(); + } + this.additionalMarketplaces.add(additionalMarketplacesItem); + return this; + } + + /** + * Get additionalMarketplaces + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public List getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable List additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromoModificationReport promoModificationReport = (PromoModificationReport) o; + return Objects.equals(this.tasks, promoModificationReport.tasks) && + Objects.equals(this.modification, promoModificationReport.modification) && + Objects.equals(this.additionalMarketplaces, promoModificationReport.additionalMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(tasks, modification, additionalMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromoModificationReport {\n"); + sb.append(" tasks: ").append(toIndentedString(tasks)).append("\n"); + sb.append(" modification: ").append(toIndentedString(modification)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tasks"); + openapiFields.add("modification"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromoModificationReport + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromoModificationReport.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromoModificationReport is not found in the empty JSON string", PromoModificationReport.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromoModificationReport.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromoModificationReport` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("tasks") != null && !jsonObj.get("tasks").isJsonNull()) { + JsonArray jsonArraytasks = jsonObj.getAsJsonArray("tasks"); + if (jsonArraytasks != null) { + // ensure the json data is an array + if (!jsonObj.get("tasks").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tasks` to be an array in the JSON string but got `%s`", jsonObj.get("tasks").toString())); + } + + // validate the optional field `tasks` (array) + for (int i = 0; i < jsonArraytasks.size(); i++) { + PromoModificationTask.validateJsonElement(jsonArraytasks.get(i)); + }; + } + } + // validate the optional field `modification` + if (jsonObj.get("modification") != null && !jsonObj.get("modification").isJsonNull()) { + PromoOptionsCommandModification.validateJsonElement(jsonObj.get("modification")); + } + if (jsonObj.get("additionalMarketplaces") != null && !jsonObj.get("additionalMarketplaces").isJsonNull()) { + JsonArray jsonArrayadditionalMarketplaces = jsonObj.getAsJsonArray("additionalMarketplaces"); + if (jsonArrayadditionalMarketplaces != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalMarketplaces").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalMarketplaces` to be an array in the JSON string but got `%s`", jsonObj.get("additionalMarketplaces").toString())); + } + + // validate the optional field `additionalMarketplaces` (array) + for (int i = 0; i < jsonArrayadditionalMarketplaces.size(); i++) { + AdditionalMarketplacePromoOptionsCommandModification.validateJsonElement(jsonArrayadditionalMarketplaces.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromoModificationReport.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromoModificationReport' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromoModificationReport.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromoModificationReport value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromoModificationReport read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromoModificationReport given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromoModificationReport + * @throws IOException if the JSON string is invalid with respect to PromoModificationReport + */ + public static PromoModificationReport fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromoModificationReport.class); + } + + /** + * Convert an instance of PromoModificationReport to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromoModificationTask.java b/src/main/java/pl/wtx/allegro/api/client/model/PromoModificationTask.java new file mode 100644 index 0000000..3d8562a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromoModificationTask.java @@ -0,0 +1,433 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error; +import pl.wtx.allegro.api.client.model.OfferId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PromoModificationTask + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromoModificationTask { + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private OfferId offer; + + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + public static final String SERIALIZED_NAME_SCHEDULED_AT = "scheduledAt"; + @SerializedName(SERIALIZED_NAME_SCHEDULED_AT) + @javax.annotation.Nullable + private OffsetDateTime scheduledAt; + + public static final String SERIALIZED_NAME_FINISHED_AT = "finishedAt"; + @SerializedName(SERIALIZED_NAME_FINISHED_AT) + @javax.annotation.Nullable + private OffsetDateTime finishedAt; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + DONE("DONE"), + + ERROR("ERROR"), + + IN_PROGRESS("IN_PROGRESS"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nullable + private List errors = new ArrayList<>(); + + public PromoModificationTask() { + } + + public PromoModificationTask offer(@javax.annotation.Nullable OfferId offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public OfferId getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable OfferId offer) { + this.offer = offer; + } + + + public PromoModificationTask marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * Get marketplaceId + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + public PromoModificationTask scheduledAt(@javax.annotation.Nullable OffsetDateTime scheduledAt) { + this.scheduledAt = scheduledAt; + return this; + } + + /** + * Date on which the promotion modification task was scheduled: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + * @return scheduledAt + */ + @javax.annotation.Nullable + public OffsetDateTime getScheduledAt() { + return scheduledAt; + } + + public void setScheduledAt(@javax.annotation.Nullable OffsetDateTime scheduledAt) { + this.scheduledAt = scheduledAt; + } + + + public PromoModificationTask finishedAt(@javax.annotation.Nullable OffsetDateTime finishedAt) { + this.finishedAt = finishedAt; + return this; + } + + /** + * Date on which the promotion modification task finished processing: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + * @return finishedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getFinishedAt() { + return finishedAt; + } + + public void setFinishedAt(@javax.annotation.Nullable OffsetDateTime finishedAt) { + this.finishedAt = finishedAt; + } + + + public PromoModificationTask status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public PromoModificationTask errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public PromoModificationTask addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * The list of all the error objects explaining the error. + * @return errors + */ + @javax.annotation.Nullable + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nullable List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromoModificationTask promoModificationTask = (PromoModificationTask) o; + return Objects.equals(this.offer, promoModificationTask.offer) && + Objects.equals(this.marketplaceId, promoModificationTask.marketplaceId) && + Objects.equals(this.scheduledAt, promoModificationTask.scheduledAt) && + Objects.equals(this.finishedAt, promoModificationTask.finishedAt) && + Objects.equals(this.status, promoModificationTask.status) && + Objects.equals(this.errors, promoModificationTask.errors); + } + + @Override + public int hashCode() { + return Objects.hash(offer, marketplaceId, scheduledAt, finishedAt, status, errors); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromoModificationTask {\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append(" scheduledAt: ").append(toIndentedString(scheduledAt)).append("\n"); + sb.append(" finishedAt: ").append(toIndentedString(finishedAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offer"); + openapiFields.add("marketplaceId"); + openapiFields.add("scheduledAt"); + openapiFields.add("finishedAt"); + openapiFields.add("status"); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromoModificationTask + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromoModificationTask.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromoModificationTask is not found in the empty JSON string", PromoModificationTask.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromoModificationTask.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromoModificationTask` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + OfferId.validateJsonElement(jsonObj.get("offer")); + } + if ((jsonObj.get("marketplaceId") != null && !jsonObj.get("marketplaceId").isJsonNull()) && !jsonObj.get("marketplaceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("marketplaceId").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if (jsonObj.get("errors") != null && !jsonObj.get("errors").isJsonNull()) { + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + if (jsonArrayerrors != null) { + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + // validate the optional field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromoModificationTask.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromoModificationTask' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromoModificationTask.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromoModificationTask value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromoModificationTask read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromoModificationTask given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromoModificationTask + * @throws IOException if the JSON string is invalid with respect to PromoModificationTask + */ + public static PromoModificationTask fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromoModificationTask.class); + } + + /** + * Convert an instance of PromoModificationTask to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommand.java b/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommand.java new file mode 100644 index 0000000..b67fac1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommand.java @@ -0,0 +1,310 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacePromoOptionsCommandModification; +import pl.wtx.allegro.api.client.model.OfferCriterium; +import pl.wtx.allegro.api.client.model.PromoOptionsCommandModification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PromoOptionsCommand + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromoOptionsCommand { + public static final String SERIALIZED_NAME_OFFER_CRITERIA = "offerCriteria"; + @SerializedName(SERIALIZED_NAME_OFFER_CRITERIA) + @javax.annotation.Nullable + private List offerCriteria = new ArrayList<>(); + + public static final String SERIALIZED_NAME_MODIFICATION = "modification"; + @SerializedName(SERIALIZED_NAME_MODIFICATION) + @javax.annotation.Nullable + private PromoOptionsCommandModification modification; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private List additionalMarketplaces = new ArrayList<>(); + + public PromoOptionsCommand() { + } + + public PromoOptionsCommand offerCriteria(@javax.annotation.Nullable List offerCriteria) { + this.offerCriteria = offerCriteria; + return this; + } + + public PromoOptionsCommand addOfferCriteriaItem(OfferCriterium offerCriteriaItem) { + if (this.offerCriteria == null) { + this.offerCriteria = new ArrayList<>(); + } + this.offerCriteria.add(offerCriteriaItem); + return this; + } + + /** + * Offer choice criteria. + * @return offerCriteria + */ + @javax.annotation.Nullable + public List getOfferCriteria() { + return offerCriteria; + } + + public void setOfferCriteria(@javax.annotation.Nullable List offerCriteria) { + this.offerCriteria = offerCriteria; + } + + + public PromoOptionsCommand modification(@javax.annotation.Nullable PromoOptionsCommandModification modification) { + this.modification = modification; + return this; + } + + /** + * Get modification + * @return modification + */ + @javax.annotation.Nullable + public PromoOptionsCommandModification getModification() { + return modification; + } + + public void setModification(@javax.annotation.Nullable PromoOptionsCommandModification modification) { + this.modification = modification; + } + + + public PromoOptionsCommand additionalMarketplaces(@javax.annotation.Nullable List additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public PromoOptionsCommand addAdditionalMarketplacesItem(AdditionalMarketplacePromoOptionsCommandModification additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new ArrayList<>(); + } + this.additionalMarketplaces.add(additionalMarketplacesItem); + return this; + } + + /** + * Get additionalMarketplaces + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public List getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable List additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromoOptionsCommand promoOptionsCommand = (PromoOptionsCommand) o; + return Objects.equals(this.offerCriteria, promoOptionsCommand.offerCriteria) && + Objects.equals(this.modification, promoOptionsCommand.modification) && + Objects.equals(this.additionalMarketplaces, promoOptionsCommand.additionalMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(offerCriteria, modification, additionalMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromoOptionsCommand {\n"); + sb.append(" offerCriteria: ").append(toIndentedString(offerCriteria)).append("\n"); + sb.append(" modification: ").append(toIndentedString(modification)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offerCriteria"); + openapiFields.add("modification"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromoOptionsCommand + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromoOptionsCommand.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromoOptionsCommand is not found in the empty JSON string", PromoOptionsCommand.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromoOptionsCommand.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromoOptionsCommand` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("offerCriteria") != null && !jsonObj.get("offerCriteria").isJsonNull()) { + JsonArray jsonArrayofferCriteria = jsonObj.getAsJsonArray("offerCriteria"); + if (jsonArrayofferCriteria != null) { + // ensure the json data is an array + if (!jsonObj.get("offerCriteria").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerCriteria` to be an array in the JSON string but got `%s`", jsonObj.get("offerCriteria").toString())); + } + + // validate the optional field `offerCriteria` (array) + for (int i = 0; i < jsonArrayofferCriteria.size(); i++) { + OfferCriterium.validateJsonElement(jsonArrayofferCriteria.get(i)); + }; + } + } + // validate the optional field `modification` + if (jsonObj.get("modification") != null && !jsonObj.get("modification").isJsonNull()) { + PromoOptionsCommandModification.validateJsonElement(jsonObj.get("modification")); + } + if (jsonObj.get("additionalMarketplaces") != null && !jsonObj.get("additionalMarketplaces").isJsonNull()) { + JsonArray jsonArrayadditionalMarketplaces = jsonObj.getAsJsonArray("additionalMarketplaces"); + if (jsonArrayadditionalMarketplaces != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalMarketplaces").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalMarketplaces` to be an array in the JSON string but got `%s`", jsonObj.get("additionalMarketplaces").toString())); + } + + // validate the optional field `additionalMarketplaces` (array) + for (int i = 0; i < jsonArrayadditionalMarketplaces.size(); i++) { + AdditionalMarketplacePromoOptionsCommandModification.validateJsonElement(jsonArrayadditionalMarketplaces.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromoOptionsCommand.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromoOptionsCommand' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromoOptionsCommand.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromoOptionsCommand value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromoOptionsCommand read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromoOptionsCommand given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromoOptionsCommand + * @throws IOException if the JSON string is invalid with respect to PromoOptionsCommand + */ + public static PromoOptionsCommand fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromoOptionsCommand.class); + } + + /** + * Convert an instance of PromoOptionsCommand to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommandModification.java b/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommandModification.java new file mode 100644 index 0000000..d6fdc5b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommandModification.java @@ -0,0 +1,345 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.PromoOptionsCommandModificationPackage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PromoOptionsCommandModification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromoOptionsCommandModification { + public static final String SERIALIZED_NAME_BASE_PACKAGE = "basePackage"; + @SerializedName(SERIALIZED_NAME_BASE_PACKAGE) + @javax.annotation.Nullable + private PromoOptionsCommandModificationPackage basePackage; + + public static final String SERIALIZED_NAME_EXTRA_PACKAGES = "extraPackages"; + @SerializedName(SERIALIZED_NAME_EXTRA_PACKAGES) + @javax.annotation.Nullable + private List extraPackages = new ArrayList<>(); + + /** + * Time at which the modification will be applied. + */ + @JsonAdapter(ModificationTimeEnum.Adapter.class) + public enum ModificationTimeEnum { + NOW("NOW"), + + END_OF_CYCLE("END_OF_CYCLE"); + + private String value; + + ModificationTimeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ModificationTimeEnum fromValue(String value) { + for (ModificationTimeEnum b : ModificationTimeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ModificationTimeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ModificationTimeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ModificationTimeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ModificationTimeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_MODIFICATION_TIME = "modificationTime"; + @SerializedName(SERIALIZED_NAME_MODIFICATION_TIME) + @javax.annotation.Nullable + private ModificationTimeEnum modificationTime; + + public PromoOptionsCommandModification() { + } + + public PromoOptionsCommandModification basePackage(@javax.annotation.Nullable PromoOptionsCommandModificationPackage basePackage) { + this.basePackage = basePackage; + return this; + } + + /** + * The base package. Available packages can be determined using <a href=\"#operation/getAvailableOfferPromotionPackages\">GET /sale/offer-promotion-packages</a>. + * @return basePackage + */ + @javax.annotation.Nullable + public PromoOptionsCommandModificationPackage getBasePackage() { + return basePackage; + } + + public void setBasePackage(@javax.annotation.Nullable PromoOptionsCommandModificationPackage basePackage) { + this.basePackage = basePackage; + } + + + public PromoOptionsCommandModification extraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + return this; + } + + public PromoOptionsCommandModification addExtraPackagesItem(PromoOptionsCommandModificationPackage extraPackagesItem) { + if (this.extraPackages == null) { + this.extraPackages = new ArrayList<>(); + } + this.extraPackages.add(extraPackagesItem); + return this; + } + + /** + * Extra packages to be set on offer. Omitting this parameter will preserve the packages already present. + * @return extraPackages + */ + @javax.annotation.Nullable + public List getExtraPackages() { + return extraPackages; + } + + public void setExtraPackages(@javax.annotation.Nullable List extraPackages) { + this.extraPackages = extraPackages; + } + + + public PromoOptionsCommandModification modificationTime(@javax.annotation.Nullable ModificationTimeEnum modificationTime) { + this.modificationTime = modificationTime; + return this; + } + + /** + * Time at which the modification will be applied. + * @return modificationTime + */ + @javax.annotation.Nullable + public ModificationTimeEnum getModificationTime() { + return modificationTime; + } + + public void setModificationTime(@javax.annotation.Nullable ModificationTimeEnum modificationTime) { + this.modificationTime = modificationTime; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromoOptionsCommandModification promoOptionsCommandModification = (PromoOptionsCommandModification) o; + return Objects.equals(this.basePackage, promoOptionsCommandModification.basePackage) && + Objects.equals(this.extraPackages, promoOptionsCommandModification.extraPackages) && + Objects.equals(this.modificationTime, promoOptionsCommandModification.modificationTime); + } + + @Override + public int hashCode() { + return Objects.hash(basePackage, extraPackages, modificationTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromoOptionsCommandModification {\n"); + sb.append(" basePackage: ").append(toIndentedString(basePackage)).append("\n"); + sb.append(" extraPackages: ").append(toIndentedString(extraPackages)).append("\n"); + sb.append(" modificationTime: ").append(toIndentedString(modificationTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("basePackage"); + openapiFields.add("extraPackages"); + openapiFields.add("modificationTime"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromoOptionsCommandModification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromoOptionsCommandModification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromoOptionsCommandModification is not found in the empty JSON string", PromoOptionsCommandModification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromoOptionsCommandModification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromoOptionsCommandModification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `basePackage` + if (jsonObj.get("basePackage") != null && !jsonObj.get("basePackage").isJsonNull()) { + PromoOptionsCommandModificationPackage.validateJsonElement(jsonObj.get("basePackage")); + } + if (jsonObj.get("extraPackages") != null && !jsonObj.get("extraPackages").isJsonNull()) { + JsonArray jsonArrayextraPackages = jsonObj.getAsJsonArray("extraPackages"); + if (jsonArrayextraPackages != null) { + // ensure the json data is an array + if (!jsonObj.get("extraPackages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `extraPackages` to be an array in the JSON string but got `%s`", jsonObj.get("extraPackages").toString())); + } + + // validate the optional field `extraPackages` (array) + for (int i = 0; i < jsonArrayextraPackages.size(); i++) { + PromoOptionsCommandModificationPackage.validateJsonElement(jsonArrayextraPackages.get(i)); + }; + } + } + if ((jsonObj.get("modificationTime") != null && !jsonObj.get("modificationTime").isJsonNull()) && !jsonObj.get("modificationTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `modificationTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("modificationTime").toString())); + } + // validate the optional field `modificationTime` + if (jsonObj.get("modificationTime") != null && !jsonObj.get("modificationTime").isJsonNull()) { + ModificationTimeEnum.validateJsonElement(jsonObj.get("modificationTime")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromoOptionsCommandModification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromoOptionsCommandModification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromoOptionsCommandModification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromoOptionsCommandModification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromoOptionsCommandModification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromoOptionsCommandModification given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromoOptionsCommandModification + * @throws IOException if the JSON string is invalid with respect to PromoOptionsCommandModification + */ + public static PromoOptionsCommandModification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromoOptionsCommandModification.class); + } + + /** + * Convert an instance of PromoOptionsCommandModification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommandModificationPackage.java b/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommandModificationPackage.java new file mode 100644 index 0000000..d3718fd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsCommandModificationPackage.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PromoOptionsCommandModificationPackage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromoOptionsCommandModificationPackage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public PromoOptionsCommandModificationPackage() { + } + + public PromoOptionsCommandModificationPackage id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromoOptionsCommandModificationPackage promoOptionsCommandModificationPackage = (PromoOptionsCommandModificationPackage) o; + return Objects.equals(this.id, promoOptionsCommandModificationPackage.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromoOptionsCommandModificationPackage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromoOptionsCommandModificationPackage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromoOptionsCommandModificationPackage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromoOptionsCommandModificationPackage is not found in the empty JSON string", PromoOptionsCommandModificationPackage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromoOptionsCommandModificationPackage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromoOptionsCommandModificationPackage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromoOptionsCommandModificationPackage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromoOptionsCommandModificationPackage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromoOptionsCommandModificationPackage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromoOptionsCommandModificationPackage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromoOptionsCommandModificationPackage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromoOptionsCommandModificationPackage given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromoOptionsCommandModificationPackage + * @throws IOException if the JSON string is invalid with respect to PromoOptionsCommandModificationPackage + */ + public static PromoOptionsCommandModificationPackage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromoOptionsCommandModificationPackage.class); + } + + /** + * Convert an instance of PromoOptionsCommandModificationPackage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsModification.java b/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsModification.java new file mode 100644 index 0000000..e86ae50 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsModification.java @@ -0,0 +1,380 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PromoOptionsModification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromoOptionsModification { + /** + * Type of modification to be applied. + */ + @JsonAdapter(ModificationTypeEnum.Adapter.class) + public enum ModificationTypeEnum { + CHANGE("CHANGE"), + + REMOVE_WITH_END_OF_CYCLE("REMOVE_WITH_END_OF_CYCLE"), + + REMOVE_NOW("REMOVE_NOW"); + + private String value; + + ModificationTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ModificationTypeEnum fromValue(String value) { + for (ModificationTypeEnum b : ModificationTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ModificationTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ModificationTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ModificationTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ModificationTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_MODIFICATION_TYPE = "modificationType"; + @SerializedName(SERIALIZED_NAME_MODIFICATION_TYPE) + @javax.annotation.Nullable + private ModificationTypeEnum modificationType; + + /** + * Type of promotion package to be changed/removed. + */ + @JsonAdapter(PackageTypeEnum.Adapter.class) + public enum PackageTypeEnum { + BASE("BASE"), + + EXTRA("EXTRA"); + + private String value; + + PackageTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PackageTypeEnum fromValue(String value) { + for (PackageTypeEnum b : PackageTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PackageTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PackageTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PackageTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + PackageTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_PACKAGE_TYPE = "packageType"; + @SerializedName(SERIALIZED_NAME_PACKAGE_TYPE) + @javax.annotation.Nullable + private PackageTypeEnum packageType; + + public static final String SERIALIZED_NAME_PACKAGE_ID = "packageId"; + @SerializedName(SERIALIZED_NAME_PACKAGE_ID) + @javax.annotation.Nullable + private String packageId; + + public PromoOptionsModification() { + } + + public PromoOptionsModification modificationType(@javax.annotation.Nullable ModificationTypeEnum modificationType) { + this.modificationType = modificationType; + return this; + } + + /** + * Type of modification to be applied. + * @return modificationType + */ + @javax.annotation.Nullable + public ModificationTypeEnum getModificationType() { + return modificationType; + } + + public void setModificationType(@javax.annotation.Nullable ModificationTypeEnum modificationType) { + this.modificationType = modificationType; + } + + + public PromoOptionsModification packageType(@javax.annotation.Nullable PackageTypeEnum packageType) { + this.packageType = packageType; + return this; + } + + /** + * Type of promotion package to be changed/removed. + * @return packageType + */ + @javax.annotation.Nullable + public PackageTypeEnum getPackageType() { + return packageType; + } + + public void setPackageType(@javax.annotation.Nullable PackageTypeEnum packageType) { + this.packageType = packageType; + } + + + public PromoOptionsModification packageId(@javax.annotation.Nullable String packageId) { + this.packageId = packageId; + return this; + } + + /** + * Promotion package identifier. + * @return packageId + */ + @javax.annotation.Nullable + public String getPackageId() { + return packageId; + } + + public void setPackageId(@javax.annotation.Nullable String packageId) { + this.packageId = packageId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromoOptionsModification promoOptionsModification = (PromoOptionsModification) o; + return Objects.equals(this.modificationType, promoOptionsModification.modificationType) && + Objects.equals(this.packageType, promoOptionsModification.packageType) && + Objects.equals(this.packageId, promoOptionsModification.packageId); + } + + @Override + public int hashCode() { + return Objects.hash(modificationType, packageType, packageId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromoOptionsModification {\n"); + sb.append(" modificationType: ").append(toIndentedString(modificationType)).append("\n"); + sb.append(" packageType: ").append(toIndentedString(packageType)).append("\n"); + sb.append(" packageId: ").append(toIndentedString(packageId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("modificationType"); + openapiFields.add("packageType"); + openapiFields.add("packageId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromoOptionsModification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromoOptionsModification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromoOptionsModification is not found in the empty JSON string", PromoOptionsModification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromoOptionsModification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromoOptionsModification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("modificationType") != null && !jsonObj.get("modificationType").isJsonNull()) && !jsonObj.get("modificationType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `modificationType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("modificationType").toString())); + } + // validate the optional field `modificationType` + if (jsonObj.get("modificationType") != null && !jsonObj.get("modificationType").isJsonNull()) { + ModificationTypeEnum.validateJsonElement(jsonObj.get("modificationType")); + } + if ((jsonObj.get("packageType") != null && !jsonObj.get("packageType").isJsonNull()) && !jsonObj.get("packageType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `packageType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("packageType").toString())); + } + // validate the optional field `packageType` + if (jsonObj.get("packageType") != null && !jsonObj.get("packageType").isJsonNull()) { + PackageTypeEnum.validateJsonElement(jsonObj.get("packageType")); + } + if ((jsonObj.get("packageId") != null && !jsonObj.get("packageId").isJsonNull()) && !jsonObj.get("packageId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `packageId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("packageId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromoOptionsModification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromoOptionsModification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromoOptionsModification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromoOptionsModification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromoOptionsModification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromoOptionsModification given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromoOptionsModification + * @throws IOException if the JSON string is invalid with respect to PromoOptionsModification + */ + public static PromoOptionsModification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromoOptionsModification.class); + } + + /** + * Convert an instance of PromoOptionsModification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsModifications.java b/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsModifications.java new file mode 100644 index 0000000..f1f6458 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromoOptionsModifications.java @@ -0,0 +1,278 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacePromoOptionsModification; +import pl.wtx.allegro.api.client.model.PromoOptionsModification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PromoOptionsModifications + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromoOptionsModifications { + public static final String SERIALIZED_NAME_MODIFICATIONS = "modifications"; + @SerializedName(SERIALIZED_NAME_MODIFICATIONS) + @javax.annotation.Nullable + private List modifications = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private List additionalMarketplaces = new ArrayList<>(); + + public PromoOptionsModifications() { + } + + public PromoOptionsModifications modifications(@javax.annotation.Nullable List modifications) { + this.modifications = modifications; + return this; + } + + public PromoOptionsModifications addModificationsItem(PromoOptionsModification modificationsItem) { + if (this.modifications == null) { + this.modifications = new ArrayList<>(); + } + this.modifications.add(modificationsItem); + return this; + } + + /** + * Promo package modifications to be applied. + * @return modifications + */ + @javax.annotation.Nullable + public List getModifications() { + return modifications; + } + + public void setModifications(@javax.annotation.Nullable List modifications) { + this.modifications = modifications; + } + + + public PromoOptionsModifications additionalMarketplaces(@javax.annotation.Nullable List additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public PromoOptionsModifications addAdditionalMarketplacesItem(AdditionalMarketplacePromoOptionsModification additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new ArrayList<>(); + } + this.additionalMarketplaces.add(additionalMarketplacesItem); + return this; + } + + /** + * Promo package modifications to be applied on additional marketplaces. + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public List getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable List additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromoOptionsModifications promoOptionsModifications = (PromoOptionsModifications) o; + return Objects.equals(this.modifications, promoOptionsModifications.modifications) && + Objects.equals(this.additionalMarketplaces, promoOptionsModifications.additionalMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(modifications, additionalMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromoOptionsModifications {\n"); + sb.append(" modifications: ").append(toIndentedString(modifications)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("modifications"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromoOptionsModifications + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromoOptionsModifications.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromoOptionsModifications is not found in the empty JSON string", PromoOptionsModifications.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromoOptionsModifications.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromoOptionsModifications` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("modifications") != null && !jsonObj.get("modifications").isJsonNull()) { + JsonArray jsonArraymodifications = jsonObj.getAsJsonArray("modifications"); + if (jsonArraymodifications != null) { + // ensure the json data is an array + if (!jsonObj.get("modifications").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `modifications` to be an array in the JSON string but got `%s`", jsonObj.get("modifications").toString())); + } + + // validate the optional field `modifications` (array) + for (int i = 0; i < jsonArraymodifications.size(); i++) { + PromoOptionsModification.validateJsonElement(jsonArraymodifications.get(i)); + }; + } + } + if (jsonObj.get("additionalMarketplaces") != null && !jsonObj.get("additionalMarketplaces").isJsonNull()) { + JsonArray jsonArrayadditionalMarketplaces = jsonObj.getAsJsonArray("additionalMarketplaces"); + if (jsonArrayadditionalMarketplaces != null) { + // ensure the json data is an array + if (!jsonObj.get("additionalMarketplaces").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalMarketplaces` to be an array in the JSON string but got `%s`", jsonObj.get("additionalMarketplaces").toString())); + } + + // validate the optional field `additionalMarketplaces` (array) + for (int i = 0; i < jsonArrayadditionalMarketplaces.size(); i++) { + AdditionalMarketplacePromoOptionsModification.validateJsonElement(jsonArrayadditionalMarketplaces.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromoOptionsModifications.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromoOptionsModifications' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromoOptionsModifications.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromoOptionsModifications value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromoOptionsModifications read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromoOptionsModifications given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromoOptionsModifications + * @throws IOException if the JSON string is invalid with respect to PromoOptionsModifications + */ + public static PromoOptionsModifications fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromoOptionsModifications.class); + } + + /** + * Convert an instance of PromoOptionsModifications to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Promotion.java b/src/main/java/pl/wtx/allegro/api/client/model/Promotion.java new file mode 100644 index 0000000..aae3ec7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Promotion.java @@ -0,0 +1,284 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Promo options on base marketplace. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Promotion { + public static final String SERIALIZED_NAME_EMPHASIZED1D = "emphasized1d"; + @SerializedName(SERIALIZED_NAME_EMPHASIZED1D) + @javax.annotation.Nullable + private Boolean emphasized1d; + + public static final String SERIALIZED_NAME_EMPHASIZED10D = "emphasized10d"; + @SerializedName(SERIALIZED_NAME_EMPHASIZED10D) + @javax.annotation.Nullable + private Boolean emphasized10d; + + public static final String SERIALIZED_NAME_PROMO_PACKAGE = "promoPackage"; + @SerializedName(SERIALIZED_NAME_PROMO_PACKAGE) + @javax.annotation.Nullable + private Boolean promoPackage; + + public static final String SERIALIZED_NAME_DEPARTMENT_PAGE = "departmentPage"; + @SerializedName(SERIALIZED_NAME_DEPARTMENT_PAGE) + @javax.annotation.Nullable + private Boolean departmentPage; + + public Promotion() { + } + + public Promotion emphasized1d(@javax.annotation.Nullable Boolean emphasized1d) { + this.emphasized1d = emphasized1d; + return this; + } + + /** + * Get emphasized1d + * @return emphasized1d + */ + @javax.annotation.Nullable + public Boolean getEmphasized1d() { + return emphasized1d; + } + + public void setEmphasized1d(@javax.annotation.Nullable Boolean emphasized1d) { + this.emphasized1d = emphasized1d; + } + + + public Promotion emphasized10d(@javax.annotation.Nullable Boolean emphasized10d) { + this.emphasized10d = emphasized10d; + return this; + } + + /** + * Get emphasized10d + * @return emphasized10d + */ + @javax.annotation.Nullable + public Boolean getEmphasized10d() { + return emphasized10d; + } + + public void setEmphasized10d(@javax.annotation.Nullable Boolean emphasized10d) { + this.emphasized10d = emphasized10d; + } + + + public Promotion promoPackage(@javax.annotation.Nullable Boolean promoPackage) { + this.promoPackage = promoPackage; + return this; + } + + /** + * Get promoPackage + * @return promoPackage + */ + @javax.annotation.Nullable + public Boolean getPromoPackage() { + return promoPackage; + } + + public void setPromoPackage(@javax.annotation.Nullable Boolean promoPackage) { + this.promoPackage = promoPackage; + } + + + public Promotion departmentPage(@javax.annotation.Nullable Boolean departmentPage) { + this.departmentPage = departmentPage; + return this; + } + + /** + * Get departmentPage + * @return departmentPage + */ + @javax.annotation.Nullable + public Boolean getDepartmentPage() { + return departmentPage; + } + + public void setDepartmentPage(@javax.annotation.Nullable Boolean departmentPage) { + this.departmentPage = departmentPage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Promotion promotion = (Promotion) o; + return Objects.equals(this.emphasized1d, promotion.emphasized1d) && + Objects.equals(this.emphasized10d, promotion.emphasized10d) && + Objects.equals(this.promoPackage, promotion.promoPackage) && + Objects.equals(this.departmentPage, promotion.departmentPage); + } + + @Override + public int hashCode() { + return Objects.hash(emphasized1d, emphasized10d, promoPackage, departmentPage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Promotion {\n"); + sb.append(" emphasized1d: ").append(toIndentedString(emphasized1d)).append("\n"); + sb.append(" emphasized10d: ").append(toIndentedString(emphasized10d)).append("\n"); + sb.append(" promoPackage: ").append(toIndentedString(promoPackage)).append("\n"); + sb.append(" departmentPage: ").append(toIndentedString(departmentPage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("emphasized1d"); + openapiFields.add("emphasized10d"); + openapiFields.add("promoPackage"); + openapiFields.add("departmentPage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Promotion + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Promotion.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Promotion is not found in the empty JSON string", Promotion.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Promotion.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Promotion` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Promotion.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Promotion' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Promotion.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Promotion value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Promotion read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Promotion given an JSON string + * + * @param jsonString JSON string + * @return An instance of Promotion + * @throws IOException if the JSON string is invalid with respect to Promotion + */ + public static Promotion fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Promotion.class); + } + + /** + * Convert an instance of Promotion to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromotionCampaignResponseDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PromotionCampaignResponseDto.java new file mode 100644 index 0000000..a422f6e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromotionCampaignResponseDto.java @@ -0,0 +1,371 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CampaignResponseDto; +import pl.wtx.allegro.api.client.model.PromotionResponseDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PromotionCampaignResponseDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromotionCampaignResponseDto { + public static final String SERIALIZED_NAME_CAMPAIGN = "campaign"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN) + @javax.annotation.Nonnull + private CampaignResponseDto campaign; + + public static final String SERIALIZED_NAME_LINK = "link"; + @SerializedName(SERIALIZED_NAME_LINK) + @javax.annotation.Nullable + private String link; + + public static final String SERIALIZED_NAME_PROMOTION = "promotion"; + @SerializedName(SERIALIZED_NAME_PROMOTION) + @javax.annotation.Nonnull + private PromotionResponseDto promotion; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + REQUESTED("REQUESTED"), + + SUSPENDED("SUSPENDED"), + + VERIFICATION("VERIFICATION"), + + ACCEPTED("ACCEPTED"), + + ACTIVE("ACTIVE"), + + FINISHED("FINISHED"), + + DECLINED("DECLINED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public PromotionCampaignResponseDto() { + } + + public PromotionCampaignResponseDto campaign(@javax.annotation.Nonnull CampaignResponseDto campaign) { + this.campaign = campaign; + return this; + } + + /** + * Get campaign + * @return campaign + */ + @javax.annotation.Nonnull + public CampaignResponseDto getCampaign() { + return campaign; + } + + public void setCampaign(@javax.annotation.Nonnull CampaignResponseDto campaign) { + this.campaign = campaign; + } + + + public PromotionCampaignResponseDto link(@javax.annotation.Nullable String link) { + this.link = link; + return this; + } + + /** + * Get link + * @return link + */ + @javax.annotation.Nullable + public String getLink() { + return link; + } + + public void setLink(@javax.annotation.Nullable String link) { + this.link = link; + } + + + public PromotionCampaignResponseDto promotion(@javax.annotation.Nonnull PromotionResponseDto promotion) { + this.promotion = promotion; + return this; + } + + /** + * Get promotion + * @return promotion + */ + @javax.annotation.Nonnull + public PromotionResponseDto getPromotion() { + return promotion; + } + + public void setPromotion(@javax.annotation.Nonnull PromotionResponseDto promotion) { + this.promotion = promotion; + } + + + public PromotionCampaignResponseDto status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromotionCampaignResponseDto promotionCampaignResponseDto = (PromotionCampaignResponseDto) o; + return Objects.equals(this.campaign, promotionCampaignResponseDto.campaign) && + Objects.equals(this.link, promotionCampaignResponseDto.link) && + Objects.equals(this.promotion, promotionCampaignResponseDto.promotion) && + Objects.equals(this.status, promotionCampaignResponseDto.status); + } + + @Override + public int hashCode() { + return Objects.hash(campaign, link, promotion, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromotionCampaignResponseDto {\n"); + sb.append(" campaign: ").append(toIndentedString(campaign)).append("\n"); + sb.append(" link: ").append(toIndentedString(link)).append("\n"); + sb.append(" promotion: ").append(toIndentedString(promotion)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("campaign"); + openapiFields.add("link"); + openapiFields.add("promotion"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("campaign"); + openapiRequiredFields.add("link"); + openapiRequiredFields.add("promotion"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromotionCampaignResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromotionCampaignResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromotionCampaignResponseDto is not found in the empty JSON string", PromotionCampaignResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromotionCampaignResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromotionCampaignResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PromotionCampaignResponseDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `campaign` + CampaignResponseDto.validateJsonElement(jsonObj.get("campaign")); + if ((jsonObj.get("link") != null && !jsonObj.get("link").isJsonNull()) && !jsonObj.get("link").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `link` to be a primitive type in the JSON string but got `%s`", jsonObj.get("link").toString())); + } + // validate the required field `promotion` + PromotionResponseDto.validateJsonElement(jsonObj.get("promotion")); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromotionCampaignResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromotionCampaignResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromotionCampaignResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromotionCampaignResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromotionCampaignResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromotionCampaignResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromotionCampaignResponseDto + * @throws IOException if the JSON string is invalid with respect to PromotionCampaignResponseDto + */ + public static PromotionCampaignResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromotionCampaignResponseDto.class); + } + + /** + * Convert an instance of PromotionCampaignResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromotionCampaignsResponseDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PromotionCampaignsResponseDto.java new file mode 100644 index 0000000..9592c07 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromotionCampaignsResponseDto.java @@ -0,0 +1,261 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.SinglePromotionCampaignResponseDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PromotionCampaignsResponseDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromotionCampaignsResponseDto { + public static final String SERIALIZED_NAME_PROMOTION_CAMPAIGNS = "promotionCampaigns"; + @SerializedName(SERIALIZED_NAME_PROMOTION_CAMPAIGNS) + @javax.annotation.Nonnull + private List promotionCampaigns = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nonnull + private Long totalCount; + + public PromotionCampaignsResponseDto() { + } + + public PromotionCampaignsResponseDto promotionCampaigns(@javax.annotation.Nonnull List promotionCampaigns) { + this.promotionCampaigns = promotionCampaigns; + return this; + } + + public PromotionCampaignsResponseDto addPromotionCampaignsItem(SinglePromotionCampaignResponseDto promotionCampaignsItem) { + if (this.promotionCampaigns == null) { + this.promotionCampaigns = new ArrayList<>(); + } + this.promotionCampaigns.add(promotionCampaignsItem); + return this; + } + + /** + * Get promotionCampaigns + * @return promotionCampaigns + */ + @javax.annotation.Nonnull + public List getPromotionCampaigns() { + return promotionCampaigns; + } + + public void setPromotionCampaigns(@javax.annotation.Nonnull List promotionCampaigns) { + this.promotionCampaigns = promotionCampaigns; + } + + + public PromotionCampaignsResponseDto totalCount(@javax.annotation.Nonnull Long totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Get totalCount + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nonnull + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nonnull Long totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromotionCampaignsResponseDto promotionCampaignsResponseDto = (PromotionCampaignsResponseDto) o; + return Objects.equals(this.promotionCampaigns, promotionCampaignsResponseDto.promotionCampaigns) && + Objects.equals(this.totalCount, promotionCampaignsResponseDto.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(promotionCampaigns, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromotionCampaignsResponseDto {\n"); + sb.append(" promotionCampaigns: ").append(toIndentedString(promotionCampaigns)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("promotionCampaigns"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("promotionCampaigns"); + openapiRequiredFields.add("totalCount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromotionCampaignsResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromotionCampaignsResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromotionCampaignsResponseDto is not found in the empty JSON string", PromotionCampaignsResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromotionCampaignsResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromotionCampaignsResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PromotionCampaignsResponseDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("promotionCampaigns").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `promotionCampaigns` to be an array in the JSON string but got `%s`", jsonObj.get("promotionCampaigns").toString())); + } + + JsonArray jsonArraypromotionCampaigns = jsonObj.getAsJsonArray("promotionCampaigns"); + // validate the required field `promotionCampaigns` (array) + for (int i = 0; i < jsonArraypromotionCampaigns.size(); i++) { + SinglePromotionCampaignResponseDto.validateJsonElement(jsonArraypromotionCampaigns.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromotionCampaignsResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromotionCampaignsResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromotionCampaignsResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromotionCampaignsResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromotionCampaignsResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromotionCampaignsResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromotionCampaignsResponseDto + * @throws IOException if the JSON string is invalid with respect to PromotionCampaignsResponseDto + */ + public static PromotionCampaignsResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromotionCampaignsResponseDto.class); + } + + /** + * Convert an instance of PromotionCampaignsResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromotionRequestDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PromotionRequestDto.java new file mode 100644 index 0000000..0f1ba32 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromotionRequestDto.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PromotionRequestDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromotionRequestDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public PromotionRequestDto() { + } + + public PromotionRequestDto id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromotionRequestDto promotionRequestDto = (PromotionRequestDto) o; + return Objects.equals(this.id, promotionRequestDto.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromotionRequestDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromotionRequestDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromotionRequestDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromotionRequestDto is not found in the empty JSON string", PromotionRequestDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromotionRequestDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromotionRequestDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PromotionRequestDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromotionRequestDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromotionRequestDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromotionRequestDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromotionRequestDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromotionRequestDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromotionRequestDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromotionRequestDto + * @throws IOException if the JSON string is invalid with respect to PromotionRequestDto + */ + public static PromotionRequestDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromotionRequestDto.class); + } + + /** + * Convert an instance of PromotionRequestDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PromotionResponseDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PromotionResponseDto.java new file mode 100644 index 0000000..f0218e5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PromotionResponseDto.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PromotionResponseDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PromotionResponseDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public PromotionResponseDto() { + } + + public PromotionResponseDto id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromotionResponseDto promotionResponseDto = (PromotionResponseDto) o; + return Objects.equals(this.id, promotionResponseDto.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromotionResponseDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PromotionResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PromotionResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PromotionResponseDto is not found in the empty JSON string", PromotionResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PromotionResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PromotionResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PromotionResponseDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PromotionResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PromotionResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PromotionResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PromotionResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PromotionResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PromotionResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PromotionResponseDto + * @throws IOException if the JSON string is invalid with respect to PromotionResponseDto + */ + public static PromotionResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PromotionResponseDto.class); + } + + /** + * Convert an instance of PromotionResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProviderRefundTransferChargeOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/ProviderRefundTransferChargeOperation.java new file mode 100644 index 0000000..e350b3f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProviderRefundTransferChargeOperation.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.OperationPayment; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProviderRefundTransferChargeOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProviderRefundTransferChargeOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "PROVIDER_REFUND_TRANSFER_CHARGE"; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nonnull + private OperationPayment payment; + + public ProviderRefundTransferChargeOperation() { + this.type = this.getClass().getSimpleName(); + } + + public ProviderRefundTransferChargeOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ProviderRefundTransferChargeOperation payment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nonnull + public OperationPayment getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProviderRefundTransferChargeOperation providerRefundTransferChargeOperation = (ProviderRefundTransferChargeOperation) o; + return Objects.equals(this.type, providerRefundTransferChargeOperation.type) && + Objects.equals(this.payment, providerRefundTransferChargeOperation.payment) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, payment, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProviderRefundTransferChargeOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("payment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payment"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProviderRefundTransferChargeOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProviderRefundTransferChargeOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProviderRefundTransferChargeOperation is not found in the empty JSON string", ProviderRefundTransferChargeOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProviderRefundTransferChargeOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProviderRefundTransferChargeOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProviderRefundTransferChargeOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProviderRefundTransferChargeOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProviderRefundTransferChargeOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProviderRefundTransferChargeOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProviderRefundTransferChargeOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProviderRefundTransferChargeOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProviderRefundTransferChargeOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProviderRefundTransferChargeOperation + * @throws IOException if the JSON string is invalid with respect to ProviderRefundTransferChargeOperation + */ + public static ProviderRefundTransferChargeOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProviderRefundTransferChargeOperation.class); + } + + /** + * Convert an instance of ProviderRefundTransferChargeOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ProviderRefundTransferIncreaseOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/ProviderRefundTransferIncreaseOperation.java new file mode 100644 index 0000000..86abfbe --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ProviderRefundTransferIncreaseOperation.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.OperationPayment; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ProviderRefundTransferIncreaseOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ProviderRefundTransferIncreaseOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "PROVIDER_REFUND_TRANSFER_INCREASE"; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nonnull + private OperationPayment payment; + + public ProviderRefundTransferIncreaseOperation() { + this.type = this.getClass().getSimpleName(); + } + + public ProviderRefundTransferIncreaseOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public ProviderRefundTransferIncreaseOperation payment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nonnull + public OperationPayment getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProviderRefundTransferIncreaseOperation providerRefundTransferIncreaseOperation = (ProviderRefundTransferIncreaseOperation) o; + return Objects.equals(this.type, providerRefundTransferIncreaseOperation.type) && + Objects.equals(this.payment, providerRefundTransferIncreaseOperation.payment) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, payment, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProviderRefundTransferIncreaseOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("payment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payment"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProviderRefundTransferIncreaseOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProviderRefundTransferIncreaseOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProviderRefundTransferIncreaseOperation is not found in the empty JSON string", ProviderRefundTransferIncreaseOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ProviderRefundTransferIncreaseOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProviderRefundTransferIncreaseOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProviderRefundTransferIncreaseOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProviderRefundTransferIncreaseOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProviderRefundTransferIncreaseOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProviderRefundTransferIncreaseOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProviderRefundTransferIncreaseOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ProviderRefundTransferIncreaseOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProviderRefundTransferIncreaseOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProviderRefundTransferIncreaseOperation + * @throws IOException if the JSON string is invalid with respect to ProviderRefundTransferIncreaseOperation + */ + public static ProviderRefundTransferIncreaseOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProviderRefundTransferIncreaseOperation.class); + } + + /** + * Convert an instance of ProviderRefundTransferIncreaseOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PublicOfferPreviewRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/PublicOfferPreviewRequest.java new file mode 100644 index 0000000..e5b3056 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PublicOfferPreviewRequest.java @@ -0,0 +1,282 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.ClassifiedsPackages; +import pl.wtx.allegro.api.client.model.PricingOffer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PublicOfferPreviewRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PublicOfferPreviewRequest { + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private PricingOffer offer; + + public static final String SERIALIZED_NAME_CLASSIFIEDS_PACKAGES = "classifiedsPackages"; + @SerializedName(SERIALIZED_NAME_CLASSIFIEDS_PACKAGES) + @javax.annotation.Nullable + private ClassifiedsPackages classifiedsPackages; + + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + public PublicOfferPreviewRequest() { + } + + public PublicOfferPreviewRequest offer(@javax.annotation.Nullable PricingOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public PricingOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable PricingOffer offer) { + this.offer = offer; + } + + + public PublicOfferPreviewRequest classifiedsPackages(@javax.annotation.Nullable ClassifiedsPackages classifiedsPackages) { + this.classifiedsPackages = classifiedsPackages; + return this; + } + + /** + * Get classifiedsPackages + * @return classifiedsPackages + */ + @javax.annotation.Nullable + public ClassifiedsPackages getClassifiedsPackages() { + return classifiedsPackages; + } + + public void setClassifiedsPackages(@javax.annotation.Nullable ClassifiedsPackages classifiedsPackages) { + this.classifiedsPackages = classifiedsPackages; + } + + + public PublicOfferPreviewRequest marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * The marketplace on which the offer should be previewed. If omitted, it will default to the base marketplace. + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PublicOfferPreviewRequest publicOfferPreviewRequest = (PublicOfferPreviewRequest) o; + return Objects.equals(this.offer, publicOfferPreviewRequest.offer) && + Objects.equals(this.classifiedsPackages, publicOfferPreviewRequest.classifiedsPackages) && + Objects.equals(this.marketplaceId, publicOfferPreviewRequest.marketplaceId); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(offer, classifiedsPackages, marketplaceId); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicOfferPreviewRequest {\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" classifiedsPackages: ").append(toIndentedString(classifiedsPackages)).append("\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offer"); + openapiFields.add("classifiedsPackages"); + openapiFields.add("marketplaceId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PublicOfferPreviewRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicOfferPreviewRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PublicOfferPreviewRequest is not found in the empty JSON string", PublicOfferPreviewRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PublicOfferPreviewRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PublicOfferPreviewRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + PricingOffer.validateJsonElement(jsonObj.get("offer")); + } + // validate the optional field `classifiedsPackages` + if (jsonObj.get("classifiedsPackages") != null && !jsonObj.get("classifiedsPackages").isJsonNull()) { + ClassifiedsPackages.validateJsonElement(jsonObj.get("classifiedsPackages")); + } + if ((jsonObj.get("marketplaceId") != null && !jsonObj.get("marketplaceId").isJsonNull()) && !jsonObj.get("marketplaceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("marketplaceId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicOfferPreviewRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicOfferPreviewRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PublicOfferPreviewRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicOfferPreviewRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PublicOfferPreviewRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PublicOfferPreviewRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicOfferPreviewRequest + * @throws IOException if the JSON string is invalid with respect to PublicOfferPreviewRequest + */ + public static PublicOfferPreviewRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicOfferPreviewRequest.class); + } + + /** + * Convert an instance of PublicOfferPreviewRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PublicTableDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PublicTableDto.java new file mode 100644 index 0000000..1b6e87b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PublicTableDto.java @@ -0,0 +1,372 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Cells; +import pl.wtx.allegro.api.client.model.Header; +import pl.wtx.allegro.api.client.model.JustId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PublicTableDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PublicTableDto { + public static final String SERIALIZED_NAME_HEADERS = "headers"; + @SerializedName(SERIALIZED_NAME_HEADERS) + @javax.annotation.Nonnull + private List
headers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_TEMPLATE = "template"; + @SerializedName(SERIALIZED_NAME_TEMPLATE) + @javax.annotation.Nullable + private JustId template; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nonnull + private List values = new ArrayList<>(); + + public PublicTableDto() { + } + + public PublicTableDto headers(@javax.annotation.Nonnull List
headers) { + this.headers = headers; + return this; + } + + public PublicTableDto addHeadersItem(Header headersItem) { + if (this.headers == null) { + this.headers = new ArrayList<>(); + } + this.headers.add(headersItem); + return this; + } + + /** + * size table headers + * @return headers + */ + @javax.annotation.Nonnull + public List
getHeaders() { + return headers; + } + + public void setHeaders(@javax.annotation.Nonnull List
headers) { + this.headers = headers; + } + + + public PublicTableDto id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * size table id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public PublicTableDto name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * size table name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PublicTableDto template(@javax.annotation.Nullable JustId template) { + this.template = template; + return this; + } + + /** + * Get template + * @return template + */ + @javax.annotation.Nullable + public JustId getTemplate() { + return template; + } + + public void setTemplate(@javax.annotation.Nullable JustId template) { + this.template = template; + } + + + public PublicTableDto values(@javax.annotation.Nonnull List values) { + this.values = values; + return this; + } + + public PublicTableDto addValuesItem(Cells valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * size table cells + * @return values + */ + @javax.annotation.Nonnull + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nonnull List values) { + this.values = values; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PublicTableDto publicTableDto = (PublicTableDto) o; + return Objects.equals(this.headers, publicTableDto.headers) && + Objects.equals(this.id, publicTableDto.id) && + Objects.equals(this.name, publicTableDto.name) && + Objects.equals(this.template, publicTableDto.template) && + Objects.equals(this.values, publicTableDto.values); + } + + @Override + public int hashCode() { + return Objects.hash(headers, id, name, template, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicTableDto {\n"); + sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" template: ").append(toIndentedString(template)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("headers"); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("template"); + openapiFields.add("values"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("headers"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("values"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PublicTableDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicTableDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PublicTableDto is not found in the empty JSON string", PublicTableDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PublicTableDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PublicTableDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PublicTableDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("headers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `headers` to be an array in the JSON string but got `%s`", jsonObj.get("headers").toString())); + } + + JsonArray jsonArrayheaders = jsonObj.getAsJsonArray("headers"); + // validate the required field `headers` (array) + for (int i = 0; i < jsonArrayheaders.size(); i++) { + Header.validateJsonElement(jsonArrayheaders.get(i)); + }; + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `template` + if (jsonObj.get("template") != null && !jsonObj.get("template").isJsonNull()) { + JustId.validateJsonElement(jsonObj.get("template")); + } + // ensure the json data is an array + if (!jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + + JsonArray jsonArrayvalues = jsonObj.getAsJsonArray("values"); + // validate the required field `values` (array) + for (int i = 0; i < jsonArrayvalues.size(); i++) { + Cells.validateJsonElement(jsonArrayvalues.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicTableDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicTableDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PublicTableDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicTableDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PublicTableDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PublicTableDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicTableDto + * @throws IOException if the JSON string is invalid with respect to PublicTableDto + */ + public static PublicTableDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicTableDto.class); + } + + /** + * Convert an instance of PublicTableDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PublicTablesDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PublicTablesDto.java new file mode 100644 index 0000000..947e72e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PublicTablesDto.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.PublicTableDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PublicTablesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PublicTablesDto { + public static final String SERIALIZED_NAME_TABLES = "tables"; + @SerializedName(SERIALIZED_NAME_TABLES) + @javax.annotation.Nonnull + private List tables = new ArrayList<>(); + + public PublicTablesDto() { + } + + public PublicTablesDto tables(@javax.annotation.Nonnull List tables) { + this.tables = tables; + return this; + } + + public PublicTablesDto addTablesItem(PublicTableDto tablesItem) { + if (this.tables == null) { + this.tables = new ArrayList<>(); + } + this.tables.add(tablesItem); + return this; + } + + /** + * Get tables + * @return tables + */ + @javax.annotation.Nonnull + public List getTables() { + return tables; + } + + public void setTables(@javax.annotation.Nonnull List tables) { + this.tables = tables; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PublicTablesDto publicTablesDto = (PublicTablesDto) o; + return Objects.equals(this.tables, publicTablesDto.tables); + } + + @Override + public int hashCode() { + return Objects.hash(tables); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicTablesDto {\n"); + sb.append(" tables: ").append(toIndentedString(tables)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tables"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("tables"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PublicTablesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicTablesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PublicTablesDto is not found in the empty JSON string", PublicTablesDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PublicTablesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PublicTablesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PublicTablesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("tables").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tables` to be an array in the JSON string but got `%s`", jsonObj.get("tables").toString())); + } + + JsonArray jsonArraytables = jsonObj.getAsJsonArray("tables"); + // validate the required field `tables` (array) + for (int i = 0; i < jsonArraytables.size(); i++) { + PublicTableDto.validateJsonElement(jsonArraytables.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicTablesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicTablesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PublicTablesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicTablesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PublicTablesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PublicTablesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicTablesDto + * @throws IOException if the JSON string is invalid with respect to PublicTablesDto + */ + public static PublicTablesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicTablesDto.class); + } + + /** + * Convert an instance of PublicTablesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Publication.java b/src/main/java/pl/wtx/allegro/api/client/model/Publication.java new file mode 100644 index 0000000..2dad5d3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Publication.java @@ -0,0 +1,413 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Publication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Publication { + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + @javax.annotation.Nullable + private String duration; + + public static final String SERIALIZED_NAME_STARTING_AT = "startingAt"; + @SerializedName(SERIALIZED_NAME_STARTING_AT) + @javax.annotation.Nullable + private OffsetDateTime startingAt; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private OfferStatus status; + + public static final String SERIALIZED_NAME_REPUBLISH = "republish"; + @SerializedName(SERIALIZED_NAME_REPUBLISH) + @javax.annotation.Nullable + private Boolean republish; + + public static final String SERIALIZED_NAME_ENDING_AT = "endingAt"; + @SerializedName(SERIALIZED_NAME_ENDING_AT) + @javax.annotation.Nullable + private OffsetDateTime endingAt; + + /** + * Indicates the reason for ending the offer: - `USER` - offer ended by the seller. - `ADMIN` - offer ended by an admin. - `EXPIRATION` - offer duration had expired (valid for offers with specified duration). - `EMPTY_STOCK` - offer ended because all available items had been sold out. - `PRODUCT_DETACHMENT` - offer ended because its link to the product was removed. Status will only occur if the base marketplace of offer requires full productization. - `ERROR` - offer ended due to internal problem with offer publication. The publication command responded with success status, but further processing failed. + */ + @JsonAdapter(EndedByEnum.Adapter.class) + public enum EndedByEnum { + USER("USER"), + + ADMIN("ADMIN"), + + EXPIRATION("EXPIRATION"), + + EMPTY_STOCK("EMPTY_STOCK"), + + PRODUCT_DETACHMENT("PRODUCT_DETACHMENT"), + + ERROR("ERROR"); + + private String value; + + EndedByEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EndedByEnum fromValue(String value) { + for (EndedByEnum b : EndedByEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EndedByEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EndedByEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EndedByEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EndedByEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENDED_BY = "endedBy"; + @SerializedName(SERIALIZED_NAME_ENDED_BY) + @javax.annotation.Nullable + private EndedByEnum endedBy; + + public Publication() { + } + + public Publication( + EndedByEnum endedBy + ) { + this(); + this.endedBy = endedBy; + } + + public Publication duration(@javax.annotation.Nullable String duration) { + this.duration = duration; + return this; + } + + /** + * This field must be set to one of the following:<br/> - for auctions: 1 day, 3 days, 5 days, 7 days, 10 days<br/> - for buy-now offers: 3 days, 5 days, 7 days, 10 days, 20 days, 30 days<br/> - for advertisements: 10 days, 20 days, 30 days.<br/> The value is in ISO 8601 format (example: PT24H, PT72H). + * @return duration + */ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + public void setDuration(@javax.annotation.Nullable String duration) { + this.duration = duration; + } + + + public Publication startingAt(@javax.annotation.Nullable OffsetDateTime startingAt) { + this.startingAt = startingAt; + return this; + } + + /** + * Publication starting date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified after activation or ending of the offer. + * @return startingAt + */ + @javax.annotation.Nullable + public OffsetDateTime getStartingAt() { + return startingAt; + } + + public void setStartingAt(@javax.annotation.Nullable OffsetDateTime startingAt) { + this.startingAt = startingAt; + } + + + public Publication status(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public OfferStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + } + + + public Publication republish(@javax.annotation.Nullable Boolean republish) { + this.republish = republish; + return this; + } + + /** + * Whether to republish an offer after ending. Automatically republish offers or auctions:</br> - `BUY_NOW` offer type are republished with initial stock, regardless of how many items you have sold.</br> - `AUCTION` offer type are republished only if they were not concluded with purchase.</br> - `ADVERTISEMENT` offer type are republished until it will be finished manually. + * @return republish + */ + @javax.annotation.Nullable + public Boolean getRepublish() { + return republish; + } + + public void setRepublish(@javax.annotation.Nullable Boolean republish) { + this.republish = republish; + } + + + public Publication endingAt(@javax.annotation.Nullable OffsetDateTime endingAt) { + this.endingAt = endingAt; + return this; + } + + /** + * Publication ending date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified + * @return endingAt + */ + @javax.annotation.Nullable + public OffsetDateTime getEndingAt() { + return endingAt; + } + + public void setEndingAt(@javax.annotation.Nullable OffsetDateTime endingAt) { + this.endingAt = endingAt; + } + + + /** + * Indicates the reason for ending the offer: - `USER` - offer ended by the seller. - `ADMIN` - offer ended by an admin. - `EXPIRATION` - offer duration had expired (valid for offers with specified duration). - `EMPTY_STOCK` - offer ended because all available items had been sold out. - `PRODUCT_DETACHMENT` - offer ended because its link to the product was removed. Status will only occur if the base marketplace of offer requires full productization. - `ERROR` - offer ended due to internal problem with offer publication. The publication command responded with success status, but further processing failed. + * @return endedBy + */ + @javax.annotation.Nullable + public EndedByEnum getEndedBy() { + return endedBy; + } + + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Publication publication = (Publication) o; + return Objects.equals(this.duration, publication.duration) && + Objects.equals(this.startingAt, publication.startingAt) && + Objects.equals(this.status, publication.status) && + Objects.equals(this.republish, publication.republish) && + Objects.equals(this.endingAt, publication.endingAt) && + Objects.equals(this.endedBy, publication.endedBy); + } + + @Override + public int hashCode() { + return Objects.hash(duration, startingAt, status, republish, endingAt, endedBy); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Publication {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" startingAt: ").append(toIndentedString(startingAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" republish: ").append(toIndentedString(republish)).append("\n"); + sb.append(" endingAt: ").append(toIndentedString(endingAt)).append("\n"); + sb.append(" endedBy: ").append(toIndentedString(endedBy)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("duration"); + openapiFields.add("startingAt"); + openapiFields.add("status"); + openapiFields.add("republish"); + openapiFields.add("endingAt"); + openapiFields.add("endedBy"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Publication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Publication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Publication is not found in the empty JSON string", Publication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Publication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Publication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + OfferStatus.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("endedBy") != null && !jsonObj.get("endedBy").isJsonNull()) && !jsonObj.get("endedBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `endedBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endedBy").toString())); + } + // validate the optional field `endedBy` + if (jsonObj.get("endedBy") != null && !jsonObj.get("endedBy").isJsonNull()) { + EndedByEnum.validateJsonElement(jsonObj.get("endedBy")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Publication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Publication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Publication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Publication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Publication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Publication given an JSON string + * + * @param jsonString JSON string + * @return An instance of Publication + * @throws IOException if the JSON string is invalid with respect to Publication + */ + public static Publication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Publication.class); + } + + /** + * Convert an instance of Publication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PublicationChangeCommandDto.java b/src/main/java/pl/wtx/allegro/api/client/model/PublicationChangeCommandDto.java new file mode 100644 index 0000000..bb7fa5a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PublicationChangeCommandDto.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.OfferCriterium; +import pl.wtx.allegro.api.client.model.PublicationModification; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Publication modification command payload + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PublicationChangeCommandDto { + public static final String SERIALIZED_NAME_OFFER_CRITERIA = "offerCriteria"; + @SerializedName(SERIALIZED_NAME_OFFER_CRITERIA) + @javax.annotation.Nullable + private List offerCriteria = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private PublicationModification publication; + + public PublicationChangeCommandDto() { + } + + public PublicationChangeCommandDto offerCriteria(@javax.annotation.Nullable List offerCriteria) { + this.offerCriteria = offerCriteria; + return this; + } + + public PublicationChangeCommandDto addOfferCriteriaItem(OfferCriterium offerCriteriaItem) { + if (this.offerCriteria == null) { + this.offerCriteria = new ArrayList<>(); + } + this.offerCriteria.add(offerCriteriaItem); + return this; + } + + /** + * List of offer criteria + * @return offerCriteria + */ + @javax.annotation.Nullable + public List getOfferCriteria() { + return offerCriteria; + } + + public void setOfferCriteria(@javax.annotation.Nullable List offerCriteria) { + this.offerCriteria = offerCriteria; + } + + + public PublicationChangeCommandDto publication(@javax.annotation.Nullable PublicationModification publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public PublicationModification getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable PublicationModification publication) { + this.publication = publication; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PublicationChangeCommandDto publicationChangeCommandDto = (PublicationChangeCommandDto) o; + return Objects.equals(this.offerCriteria, publicationChangeCommandDto.offerCriteria) && + Objects.equals(this.publication, publicationChangeCommandDto.publication); + } + + @Override + public int hashCode() { + return Objects.hash(offerCriteria, publication); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicationChangeCommandDto {\n"); + sb.append(" offerCriteria: ").append(toIndentedString(offerCriteria)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offerCriteria"); + openapiFields.add("publication"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PublicationChangeCommandDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicationChangeCommandDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PublicationChangeCommandDto is not found in the empty JSON string", PublicationChangeCommandDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PublicationChangeCommandDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PublicationChangeCommandDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("offerCriteria") != null && !jsonObj.get("offerCriteria").isJsonNull()) { + JsonArray jsonArrayofferCriteria = jsonObj.getAsJsonArray("offerCriteria"); + if (jsonArrayofferCriteria != null) { + // ensure the json data is an array + if (!jsonObj.get("offerCriteria").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerCriteria` to be an array in the JSON string but got `%s`", jsonObj.get("offerCriteria").toString())); + } + + // validate the optional field `offerCriteria` (array) + for (int i = 0; i < jsonArrayofferCriteria.size(); i++) { + OfferCriterium.validateJsonElement(jsonArrayofferCriteria.get(i)); + }; + } + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + PublicationModification.validateJsonElement(jsonObj.get("publication")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicationChangeCommandDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicationChangeCommandDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PublicationChangeCommandDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicationChangeCommandDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PublicationChangeCommandDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PublicationChangeCommandDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicationChangeCommandDto + * @throws IOException if the JSON string is invalid with respect to PublicationChangeCommandDto + */ + public static PublicationChangeCommandDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicationChangeCommandDto.class); + } + + /** + * Convert an instance of PublicationChangeCommandDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PublicationModification.java b/src/main/java/pl/wtx/allegro/api/client/model/PublicationModification.java new file mode 100644 index 0000000..26b44b0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PublicationModification.java @@ -0,0 +1,290 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contains publication's fields to change + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PublicationModification { + /** + * Action to perform + */ + @JsonAdapter(ActionEnum.Adapter.class) + public enum ActionEnum { + ACTIVATE("ACTIVATE"), + + END("END"); + + private String value; + + ActionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ActionEnum fromValue(String value) { + for (ActionEnum b : ActionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ActionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ActionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ActionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ActionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + @javax.annotation.Nullable + private ActionEnum action; + + public static final String SERIALIZED_NAME_SCHEDULED_FOR = "scheduledFor"; + @SerializedName(SERIALIZED_NAME_SCHEDULED_FOR) + @javax.annotation.Nullable + private OffsetDateTime scheduledFor; + + public PublicationModification() { + } + + public PublicationModification action(@javax.annotation.Nullable ActionEnum action) { + this.action = action; + return this; + } + + /** + * Action to perform + * @return action + */ + @javax.annotation.Nullable + public ActionEnum getAction() { + return action; + } + + public void setAction(@javax.annotation.Nullable ActionEnum action) { + this.action = action; + } + + + public PublicationModification scheduledFor(@javax.annotation.Nullable OffsetDateTime scheduledFor) { + this.scheduledFor = scheduledFor; + return this; + } + + /** + * Date and time for scheduling ACTIVATE action, will be ignored for another actions + * @return scheduledFor + */ + @javax.annotation.Nullable + public OffsetDateTime getScheduledFor() { + return scheduledFor; + } + + public void setScheduledFor(@javax.annotation.Nullable OffsetDateTime scheduledFor) { + this.scheduledFor = scheduledFor; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PublicationModification publicationModification = (PublicationModification) o; + return Objects.equals(this.action, publicationModification.action) && + Objects.equals(this.scheduledFor, publicationModification.scheduledFor); + } + + @Override + public int hashCode() { + return Objects.hash(action, scheduledFor); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicationModification {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" scheduledFor: ").append(toIndentedString(scheduledFor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("action"); + openapiFields.add("scheduledFor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PublicationModification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicationModification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PublicationModification is not found in the empty JSON string", PublicationModification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PublicationModification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PublicationModification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("action") != null && !jsonObj.get("action").isJsonNull()) && !jsonObj.get("action").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `action` to be a primitive type in the JSON string but got `%s`", jsonObj.get("action").toString())); + } + // validate the optional field `action` + if (jsonObj.get("action") != null && !jsonObj.get("action").isJsonNull()) { + ActionEnum.validateJsonElement(jsonObj.get("action")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicationModification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicationModification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PublicationModification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicationModification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PublicationModification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PublicationModification given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicationModification + * @throws IOException if the JSON string is invalid with respect to PublicationModification + */ + public static PublicationModification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicationModification.class); + } + + /** + * Convert an instance of PublicationModification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PublicationRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/PublicationRequest.java new file mode 100644 index 0000000..04de9cb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PublicationRequest.java @@ -0,0 +1,293 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * PublicationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PublicationRequest { + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + @javax.annotation.Nullable + private String duration; + + public static final String SERIALIZED_NAME_STARTING_AT = "startingAt"; + @SerializedName(SERIALIZED_NAME_STARTING_AT) + @javax.annotation.Nullable + private OffsetDateTime startingAt; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private OfferStatus status; + + public static final String SERIALIZED_NAME_REPUBLISH = "republish"; + @SerializedName(SERIALIZED_NAME_REPUBLISH) + @javax.annotation.Nullable + private Boolean republish; + + public PublicationRequest() { + } + + public PublicationRequest duration(@javax.annotation.Nullable String duration) { + this.duration = duration; + return this; + } + + /** + * This field must be set to one of the following:<br/> - for auctions: 1 day, 3 days, 5 days, 7 days, 10 days<br/> - for buy-now offers: 3 days, 5 days, 7 days, 10 days, 20 days, 30 days<br/> - for advertisements: 10 days, 20 days, 30 days.<br/> The value is in ISO 8601 format (example: PT24H, PT72H). + * @return duration + */ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + public void setDuration(@javax.annotation.Nullable String duration) { + this.duration = duration; + } + + + public PublicationRequest startingAt(@javax.annotation.Nullable OffsetDateTime startingAt) { + this.startingAt = startingAt; + return this; + } + + /** + * Publication starting date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified after activation or ending of the offer. + * @return startingAt + */ + @javax.annotation.Nullable + public OffsetDateTime getStartingAt() { + return startingAt; + } + + public void setStartingAt(@javax.annotation.Nullable OffsetDateTime startingAt) { + this.startingAt = startingAt; + } + + + public PublicationRequest status(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public OfferStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + } + + + public PublicationRequest republish(@javax.annotation.Nullable Boolean republish) { + this.republish = republish; + return this; + } + + /** + * Whether to republish an offer after ending. Automatically republish offers or auctions:</br> - `BUY_NOW` offer type are republished with initial stock, regardless of how many items you have sold.</br> - `AUCTION` offer type are republished only if they were not concluded with purchase.</br> - `ADVERTISEMENT` offer type are republished until it will be finished manually. + * @return republish + */ + @javax.annotation.Nullable + public Boolean getRepublish() { + return republish; + } + + public void setRepublish(@javax.annotation.Nullable Boolean republish) { + this.republish = republish; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PublicationRequest publicationRequest = (PublicationRequest) o; + return Objects.equals(this.duration, publicationRequest.duration) && + Objects.equals(this.startingAt, publicationRequest.startingAt) && + Objects.equals(this.status, publicationRequest.status) && + Objects.equals(this.republish, publicationRequest.republish); + } + + @Override + public int hashCode() { + return Objects.hash(duration, startingAt, status, republish); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicationRequest {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" startingAt: ").append(toIndentedString(startingAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" republish: ").append(toIndentedString(republish)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("duration"); + openapiFields.add("startingAt"); + openapiFields.add("status"); + openapiFields.add("republish"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PublicationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PublicationRequest is not found in the empty JSON string", PublicationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PublicationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PublicationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + OfferStatus.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PublicationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PublicationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PublicationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicationRequest + * @throws IOException if the JSON string is invalid with respect to PublicationRequest + */ + public static PublicationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicationRequest.class); + } + + /** + * Convert an instance of PublicationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/PublicationTimePolicy.java b/src/main/java/pl/wtx/allegro/api/client/model/PublicationTimePolicy.java new file mode 100644 index 0000000..b46f145 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/PublicationTimePolicy.java @@ -0,0 +1,334 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Time period when the badge is displayed on the list of offers or on the offer page. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class PublicationTimePolicy { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ALWAYS("ALWAYS"), + + SINCE("SINCE"), + + WITHIN("WITHIN"), + + UNTIL("UNTIL"), + + NEVER("NEVER"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private String to; + + public PublicationTimePolicy() { + } + + public PublicationTimePolicy type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public PublicationTimePolicy from(@javax.annotation.Nullable String from) { + this.from = from; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return from + */ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable String from) { + this.from = from; + } + + + public PublicationTimePolicy to(@javax.annotation.Nullable String to) { + this.to = to; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return to + */ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable String to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PublicationTimePolicy publicationTimePolicy = (PublicationTimePolicy) o; + return Objects.equals(this.type, publicationTimePolicy.type) && + Objects.equals(this.from, publicationTimePolicy.from) && + Objects.equals(this.to, publicationTimePolicy.to); + } + + @Override + public int hashCode() { + return Objects.hash(type, from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicationTimePolicy {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PublicationTimePolicy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicationTimePolicy.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PublicationTimePolicy is not found in the empty JSON string", PublicationTimePolicy.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PublicationTimePolicy.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PublicationTimePolicy` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PublicationTimePolicy.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicationTimePolicy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicationTimePolicy' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PublicationTimePolicy.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicationTimePolicy value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PublicationTimePolicy read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PublicationTimePolicy given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicationTimePolicy + * @throws IOException if the JSON string is invalid with respect to PublicationTimePolicy + */ + public static PublicationTimePolicy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicationTimePolicy.class); + } + + /** + * Convert an instance of PublicationTimePolicy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/QuantityModification.java b/src/main/java/pl/wtx/allegro/api/client/model/QuantityModification.java new file mode 100644 index 0000000..cf456ab --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/QuantityModification.java @@ -0,0 +1,289 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The way the offer quantity should be changed. One of two ways is possible: new quantity, increase/decrease quantity and only one can be chosen at once. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class QuantityModification { + /** + * modification type + */ + @JsonAdapter(ChangeTypeEnum.Adapter.class) + public enum ChangeTypeEnum { + FIXED("FIXED"), + + GAIN("GAIN"); + + private String value; + + ChangeTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ChangeTypeEnum fromValue(String value) { + for (ChangeTypeEnum b : ChangeTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ChangeTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ChangeTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ChangeTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ChangeTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CHANGE_TYPE = "changeType"; + @SerializedName(SERIALIZED_NAME_CHANGE_TYPE) + @javax.annotation.Nullable + private ChangeTypeEnum changeType; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private Integer value; + + public QuantityModification() { + } + + public QuantityModification changeType(@javax.annotation.Nullable ChangeTypeEnum changeType) { + this.changeType = changeType; + return this; + } + + /** + * modification type + * @return changeType + */ + @javax.annotation.Nullable + public ChangeTypeEnum getChangeType() { + return changeType; + } + + public void setChangeType(@javax.annotation.Nullable ChangeTypeEnum changeType) { + this.changeType = changeType; + } + + + public QuantityModification value(@javax.annotation.Nullable Integer value) { + this.value = value; + return this; + } + + /** + * - For changeType = \"FIXED\", a new stock quantity > 0 - For changeType = \"GAIN\", an increase/decrease in stock quantity + * @return value + */ + @javax.annotation.Nullable + public Integer getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable Integer value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QuantityModification quantityModification = (QuantityModification) o; + return Objects.equals(this.changeType, quantityModification.changeType) && + Objects.equals(this.value, quantityModification.value); + } + + @Override + public int hashCode() { + return Objects.hash(changeType, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuantityModification {\n"); + sb.append(" changeType: ").append(toIndentedString(changeType)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("changeType"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QuantityModification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QuantityModification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QuantityModification is not found in the empty JSON string", QuantityModification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QuantityModification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QuantityModification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("changeType") != null && !jsonObj.get("changeType").isJsonNull()) && !jsonObj.get("changeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `changeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("changeType").toString())); + } + // validate the optional field `changeType` + if (jsonObj.get("changeType") != null && !jsonObj.get("changeType").isJsonNull()) { + ChangeTypeEnum.validateJsonElement(jsonObj.get("changeType")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QuantityModification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QuantityModification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QuantityModification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QuantityModification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QuantityModification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QuantityModification given an JSON string + * + * @param jsonString JSON string + * @return An instance of QuantityModification + * @throws IOException if the JSON string is invalid with respect to QuantityModification + */ + public static QuantityModification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QuantityModification.class); + } + + /** + * Convert an instance of QuantityModification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/QuoteResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/QuoteResponse.java new file mode 100644 index 0000000..b28045c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/QuoteResponse.java @@ -0,0 +1,330 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ClassifiedPackage; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * QuoteResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class QuoteResponse { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private String type; + + public static final String SERIALIZED_NAME_FEE = "fee"; + @SerializedName(SERIALIZED_NAME_FEE) + @javax.annotation.Nullable + private Price fee; + + public static final String SERIALIZED_NAME_CYCLE_DURATION = "cycleDuration"; + @SerializedName(SERIALIZED_NAME_CYCLE_DURATION) + @javax.annotation.Nullable + private String cycleDuration; + + public static final String SERIALIZED_NAME_CLASSIFIEDS_PACKAGE = "classifiedsPackage"; + @SerializedName(SERIALIZED_NAME_CLASSIFIEDS_PACKAGE) + @javax.annotation.Nullable + private ClassifiedPackage classifiedsPackage; + + public QuoteResponse() { + } + + public QuoteResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Quote fee name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public QuoteResponse type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Quote fee type. + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public QuoteResponse fee(@javax.annotation.Nullable Price fee) { + this.fee = fee; + return this; + } + + /** + * Get fee + * @return fee + */ + @javax.annotation.Nullable + public Price getFee() { + return fee; + } + + public void setFee(@javax.annotation.Nullable Price fee) { + this.fee = fee; + } + + + public QuoteResponse cycleDuration(@javax.annotation.Nullable String cycleDuration) { + this.cycleDuration = cycleDuration; + return this; + } + + /** + * Duration in ISO 8601 format. + * @return cycleDuration + */ + @javax.annotation.Nullable + public String getCycleDuration() { + return cycleDuration; + } + + public void setCycleDuration(@javax.annotation.Nullable String cycleDuration) { + this.cycleDuration = cycleDuration; + } + + + public QuoteResponse classifiedsPackage(@javax.annotation.Nullable ClassifiedPackage classifiedsPackage) { + this.classifiedsPackage = classifiedsPackage; + return this; + } + + /** + * Get classifiedsPackage + * @return classifiedsPackage + */ + @javax.annotation.Nullable + public ClassifiedPackage getClassifiedsPackage() { + return classifiedsPackage; + } + + public void setClassifiedsPackage(@javax.annotation.Nullable ClassifiedPackage classifiedsPackage) { + this.classifiedsPackage = classifiedsPackage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QuoteResponse quoteResponse = (QuoteResponse) o; + return Objects.equals(this.name, quoteResponse.name) && + Objects.equals(this.type, quoteResponse.type) && + Objects.equals(this.fee, quoteResponse.fee) && + Objects.equals(this.cycleDuration, quoteResponse.cycleDuration) && + Objects.equals(this.classifiedsPackage, quoteResponse.classifiedsPackage); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, fee, cycleDuration, classifiedsPackage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuoteResponse {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" fee: ").append(toIndentedString(fee)).append("\n"); + sb.append(" cycleDuration: ").append(toIndentedString(cycleDuration)).append("\n"); + sb.append(" classifiedsPackage: ").append(toIndentedString(classifiedsPackage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("fee"); + openapiFields.add("cycleDuration"); + openapiFields.add("classifiedsPackage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QuoteResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QuoteResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QuoteResponse is not found in the empty JSON string", QuoteResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QuoteResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QuoteResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `fee` + if (jsonObj.get("fee") != null && !jsonObj.get("fee").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("fee")); + } + if ((jsonObj.get("cycleDuration") != null && !jsonObj.get("cycleDuration").isJsonNull()) && !jsonObj.get("cycleDuration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cycleDuration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cycleDuration").toString())); + } + // validate the optional field `classifiedsPackage` + if (jsonObj.get("classifiedsPackage") != null && !jsonObj.get("classifiedsPackage").isJsonNull()) { + ClassifiedPackage.validateJsonElement(jsonObj.get("classifiedsPackage")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QuoteResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QuoteResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QuoteResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QuoteResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QuoteResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of QuoteResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QuoteResponse + * @throws IOException if the JSON string is invalid with respect to QuoteResponse + */ + public static QuoteResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QuoteResponse.class); + } + + /** + * Convert an instance of QuoteResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Rates.java b/src/main/java/pl/wtx/allegro/api/client/model/Rates.java new file mode 100644 index 0000000..81e8f5c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Rates.java @@ -0,0 +1,536 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Rates + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Rates { + /** + * Delivery rate value + */ + @JsonAdapter(DeliveryEnum.Adapter.class) + public enum DeliveryEnum { + NUMBER_1(1), + + NUMBER_2(2), + + NUMBER_3(3), + + NUMBER_4(4), + + NUMBER_5(5); + + private Integer value; + + DeliveryEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DeliveryEnum fromValue(Integer value) { + for (DeliveryEnum b : DeliveryEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DeliveryEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DeliveryEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return DeliveryEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + DeliveryEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private DeliveryEnum delivery; + + /** + * Delivery cost rate value + */ + @JsonAdapter(DeliveryCostEnum.Adapter.class) + public enum DeliveryCostEnum { + NUMBER_1(1), + + NUMBER_2(2), + + NUMBER_3(3), + + NUMBER_4(4), + + NUMBER_5(5); + + private Integer value; + + DeliveryCostEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DeliveryCostEnum fromValue(Integer value) { + for (DeliveryCostEnum b : DeliveryCostEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DeliveryCostEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DeliveryCostEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return DeliveryCostEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + DeliveryCostEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_DELIVERY_COST = "deliveryCost"; + @SerializedName(SERIALIZED_NAME_DELIVERY_COST) + @javax.annotation.Nullable + private DeliveryCostEnum deliveryCost; + + /** + * Description rate value + */ + @JsonAdapter(DescriptionEnum.Adapter.class) + public enum DescriptionEnum { + NUMBER_1(1), + + NUMBER_2(2), + + NUMBER_3(3), + + NUMBER_4(4), + + NUMBER_5(5); + + private Integer value; + + DescriptionEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DescriptionEnum fromValue(Integer value) { + for (DescriptionEnum b : DescriptionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DescriptionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DescriptionEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return DescriptionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + DescriptionEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private DescriptionEnum description; + + /** + * Service rate value + */ + @JsonAdapter(ServiceEnum.Adapter.class) + public enum ServiceEnum { + NUMBER_1(1), + + NUMBER_2(2), + + NUMBER_3(3), + + NUMBER_4(4), + + NUMBER_5(5); + + private Integer value; + + ServiceEnum(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ServiceEnum fromValue(Integer value) { + for (ServiceEnum b : ServiceEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ServiceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ServiceEnum read(final JsonReader jsonReader) throws IOException { + Integer value = jsonReader.nextInt(); + return ServiceEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + Integer value = jsonElement.getAsInt(); + ServiceEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SERVICE = "service"; + @SerializedName(SERIALIZED_NAME_SERVICE) + @javax.annotation.Nullable + private ServiceEnum service; + + public Rates() { + } + + public Rates delivery(@javax.annotation.Nullable DeliveryEnum delivery) { + this.delivery = delivery; + return this; + } + + /** + * Delivery rate value + * minimum: 0 + * @return delivery + */ + @javax.annotation.Nullable + public DeliveryEnum getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable DeliveryEnum delivery) { + this.delivery = delivery; + } + + + public Rates deliveryCost(@javax.annotation.Nullable DeliveryCostEnum deliveryCost) { + this.deliveryCost = deliveryCost; + return this; + } + + /** + * Delivery cost rate value + * minimum: 0 + * @return deliveryCost + */ + @javax.annotation.Nullable + public DeliveryCostEnum getDeliveryCost() { + return deliveryCost; + } + + public void setDeliveryCost(@javax.annotation.Nullable DeliveryCostEnum deliveryCost) { + this.deliveryCost = deliveryCost; + } + + + public Rates description(@javax.annotation.Nullable DescriptionEnum description) { + this.description = description; + return this; + } + + /** + * Description rate value + * minimum: 0 + * @return description + */ + @javax.annotation.Nullable + public DescriptionEnum getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable DescriptionEnum description) { + this.description = description; + } + + + public Rates service(@javax.annotation.Nullable ServiceEnum service) { + this.service = service; + return this; + } + + /** + * Service rate value + * minimum: 0 + * @return service + */ + @javax.annotation.Nullable + public ServiceEnum getService() { + return service; + } + + public void setService(@javax.annotation.Nullable ServiceEnum service) { + this.service = service; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Rates rates = (Rates) o; + return Objects.equals(this.delivery, rates.delivery) && + Objects.equals(this.deliveryCost, rates.deliveryCost) && + Objects.equals(this.description, rates.description) && + Objects.equals(this.service, rates.service); + } + + @Override + public int hashCode() { + return Objects.hash(delivery, deliveryCost, description, service); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Rates {\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" deliveryCost: ").append(toIndentedString(deliveryCost)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("delivery"); + openapiFields.add("deliveryCost"); + openapiFields.add("description"); + openapiFields.add("service"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Rates + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Rates.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Rates is not found in the empty JSON string", Rates.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Rates.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Rates` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `delivery` + if (jsonObj.get("delivery") != null && !jsonObj.get("delivery").isJsonNull()) { + DeliveryEnum.validateJsonElement(jsonObj.get("delivery")); + } + // validate the optional field `deliveryCost` + if (jsonObj.get("deliveryCost") != null && !jsonObj.get("deliveryCost").isJsonNull()) { + DeliveryCostEnum.validateJsonElement(jsonObj.get("deliveryCost")); + } + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + DescriptionEnum.validateJsonElement(jsonObj.get("description")); + } + // validate the optional field `service` + if (jsonObj.get("service") != null && !jsonObj.get("service").isJsonNull()) { + ServiceEnum.validateJsonElement(jsonObj.get("service")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Rates.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Rates' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Rates.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Rates value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Rates read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Rates given an JSON string + * + * @param jsonString JSON string + * @return An instance of Rates + * @throws IOException if the JSON string is invalid with respect to Rates + */ + public static Rates fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Rates.class); + } + + /** + * Convert an instance of Rates to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReceiverAddressDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ReceiverAddressDto.java new file mode 100644 index 0000000..5e35763 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReceiverAddressDto.java @@ -0,0 +1,489 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Receiver address data with optional point ID. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReceiverAddressDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_COMPANY = "company"; + @SerializedName(SERIALIZED_NAME_COMPANY) + @javax.annotation.Nullable + private String company; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_POSTAL_CODE = "postalCode"; + @SerializedName(SERIALIZED_NAME_POSTAL_CODE) + @javax.annotation.Nonnull + private String postalCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nullable + private String state; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode = "PL"; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nonnull + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nonnull + private String phone; + + public static final String SERIALIZED_NAME_POINT = "point"; + @SerializedName(SERIALIZED_NAME_POINT) + @javax.annotation.Nullable + private String point; + + public ReceiverAddressDto() { + } + + public ReceiverAddressDto name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Person name. Name or Company are required. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ReceiverAddressDto company(@javax.annotation.Nullable String company) { + this.company = company; + return this; + } + + /** + * Company name. Name or Company are required. + * @return company + */ + @javax.annotation.Nullable + public String getCompany() { + return company; + } + + public void setCompany(@javax.annotation.Nullable String company) { + this.company = company; + } + + + public ReceiverAddressDto street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Get street + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public ReceiverAddressDto postalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * Get postalCode + * @return postalCode + */ + @javax.annotation.Nonnull + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + } + + + public ReceiverAddressDto city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * Get city + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public ReceiverAddressDto state(@javax.annotation.Nullable String state) { + this.state = state; + return this; + } + + /** + * Required for shipments to Ireland( county name ), United States ( state abbreviation / ISO code ), Canada ( province postal code / ISO code ) + * @return state + */ + @javax.annotation.Nullable + public String getState() { + return state; + } + + public void setState(@javax.annotation.Nullable String state) { + this.state = state; + } + + + public ReceiverAddressDto countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code in ISO 3166-1 alfa-2 format (two-letter code). + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + public ReceiverAddressDto email(@javax.annotation.Nonnull String email) { + this.email = email; + return this; + } + + /** + * Email address. For receiver, must be a valid buyer email generated by Allegro (eg. hamu7udk3p+17454c1b6@allegromail.pl). + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nonnull String email) { + this.email = email; + } + + + public ReceiverAddressDto phone(@javax.annotation.Nonnull String phone) { + this.phone = phone; + return this; + } + + /** + * Cell phone + * @return phone + */ + @javax.annotation.Nonnull + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nonnull String phone) { + this.phone = phone; + } + + + public ReceiverAddressDto point(@javax.annotation.Nullable String point) { + this.point = point; + return this; + } + + /** + * Pick up point id. You can get it from order or directly from courier service. + * @return point + */ + @javax.annotation.Nullable + public String getPoint() { + return point; + } + + public void setPoint(@javax.annotation.Nullable String point) { + this.point = point; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceiverAddressDto receiverAddressDto = (ReceiverAddressDto) o; + return Objects.equals(this.name, receiverAddressDto.name) && + Objects.equals(this.company, receiverAddressDto.company) && + Objects.equals(this.street, receiverAddressDto.street) && + Objects.equals(this.postalCode, receiverAddressDto.postalCode) && + Objects.equals(this.city, receiverAddressDto.city) && + Objects.equals(this.state, receiverAddressDto.state) && + Objects.equals(this.countryCode, receiverAddressDto.countryCode) && + Objects.equals(this.email, receiverAddressDto.email) && + Objects.equals(this.phone, receiverAddressDto.phone) && + Objects.equals(this.point, receiverAddressDto.point); + } + + @Override + public int hashCode() { + return Objects.hash(name, company, street, postalCode, city, state, countryCode, email, phone, point); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceiverAddressDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" company: ").append(toIndentedString(company)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" point: ").append(toIndentedString(point)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("company"); + openapiFields.add("street"); + openapiFields.add("postalCode"); + openapiFields.add("city"); + openapiFields.add("state"); + openapiFields.add("countryCode"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("point"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("postalCode"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("countryCode"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceiverAddressDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceiverAddressDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceiverAddressDto is not found in the empty JSON string", ReceiverAddressDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceiverAddressDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceiverAddressDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReceiverAddressDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("company") != null && !jsonObj.get("company").isJsonNull()) && !jsonObj.get("company").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `company` to be a primitive type in the JSON string but got `%s`", jsonObj.get("company").toString())); + } + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("postalCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postalCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postalCode").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + if ((jsonObj.get("point") != null && !jsonObj.get("point").isJsonNull()) && !jsonObj.get("point").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `point` to be a primitive type in the JSON string but got `%s`", jsonObj.get("point").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceiverAddressDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceiverAddressDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceiverAddressDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceiverAddressDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceiverAddressDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceiverAddressDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceiverAddressDto + * @throws IOException if the JSON string is invalid with respect to ReceiverAddressDto + */ + public static ReceiverAddressDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceiverAddressDto.class); + } + + /** + * Convert an instance of ReceiverAddressDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReceivingEntry.java b/src/main/java/pl/wtx/allegro/api/client/model/ReceivingEntry.java new file mode 100644 index 0000000..0fddd63 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReceivingEntry.java @@ -0,0 +1,288 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Product; +import pl.wtx.allegro.api.client.model.ReceivingStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ReceivingEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReceivingEntry { + public static final String SERIALIZED_NAME_EXPECTED = "expected"; + @SerializedName(SERIALIZED_NAME_EXPECTED) + @javax.annotation.Nullable + private Integer expected; + + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + @javax.annotation.Nullable + private Product product; + + public static final String SERIALIZED_NAME_RECEIVED = "received"; + @SerializedName(SERIALIZED_NAME_RECEIVED) + @javax.annotation.Nullable + private List received = new ArrayList<>(); + + public ReceivingEntry() { + } + + public ReceivingEntry expected(@javax.annotation.Nullable Integer expected) { + this.expected = expected; + return this; + } + + /** + * Expected product quantity. + * minimum: 0 + * @return expected + */ + @javax.annotation.Nullable + public Integer getExpected() { + return expected; + } + + public void setExpected(@javax.annotation.Nullable Integer expected) { + this.expected = expected; + } + + + public ReceivingEntry product(@javax.annotation.Nullable Product product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public Product getProduct() { + return product; + } + + public void setProduct(@javax.annotation.Nullable Product product) { + this.product = product; + } + + + public ReceivingEntry received(@javax.annotation.Nullable List received) { + this.received = received; + return this; + } + + public ReceivingEntry addReceivedItem(ReceivingStatus receivedItem) { + if (this.received == null) { + this.received = new ArrayList<>(); + } + this.received.add(receivedItem); + return this; + } + + /** + * Get received + * @return received + */ + @javax.annotation.Nullable + public List getReceived() { + return received; + } + + public void setReceived(@javax.annotation.Nullable List received) { + this.received = received; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivingEntry receivingEntry = (ReceivingEntry) o; + return Objects.equals(this.expected, receivingEntry.expected) && + Objects.equals(this.product, receivingEntry.product) && + Objects.equals(this.received, receivingEntry.received); + } + + @Override + public int hashCode() { + return Objects.hash(expected, product, received); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivingEntry {\n"); + sb.append(" expected: ").append(toIndentedString(expected)).append("\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" received: ").append(toIndentedString(received)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("expected"); + openapiFields.add("product"); + openapiFields.add("received"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivingEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivingEntry.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivingEntry is not found in the empty JSON string", ReceivingEntry.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivingEntry.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivingEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + Product.validateJsonElement(jsonObj.get("product")); + } + if (jsonObj.get("received") != null && !jsonObj.get("received").isJsonNull()) { + JsonArray jsonArrayreceived = jsonObj.getAsJsonArray("received"); + if (jsonArrayreceived != null) { + // ensure the json data is an array + if (!jsonObj.get("received").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `received` to be an array in the JSON string but got `%s`", jsonObj.get("received").toString())); + } + + // validate the optional field `received` (array) + for (int i = 0; i < jsonArrayreceived.size(); i++) { + ReceivingStatus.validateJsonElement(jsonArrayreceived.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivingEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivingEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivingEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivingEntry value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivingEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivingEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivingEntry + * @throws IOException if the JSON string is invalid with respect to ReceivingEntry + */ + public static ReceivingEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivingEntry.class); + } + + /** + * Convert an instance of ReceivingEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReceivingState.java b/src/main/java/pl/wtx/allegro/api/client/model/ReceivingState.java new file mode 100644 index 0000000..1745dea --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReceivingState.java @@ -0,0 +1,372 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ReceivingEntry; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ReceivingState + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReceivingState { + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + /** + * Stage of Advance Ship Notice receiving + */ + @JsonAdapter(StageEnum.Adapter.class) + public enum StageEnum { + IN_PROGRESS("IN_PROGRESS"), + + COMPLETED("COMPLETED"); + + private String value; + + StageEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StageEnum fromValue(String value) { + for (StageEnum b : StageEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StageEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StageEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StageEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StageEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STAGE = "stage"; + @SerializedName(SERIALIZED_NAME_STAGE) + @javax.annotation.Nullable + private StageEnum stage; + + public static final String SERIALIZED_NAME_DISPLAY_NUMBER = "displayNumber"; + @SerializedName(SERIALIZED_NAME_DISPLAY_NUMBER) + @javax.annotation.Nullable + private String displayNumber; + + public static final String SERIALIZED_NAME_CONTENT = "content"; + @SerializedName(SERIALIZED_NAME_CONTENT) + @javax.annotation.Nullable + private List content = new ArrayList<>(); + + public ReceivingState() { + } + + public ReceivingState updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The date and time when report was updated last time. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601). + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public ReceivingState stage(@javax.annotation.Nullable StageEnum stage) { + this.stage = stage; + return this; + } + + /** + * Stage of Advance Ship Notice receiving + * @return stage + */ + @javax.annotation.Nullable + public StageEnum getStage() { + return stage; + } + + public void setStage(@javax.annotation.Nullable StageEnum stage) { + this.stage = stage; + } + + + public ReceivingState displayNumber(@javax.annotation.Nullable String displayNumber) { + this.displayNumber = displayNumber; + return this; + } + + /** + * A human friendly identifier of Advance Ship Notice. + * @return displayNumber + */ + @javax.annotation.Nullable + public String getDisplayNumber() { + return displayNumber; + } + + public void setDisplayNumber(@javax.annotation.Nullable String displayNumber) { + this.displayNumber = displayNumber; + } + + + public ReceivingState content(@javax.annotation.Nullable List content) { + this.content = content; + return this; + } + + public ReceivingState addContentItem(ReceivingEntry contentItem) { + if (this.content == null) { + this.content = new ArrayList<>(); + } + this.content.add(contentItem); + return this; + } + + /** + * The list of products with receiving status. + * @return content + */ + @javax.annotation.Nullable + public List getContent() { + return content; + } + + public void setContent(@javax.annotation.Nullable List content) { + this.content = content; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivingState receivingState = (ReceivingState) o; + return Objects.equals(this.updatedAt, receivingState.updatedAt) && + Objects.equals(this.stage, receivingState.stage) && + Objects.equals(this.displayNumber, receivingState.displayNumber) && + Objects.equals(this.content, receivingState.content); + } + + @Override + public int hashCode() { + return Objects.hash(updatedAt, stage, displayNumber, content); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivingState {\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" stage: ").append(toIndentedString(stage)).append("\n"); + sb.append(" displayNumber: ").append(toIndentedString(displayNumber)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("updatedAt"); + openapiFields.add("stage"); + openapiFields.add("displayNumber"); + openapiFields.add("content"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivingState + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivingState.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivingState is not found in the empty JSON string", ReceivingState.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivingState.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivingState` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("stage") != null && !jsonObj.get("stage").isJsonNull()) && !jsonObj.get("stage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stage").toString())); + } + // validate the optional field `stage` + if (jsonObj.get("stage") != null && !jsonObj.get("stage").isJsonNull()) { + StageEnum.validateJsonElement(jsonObj.get("stage")); + } + if ((jsonObj.get("displayNumber") != null && !jsonObj.get("displayNumber").isJsonNull()) && !jsonObj.get("displayNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `displayNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayNumber").toString())); + } + if (jsonObj.get("content") != null && !jsonObj.get("content").isJsonNull()) { + JsonArray jsonArraycontent = jsonObj.getAsJsonArray("content"); + if (jsonArraycontent != null) { + // ensure the json data is an array + if (!jsonObj.get("content").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `content` to be an array in the JSON string but got `%s`", jsonObj.get("content").toString())); + } + + // validate the optional field `content` (array) + for (int i = 0; i < jsonArraycontent.size(); i++) { + ReceivingEntry.validateJsonElement(jsonArraycontent.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivingState.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivingState' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivingState.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivingState value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivingState read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivingState given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivingState + * @throws IOException if the JSON string is invalid with respect to ReceivingState + */ + public static ReceivingState fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivingState.class); + } + + /** + * Convert an instance of ReceivingState to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReceivingStatus.java b/src/main/java/pl/wtx/allegro/api/client/model/ReceivingStatus.java new file mode 100644 index 0000000..75ac661 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReceivingStatus.java @@ -0,0 +1,394 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ReceivingStatus + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReceivingStatus { + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + /** + * Received item condition. + */ + @JsonAdapter(ReceivedTypeEnum.Adapter.class) + public enum ReceivedTypeEnum { + SELLABLE("SELLABLE"), + + DAMAGE("DAMAGE"), + + REJECT("REJECT"); + + private String value; + + ReceivedTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ReceivedTypeEnum fromValue(String value) { + for (ReceivedTypeEnum b : ReceivedTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReceivedTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ReceivedTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReceivedTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ReceivedTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_RECEIVED_TYPE = "receivedType"; + @SerializedName(SERIALIZED_NAME_RECEIVED_TYPE) + @javax.annotation.Nullable + private ReceivedTypeEnum receivedType; + + /** + * The reasonCode indicates the condition of the product after unpacking. For sellable product is given the reasonCode SELLABLE. For a product that is not suitable for sale receives a code specifying a detailed reason for rejection, e.g. \"DAMAGED_IN_TRANSPORT\" or \"NO_BARCODE\" + */ + @JsonAdapter(ReasonCodeEnum.Adapter.class) + public enum ReasonCodeEnum { + SELLABLE("SELLABLE"), + + DAMAGED_CARRIER_CLAIM("DAMAGED_CARRIER_CLAIM"), + + DAMAGED_IN_TRANSPORT("DAMAGED_IN_TRANSPORT"), + + NO_BARCODE("NO_BARCODE"), + + PRODUCT_NOT_ACCEPTABLE_IN_FULFILLMENT("PRODUCT_NOT_ACCEPTABLE_IN_FULFILLMENT"), + + SHORT_EXPIRY_DATE("SHORT_EXPIRY_DATE"), + + UNACCEPTABLE_HAZMAT("UNACCEPTABLE_HAZMAT"), + + UNACCEPTABLE_PRODUCT_SIZE("UNACCEPTABLE_PRODUCT_SIZE"), + + UNACCEPTABLE_PRODUCT_VARIANT("UNACCEPTABLE_PRODUCT_VARIANT"), + + UNSCANNABLE_BARCODE("UNSCANNABLE_BARCODE"); + + private String value; + + ReasonCodeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ReasonCodeEnum fromValue(String value) { + for (ReasonCodeEnum b : ReasonCodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReasonCodeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ReasonCodeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReasonCodeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ReasonCodeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_REASON_CODE = "reasonCode"; + @SerializedName(SERIALIZED_NAME_REASON_CODE) + @javax.annotation.Nullable + private ReasonCodeEnum reasonCode; + + public ReceivingStatus() { + } + + public ReceivingStatus quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Product quantity. + * minimum: 0 + * @return quantity + */ + @javax.annotation.Nullable + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public ReceivingStatus receivedType(@javax.annotation.Nullable ReceivedTypeEnum receivedType) { + this.receivedType = receivedType; + return this; + } + + /** + * Received item condition. + * @return receivedType + */ + @javax.annotation.Nullable + public ReceivedTypeEnum getReceivedType() { + return receivedType; + } + + public void setReceivedType(@javax.annotation.Nullable ReceivedTypeEnum receivedType) { + this.receivedType = receivedType; + } + + + public ReceivingStatus reasonCode(@javax.annotation.Nullable ReasonCodeEnum reasonCode) { + this.reasonCode = reasonCode; + return this; + } + + /** + * The reasonCode indicates the condition of the product after unpacking. For sellable product is given the reasonCode SELLABLE. For a product that is not suitable for sale receives a code specifying a detailed reason for rejection, e.g. \"DAMAGED_IN_TRANSPORT\" or \"NO_BARCODE\" + * @return reasonCode + */ + @javax.annotation.Nullable + public ReasonCodeEnum getReasonCode() { + return reasonCode; + } + + public void setReasonCode(@javax.annotation.Nullable ReasonCodeEnum reasonCode) { + this.reasonCode = reasonCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReceivingStatus receivingStatus = (ReceivingStatus) o; + return Objects.equals(this.quantity, receivingStatus.quantity) && + Objects.equals(this.receivedType, receivingStatus.receivedType) && + Objects.equals(this.reasonCode, receivingStatus.reasonCode); + } + + @Override + public int hashCode() { + return Objects.hash(quantity, receivedType, reasonCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReceivingStatus {\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" receivedType: ").append(toIndentedString(receivedType)).append("\n"); + sb.append(" reasonCode: ").append(toIndentedString(reasonCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("quantity"); + openapiFields.add("receivedType"); + openapiFields.add("reasonCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReceivingStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReceivingStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReceivingStatus is not found in the empty JSON string", ReceivingStatus.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReceivingStatus.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReceivingStatus` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("receivedType") != null && !jsonObj.get("receivedType").isJsonNull()) && !jsonObj.get("receivedType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `receivedType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("receivedType").toString())); + } + // validate the optional field `receivedType` + if (jsonObj.get("receivedType") != null && !jsonObj.get("receivedType").isJsonNull()) { + ReceivedTypeEnum.validateJsonElement(jsonObj.get("receivedType")); + } + if ((jsonObj.get("reasonCode") != null && !jsonObj.get("reasonCode").isJsonNull()) && !jsonObj.get("reasonCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reasonCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reasonCode").toString())); + } + // validate the optional field `reasonCode` + if (jsonObj.get("reasonCode") != null && !jsonObj.get("reasonCode").isJsonNull()) { + ReasonCodeEnum.validateJsonElement(jsonObj.get("reasonCode")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReceivingStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReceivingStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReceivingStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReceivingStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReceivingStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReceivingStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReceivingStatus + * @throws IOException if the JSON string is invalid with respect to ReceivingStatus + */ + public static ReceivingStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReceivingStatus.class); + } + + /** + * Convert an instance of ReceivingStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Recipient.java b/src/main/java/pl/wtx/allegro/api/client/model/Recipient.java new file mode 100644 index 0000000..fe1b1a6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Recipient.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Recipient + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Recipient { + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nonnull + private String login; + + public Recipient() { + } + + public Recipient login(@javax.annotation.Nonnull String login) { + this.login = login; + return this; + } + + /** + * Get login + * @return login + */ + @javax.annotation.Nonnull + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nonnull String login) { + this.login = login; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Recipient recipient = (Recipient) o; + return Objects.equals(this.login, recipient.login); + } + + @Override + public int hashCode() { + return Objects.hash(login); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Recipient {\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("login"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("login"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Recipient + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Recipient.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Recipient is not found in the empty JSON string", Recipient.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Recipient.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Recipient` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Recipient.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Recipient.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Recipient' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Recipient.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Recipient value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Recipient read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Recipient given an JSON string + * + * @param jsonString JSON string + * @return An instance of Recipient + * @throws IOException if the JSON string is invalid with respect to Recipient + */ + public static Recipient fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Recipient.class); + } + + /** + * Convert an instance of Recipient to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Reference.java b/src/main/java/pl/wtx/allegro/api/client/model/Reference.java new file mode 100644 index 0000000..fd464eb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Reference.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Reference + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Reference { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public Reference() { + } + + public Reference id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Reference reference = (Reference) o; + return Objects.equals(this.id, reference.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Reference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Reference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Reference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Reference is not found in the empty JSON string", Reference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Reference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Reference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Reference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Reference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Reference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Reference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Reference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Reference given an JSON string + * + * @param jsonString JSON string + * @return An instance of Reference + * @throws IOException if the JSON string is invalid with respect to Reference + */ + public static Reference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Reference.class); + } + + /** + * Convert an instance of Reference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundAdditionalServicesValue.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundAdditionalServicesValue.java new file mode 100644 index 0000000..cb07a4d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundAdditionalServicesValue.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Additional services amount for payment refund. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundAdditionalServicesValue { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public RefundAdditionalServicesValue() { + } + + public RefundAdditionalServicesValue amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public RefundAdditionalServicesValue currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundAdditionalServicesValue refundAdditionalServicesValue = (RefundAdditionalServicesValue) o; + return Objects.equals(this.amount, refundAdditionalServicesValue.amount) && + Objects.equals(this.currency, refundAdditionalServicesValue.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundAdditionalServicesValue {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundAdditionalServicesValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundAdditionalServicesValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundAdditionalServicesValue is not found in the empty JSON string", RefundAdditionalServicesValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundAdditionalServicesValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundAdditionalServicesValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefundAdditionalServicesValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundAdditionalServicesValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundAdditionalServicesValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundAdditionalServicesValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundAdditionalServicesValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundAdditionalServicesValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundAdditionalServicesValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundAdditionalServicesValue + * @throws IOException if the JSON string is invalid with respect to RefundAdditionalServicesValue + */ + public static RefundAdditionalServicesValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundAdditionalServicesValue.class); + } + + /** + * Convert an instance of RefundAdditionalServicesValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundCancelOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundCancelOperation.java new file mode 100644 index 0000000..3b89eaf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundCancelOperation.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.OperationPayment; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * RefundCancelOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundCancelOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "REFUND_CANCEL"; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nonnull + private OperationPayment payment; + + public RefundCancelOperation() { + this.type = this.getClass().getSimpleName(); + } + + public RefundCancelOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public RefundCancelOperation payment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nonnull + public OperationPayment getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundCancelOperation refundCancelOperation = (RefundCancelOperation) o; + return Objects.equals(this.type, refundCancelOperation.type) && + Objects.equals(this.payment, refundCancelOperation.payment) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, payment, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundCancelOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("payment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payment"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundCancelOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundCancelOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundCancelOperation is not found in the empty JSON string", RefundCancelOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundCancelOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundCancelOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefundCancelOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundCancelOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundCancelOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundCancelOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundCancelOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundCancelOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundCancelOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundCancelOperation + * @throws IOException if the JSON string is invalid with respect to RefundCancelOperation + */ + public static RefundCancelOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundCancelOperation.class); + } + + /** + * Convert an instance of RefundCancelOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundChargeOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundChargeOperation.java new file mode 100644 index 0000000..962b837 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundChargeOperation.java @@ -0,0 +1,283 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.BuyerParticipant; +import pl.wtx.allegro.api.client.model.OperationPayment; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * RefundChargeOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundChargeOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "REFUND_CHARGE"; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nonnull + private OperationPayment payment; + + public static final String SERIALIZED_NAME_PARTICIPANT = "participant"; + @SerializedName(SERIALIZED_NAME_PARTICIPANT) + @javax.annotation.Nonnull + private BuyerParticipant participant; + + public RefundChargeOperation() { + this.type = this.getClass().getSimpleName(); + } + + public RefundChargeOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public RefundChargeOperation payment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nonnull + public OperationPayment getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + } + + + public RefundChargeOperation participant(@javax.annotation.Nonnull BuyerParticipant participant) { + this.participant = participant; + return this; + } + + /** + * Get participant + * @return participant + */ + @javax.annotation.Nonnull + public BuyerParticipant getParticipant() { + return participant; + } + + public void setParticipant(@javax.annotation.Nonnull BuyerParticipant participant) { + this.participant = participant; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundChargeOperation refundChargeOperation = (RefundChargeOperation) o; + return Objects.equals(this.type, refundChargeOperation.type) && + Objects.equals(this.payment, refundChargeOperation.payment) && + Objects.equals(this.participant, refundChargeOperation.participant) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, payment, participant, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundChargeOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append(" participant: ").append(toIndentedString(participant)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("payment"); + openapiFields.add("participant"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payment"); + openapiRequiredFields.add("participant"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundChargeOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundChargeOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundChargeOperation is not found in the empty JSON string", RefundChargeOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundChargeOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundChargeOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefundChargeOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundChargeOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundChargeOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundChargeOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundChargeOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundChargeOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundChargeOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundChargeOperation + * @throws IOException if the JSON string is invalid with respect to RefundChargeOperation + */ + public static RefundChargeOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundChargeOperation.class); + } + + /** + * Convert an instance of RefundChargeOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundClaim.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaim.java new file mode 100644 index 0000000..1a0c64c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaim.java @@ -0,0 +1,541 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.RefundClaimBuyer; +import pl.wtx.allegro.api.client.model.RefundClaimCommission; +import pl.wtx.allegro.api.client.model.RefundClaimLineItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Detailed information about the refund application. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundClaim { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + /** + * Status of the returned refund application. - `IN_PROGRESS` - the application is being processed or awaits user or admin action. - `WAITING_FOR_PAYMENT_REFUND` - the application is being processed and awaits payment refund to buyer. - `GRANTED` - the application was accepted and a commission refund was granted as requested, or the application was rejected and the seller successfully appealed. - `REJECTED` - the application was rejected and no commission was refunded. - `REJECTED_AFTER_APPEAL` - the application was initially rejected and the seller unsuccessfully appealed. - `CANCELLED` - the application was cancelled by the seller. - `APPEALED` - the application was rejected and the seller appealed, but the appeal has not yet finished processing. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + IN_PROGRESS("IN_PROGRESS"), + + WAITING_FOR_PAYMENT_REFUND("WAITING_FOR_PAYMENT_REFUND"), + + GRANTED("GRANTED"), + + REJECTED("REJECTED"), + + REJECTED_AFTER_APPEAL("REJECTED_AFTER_APPEAL"), + + CANCELLED("CANCELLED"), + + APPEALED("APPEALED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_COMMISSION = "commission"; + @SerializedName(SERIALIZED_NAME_COMMISSION) + @javax.annotation.Nullable + private RefundClaimCommission commission; + + public static final String SERIALIZED_NAME_BUYER = "buyer"; + @SerializedName(SERIALIZED_NAME_BUYER) + @javax.annotation.Nullable + private RefundClaimBuyer buyer; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_LINE_ITEM = "lineItem"; + @SerializedName(SERIALIZED_NAME_LINE_ITEM) + @javax.annotation.Nullable + private RefundClaimLineItem lineItem; + + /** + * Type of commission refund application. - `MANUAL` - the application was created manually by the seller. - `AUTOMATIC` - the application was created automatically. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + MANUAL("MANUAL"), + + AUTOMATIC("AUTOMATIC"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + public RefundClaim() { + } + + public RefundClaim id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * ID of the returned refund application. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public RefundClaim status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Status of the returned refund application. - `IN_PROGRESS` - the application is being processed or awaits user or admin action. - `WAITING_FOR_PAYMENT_REFUND` - the application is being processed and awaits payment refund to buyer. - `GRANTED` - the application was accepted and a commission refund was granted as requested, or the application was rejected and the seller successfully appealed. - `REJECTED` - the application was rejected and no commission was refunded. - `REJECTED_AFTER_APPEAL` - the application was initially rejected and the seller unsuccessfully appealed. - `CANCELLED` - the application was cancelled by the seller. - `APPEALED` - the application was rejected and the seller appealed, but the appeal has not yet finished processing. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public RefundClaim quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Quantity of product for which the seller filed the refund application. + * minimum: 1 + * @return quantity + */ + @javax.annotation.Nullable + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public RefundClaim commission(@javax.annotation.Nullable RefundClaimCommission commission) { + this.commission = commission; + return this; + } + + /** + * Get commission + * @return commission + */ + @javax.annotation.Nullable + public RefundClaimCommission getCommission() { + return commission; + } + + public void setCommission(@javax.annotation.Nullable RefundClaimCommission commission) { + this.commission = commission; + } + + + public RefundClaim buyer(@javax.annotation.Nullable RefundClaimBuyer buyer) { + this.buyer = buyer; + return this; + } + + /** + * Get buyer + * @return buyer + */ + @javax.annotation.Nullable + public RefundClaimBuyer getBuyer() { + return buyer; + } + + public void setBuyer(@javax.annotation.Nullable RefundClaimBuyer buyer) { + this.buyer = buyer; + } + + + public RefundClaim createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Date when the refund application was created. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public RefundClaim lineItem(@javax.annotation.Nullable RefundClaimLineItem lineItem) { + this.lineItem = lineItem; + return this; + } + + /** + * Get lineItem + * @return lineItem + */ + @javax.annotation.Nullable + public RefundClaimLineItem getLineItem() { + return lineItem; + } + + public void setLineItem(@javax.annotation.Nullable RefundClaimLineItem lineItem) { + this.lineItem = lineItem; + } + + + public RefundClaim type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of commission refund application. - `MANUAL` - the application was created manually by the seller. - `AUTOMATIC` - the application was created automatically. + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundClaim refundClaim = (RefundClaim) o; + return Objects.equals(this.id, refundClaim.id) && + Objects.equals(this.status, refundClaim.status) && + Objects.equals(this.quantity, refundClaim.quantity) && + Objects.equals(this.commission, refundClaim.commission) && + Objects.equals(this.buyer, refundClaim.buyer) && + Objects.equals(this.createdAt, refundClaim.createdAt) && + Objects.equals(this.lineItem, refundClaim.lineItem) && + Objects.equals(this.type, refundClaim.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, quantity, commission, buyer, createdAt, lineItem, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundClaim {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" commission: ").append(toIndentedString(commission)).append("\n"); + sb.append(" buyer: ").append(toIndentedString(buyer)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" lineItem: ").append(toIndentedString(lineItem)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("status"); + openapiFields.add("quantity"); + openapiFields.add("commission"); + openapiFields.add("buyer"); + openapiFields.add("createdAt"); + openapiFields.add("lineItem"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundClaim + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundClaim.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundClaim is not found in the empty JSON string", RefundClaim.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundClaim.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundClaim` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + // validate the optional field `commission` + if (jsonObj.get("commission") != null && !jsonObj.get("commission").isJsonNull()) { + RefundClaimCommission.validateJsonElement(jsonObj.get("commission")); + } + // validate the optional field `buyer` + if (jsonObj.get("buyer") != null && !jsonObj.get("buyer").isJsonNull()) { + RefundClaimBuyer.validateJsonElement(jsonObj.get("buyer")); + } + // validate the optional field `lineItem` + if (jsonObj.get("lineItem") != null && !jsonObj.get("lineItem").isJsonNull()) { + RefundClaimLineItem.validateJsonElement(jsonObj.get("lineItem")); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundClaim.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundClaim' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundClaim.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundClaim value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundClaim read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundClaim given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundClaim + * @throws IOException if the JSON string is invalid with respect to RefundClaim + */ + public static RefundClaim fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundClaim.class); + } + + /** + * Convert an instance of RefundClaim to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimBuyer.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimBuyer.java new file mode 100644 index 0000000..44b6c52 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimBuyer.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Buyer associated with the refund application. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundClaimBuyer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nullable + private String login; + + public RefundClaimBuyer() { + } + + public RefundClaimBuyer id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of the buyer associated with the refund application. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public RefundClaimBuyer login(@javax.annotation.Nullable String login) { + this.login = login; + return this; + } + + /** + * Login of the buyer associated with the refund application. + * @return login + */ + @javax.annotation.Nullable + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nullable String login) { + this.login = login; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundClaimBuyer refundClaimBuyer = (RefundClaimBuyer) o; + return Objects.equals(this.id, refundClaimBuyer.id) && + Objects.equals(this.login, refundClaimBuyer.login); + } + + @Override + public int hashCode() { + return Objects.hash(id, login); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundClaimBuyer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("login"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundClaimBuyer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundClaimBuyer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundClaimBuyer is not found in the empty JSON string", RefundClaimBuyer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundClaimBuyer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundClaimBuyer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("login") != null && !jsonObj.get("login").isJsonNull()) && !jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundClaimBuyer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundClaimBuyer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundClaimBuyer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundClaimBuyer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundClaimBuyer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundClaimBuyer given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundClaimBuyer + * @throws IOException if the JSON string is invalid with respect to RefundClaimBuyer + */ + public static RefundClaimBuyer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundClaimBuyer.class); + } + + /** + * Convert an instance of RefundClaimBuyer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimCommission.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimCommission.java new file mode 100644 index 0000000..8550a92 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimCommission.java @@ -0,0 +1,234 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Money value of the returned refund application. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundClaimCommission { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private BigDecimal amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public RefundClaimCommission() { + } + + public RefundClaimCommission amount(@javax.annotation.Nullable BigDecimal amount) { + this.amount = amount; + return this; + } + + /** + * Monetary amount of the returned refund application. + * @return amount + */ + @javax.annotation.Nullable + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable BigDecimal amount) { + this.amount = amount; + } + + + public RefundClaimCommission currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Three-letter currency code (ISO-4217) of the returned refund application. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundClaimCommission refundClaimCommission = (RefundClaimCommission) o; + return Objects.equals(this.amount, refundClaimCommission.amount) && + Objects.equals(this.currency, refundClaimCommission.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundClaimCommission {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundClaimCommission + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundClaimCommission.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundClaimCommission is not found in the empty JSON string", RefundClaimCommission.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundClaimCommission.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundClaimCommission` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundClaimCommission.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundClaimCommission' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundClaimCommission.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundClaimCommission value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundClaimCommission read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundClaimCommission given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundClaimCommission + * @throws IOException if the JSON string is invalid with respect to RefundClaimCommission + */ + public static RefundClaimCommission fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundClaimCommission.class); + } + + /** + * Convert an instance of RefundClaimCommission to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimLineItem.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimLineItem.java new file mode 100644 index 0000000..8537bf6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimLineItem.java @@ -0,0 +1,294 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.RefundClaimLineItemOffer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Purchase associated with the refund application. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundClaimLineItem { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public static final String SERIALIZED_NAME_BOUGHT_AT = "boughtAt"; + @SerializedName(SERIALIZED_NAME_BOUGHT_AT) + @javax.annotation.Nullable + private OffsetDateTime boughtAt; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private RefundClaimLineItemOffer offer; + + public RefundClaimLineItem() { + } + + public RefundClaimLineItem id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of the purchase associated with the refund application. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public RefundClaimLineItem quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Total quantity of product purchased by the buyer. Equal to or greater than quantity for which the seller filed the refund application. + * minimum: 1 + * @return quantity + */ + @javax.annotation.Nullable + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + public RefundClaimLineItem boughtAt(@javax.annotation.Nullable OffsetDateTime boughtAt) { + this.boughtAt = boughtAt; + return this; + } + + /** + * Date when the purchase was made. + * @return boughtAt + */ + @javax.annotation.Nullable + public OffsetDateTime getBoughtAt() { + return boughtAt; + } + + public void setBoughtAt(@javax.annotation.Nullable OffsetDateTime boughtAt) { + this.boughtAt = boughtAt; + } + + + public RefundClaimLineItem offer(@javax.annotation.Nullable RefundClaimLineItemOffer offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public RefundClaimLineItemOffer getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable RefundClaimLineItemOffer offer) { + this.offer = offer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundClaimLineItem refundClaimLineItem = (RefundClaimLineItem) o; + return Objects.equals(this.id, refundClaimLineItem.id) && + Objects.equals(this.quantity, refundClaimLineItem.quantity) && + Objects.equals(this.boughtAt, refundClaimLineItem.boughtAt) && + Objects.equals(this.offer, refundClaimLineItem.offer); + } + + @Override + public int hashCode() { + return Objects.hash(id, quantity, boughtAt, offer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundClaimLineItem {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" boughtAt: ").append(toIndentedString(boughtAt)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("quantity"); + openapiFields.add("boughtAt"); + openapiFields.add("offer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundClaimLineItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundClaimLineItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundClaimLineItem is not found in the empty JSON string", RefundClaimLineItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundClaimLineItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundClaimLineItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + RefundClaimLineItemOffer.validateJsonElement(jsonObj.get("offer")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundClaimLineItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundClaimLineItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundClaimLineItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundClaimLineItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundClaimLineItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundClaimLineItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundClaimLineItem + * @throws IOException if the JSON string is invalid with respect to RefundClaimLineItem + */ + public static RefundClaimLineItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundClaimLineItem.class); + } + + /** + * Convert an instance of RefundClaimLineItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimLineItemOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimLineItemOffer.java new file mode 100644 index 0000000..f26081c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimLineItemOffer.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer associated with the purchase. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundClaimLineItemOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public RefundClaimLineItemOffer() { + } + + public RefundClaimLineItemOffer id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of the offer associated with the purchase. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public RefundClaimLineItemOffer name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of the offer associated with the purchase. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundClaimLineItemOffer refundClaimLineItemOffer = (RefundClaimLineItemOffer) o; + return Objects.equals(this.id, refundClaimLineItemOffer.id) && + Objects.equals(this.name, refundClaimLineItemOffer.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundClaimLineItemOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundClaimLineItemOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundClaimLineItemOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundClaimLineItemOffer is not found in the empty JSON string", RefundClaimLineItemOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundClaimLineItemOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundClaimLineItemOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundClaimLineItemOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundClaimLineItemOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundClaimLineItemOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundClaimLineItemOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundClaimLineItemOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundClaimLineItemOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundClaimLineItemOffer + * @throws IOException if the JSON string is invalid with respect to RefundClaimLineItemOffer + */ + public static RefundClaimLineItemOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundClaimLineItemOffer.class); + } + + /** + * Convert an instance of RefundClaimLineItemOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimRequest.java new file mode 100644 index 0000000..ec6cdff --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimRequest.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.RefundClaimRequestLineItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * RefundClaimRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundClaimRequest { + public static final String SERIALIZED_NAME_LINE_ITEM = "lineItem"; + @SerializedName(SERIALIZED_NAME_LINE_ITEM) + @javax.annotation.Nullable + private RefundClaimRequestLineItem lineItem; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private Integer quantity; + + public RefundClaimRequest() { + } + + public RefundClaimRequest lineItem(@javax.annotation.Nullable RefundClaimRequestLineItem lineItem) { + this.lineItem = lineItem; + return this; + } + + /** + * Get lineItem + * @return lineItem + */ + @javax.annotation.Nullable + public RefundClaimRequestLineItem getLineItem() { + return lineItem; + } + + public void setLineItem(@javax.annotation.Nullable RefundClaimRequestLineItem lineItem) { + this.lineItem = lineItem; + } + + + public RefundClaimRequest quantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Quantity of product for which the refund application will be created. Must be greater than zero. + * minimum: 1 + * @return quantity + */ + @javax.annotation.Nullable + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable Integer quantity) { + this.quantity = quantity; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundClaimRequest refundClaimRequest = (RefundClaimRequest) o; + return Objects.equals(this.lineItem, refundClaimRequest.lineItem) && + Objects.equals(this.quantity, refundClaimRequest.quantity); + } + + @Override + public int hashCode() { + return Objects.hash(lineItem, quantity); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundClaimRequest {\n"); + sb.append(" lineItem: ").append(toIndentedString(lineItem)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("lineItem"); + openapiFields.add("quantity"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundClaimRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundClaimRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundClaimRequest is not found in the empty JSON string", RefundClaimRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundClaimRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundClaimRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `lineItem` + if (jsonObj.get("lineItem") != null && !jsonObj.get("lineItem").isJsonNull()) { + RefundClaimRequestLineItem.validateJsonElement(jsonObj.get("lineItem")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundClaimRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundClaimRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundClaimRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundClaimRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundClaimRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundClaimRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundClaimRequest + * @throws IOException if the JSON string is invalid with respect to RefundClaimRequest + */ + public static RefundClaimRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundClaimRequest.class); + } + + /** + * Convert an instance of RefundClaimRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimRequestLineItem.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimRequestLineItem.java new file mode 100644 index 0000000..0218057 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimRequestLineItem.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Purchase for which a refund application will be created. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundClaimRequestLineItem { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public RefundClaimRequestLineItem() { + } + + public RefundClaimRequestLineItem id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of the purchase for which a refund application will be created. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundClaimRequestLineItem refundClaimRequestLineItem = (RefundClaimRequestLineItem) o; + return Objects.equals(this.id, refundClaimRequestLineItem.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundClaimRequestLineItem {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundClaimRequestLineItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundClaimRequestLineItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundClaimRequestLineItem is not found in the empty JSON string", RefundClaimRequestLineItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundClaimRequestLineItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundClaimRequestLineItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundClaimRequestLineItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundClaimRequestLineItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundClaimRequestLineItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundClaimRequestLineItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundClaimRequestLineItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundClaimRequestLineItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundClaimRequestLineItem + * @throws IOException if the JSON string is invalid with respect to RefundClaimRequestLineItem + */ + public static RefundClaimRequestLineItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundClaimRequestLineItem.class); + } + + /** + * Convert an instance of RefundClaimRequestLineItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimResponse.java new file mode 100644 index 0000000..d99b551 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundClaimResponse.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * RefundClaimResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundClaimResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public RefundClaimResponse() { + } + + public RefundClaimResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of created claim. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundClaimResponse refundClaimResponse = (RefundClaimResponse) o; + return Objects.equals(this.id, refundClaimResponse.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundClaimResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundClaimResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundClaimResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundClaimResponse is not found in the empty JSON string", RefundClaimResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundClaimResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundClaimResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundClaimResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundClaimResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundClaimResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundClaimResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundClaimResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundClaimResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundClaimResponse + * @throws IOException if the JSON string is invalid with respect to RefundClaimResponse + */ + public static RefundClaimResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundClaimResponse.class); + } + + /** + * Convert an instance of RefundClaimResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundDeliveryValue.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundDeliveryValue.java new file mode 100644 index 0000000..dea22cf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundDeliveryValue.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Delivery amount for payment refund. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundDeliveryValue { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public RefundDeliveryValue() { + } + + public RefundDeliveryValue amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public RefundDeliveryValue currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundDeliveryValue refundDeliveryValue = (RefundDeliveryValue) o; + return Objects.equals(this.amount, refundDeliveryValue.amount) && + Objects.equals(this.currency, refundDeliveryValue.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundDeliveryValue {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundDeliveryValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundDeliveryValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundDeliveryValue is not found in the empty JSON string", RefundDeliveryValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundDeliveryValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundDeliveryValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefundDeliveryValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundDeliveryValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundDeliveryValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundDeliveryValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundDeliveryValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundDeliveryValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundDeliveryValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundDeliveryValue + * @throws IOException if the JSON string is invalid with respect to RefundDeliveryValue + */ + public static RefundDeliveryValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundDeliveryValue.class); + } + + /** + * Convert an instance of RefundDeliveryValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundDetails.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundDetails.java new file mode 100644 index 0000000..67fdc3f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundDetails.java @@ -0,0 +1,756 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.InitializeRefundAdditionalServices; +import pl.wtx.allegro.api.client.model.InitializeRefundDelivery; +import pl.wtx.allegro.api.client.model.InitializeRefundOverpaid; +import pl.wtx.allegro.api.client.model.PaymentsSurcharge; +import pl.wtx.allegro.api.client.model.RefundLineItem; +import pl.wtx.allegro.api.client.model.RefundOrder; +import pl.wtx.allegro.api.client.model.RefundPayment; +import pl.wtx.allegro.api.client.model.RefundTotalValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Detailed information about the refund. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundDetails { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nonnull + private RefundPayment payment; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + @javax.annotation.Nullable + private RefundOrder order; + + /** + * Reason for a payment refund. + */ + @JsonAdapter(ReasonEnum.Adapter.class) + public enum ReasonEnum { + REFUND("REFUND"), + + COMPLAINT("COMPLAINT"), + + PRODUCT_NOT_AVAILABLE("PRODUCT_NOT_AVAILABLE"), + + PAID_VALUE_TOO_LOW("PAID_VALUE_TOO_LOW"), + + OVERPAID("OVERPAID"), + + CANCELLED_BY_BUYER("CANCELLED_BY_BUYER"), + + NOT_COLLECTED("NOT_COLLECTED"); + + private String value; + + ReasonEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ReasonEnum fromValue(String value) { + for (ReasonEnum b : ReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReasonEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ReasonEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReasonEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ReasonEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nonnull + private ReasonEnum reason; + + /** + * Current status of payment refund. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + SUCCESS("SUCCESS"), + + CANCELED("CANCELED"), + + PARTIAL("PARTIAL"), + + IN_PROGRESS("IN_PROGRESS"), + + VALIDATED("VALIDATED"), + + VALIDATE_FAILED("VALIDATE_FAILED"), + + NEW("NEW"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_TOTAL_VALUE = "totalValue"; + @SerializedName(SERIALIZED_NAME_TOTAL_VALUE) + @javax.annotation.Nonnull + private RefundTotalValue totalValue; + + public static final String SERIALIZED_NAME_LINE_ITEMS = "lineItems"; + @SerializedName(SERIALIZED_NAME_LINE_ITEMS) + @javax.annotation.Nullable + private List lineItems = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private InitializeRefundDelivery delivery; + + public static final String SERIALIZED_NAME_OVERPAID = "overpaid"; + @SerializedName(SERIALIZED_NAME_OVERPAID) + @javax.annotation.Nullable + private InitializeRefundOverpaid overpaid; + + public static final String SERIALIZED_NAME_SURCHARGES = "surcharges"; + @SerializedName(SERIALIZED_NAME_SURCHARGES) + @javax.annotation.Nullable + private List surcharges = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private InitializeRefundAdditionalServices additionalServices; + + public static final String SERIALIZED_NAME_SELLER_COMMENT = "sellerComment"; + @SerializedName(SERIALIZED_NAME_SELLER_COMMENT) + @javax.annotation.Nullable + private String sellerComment; + + public RefundDetails() { + } + + public RefundDetails id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * The payment refund identifier. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public RefundDetails payment(@javax.annotation.Nonnull RefundPayment payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nonnull + public RefundPayment getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nonnull RefundPayment payment) { + this.payment = payment; + } + + + public RefundDetails order(@javax.annotation.Nullable RefundOrder order) { + this.order = order; + return this; + } + + /** + * Get order + * @return order + */ + @javax.annotation.Nullable + public RefundOrder getOrder() { + return order; + } + + public void setOrder(@javax.annotation.Nullable RefundOrder order) { + this.order = order; + } + + + public RefundDetails reason(@javax.annotation.Nonnull ReasonEnum reason) { + this.reason = reason; + return this; + } + + /** + * Reason for a payment refund. + * @return reason + */ + @javax.annotation.Nonnull + public ReasonEnum getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nonnull ReasonEnum reason) { + this.reason = reason; + } + + + public RefundDetails status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Current status of payment refund. + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + public RefundDetails createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Date and time when the refund was created provided in ISO 8601 format. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public RefundDetails totalValue(@javax.annotation.Nonnull RefundTotalValue totalValue) { + this.totalValue = totalValue; + return this; + } + + /** + * Get totalValue + * @return totalValue + */ + @javax.annotation.Nonnull + public RefundTotalValue getTotalValue() { + return totalValue; + } + + public void setTotalValue(@javax.annotation.Nonnull RefundTotalValue totalValue) { + this.totalValue = totalValue; + } + + + public RefundDetails lineItems(@javax.annotation.Nullable List lineItems) { + this.lineItems = lineItems; + return this; + } + + public RefundDetails addLineItemsItem(RefundLineItem lineItemsItem) { + if (this.lineItems == null) { + this.lineItems = new ArrayList<>(); + } + this.lineItems.add(lineItemsItem); + return this; + } + + /** + * List of order's line items which can be refunded. + * @return lineItems + */ + @javax.annotation.Nullable + public List getLineItems() { + return lineItems; + } + + public void setLineItems(@javax.annotation.Nullable List lineItems) { + this.lineItems = lineItems; + } + + + public RefundDetails delivery(@javax.annotation.Nullable InitializeRefundDelivery delivery) { + this.delivery = delivery; + return this; + } + + /** + * Get delivery + * @return delivery + */ + @javax.annotation.Nullable + public InitializeRefundDelivery getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable InitializeRefundDelivery delivery) { + this.delivery = delivery; + } + + + public RefundDetails overpaid(@javax.annotation.Nullable InitializeRefundOverpaid overpaid) { + this.overpaid = overpaid; + return this; + } + + /** + * Get overpaid + * @return overpaid + */ + @javax.annotation.Nullable + public InitializeRefundOverpaid getOverpaid() { + return overpaid; + } + + public void setOverpaid(@javax.annotation.Nullable InitializeRefundOverpaid overpaid) { + this.overpaid = overpaid; + } + + + public RefundDetails surcharges(@javax.annotation.Nullable List surcharges) { + this.surcharges = surcharges; + return this; + } + + public RefundDetails addSurchargesItem(PaymentsSurcharge surchargesItem) { + if (this.surcharges == null) { + this.surcharges = new ArrayList<>(); + } + this.surcharges.add(surchargesItem); + return this; + } + + /** + * List of surcharges for payment which can be refunded. + * @return surcharges + */ + @javax.annotation.Nullable + public List getSurcharges() { + return surcharges; + } + + public void setSurcharges(@javax.annotation.Nullable List surcharges) { + this.surcharges = surcharges; + } + + + public RefundDetails additionalServices(@javax.annotation.Nullable InitializeRefundAdditionalServices additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nullable + public InitializeRefundAdditionalServices getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable InitializeRefundAdditionalServices additionalServices) { + this.additionalServices = additionalServices; + } + + + public RefundDetails sellerComment(@javax.annotation.Nullable String sellerComment) { + this.sellerComment = sellerComment; + return this; + } + + /** + * Sellers optional justification for refund. + * @return sellerComment + */ + @javax.annotation.Nullable + public String getSellerComment() { + return sellerComment; + } + + public void setSellerComment(@javax.annotation.Nullable String sellerComment) { + this.sellerComment = sellerComment; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundDetails refundDetails = (RefundDetails) o; + return Objects.equals(this.id, refundDetails.id) && + Objects.equals(this.payment, refundDetails.payment) && + Objects.equals(this.order, refundDetails.order) && + Objects.equals(this.reason, refundDetails.reason) && + Objects.equals(this.status, refundDetails.status) && + Objects.equals(this.createdAt, refundDetails.createdAt) && + Objects.equals(this.totalValue, refundDetails.totalValue) && + Objects.equals(this.lineItems, refundDetails.lineItems) && + Objects.equals(this.delivery, refundDetails.delivery) && + Objects.equals(this.overpaid, refundDetails.overpaid) && + Objects.equals(this.surcharges, refundDetails.surcharges) && + Objects.equals(this.additionalServices, refundDetails.additionalServices) && + Objects.equals(this.sellerComment, refundDetails.sellerComment); + } + + @Override + public int hashCode() { + return Objects.hash(id, payment, order, reason, status, createdAt, totalValue, lineItems, delivery, overpaid, surcharges, additionalServices, sellerComment); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundDetails {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" totalValue: ").append(toIndentedString(totalValue)).append("\n"); + sb.append(" lineItems: ").append(toIndentedString(lineItems)).append("\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" overpaid: ").append(toIndentedString(overpaid)).append("\n"); + sb.append(" surcharges: ").append(toIndentedString(surcharges)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append(" sellerComment: ").append(toIndentedString(sellerComment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("payment"); + openapiFields.add("order"); + openapiFields.add("reason"); + openapiFields.add("status"); + openapiFields.add("createdAt"); + openapiFields.add("totalValue"); + openapiFields.add("lineItems"); + openapiFields.add("delivery"); + openapiFields.add("overpaid"); + openapiFields.add("surcharges"); + openapiFields.add("additionalServices"); + openapiFields.add("sellerComment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("payment"); + openapiRequiredFields.add("reason"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("totalValue"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundDetails + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundDetails.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundDetails is not found in the empty JSON string", RefundDetails.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundDetails.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundDetails` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefundDetails.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `payment` + RefundPayment.validateJsonElement(jsonObj.get("payment")); + // validate the optional field `order` + if (jsonObj.get("order") != null && !jsonObj.get("order").isJsonNull()) { + RefundOrder.validateJsonElement(jsonObj.get("order")); + } + if (!jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + // validate the required field `reason` + ReasonEnum.validateJsonElement(jsonObj.get("reason")); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + // validate the required field `totalValue` + RefundTotalValue.validateJsonElement(jsonObj.get("totalValue")); + if (jsonObj.get("lineItems") != null && !jsonObj.get("lineItems").isJsonNull()) { + JsonArray jsonArraylineItems = jsonObj.getAsJsonArray("lineItems"); + if (jsonArraylineItems != null) { + // ensure the json data is an array + if (!jsonObj.get("lineItems").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `lineItems` to be an array in the JSON string but got `%s`", jsonObj.get("lineItems").toString())); + } + + // validate the optional field `lineItems` (array) + for (int i = 0; i < jsonArraylineItems.size(); i++) { + RefundLineItem.validateJsonElement(jsonArraylineItems.get(i)); + }; + } + } + // validate the optional field `delivery` + if (jsonObj.get("delivery") != null && !jsonObj.get("delivery").isJsonNull()) { + InitializeRefundDelivery.validateJsonElement(jsonObj.get("delivery")); + } + // validate the optional field `overpaid` + if (jsonObj.get("overpaid") != null && !jsonObj.get("overpaid").isJsonNull()) { + InitializeRefundOverpaid.validateJsonElement(jsonObj.get("overpaid")); + } + if (jsonObj.get("surcharges") != null && !jsonObj.get("surcharges").isJsonNull()) { + JsonArray jsonArraysurcharges = jsonObj.getAsJsonArray("surcharges"); + if (jsonArraysurcharges != null) { + // ensure the json data is an array + if (!jsonObj.get("surcharges").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `surcharges` to be an array in the JSON string but got `%s`", jsonObj.get("surcharges").toString())); + } + + // validate the optional field `surcharges` (array) + for (int i = 0; i < jsonArraysurcharges.size(); i++) { + PaymentsSurcharge.validateJsonElement(jsonArraysurcharges.get(i)); + }; + } + } + // validate the optional field `additionalServices` + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull()) { + InitializeRefundAdditionalServices.validateJsonElement(jsonObj.get("additionalServices")); + } + if ((jsonObj.get("sellerComment") != null && !jsonObj.get("sellerComment").isJsonNull()) && !jsonObj.get("sellerComment").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sellerComment` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sellerComment").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundDetails.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundDetails' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundDetails.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundDetails value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundDetails read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundDetails given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundDetails + * @throws IOException if the JSON string is invalid with respect to RefundDetails + */ + public static RefundDetails fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundDetails.class); + } + + /** + * Convert an instance of RefundDetails to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundIncreaseOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundIncreaseOperation.java new file mode 100644 index 0000000..66cdb7e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundIncreaseOperation.java @@ -0,0 +1,283 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.OperationPayment; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.SellerParticipant; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * RefundIncreaseOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundIncreaseOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "REFUND_INCREASE"; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nonnull + private OperationPayment payment; + + public static final String SERIALIZED_NAME_PARTICIPANT = "participant"; + @SerializedName(SERIALIZED_NAME_PARTICIPANT) + @javax.annotation.Nonnull + private SellerParticipant participant; + + public RefundIncreaseOperation() { + this.type = this.getClass().getSimpleName(); + } + + public RefundIncreaseOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public RefundIncreaseOperation payment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nonnull + public OperationPayment getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + } + + + public RefundIncreaseOperation participant(@javax.annotation.Nonnull SellerParticipant participant) { + this.participant = participant; + return this; + } + + /** + * Get participant + * @return participant + */ + @javax.annotation.Nonnull + public SellerParticipant getParticipant() { + return participant; + } + + public void setParticipant(@javax.annotation.Nonnull SellerParticipant participant) { + this.participant = participant; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundIncreaseOperation refundIncreaseOperation = (RefundIncreaseOperation) o; + return Objects.equals(this.type, refundIncreaseOperation.type) && + Objects.equals(this.payment, refundIncreaseOperation.payment) && + Objects.equals(this.participant, refundIncreaseOperation.participant) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, payment, participant, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundIncreaseOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append(" participant: ").append(toIndentedString(participant)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("payment"); + openapiFields.add("participant"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payment"); + openapiRequiredFields.add("participant"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundIncreaseOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundIncreaseOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundIncreaseOperation is not found in the empty JSON string", RefundIncreaseOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundIncreaseOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundIncreaseOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefundIncreaseOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundIncreaseOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundIncreaseOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundIncreaseOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundIncreaseOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundIncreaseOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundIncreaseOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundIncreaseOperation + * @throws IOException if the JSON string is invalid with respect to RefundIncreaseOperation + */ + public static RefundIncreaseOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundIncreaseOperation.class); + } + + /** + * Convert an instance of RefundIncreaseOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundLineItem.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundLineItem.java new file mode 100644 index 0000000..1a21594 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundLineItem.java @@ -0,0 +1,373 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.RefundLineItemValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * RefundLineItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundLineItem { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + /** + * Type for line items refund. QUANTITY is provided when you can refund one or more items. AMOUNT is provided when you can refund a partial price. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + AMOUNT("AMOUNT"), + + QUANTITY("QUANTITY"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private BigDecimal quantity; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private RefundLineItemValue value; + + public RefundLineItem() { + } + + public RefundLineItem id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * The line-item identifier. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public RefundLineItem type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type for line items refund. QUANTITY is provided when you can refund one or more items. AMOUNT is provided when you can refund a partial price. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public RefundLineItem quantity(@javax.annotation.Nullable BigDecimal quantity) { + this.quantity = quantity; + return this; + } + + /** + * This field is provided for QUANTITY type only. It specifies how many items will be refunded. + * minimum: 0 + * @return quantity + */ + @javax.annotation.Nullable + public BigDecimal getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable BigDecimal quantity) { + this.quantity = quantity; + } + + + public RefundLineItem value(@javax.annotation.Nullable RefundLineItemValue value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public RefundLineItemValue getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable RefundLineItemValue value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundLineItem refundLineItem = (RefundLineItem) o; + return Objects.equals(this.id, refundLineItem.id) && + Objects.equals(this.type, refundLineItem.type) && + Objects.equals(this.quantity, refundLineItem.quantity) && + Objects.equals(this.value, refundLineItem.value); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, quantity, value); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundLineItem {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("quantity"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundLineItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundLineItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundLineItem is not found in the empty JSON string", RefundLineItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundLineItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundLineItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefundLineItem.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the optional field `value` + if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { + RefundLineItemValue.validateJsonElement(jsonObj.get("value")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundLineItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundLineItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundLineItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundLineItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundLineItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundLineItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundLineItem + * @throws IOException if the JSON string is invalid with respect to RefundLineItem + */ + public static RefundLineItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundLineItem.class); + } + + /** + * Convert an instance of RefundLineItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundLineItemValue.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundLineItemValue.java new file mode 100644 index 0000000..8fca834 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundLineItemValue.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * This field is available for AMOUNT type only and specifies the amount refunded to the customer. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundLineItemValue { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public RefundLineItemValue() { + } + + public RefundLineItemValue amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public RefundLineItemValue currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundLineItemValue refundLineItemValue = (RefundLineItemValue) o; + return Objects.equals(this.amount, refundLineItemValue.amount) && + Objects.equals(this.currency, refundLineItemValue.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundLineItemValue {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundLineItemValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundLineItemValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundLineItemValue is not found in the empty JSON string", RefundLineItemValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundLineItemValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundLineItemValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefundLineItemValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundLineItemValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundLineItemValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundLineItemValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundLineItemValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundLineItemValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundLineItemValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundLineItemValue + * @throws IOException if the JSON string is invalid with respect to RefundLineItemValue + */ + public static RefundLineItemValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundLineItemValue.class); + } + + /** + * Convert an instance of RefundLineItemValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundOrder.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundOrder.java new file mode 100644 index 0000000..c87edbf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundOrder.java @@ -0,0 +1,207 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Order affected by refund operation. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundOrder { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public RefundOrder() { + } + + public RefundOrder id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The order identifier. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundOrder refundOrder = (RefundOrder) o; + return Objects.equals(this.id, refundOrder.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundOrder {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundOrder + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundOrder.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundOrder is not found in the empty JSON string", RefundOrder.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundOrder.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundOrder` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundOrder.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundOrder' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundOrder.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundOrder value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundOrder read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundOrder given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundOrder + * @throws IOException if the JSON string is invalid with respect to RefundOrder + */ + public static RefundOrder fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundOrder.class); + } + + /** + * Convert an instance of RefundOrder to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundOverpaidValue.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundOverpaidValue.java new file mode 100644 index 0000000..9c5ed0d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundOverpaidValue.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Overpaid amount for payment refund. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundOverpaidValue { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public RefundOverpaidValue() { + } + + public RefundOverpaidValue amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public RefundOverpaidValue currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundOverpaidValue refundOverpaidValue = (RefundOverpaidValue) o; + return Objects.equals(this.amount, refundOverpaidValue.amount) && + Objects.equals(this.currency, refundOverpaidValue.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundOverpaidValue {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundOverpaidValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundOverpaidValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundOverpaidValue is not found in the empty JSON string", RefundOverpaidValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundOverpaidValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundOverpaidValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefundOverpaidValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundOverpaidValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundOverpaidValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundOverpaidValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundOverpaidValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundOverpaidValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundOverpaidValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundOverpaidValue + * @throws IOException if the JSON string is invalid with respect to RefundOverpaidValue + */ + public static RefundOverpaidValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundOverpaidValue.class); + } + + /** + * Convert an instance of RefundOverpaidValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundPayment.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundPayment.java new file mode 100644 index 0000000..9f78dd7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundPayment.java @@ -0,0 +1,207 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Payment affected by refund operation. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundPayment { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public RefundPayment() { + } + + public RefundPayment id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The payment identifier. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundPayment refundPayment = (RefundPayment) o; + return Objects.equals(this.id, refundPayment.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundPayment {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundPayment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundPayment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundPayment is not found in the empty JSON string", RefundPayment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundPayment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundPayment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundPayment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundPayment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundPayment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundPayment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundPayment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundPayment given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundPayment + * @throws IOException if the JSON string is invalid with respect to RefundPayment + */ + public static RefundPayment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundPayment.class); + } + + /** + * Convert an instance of RefundPayment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundSurchargeValue.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundSurchargeValue.java new file mode 100644 index 0000000..666c91f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundSurchargeValue.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Surcharge refund amount. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundSurchargeValue { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public RefundSurchargeValue() { + } + + public RefundSurchargeValue amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public RefundSurchargeValue currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundSurchargeValue refundSurchargeValue = (RefundSurchargeValue) o; + return Objects.equals(this.amount, refundSurchargeValue.amount) && + Objects.equals(this.currency, refundSurchargeValue.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundSurchargeValue {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundSurchargeValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundSurchargeValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundSurchargeValue is not found in the empty JSON string", RefundSurchargeValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundSurchargeValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundSurchargeValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefundSurchargeValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundSurchargeValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundSurchargeValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundSurchargeValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundSurchargeValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundSurchargeValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundSurchargeValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundSurchargeValue + * @throws IOException if the JSON string is invalid with respect to RefundSurchargeValue + */ + public static RefundSurchargeValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundSurchargeValue.class); + } + + /** + * Convert an instance of RefundSurchargeValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefundTotalValue.java b/src/main/java/pl/wtx/allegro/api/client/model/RefundTotalValue.java new file mode 100644 index 0000000..56749ac --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefundTotalValue.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Total amount for payment refund. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefundTotalValue { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public RefundTotalValue() { + } + + public RefundTotalValue amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public RefundTotalValue currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefundTotalValue refundTotalValue = (RefundTotalValue) o; + return Objects.equals(this.amount, refundTotalValue.amount) && + Objects.equals(this.currency, refundTotalValue.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefundTotalValue {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefundTotalValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefundTotalValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefundTotalValue is not found in the empty JSON string", RefundTotalValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefundTotalValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefundTotalValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefundTotalValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefundTotalValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefundTotalValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefundTotalValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefundTotalValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefundTotalValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefundTotalValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefundTotalValue + * @throws IOException if the JSON string is invalid with respect to RefundTotalValue + */ + public static RefundTotalValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefundTotalValue.class); + } + + /** + * Convert an instance of RefundTotalValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefusalMessage.java b/src/main/java/pl/wtx/allegro/api/client/model/RefusalMessage.java new file mode 100644 index 0000000..071a897 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefusalMessage.java @@ -0,0 +1,256 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * RefusalMessage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefusalMessage { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nonnull + private String text; + + public static final String SERIALIZED_NAME_LINK = "link"; + @SerializedName(SERIALIZED_NAME_LINK) + @javax.annotation.Nullable + private String link; + + public RefusalMessage() { + } + + public RefusalMessage text(@javax.annotation.Nonnull String text) { + this.text = text; + return this; + } + + /** + * Detailed message. + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nonnull String text) { + this.text = text; + } + + + public RefusalMessage link(@javax.annotation.Nullable String link) { + this.link = link; + return this; + } + + /** + * Optional link that redirects to page associated with refusal reason. + * @return link + */ + @javax.annotation.Nullable + public String getLink() { + return link; + } + + public void setLink(@javax.annotation.Nullable String link) { + this.link = link; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefusalMessage refusalMessage = (RefusalMessage) o; + return Objects.equals(this.text, refusalMessage.text) && + Objects.equals(this.link, refusalMessage.link); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(text, link); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefusalMessage {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" link: ").append(toIndentedString(link)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("text"); + openapiFields.add("link"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("text"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefusalMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefusalMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefusalMessage is not found in the empty JSON string", RefusalMessage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefusalMessage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefusalMessage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefusalMessage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if ((jsonObj.get("link") != null && !jsonObj.get("link").isJsonNull()) && !jsonObj.get("link").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `link` to be a primitive type in the JSON string but got `%s`", jsonObj.get("link").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefusalMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefusalMessage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefusalMessage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefusalMessage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefusalMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefusalMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefusalMessage + * @throws IOException if the JSON string is invalid with respect to RefusalMessage + */ + public static RefusalMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefusalMessage.class); + } + + /** + * Convert an instance of RefusalMessage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RefusalReason.java b/src/main/java/pl/wtx/allegro/api/client/model/RefusalReason.java new file mode 100644 index 0000000..56088ae --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RefusalReason.java @@ -0,0 +1,303 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import pl.wtx.allegro.api.client.model.RelatedReason; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * RefusalReason + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RefusalReason { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private String code; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private Map> parameters = new HashMap<>(); + + public static final String SERIALIZED_NAME_RELATED_REASONS = "relatedReasons"; + @SerializedName(SERIALIZED_NAME_RELATED_REASONS) + @javax.annotation.Nullable + private List relatedReasons = new ArrayList<>(); + + public RefusalReason() { + } + + public RefusalReason code(@javax.annotation.Nonnull String code) { + this.code = code; + return this; + } + + /** + * Refusal reason code. + * @return code + */ + @javax.annotation.Nonnull + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull String code) { + this.code = code; + } + + + public RefusalReason parameters(@javax.annotation.Nullable Map> parameters) { + this.parameters = parameters; + return this; + } + + public RefusalReason putParametersItem(String key, List parametersItem) { + if (this.parameters == null) { + this.parameters = new HashMap<>(); + } + this.parameters.put(key, parametersItem); + return this; + } + + /** + * Refusal reason parameters. + * @return parameters + */ + @javax.annotation.Nullable + public Map> getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable Map> parameters) { + this.parameters = parameters; + } + + + public RefusalReason relatedReasons(@javax.annotation.Nullable List relatedReasons) { + this.relatedReasons = relatedReasons; + return this; + } + + public RefusalReason addRelatedReasonsItem(RelatedReason relatedReasonsItem) { + if (this.relatedReasons == null) { + this.relatedReasons = new ArrayList<>(); + } + this.relatedReasons.add(relatedReasonsItem); + return this; + } + + /** + * Related refusal reasons. + * @return relatedReasons + */ + @javax.annotation.Nullable + public List getRelatedReasons() { + return relatedReasons; + } + + public void setRelatedReasons(@javax.annotation.Nullable List relatedReasons) { + this.relatedReasons = relatedReasons; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefusalReason refusalReason = (RefusalReason) o; + return Objects.equals(this.code, refusalReason.code) && + Objects.equals(this.parameters, refusalReason.parameters) && + Objects.equals(this.relatedReasons, refusalReason.relatedReasons); + } + + @Override + public int hashCode() { + return Objects.hash(code, parameters, relatedReasons); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RefusalReason {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" relatedReasons: ").append(toIndentedString(relatedReasons)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("parameters"); + openapiFields.add("relatedReasons"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("code"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RefusalReason + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RefusalReason.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RefusalReason is not found in the empty JSON string", RefusalReason.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RefusalReason.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RefusalReason` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RefusalReason.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if (jsonObj.get("relatedReasons") != null && !jsonObj.get("relatedReasons").isJsonNull()) { + JsonArray jsonArrayrelatedReasons = jsonObj.getAsJsonArray("relatedReasons"); + if (jsonArrayrelatedReasons != null) { + // ensure the json data is an array + if (!jsonObj.get("relatedReasons").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `relatedReasons` to be an array in the JSON string but got `%s`", jsonObj.get("relatedReasons").toString())); + } + + // validate the optional field `relatedReasons` (array) + for (int i = 0; i < jsonArrayrelatedReasons.size(); i++) { + RelatedReason.validateJsonElement(jsonArrayrelatedReasons.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RefusalReason.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RefusalReason' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RefusalReason.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RefusalReason value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RefusalReason read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RefusalReason given an JSON string + * + * @param jsonString JSON string + * @return An instance of RefusalReason + * @throws IOException if the JSON string is invalid with respect to RefusalReason + */ + public static RefusalReason fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RefusalReason.class); + } + + /** + * Convert an instance of RefusalReason to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RelatedReason.java b/src/main/java/pl/wtx/allegro/api/client/model/RelatedReason.java new file mode 100644 index 0000000..eef223a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RelatedReason.java @@ -0,0 +1,252 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * RelatedReason + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RelatedReason { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private String code; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private Map> parameters = new HashMap<>(); + + public RelatedReason() { + } + + public RelatedReason code(@javax.annotation.Nonnull String code) { + this.code = code; + return this; + } + + /** + * Refusal reason code. + * @return code + */ + @javax.annotation.Nonnull + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull String code) { + this.code = code; + } + + + public RelatedReason parameters(@javax.annotation.Nullable Map> parameters) { + this.parameters = parameters; + return this; + } + + public RelatedReason putParametersItem(String key, List parametersItem) { + if (this.parameters == null) { + this.parameters = new HashMap<>(); + } + this.parameters.put(key, parametersItem); + return this; + } + + /** + * Refusal reason parameters. + * @return parameters + */ + @javax.annotation.Nullable + public Map> getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable Map> parameters) { + this.parameters = parameters; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelatedReason relatedReason = (RelatedReason) o; + return Objects.equals(this.code, relatedReason.code) && + Objects.equals(this.parameters, relatedReason.parameters); + } + + @Override + public int hashCode() { + return Objects.hash(code, parameters); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelatedReason {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("parameters"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("code"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RelatedReason + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RelatedReason.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RelatedReason is not found in the empty JSON string", RelatedReason.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RelatedReason.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RelatedReason` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RelatedReason.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RelatedReason.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RelatedReason' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RelatedReason.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RelatedReason value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RelatedReason read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RelatedReason given an JSON string + * + * @param jsonString JSON string + * @return An instance of RelatedReason + * @throws IOException if the JSON string is invalid with respect to RelatedReason + */ + public static RelatedReason fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RelatedReason.class); + } + + /** + * Convert an instance of RelatedReason to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Removal.java b/src/main/java/pl/wtx/allegro/api/client/model/Removal.java new file mode 100644 index 0000000..9ae414e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Removal.java @@ -0,0 +1,246 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.RemovalRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Removal + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Removal { + public static final String SERIALIZED_NAME_POSSIBLE_TO = "possibleTo"; + @SerializedName(SERIALIZED_NAME_POSSIBLE_TO) + @javax.annotation.Nonnull + private String possibleTo; + + public static final String SERIALIZED_NAME_REQUEST = "request"; + @SerializedName(SERIALIZED_NAME_REQUEST) + @javax.annotation.Nullable + private RemovalRequest request; + + public Removal() { + } + + public Removal possibleTo(@javax.annotation.Nonnull String possibleTo) { + this.possibleTo = possibleTo; + return this; + } + + /** + * Date until a removal request can be submitted in ISO 8601 format + * @return possibleTo + */ + @javax.annotation.Nonnull + public String getPossibleTo() { + return possibleTo; + } + + public void setPossibleTo(@javax.annotation.Nonnull String possibleTo) { + this.possibleTo = possibleTo; + } + + + public Removal request(@javax.annotation.Nullable RemovalRequest request) { + this.request = request; + return this; + } + + /** + * Get request + * @return request + */ + @javax.annotation.Nullable + public RemovalRequest getRequest() { + return request; + } + + public void setRequest(@javax.annotation.Nullable RemovalRequest request) { + this.request = request; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Removal removal = (Removal) o; + return Objects.equals(this.possibleTo, removal.possibleTo) && + Objects.equals(this.request, removal.request); + } + + @Override + public int hashCode() { + return Objects.hash(possibleTo, request); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Removal {\n"); + sb.append(" possibleTo: ").append(toIndentedString(possibleTo)).append("\n"); + sb.append(" request: ").append(toIndentedString(request)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("possibleTo"); + openapiFields.add("request"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("possibleTo"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Removal + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Removal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Removal is not found in the empty JSON string", Removal.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Removal.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Removal` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Removal.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("possibleTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `possibleTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("possibleTo").toString())); + } + // validate the optional field `request` + if (jsonObj.get("request") != null && !jsonObj.get("request").isJsonNull()) { + RemovalRequest.validateJsonElement(jsonObj.get("request")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Removal.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Removal' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Removal.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Removal value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Removal read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Removal given an JSON string + * + * @param jsonString JSON string + * @return An instance of Removal + * @throws IOException if the JSON string is invalid with respect to Removal + */ + public static Removal fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Removal.class); + } + + /** + * Convert an instance of Removal to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RemovalRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/RemovalRequest.java new file mode 100644 index 0000000..82d0792 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RemovalRequest.java @@ -0,0 +1,331 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Submitted removal request, null if removal was not requested + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RemovalRequest { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private String createdAt; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nonnull + private String message; + + /** + * Message containing information who requested removing of a rating + */ + @JsonAdapter(SourceEnum.Adapter.class) + public enum SourceEnum { + SELLER("SELLER"), + + ADMIN("ADMIN"); + + private String value; + + SourceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceEnum fromValue(String value) { + for (SourceEnum b : SourceEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SourceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable + private SourceEnum source; + + public RemovalRequest() { + } + + public RemovalRequest createdAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Removal request creation datetime in ISO 8601 format + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + } + + + public RemovalRequest message(@javax.annotation.Nonnull String message) { + this.message = message; + return this; + } + + /** + * Message containing explanation for removing rating + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nonnull String message) { + this.message = message; + } + + + public RemovalRequest source(@javax.annotation.Nullable SourceEnum source) { + this.source = source; + return this; + } + + /** + * Message containing information who requested removing of a rating + * @return source + */ + @javax.annotation.Nullable + public SourceEnum getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable SourceEnum source) { + this.source = source; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RemovalRequest removalRequest = (RemovalRequest) o; + return Objects.equals(this.createdAt, removalRequest.createdAt) && + Objects.equals(this.message, removalRequest.message) && + Objects.equals(this.source, removalRequest.source); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, message, source); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RemovalRequest {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("createdAt"); + openapiFields.add("message"); + openapiFields.add("source"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("message"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RemovalRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RemovalRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RemovalRequest is not found in the empty JSON string", RemovalRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RemovalRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RemovalRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RemovalRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); + } + if (!jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) && !jsonObj.get("source").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source").toString())); + } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + SourceEnum.validateJsonElement(jsonObj.get("source")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RemovalRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RemovalRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RemovalRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RemovalRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RemovalRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RemovalRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of RemovalRequest + * @throws IOException if the JSON string is invalid with respect to RemovalRequest + */ + public static RemovalRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RemovalRequest.class); + } + + /** + * Convert an instance of RemovalRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RequirementChange.java b/src/main/java/pl/wtx/allegro/api/client/model/RequirementChange.java new file mode 100644 index 0000000..193c904 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RequirementChange.java @@ -0,0 +1,276 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CategoryParametersScheduledBaseChange; +import pl.wtx.allegro.api.client.model.CategoryParametersScheduledBaseChangeCategory; +import pl.wtx.allegro.api.client.model.CategoryParametersScheduledBaseChangeParameter; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * RequirementChange + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RequirementChange extends CategoryParametersScheduledBaseChange { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "REQUIREMENT_CHANGE"; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nonnull + private CategoryParametersScheduledBaseChangeCategory category; + + public static final String SERIALIZED_NAME_PARAMETER = "parameter"; + @SerializedName(SERIALIZED_NAME_PARAMETER) + @javax.annotation.Nonnull + private CategoryParametersScheduledBaseChangeParameter parameter; + + public RequirementChange() { + this.type = this.getClass().getSimpleName(); + } + + public RequirementChange type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public RequirementChange category(@javax.annotation.Nonnull CategoryParametersScheduledBaseChangeCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nonnull + public CategoryParametersScheduledBaseChangeCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nonnull CategoryParametersScheduledBaseChangeCategory category) { + this.category = category; + } + + + public RequirementChange parameter(@javax.annotation.Nonnull CategoryParametersScheduledBaseChangeParameter parameter) { + this.parameter = parameter; + return this; + } + + /** + * Get parameter + * @return parameter + */ + @javax.annotation.Nonnull + public CategoryParametersScheduledBaseChangeParameter getParameter() { + return parameter; + } + + public void setParameter(@javax.annotation.Nonnull CategoryParametersScheduledBaseChangeParameter parameter) { + this.parameter = parameter; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequirementChange requirementChange = (RequirementChange) o; + return Objects.equals(this.type, requirementChange.type) && + Objects.equals(this.category, requirementChange.category) && + Objects.equals(this.parameter, requirementChange.parameter) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, category, parameter, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequirementChange {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" parameter: ").append(toIndentedString(parameter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("scheduledAt"); + openapiFields.add("scheduledFor"); + openapiFields.add("type"); + openapiFields.add("category"); + openapiFields.add("parameter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("category"); + openapiRequiredFields.add("parameter"); + openapiRequiredFields.add("scheduledAt"); + openapiRequiredFields.add("scheduledFor"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RequirementChange + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RequirementChange.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RequirementChange is not found in the empty JSON string", RequirementChange.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RequirementChange.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RequirementChange` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RequirementChange.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RequirementChange.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RequirementChange' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RequirementChange.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RequirementChange value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RequirementChange read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RequirementChange given an JSON string + * + * @param jsonString JSON string + * @return An instance of RequirementChange + * @throws IOException if the JSON string is invalid with respect to RequirementChange + */ + public static RequirementChange fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RequirementChange.class); + } + + /** + * Convert an instance of RequirementChange to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReserveInfo.java b/src/main/java/pl/wtx/allegro/api/client/model/ReserveInfo.java new file mode 100644 index 0000000..c12eb61 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReserveInfo.java @@ -0,0 +1,294 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contains information about amount of reserve and its sufficiency for next days. If status is set to NOT_ENOUGH_DATA value of will not be sent. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReserveInfo { + public static final String SERIALIZED_NAME_OUT_OF_STOCK_IN = "outOfStockIn"; + @SerializedName(SERIALIZED_NAME_OUT_OF_STOCK_IN) + @javax.annotation.Nullable + private BigDecimal outOfStockIn; + + /** + * Gives information about inventory, that can not be expressed using `outOfStockIn` property. Can be one of the given values: NOT_ENOUGH_DATA - not enough data to calculate sufficiency, LOW_STOCK - inventory quantity will run out soon (in 14 days or less) NORMAL - prediction can be calculated, EXCESS_ONE_YEAR - amount of inventory will not be exhausted in (approximately) one year threshold. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + NOT_ENOUGH_DATA("NOT_ENOUGH_DATA"), + + LOW_STOCK("LOW_STOCK"), + + NORMAL("NORMAL"), + + EXCESS_ONE_YEAR("EXCESS_ONE_YEAR"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public ReserveInfo() { + } + + public ReserveInfo outOfStockIn(@javax.annotation.Nullable BigDecimal outOfStockIn) { + this.outOfStockIn = outOfStockIn; + return this; + } + + /** + * Prediction of number of days in which inventory will be sold out. + * @return outOfStockIn + */ + @javax.annotation.Nullable + public BigDecimal getOutOfStockIn() { + return outOfStockIn; + } + + public void setOutOfStockIn(@javax.annotation.Nullable BigDecimal outOfStockIn) { + this.outOfStockIn = outOfStockIn; + } + + + public ReserveInfo status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Gives information about inventory, that can not be expressed using `outOfStockIn` property. Can be one of the given values: NOT_ENOUGH_DATA - not enough data to calculate sufficiency, LOW_STOCK - inventory quantity will run out soon (in 14 days or less) NORMAL - prediction can be calculated, EXCESS_ONE_YEAR - amount of inventory will not be exhausted in (approximately) one year threshold. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReserveInfo reserveInfo = (ReserveInfo) o; + return Objects.equals(this.outOfStockIn, reserveInfo.outOfStockIn) && + Objects.equals(this.status, reserveInfo.status); + } + + @Override + public int hashCode() { + return Objects.hash(outOfStockIn, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReserveInfo {\n"); + sb.append(" outOfStockIn: ").append(toIndentedString(outOfStockIn)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("outOfStockIn"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReserveInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReserveInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReserveInfo is not found in the empty JSON string", ReserveInfo.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReserveInfo.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReserveInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReserveInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReserveInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReserveInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReserveInfo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReserveInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReserveInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReserveInfo + * @throws IOException if the JSON string is invalid with respect to ReserveInfo + */ + public static ReserveInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReserveInfo.class); + } + + /** + * Convert an instance of ReserveInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonAddress.java new file mode 100644 index 0000000..698aae7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonAddress.java @@ -0,0 +1,402 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Responsible person address. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ResponsiblePersonAddress { + /** + * Code of responsible person country (ISO 3166). + */ + @JsonAdapter(CountryCodeEnum.Adapter.class) + public enum CountryCodeEnum { + AT("AT"), + + BE("BE"), + + BG("BG"), + + HR("HR"), + + CY("CY"), + + CZ("CZ"), + + DK("DK"), + + EE("EE"), + + FI("FI"), + + FR("FR"), + + GR("GR"), + + ES("ES"), + + IE("IE"), + + LT("LT"), + + LU("LU"), + + LV("LV"), + + MT("MT"), + + NL("NL"), + + DE("DE"), + + PL("PL"), + + PT("PT"), + + RO("RO"), + + SK("SK"), + + SI("SI"), + + SE("SE"), + + HU("HU"), + + IT("IT"); + + private String value; + + CountryCodeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CountryCodeEnum fromValue(String value) { + for (CountryCodeEnum b : CountryCodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CountryCodeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CountryCodeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CountryCodeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CountryCodeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private CountryCodeEnum countryCode; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nullable + private String street; + + public static final String SERIALIZED_NAME_POSTAL_CODE = "postalCode"; + @SerializedName(SERIALIZED_NAME_POSTAL_CODE) + @javax.annotation.Nullable + private String postalCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nullable + private String city; + + public ResponsiblePersonAddress() { + } + + public ResponsiblePersonAddress countryCode(@javax.annotation.Nullable CountryCodeEnum countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Code of responsible person country (ISO 3166). + * @return countryCode + */ + @javax.annotation.Nullable + public CountryCodeEnum getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable CountryCodeEnum countryCode) { + this.countryCode = countryCode; + } + + + public ResponsiblePersonAddress street(@javax.annotation.Nullable String street) { + this.street = street; + return this; + } + + /** + * Street and number. + * @return street + */ + @javax.annotation.Nullable + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nullable String street) { + this.street = street; + } + + + public ResponsiblePersonAddress postalCode(@javax.annotation.Nullable String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * Postal code. + * @return postalCode + */ + @javax.annotation.Nullable + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(@javax.annotation.Nullable String postalCode) { + this.postalCode = postalCode; + } + + + public ResponsiblePersonAddress city(@javax.annotation.Nullable String city) { + this.city = city; + return this; + } + + /** + * City. + * @return city + */ + @javax.annotation.Nullable + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nullable String city) { + this.city = city; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponsiblePersonAddress responsiblePersonAddress = (ResponsiblePersonAddress) o; + return Objects.equals(this.countryCode, responsiblePersonAddress.countryCode) && + Objects.equals(this.street, responsiblePersonAddress.street) && + Objects.equals(this.postalCode, responsiblePersonAddress.postalCode) && + Objects.equals(this.city, responsiblePersonAddress.city); + } + + @Override + public int hashCode() { + return Objects.hash(countryCode, street, postalCode, city); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponsiblePersonAddress {\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("countryCode"); + openapiFields.add("street"); + openapiFields.add("postalCode"); + openapiFields.add("city"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResponsiblePersonAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResponsiblePersonAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResponsiblePersonAddress is not found in the empty JSON string", ResponsiblePersonAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResponsiblePersonAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResponsiblePersonAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("countryCode") != null && !jsonObj.get("countryCode").isJsonNull()) && !jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + // validate the optional field `countryCode` + if (jsonObj.get("countryCode") != null && !jsonObj.get("countryCode").isJsonNull()) { + CountryCodeEnum.validateJsonElement(jsonObj.get("countryCode")); + } + if ((jsonObj.get("street") != null && !jsonObj.get("street").isJsonNull()) && !jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if ((jsonObj.get("postalCode") != null && !jsonObj.get("postalCode").isJsonNull()) && !jsonObj.get("postalCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postalCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postalCode").toString())); + } + if ((jsonObj.get("city") != null && !jsonObj.get("city").isJsonNull()) && !jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResponsiblePersonAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResponsiblePersonAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResponsiblePersonAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResponsiblePersonAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResponsiblePersonAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ResponsiblePersonAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponsiblePersonAddress + * @throws IOException if the JSON string is invalid with respect to ResponsiblePersonAddress + */ + public static ResponsiblePersonAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResponsiblePersonAddress.class); + } + + /** + * Convert an instance of ResponsiblePersonAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonContact.java b/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonContact.java new file mode 100644 index 0000000..119009a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonContact.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contact to responsible person. At least one of the following fields is required: `email` or `formUrl`. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ResponsiblePersonContact { + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nullable + private String phoneNumber; + + public static final String SERIALIZED_NAME_FORM_URL = "formUrl"; + @SerializedName(SERIALIZED_NAME_FORM_URL) + @javax.annotation.Nullable + private String formUrl; + + public ResponsiblePersonContact() { + } + + public ResponsiblePersonContact email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Email of responsible person. + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public ResponsiblePersonContact phoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Phone number of responsible person. This field is optional. + * @return phoneNumber + */ + @javax.annotation.Nullable + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public ResponsiblePersonContact formUrl(@javax.annotation.Nullable String formUrl) { + this.formUrl = formUrl; + return this; + } + + /** + * URL address to contact form. + * @return formUrl + */ + @javax.annotation.Nullable + public String getFormUrl() { + return formUrl; + } + + public void setFormUrl(@javax.annotation.Nullable String formUrl) { + this.formUrl = formUrl; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponsiblePersonContact responsiblePersonContact = (ResponsiblePersonContact) o; + return Objects.equals(this.email, responsiblePersonContact.email) && + Objects.equals(this.phoneNumber, responsiblePersonContact.phoneNumber) && + Objects.equals(this.formUrl, responsiblePersonContact.formUrl); + } + + @Override + public int hashCode() { + return Objects.hash(email, phoneNumber, formUrl); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponsiblePersonContact {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" formUrl: ").append(toIndentedString(formUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("email"); + openapiFields.add("phoneNumber"); + openapiFields.add("formUrl"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResponsiblePersonContact + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResponsiblePersonContact.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResponsiblePersonContact is not found in the empty JSON string", ResponsiblePersonContact.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResponsiblePersonContact.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResponsiblePersonContact` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("phoneNumber") != null && !jsonObj.get("phoneNumber").isJsonNull()) && !jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + if ((jsonObj.get("formUrl") != null && !jsonObj.get("formUrl").isJsonNull()) && !jsonObj.get("formUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `formUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("formUrl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResponsiblePersonContact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResponsiblePersonContact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResponsiblePersonContact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResponsiblePersonContact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResponsiblePersonContact read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ResponsiblePersonContact given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponsiblePersonContact + * @throws IOException if the JSON string is invalid with respect to ResponsiblePersonContact + */ + public static ResponsiblePersonContact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResponsiblePersonContact.class); + } + + /** + * Convert an instance of ResponsiblePersonContact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonResponse.java new file mode 100644 index 0000000..6afcc13 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonResponse.java @@ -0,0 +1,269 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.ResponsiblePersonResponsePersonalData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ResponsiblePersonResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ResponsiblePersonResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PERSONAL_DATA = "personalData"; + @SerializedName(SERIALIZED_NAME_PERSONAL_DATA) + @javax.annotation.Nullable + private ResponsiblePersonResponsePersonalData personalData; + + public ResponsiblePersonResponse() { + } + + public ResponsiblePersonResponse id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * Responsible person ID. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public ResponsiblePersonResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Internal name of responsible person in dictionary (visible only to you). + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ResponsiblePersonResponse personalData(@javax.annotation.Nullable ResponsiblePersonResponsePersonalData personalData) { + this.personalData = personalData; + return this; + } + + /** + * Get personalData + * @return personalData + */ + @javax.annotation.Nullable + public ResponsiblePersonResponsePersonalData getPersonalData() { + return personalData; + } + + public void setPersonalData(@javax.annotation.Nullable ResponsiblePersonResponsePersonalData personalData) { + this.personalData = personalData; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponsiblePersonResponse responsiblePersonResponse = (ResponsiblePersonResponse) o; + return Objects.equals(this.id, responsiblePersonResponse.id) && + Objects.equals(this.name, responsiblePersonResponse.name) && + Objects.equals(this.personalData, responsiblePersonResponse.personalData); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, personalData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponsiblePersonResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" personalData: ").append(toIndentedString(personalData)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("personalData"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResponsiblePersonResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResponsiblePersonResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResponsiblePersonResponse is not found in the empty JSON string", ResponsiblePersonResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResponsiblePersonResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResponsiblePersonResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `personalData` + if (jsonObj.get("personalData") != null && !jsonObj.get("personalData").isJsonNull()) { + ResponsiblePersonResponsePersonalData.validateJsonElement(jsonObj.get("personalData")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResponsiblePersonResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResponsiblePersonResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResponsiblePersonResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResponsiblePersonResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResponsiblePersonResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ResponsiblePersonResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponsiblePersonResponse + * @throws IOException if the JSON string is invalid with respect to ResponsiblePersonResponse + */ + public static ResponsiblePersonResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResponsiblePersonResponse.class); + } + + /** + * Convert an instance of ResponsiblePersonResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonResponsePersonalData.java b/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonResponsePersonalData.java new file mode 100644 index 0000000..22f9d92 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonResponsePersonalData.java @@ -0,0 +1,270 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ResponsiblePersonAddress; +import pl.wtx.allegro.api.client.model.ResponsiblePersonContact; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Responsible person personal data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ResponsiblePersonResponsePersonalData { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private ResponsiblePersonAddress address; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + @javax.annotation.Nullable + private ResponsiblePersonContact contact; + + public ResponsiblePersonResponsePersonalData() { + } + + public ResponsiblePersonResponsePersonalData name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name of responsible person. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ResponsiblePersonResponsePersonalData address(@javax.annotation.Nullable ResponsiblePersonAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public ResponsiblePersonAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable ResponsiblePersonAddress address) { + this.address = address; + } + + + public ResponsiblePersonResponsePersonalData contact(@javax.annotation.Nullable ResponsiblePersonContact contact) { + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + */ + @javax.annotation.Nullable + public ResponsiblePersonContact getContact() { + return contact; + } + + public void setContact(@javax.annotation.Nullable ResponsiblePersonContact contact) { + this.contact = contact; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponsiblePersonResponsePersonalData responsiblePersonResponsePersonalData = (ResponsiblePersonResponsePersonalData) o; + return Objects.equals(this.name, responsiblePersonResponsePersonalData.name) && + Objects.equals(this.address, responsiblePersonResponsePersonalData.address) && + Objects.equals(this.contact, responsiblePersonResponsePersonalData.contact); + } + + @Override + public int hashCode() { + return Objects.hash(name, address, contact); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponsiblePersonResponsePersonalData {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("address"); + openapiFields.add("contact"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResponsiblePersonResponsePersonalData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResponsiblePersonResponsePersonalData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResponsiblePersonResponsePersonalData is not found in the empty JSON string", ResponsiblePersonResponsePersonalData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResponsiblePersonResponsePersonalData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResponsiblePersonResponsePersonalData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + ResponsiblePersonAddress.validateJsonElement(jsonObj.get("address")); + } + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + ResponsiblePersonContact.validateJsonElement(jsonObj.get("contact")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResponsiblePersonResponsePersonalData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResponsiblePersonResponsePersonalData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResponsiblePersonResponsePersonalData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResponsiblePersonResponsePersonalData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResponsiblePersonResponsePersonalData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ResponsiblePersonResponsePersonalData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponsiblePersonResponsePersonalData + * @throws IOException if the JSON string is invalid with respect to ResponsiblePersonResponsePersonalData + */ + public static ResponsiblePersonResponsePersonalData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResponsiblePersonResponsePersonalData.class); + } + + /** + * Convert an instance of ResponsiblePersonResponsePersonalData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonsGET200Response.java b/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonsGET200Response.java new file mode 100644 index 0000000..e55d1bf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ResponsiblePersonsGET200Response.java @@ -0,0 +1,284 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ResponsiblePersonResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ResponsiblePersonsGET200Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ResponsiblePersonsGET200Response { + public static final String SERIALIZED_NAME_RESPONSIBLE_PERSONS = "responsiblePersons"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PERSONS) + @javax.annotation.Nullable + private List responsiblePersons = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private Integer totalCount; + + public ResponsiblePersonsGET200Response() { + } + + public ResponsiblePersonsGET200Response responsiblePersons(@javax.annotation.Nullable List responsiblePersons) { + this.responsiblePersons = responsiblePersons; + return this; + } + + public ResponsiblePersonsGET200Response addResponsiblePersonsItem(ResponsiblePersonResponse responsiblePersonsItem) { + if (this.responsiblePersons == null) { + this.responsiblePersons = new ArrayList<>(); + } + this.responsiblePersons.add(responsiblePersonsItem); + return this; + } + + /** + * Get responsiblePersons + * @return responsiblePersons + */ + @javax.annotation.Nullable + public List getResponsiblePersons() { + return responsiblePersons; + } + + public void setResponsiblePersons(@javax.annotation.Nullable List responsiblePersons) { + this.responsiblePersons = responsiblePersons; + } + + + public ResponsiblePersonsGET200Response count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Number of responsible persons data returned in search result for the given parameters. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public ResponsiblePersonsGET200Response totalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of available responsible persons data. + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponsiblePersonsGET200Response responsiblePersonsGET200Response = (ResponsiblePersonsGET200Response) o; + return Objects.equals(this.responsiblePersons, responsiblePersonsGET200Response.responsiblePersons) && + Objects.equals(this.count, responsiblePersonsGET200Response.count) && + Objects.equals(this.totalCount, responsiblePersonsGET200Response.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(responsiblePersons, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponsiblePersonsGET200Response {\n"); + sb.append(" responsiblePersons: ").append(toIndentedString(responsiblePersons)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("responsiblePersons"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResponsiblePersonsGET200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResponsiblePersonsGET200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResponsiblePersonsGET200Response is not found in the empty JSON string", ResponsiblePersonsGET200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResponsiblePersonsGET200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResponsiblePersonsGET200Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("responsiblePersons") != null && !jsonObj.get("responsiblePersons").isJsonNull()) { + JsonArray jsonArrayresponsiblePersons = jsonObj.getAsJsonArray("responsiblePersons"); + if (jsonArrayresponsiblePersons != null) { + // ensure the json data is an array + if (!jsonObj.get("responsiblePersons").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `responsiblePersons` to be an array in the JSON string but got `%s`", jsonObj.get("responsiblePersons").toString())); + } + + // validate the optional field `responsiblePersons` (array) + for (int i = 0; i < jsonArrayresponsiblePersons.size(); i++) { + ResponsiblePersonResponse.validateJsonElement(jsonArrayresponsiblePersons.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResponsiblePersonsGET200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResponsiblePersonsGET200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResponsiblePersonsGET200Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResponsiblePersonsGET200Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResponsiblePersonsGET200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ResponsiblePersonsGET200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponsiblePersonsGET200Response + * @throws IOException if the JSON string is invalid with respect to ResponsiblePersonsGET200Response + */ + public static ResponsiblePersonsGET200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResponsiblePersonsGET200Response.class); + } + + /** + * Convert an instance of ResponsiblePersonsGET200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerAddress.java new file mode 100644 index 0000000..9a7327f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerAddress.java @@ -0,0 +1,296 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Responsible producer address. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ResponsibleProducerAddress { + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nullable + private String street; + + public static final String SERIALIZED_NAME_POSTAL_CODE = "postalCode"; + @SerializedName(SERIALIZED_NAME_POSTAL_CODE) + @javax.annotation.Nullable + private String postalCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nullable + private String city; + + public ResponsibleProducerAddress() { + } + + public ResponsibleProducerAddress countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Code of responsible producer country (ISO 3166). + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + public ResponsibleProducerAddress street(@javax.annotation.Nullable String street) { + this.street = street; + return this; + } + + /** + * Street and number. + * @return street + */ + @javax.annotation.Nullable + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nullable String street) { + this.street = street; + } + + + public ResponsibleProducerAddress postalCode(@javax.annotation.Nullable String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * Postal code. + * @return postalCode + */ + @javax.annotation.Nullable + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(@javax.annotation.Nullable String postalCode) { + this.postalCode = postalCode; + } + + + public ResponsibleProducerAddress city(@javax.annotation.Nullable String city) { + this.city = city; + return this; + } + + /** + * City. + * @return city + */ + @javax.annotation.Nullable + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nullable String city) { + this.city = city; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponsibleProducerAddress responsibleProducerAddress = (ResponsibleProducerAddress) o; + return Objects.equals(this.countryCode, responsibleProducerAddress.countryCode) && + Objects.equals(this.street, responsibleProducerAddress.street) && + Objects.equals(this.postalCode, responsibleProducerAddress.postalCode) && + Objects.equals(this.city, responsibleProducerAddress.city); + } + + @Override + public int hashCode() { + return Objects.hash(countryCode, street, postalCode, city); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponsibleProducerAddress {\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("countryCode"); + openapiFields.add("street"); + openapiFields.add("postalCode"); + openapiFields.add("city"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResponsibleProducerAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResponsibleProducerAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResponsibleProducerAddress is not found in the empty JSON string", ResponsibleProducerAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResponsibleProducerAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResponsibleProducerAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("countryCode") != null && !jsonObj.get("countryCode").isJsonNull()) && !jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if ((jsonObj.get("street") != null && !jsonObj.get("street").isJsonNull()) && !jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if ((jsonObj.get("postalCode") != null && !jsonObj.get("postalCode").isJsonNull()) && !jsonObj.get("postalCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postalCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postalCode").toString())); + } + if ((jsonObj.get("city") != null && !jsonObj.get("city").isJsonNull()) && !jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResponsibleProducerAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResponsibleProducerAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResponsibleProducerAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResponsibleProducerAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResponsibleProducerAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ResponsibleProducerAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponsibleProducerAddress + * @throws IOException if the JSON string is invalid with respect to ResponsibleProducerAddress + */ + public static ResponsibleProducerAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResponsibleProducerAddress.class); + } + + /** + * Convert an instance of ResponsibleProducerAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerContact.java b/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerContact.java new file mode 100644 index 0000000..f110bdc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerContact.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contact to responsible producer. At least one of the following fields is required: `email` or `formUrl`. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ResponsibleProducerContact { + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nullable + private String phoneNumber; + + public static final String SERIALIZED_NAME_FORM_URL = "formUrl"; + @SerializedName(SERIALIZED_NAME_FORM_URL) + @javax.annotation.Nullable + private String formUrl; + + public ResponsibleProducerContact() { + } + + public ResponsibleProducerContact email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * Email of responsible producer. + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + public ResponsibleProducerContact phoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Phone number of responsible producer. This field is optional. + * @return phoneNumber + */ + @javax.annotation.Nullable + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public ResponsibleProducerContact formUrl(@javax.annotation.Nullable String formUrl) { + this.formUrl = formUrl; + return this; + } + + /** + * URL address to contact form. + * @return formUrl + */ + @javax.annotation.Nullable + public String getFormUrl() { + return formUrl; + } + + public void setFormUrl(@javax.annotation.Nullable String formUrl) { + this.formUrl = formUrl; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponsibleProducerContact responsibleProducerContact = (ResponsibleProducerContact) o; + return Objects.equals(this.email, responsibleProducerContact.email) && + Objects.equals(this.phoneNumber, responsibleProducerContact.phoneNumber) && + Objects.equals(this.formUrl, responsibleProducerContact.formUrl); + } + + @Override + public int hashCode() { + return Objects.hash(email, phoneNumber, formUrl); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponsibleProducerContact {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" formUrl: ").append(toIndentedString(formUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("email"); + openapiFields.add("phoneNumber"); + openapiFields.add("formUrl"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResponsibleProducerContact + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResponsibleProducerContact.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResponsibleProducerContact is not found in the empty JSON string", ResponsibleProducerContact.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResponsibleProducerContact.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResponsibleProducerContact` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("phoneNumber") != null && !jsonObj.get("phoneNumber").isJsonNull()) && !jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + if ((jsonObj.get("formUrl") != null && !jsonObj.get("formUrl").isJsonNull()) && !jsonObj.get("formUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `formUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("formUrl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResponsibleProducerContact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResponsibleProducerContact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResponsibleProducerContact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResponsibleProducerContact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResponsibleProducerContact read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ResponsibleProducerContact given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponsibleProducerContact + * @throws IOException if the JSON string is invalid with respect to ResponsibleProducerContact + */ + public static ResponsibleProducerContact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResponsibleProducerContact.class); + } + + /** + * Convert an instance of ResponsibleProducerContact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerResponse.java new file mode 100644 index 0000000..ff33c13 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerResponse.java @@ -0,0 +1,269 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.ResponsibleProducerResponseProducerData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ResponsibleProducerResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ResponsibleProducerResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PRODUCER_DATA = "producerData"; + @SerializedName(SERIALIZED_NAME_PRODUCER_DATA) + @javax.annotation.Nullable + private ResponsibleProducerResponseProducerData producerData; + + public ResponsibleProducerResponse() { + } + + public ResponsibleProducerResponse id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * Responsible producer ID. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public ResponsibleProducerResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Internal name of responsible producer in dictionary. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ResponsibleProducerResponse producerData(@javax.annotation.Nullable ResponsibleProducerResponseProducerData producerData) { + this.producerData = producerData; + return this; + } + + /** + * Get producerData + * @return producerData + */ + @javax.annotation.Nullable + public ResponsibleProducerResponseProducerData getProducerData() { + return producerData; + } + + public void setProducerData(@javax.annotation.Nullable ResponsibleProducerResponseProducerData producerData) { + this.producerData = producerData; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponsibleProducerResponse responsibleProducerResponse = (ResponsibleProducerResponse) o; + return Objects.equals(this.id, responsibleProducerResponse.id) && + Objects.equals(this.name, responsibleProducerResponse.name) && + Objects.equals(this.producerData, responsibleProducerResponse.producerData); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, producerData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponsibleProducerResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" producerData: ").append(toIndentedString(producerData)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("producerData"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResponsibleProducerResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResponsibleProducerResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResponsibleProducerResponse is not found in the empty JSON string", ResponsibleProducerResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResponsibleProducerResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResponsibleProducerResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `producerData` + if (jsonObj.get("producerData") != null && !jsonObj.get("producerData").isJsonNull()) { + ResponsibleProducerResponseProducerData.validateJsonElement(jsonObj.get("producerData")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResponsibleProducerResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResponsibleProducerResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResponsibleProducerResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResponsibleProducerResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResponsibleProducerResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ResponsibleProducerResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponsibleProducerResponse + * @throws IOException if the JSON string is invalid with respect to ResponsibleProducerResponse + */ + public static ResponsibleProducerResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResponsibleProducerResponse.class); + } + + /** + * Convert an instance of ResponsibleProducerResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerResponseProducerData.java b/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerResponseProducerData.java new file mode 100644 index 0000000..3c0967e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducerResponseProducerData.java @@ -0,0 +1,270 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ResponsibleProducerAddress; +import pl.wtx.allegro.api.client.model.ResponsibleProducerContact; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Responsible producer data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ResponsibleProducerResponseProducerData { + public static final String SERIALIZED_NAME_TRADE_NAME = "tradeName"; + @SerializedName(SERIALIZED_NAME_TRADE_NAME) + @javax.annotation.Nullable + private String tradeName; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private ResponsibleProducerAddress address; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + @javax.annotation.Nullable + private ResponsibleProducerContact contact; + + public ResponsibleProducerResponseProducerData() { + } + + public ResponsibleProducerResponseProducerData tradeName(@javax.annotation.Nullable String tradeName) { + this.tradeName = tradeName; + return this; + } + + /** + * Name of company, first name and last name or trade name of company responsible for producing product. + * @return tradeName + */ + @javax.annotation.Nullable + public String getTradeName() { + return tradeName; + } + + public void setTradeName(@javax.annotation.Nullable String tradeName) { + this.tradeName = tradeName; + } + + + public ResponsibleProducerResponseProducerData address(@javax.annotation.Nullable ResponsibleProducerAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public ResponsibleProducerAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable ResponsibleProducerAddress address) { + this.address = address; + } + + + public ResponsibleProducerResponseProducerData contact(@javax.annotation.Nullable ResponsibleProducerContact contact) { + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + */ + @javax.annotation.Nullable + public ResponsibleProducerContact getContact() { + return contact; + } + + public void setContact(@javax.annotation.Nullable ResponsibleProducerContact contact) { + this.contact = contact; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponsibleProducerResponseProducerData responsibleProducerResponseProducerData = (ResponsibleProducerResponseProducerData) o; + return Objects.equals(this.tradeName, responsibleProducerResponseProducerData.tradeName) && + Objects.equals(this.address, responsibleProducerResponseProducerData.address) && + Objects.equals(this.contact, responsibleProducerResponseProducerData.contact); + } + + @Override + public int hashCode() { + return Objects.hash(tradeName, address, contact); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponsibleProducerResponseProducerData {\n"); + sb.append(" tradeName: ").append(toIndentedString(tradeName)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tradeName"); + openapiFields.add("address"); + openapiFields.add("contact"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResponsibleProducerResponseProducerData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResponsibleProducerResponseProducerData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResponsibleProducerResponseProducerData is not found in the empty JSON string", ResponsibleProducerResponseProducerData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResponsibleProducerResponseProducerData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResponsibleProducerResponseProducerData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("tradeName") != null && !jsonObj.get("tradeName").isJsonNull()) && !jsonObj.get("tradeName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tradeName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tradeName").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + ResponsibleProducerAddress.validateJsonElement(jsonObj.get("address")); + } + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + ResponsibleProducerContact.validateJsonElement(jsonObj.get("contact")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResponsibleProducerResponseProducerData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResponsibleProducerResponseProducerData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResponsibleProducerResponseProducerData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResponsibleProducerResponseProducerData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResponsibleProducerResponseProducerData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ResponsibleProducerResponseProducerData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponsibleProducerResponseProducerData + * @throws IOException if the JSON string is invalid with respect to ResponsibleProducerResponseProducerData + */ + public static ResponsibleProducerResponseProducerData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResponsibleProducerResponseProducerData.class); + } + + /** + * Convert an instance of ResponsibleProducerResponseProducerData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducersGET200Response.java b/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducersGET200Response.java new file mode 100644 index 0000000..78cb209 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ResponsibleProducersGET200Response.java @@ -0,0 +1,284 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ResponsibleProducerResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ResponsibleProducersGET200Response + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ResponsibleProducersGET200Response { + public static final String SERIALIZED_NAME_RESPONSIBLE_PRODUCERS = "responsibleProducers"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PRODUCERS) + @javax.annotation.Nullable + private List responsibleProducers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private Integer totalCount; + + public ResponsibleProducersGET200Response() { + } + + public ResponsibleProducersGET200Response responsibleProducers(@javax.annotation.Nullable List responsibleProducers) { + this.responsibleProducers = responsibleProducers; + return this; + } + + public ResponsibleProducersGET200Response addResponsibleProducersItem(ResponsibleProducerResponse responsibleProducersItem) { + if (this.responsibleProducers == null) { + this.responsibleProducers = new ArrayList<>(); + } + this.responsibleProducers.add(responsibleProducersItem); + return this; + } + + /** + * Get responsibleProducers + * @return responsibleProducers + */ + @javax.annotation.Nullable + public List getResponsibleProducers() { + return responsibleProducers; + } + + public void setResponsibleProducers(@javax.annotation.Nullable List responsibleProducers) { + this.responsibleProducers = responsibleProducers; + } + + + public ResponsibleProducersGET200Response count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Number of responsible producers data returned in search result for the given parameters. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public ResponsibleProducersGET200Response totalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of available responsible producers data. + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponsibleProducersGET200Response responsibleProducersGET200Response = (ResponsibleProducersGET200Response) o; + return Objects.equals(this.responsibleProducers, responsibleProducersGET200Response.responsibleProducers) && + Objects.equals(this.count, responsibleProducersGET200Response.count) && + Objects.equals(this.totalCount, responsibleProducersGET200Response.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(responsibleProducers, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponsibleProducersGET200Response {\n"); + sb.append(" responsibleProducers: ").append(toIndentedString(responsibleProducers)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("responsibleProducers"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResponsibleProducersGET200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResponsibleProducersGET200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResponsibleProducersGET200Response is not found in the empty JSON string", ResponsibleProducersGET200Response.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResponsibleProducersGET200Response.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResponsibleProducersGET200Response` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("responsibleProducers") != null && !jsonObj.get("responsibleProducers").isJsonNull()) { + JsonArray jsonArrayresponsibleProducers = jsonObj.getAsJsonArray("responsibleProducers"); + if (jsonArrayresponsibleProducers != null) { + // ensure the json data is an array + if (!jsonObj.get("responsibleProducers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `responsibleProducers` to be an array in the JSON string but got `%s`", jsonObj.get("responsibleProducers").toString())); + } + + // validate the optional field `responsibleProducers` (array) + for (int i = 0; i < jsonArrayresponsibleProducers.size(); i++) { + ResponsibleProducerResponse.validateJsonElement(jsonArrayresponsibleProducers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResponsibleProducersGET200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResponsibleProducersGET200Response' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResponsibleProducersGET200Response.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResponsibleProducersGET200Response value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResponsibleProducersGET200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ResponsibleProducersGET200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResponsibleProducersGET200Response + * @throws IOException if the JSON string is invalid with respect to ResponsibleProducersGET200Response + */ + public static ResponsibleProducersGET200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResponsibleProducersGET200Response.class); + } + + /** + * Convert an instance of ResponsibleProducersGET200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/RestrictionCause.java b/src/main/java/pl/wtx/allegro/api/client/model/RestrictionCause.java new file mode 100644 index 0000000..2f63296 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/RestrictionCause.java @@ -0,0 +1,312 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * RestrictionCause + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class RestrictionCause { + /** + * Type of return policy restrictions. Required if range of policy is set to RESTRICTED or DISABLED, otherwise must be empty. Selected restriction depends on the chosen range of policy. Values 'ALCOHOL', 'FULLY_IMPLEMENTED_SERVICE' and 'BOOKED_SERVICE' are deprecated and should no longer be used. Read more info [PL](https://developer.allegro.pl/tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-zarzadzac-warunkami-zwrotow) / [EN](https://developer.allegro.pl/tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-manage-return-policies). + */ + @JsonAdapter(NameEnum.Adapter.class) + public enum NameEnum { + SEALED_MEDIA("SEALED_MEDIA"), + + SEALED_ITEM_NO_RETURN_DUE_HEALTH_OR_HYGIENE("SEALED_ITEM_NO_RETURN_DUE_HEALTH_OR_HYGIENE"), + + CUSTOM_ITEM("CUSTOM_ITEM"), + + SHORT_SHELF_LIFE("SHORT_SHELF_LIFE"), + + INSEPARABLY_LINKED("INSEPARABLY_LINKED"), + + PRESS("PRESS"), + + MEDICINAL_PRODUCT("MEDICINAL_PRODUCT"), + + NOT_RECORDED_DIGITAL_CONTENT("NOT_RECORDED_DIGITAL_CONTENT"), + + VALUE_DEPENDENT_ON_FINANCIAL_MARKET("VALUE_DEPENDENT_ON_FINANCIAL_MARKET"), + + ALCOHOL("ALCOHOL"), + + FULLY_IMPLEMENTED_SERVICE("FULLY_IMPLEMENTED_SERVICE"), + + BOOKED_SERVICE("BOOKED_SERVICE"); + + private String value; + + NameEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static NameEnum fromValue(String value) { + for (NameEnum b : NameEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final NameEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public NameEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return NameEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + NameEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private NameEnum name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public RestrictionCause() { + } + + public RestrictionCause name(@javax.annotation.Nullable NameEnum name) { + this.name = name; + return this; + } + + /** + * Type of return policy restrictions. Required if range of policy is set to RESTRICTED or DISABLED, otherwise must be empty. Selected restriction depends on the chosen range of policy. Values 'ALCOHOL', 'FULLY_IMPLEMENTED_SERVICE' and 'BOOKED_SERVICE' are deprecated and should no longer be used. Read more info [PL](https://developer.allegro.pl/tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-zarzadzac-warunkami-zwrotow) / [EN](https://developer.allegro.pl/tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-manage-return-policies). + * @return name + */ + @javax.annotation.Nullable + public NameEnum getName() { + return name; + } + + public void setName(@javax.annotation.Nullable NameEnum name) { + this.name = name; + } + + + public RestrictionCause description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestrictionCause restrictionCause = (RestrictionCause) o; + return Objects.equals(this.name, restrictionCause.name) && + Objects.equals(this.description, restrictionCause.description); + } + + @Override + public int hashCode() { + return Objects.hash(name, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestrictionCause {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RestrictionCause + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RestrictionCause.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RestrictionCause is not found in the empty JSON string", RestrictionCause.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RestrictionCause.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RestrictionCause` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `name` + if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) { + NameEnum.validateJsonElement(jsonObj.get("name")); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RestrictionCause.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RestrictionCause' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RestrictionCause.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RestrictionCause value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RestrictionCause read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RestrictionCause given an JSON string + * + * @param jsonString JSON string + * @return An instance of RestrictionCause + * @throws IOException if the JSON string is invalid with respect to RestrictionCause + */ + public static RestrictionCause fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RestrictionCause.class); + } + + /** + * Convert an instance of RestrictionCause to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReturnPoliciesListReturnPolicy.java b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPoliciesListReturnPolicy.java new file mode 100644 index 0000000..affcf34 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPoliciesListReturnPolicy.java @@ -0,0 +1,256 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ReturnPolicyResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ReturnPoliciesListReturnPolicy + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReturnPoliciesListReturnPolicy { + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_RETURN_POLICIES = "returnPolicies"; + @SerializedName(SERIALIZED_NAME_RETURN_POLICIES) + @javax.annotation.Nullable + private List returnPolicies = new ArrayList<>(); + + public ReturnPoliciesListReturnPolicy() { + } + + public ReturnPoliciesListReturnPolicy count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public ReturnPoliciesListReturnPolicy returnPolicies(@javax.annotation.Nullable List returnPolicies) { + this.returnPolicies = returnPolicies; + return this; + } + + public ReturnPoliciesListReturnPolicy addReturnPoliciesItem(ReturnPolicyResponse returnPoliciesItem) { + if (this.returnPolicies == null) { + this.returnPolicies = new ArrayList<>(); + } + this.returnPolicies.add(returnPoliciesItem); + return this; + } + + /** + * Get returnPolicies + * @return returnPolicies + */ + @javax.annotation.Nullable + public List getReturnPolicies() { + return returnPolicies; + } + + public void setReturnPolicies(@javax.annotation.Nullable List returnPolicies) { + this.returnPolicies = returnPolicies; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnPoliciesListReturnPolicy returnPoliciesListReturnPolicy = (ReturnPoliciesListReturnPolicy) o; + return Objects.equals(this.count, returnPoliciesListReturnPolicy.count) && + Objects.equals(this.returnPolicies, returnPoliciesListReturnPolicy.returnPolicies); + } + + @Override + public int hashCode() { + return Objects.hash(count, returnPolicies); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnPoliciesListReturnPolicy {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" returnPolicies: ").append(toIndentedString(returnPolicies)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("count"); + openapiFields.add("returnPolicies"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnPoliciesListReturnPolicy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnPoliciesListReturnPolicy.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnPoliciesListReturnPolicy is not found in the empty JSON string", ReturnPoliciesListReturnPolicy.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnPoliciesListReturnPolicy.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnPoliciesListReturnPolicy` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("returnPolicies") != null && !jsonObj.get("returnPolicies").isJsonNull()) { + JsonArray jsonArrayreturnPolicies = jsonObj.getAsJsonArray("returnPolicies"); + if (jsonArrayreturnPolicies != null) { + // ensure the json data is an array + if (!jsonObj.get("returnPolicies").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `returnPolicies` to be an array in the JSON string but got `%s`", jsonObj.get("returnPolicies").toString())); + } + + // validate the optional field `returnPolicies` (array) + for (int i = 0; i < jsonArrayreturnPolicies.size(); i++) { + ReturnPolicyResponse.validateJsonElement(jsonArrayreturnPolicies.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnPoliciesListReturnPolicy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnPoliciesListReturnPolicy' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnPoliciesListReturnPolicy.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnPoliciesListReturnPolicy value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnPoliciesListReturnPolicy read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnPoliciesListReturnPolicy given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnPoliciesListReturnPolicy + * @throws IOException if the JSON string is invalid with respect to ReturnPoliciesListReturnPolicy + */ + public static ReturnPoliciesListReturnPolicy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnPoliciesListReturnPolicy.class); + } + + /** + * Convert an instance of ReturnPoliciesListReturnPolicy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicy.java b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicy.java new file mode 100644 index 0000000..ae9b614 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicy.java @@ -0,0 +1,207 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The return policy information. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReturnPolicy { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public ReturnPolicy() { + } + + public ReturnPolicy id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the return policy definition. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnPolicy returnPolicy = (ReturnPolicy) o; + return Objects.equals(this.id, returnPolicy.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnPolicy {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnPolicy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnPolicy.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnPolicy is not found in the empty JSON string", ReturnPolicy.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnPolicy.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnPolicy` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnPolicy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnPolicy' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnPolicy.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnPolicy value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnPolicy read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnPolicy given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnPolicy + * @throws IOException if the JSON string is invalid with respect to ReturnPolicy + */ + public static ReturnPolicy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnPolicy.class); + } + + /** + * Convert an instance of ReturnPolicy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyAddress.java b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyAddress.java new file mode 100644 index 0000000..fcdf6be --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyAddress.java @@ -0,0 +1,338 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The return address of the policy. Can be null if availability range is 'DISABLED'. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReturnPolicyAddress { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_POST_CODE = "postCode"; + @SerializedName(SERIALIZED_NAME_POST_CODE) + @javax.annotation.Nonnull + private String postCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode; + + public ReturnPolicyAddress() { + } + + public ReturnPolicyAddress name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Company or person name. Length is dependent on specified 'countryCode' - for CZ and SK length is equal to 50 characters, for other countries - 200. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ReturnPolicyAddress street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Street name. Length is dependent on specified 'countryCode' - for PL, CZ and SK length is equal to 35 characters, for other countries - 200. + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public ReturnPolicyAddress postCode(@javax.annotation.Nonnull String postCode) { + this.postCode = postCode; + return this; + } + + /** + * Post code format is dependent on 'countryCode' - PL='XX-XXX', CZ='XXX XX', SK='XXX XX' for other countries format is less restrictive - 16 characters alphanumeric with ' '(space) and '-' allowed. + * @return postCode + */ + @javax.annotation.Nonnull + public String getPostCode() { + return postCode; + } + + public void setPostCode(@javax.annotation.Nonnull String postCode) { + this.postCode = postCode; + } + + + public ReturnPolicyAddress city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * City name. Length is dependent on specified 'countryCode' - for PL, CZ and SK length is equal to 30 characters, for other countries - 200. + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public ReturnPolicyAddress countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code. + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnPolicyAddress returnPolicyAddress = (ReturnPolicyAddress) o; + return Objects.equals(this.name, returnPolicyAddress.name) && + Objects.equals(this.street, returnPolicyAddress.street) && + Objects.equals(this.postCode, returnPolicyAddress.postCode) && + Objects.equals(this.city, returnPolicyAddress.city) && + Objects.equals(this.countryCode, returnPolicyAddress.countryCode); + } + + @Override + public int hashCode() { + return Objects.hash(name, street, postCode, city, countryCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnPolicyAddress {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postCode: ").append(toIndentedString(postCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("street"); + openapiFields.add("postCode"); + openapiFields.add("city"); + openapiFields.add("countryCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("postCode"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("countryCode"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnPolicyAddress + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnPolicyAddress.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnPolicyAddress is not found in the empty JSON string", ReturnPolicyAddress.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnPolicyAddress.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnPolicyAddress` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnPolicyAddress.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("postCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postCode").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnPolicyAddress.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnPolicyAddress' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnPolicyAddress.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnPolicyAddress value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnPolicyAddress read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnPolicyAddress given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnPolicyAddress + * @throws IOException if the JSON string is invalid with respect to ReturnPolicyAddress + */ + public static ReturnPolicyAddress fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnPolicyAddress.class); + } + + /** + * Convert an instance of ReturnPolicyAddress to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyAvailability.java b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyAvailability.java new file mode 100644 index 0000000..54ed7dc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyAvailability.java @@ -0,0 +1,314 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.RestrictionCause; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ReturnPolicyAvailability + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReturnPolicyAvailability { + /** + * Indicates if return policy is full, restricted or disabled. + */ + @JsonAdapter(RangeEnum.Adapter.class) + public enum RangeEnum { + FULL("FULL"), + + RESTRICTED("RESTRICTED"), + + DISABLED("DISABLED"); + + private String value; + + RangeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RangeEnum fromValue(String value) { + for (RangeEnum b : RangeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RangeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RangeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RangeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + RangeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_RANGE = "range"; + @SerializedName(SERIALIZED_NAME_RANGE) + @javax.annotation.Nonnull + private RangeEnum range; + + public static final String SERIALIZED_NAME_RESTRICTION_CAUSE = "restrictionCause"; + @SerializedName(SERIALIZED_NAME_RESTRICTION_CAUSE) + @javax.annotation.Nullable + private RestrictionCause restrictionCause; + + public ReturnPolicyAvailability() { + } + + public ReturnPolicyAvailability range(@javax.annotation.Nonnull RangeEnum range) { + this.range = range; + return this; + } + + /** + * Indicates if return policy is full, restricted or disabled. + * @return range + */ + @javax.annotation.Nonnull + public RangeEnum getRange() { + return range; + } + + public void setRange(@javax.annotation.Nonnull RangeEnum range) { + this.range = range; + } + + + public ReturnPolicyAvailability restrictionCause(@javax.annotation.Nullable RestrictionCause restrictionCause) { + this.restrictionCause = restrictionCause; + return this; + } + + /** + * Get restrictionCause + * @return restrictionCause + */ + @javax.annotation.Nullable + public RestrictionCause getRestrictionCause() { + return restrictionCause; + } + + public void setRestrictionCause(@javax.annotation.Nullable RestrictionCause restrictionCause) { + this.restrictionCause = restrictionCause; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnPolicyAvailability returnPolicyAvailability = (ReturnPolicyAvailability) o; + return Objects.equals(this.range, returnPolicyAvailability.range) && + Objects.equals(this.restrictionCause, returnPolicyAvailability.restrictionCause); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(range, restrictionCause); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnPolicyAvailability {\n"); + sb.append(" range: ").append(toIndentedString(range)).append("\n"); + sb.append(" restrictionCause: ").append(toIndentedString(restrictionCause)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("range"); + openapiFields.add("restrictionCause"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("range"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnPolicyAvailability + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnPolicyAvailability.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnPolicyAvailability is not found in the empty JSON string", ReturnPolicyAvailability.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnPolicyAvailability.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnPolicyAvailability` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnPolicyAvailability.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("range").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `range` to be a primitive type in the JSON string but got `%s`", jsonObj.get("range").toString())); + } + // validate the required field `range` + RangeEnum.validateJsonElement(jsonObj.get("range")); + // validate the optional field `restrictionCause` + if (jsonObj.get("restrictionCause") != null && !jsonObj.get("restrictionCause").isJsonNull()) { + RestrictionCause.validateJsonElement(jsonObj.get("restrictionCause")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnPolicyAvailability.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnPolicyAvailability' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnPolicyAvailability.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnPolicyAvailability value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnPolicyAvailability read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnPolicyAvailability given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnPolicyAvailability + * @throws IOException if the JSON string is invalid with respect to ReturnPolicyAvailability + */ + public static ReturnPolicyAvailability fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnPolicyAvailability.class); + } + + /** + * Convert an instance of ReturnPolicyAvailability to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyContact.java b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyContact.java new file mode 100644 index 0000000..2b4e055 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyContact.java @@ -0,0 +1,248 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ReturnPolicyContact + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReturnPolicyContact { + public static final String SERIALIZED_NAME_PHONE_NUMBER = "phoneNumber"; + @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) + @javax.annotation.Nullable + private String phoneNumber; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nullable + private String email; + + public ReturnPolicyContact() { + } + + public ReturnPolicyContact phoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * A valid phone number of the seller + * @return phoneNumber + */ + @javax.annotation.Nullable + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(@javax.annotation.Nullable String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + public ReturnPolicyContact email(@javax.annotation.Nullable String email) { + this.email = email; + return this; + } + + /** + * A valid email address of the seller + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nullable String email) { + this.email = email; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnPolicyContact returnPolicyContact = (ReturnPolicyContact) o; + return Objects.equals(this.phoneNumber, returnPolicyContact.phoneNumber) && + Objects.equals(this.email, returnPolicyContact.email); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(phoneNumber, email); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnPolicyContact {\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("phoneNumber"); + openapiFields.add("email"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnPolicyContact + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnPolicyContact.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnPolicyContact is not found in the empty JSON string", ReturnPolicyContact.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnPolicyContact.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnPolicyContact` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("phoneNumber") != null && !jsonObj.get("phoneNumber").isJsonNull()) && !jsonObj.get("phoneNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phoneNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phoneNumber").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnPolicyContact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnPolicyContact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnPolicyContact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnPolicyContact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnPolicyContact read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnPolicyContact given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnPolicyContact + * @throws IOException if the JSON string is invalid with respect to ReturnPolicyContact + */ + public static ReturnPolicyContact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnPolicyContact.class); + } + + /** + * Convert an instance of ReturnPolicyContact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyOptions.java b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyOptions.java new file mode 100644 index 0000000..916258a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyOptions.java @@ -0,0 +1,323 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Can be null if availability range is 'DISABLED'. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReturnPolicyOptions { + public static final String SERIALIZED_NAME_CASH_ON_DELIVERY_NOT_ALLOWED = "cashOnDeliveryNotAllowed"; + @SerializedName(SERIALIZED_NAME_CASH_ON_DELIVERY_NOT_ALLOWED) + @javax.annotation.Nonnull + private Boolean cashOnDeliveryNotAllowed; + + public static final String SERIALIZED_NAME_FREE_ACCESSORIES_RETURN_REQUIRED = "freeAccessoriesReturnRequired"; + @SerializedName(SERIALIZED_NAME_FREE_ACCESSORIES_RETURN_REQUIRED) + @javax.annotation.Nonnull + private Boolean freeAccessoriesReturnRequired; + + public static final String SERIALIZED_NAME_REFUND_LOWERED_BY_RECEIVED_DISCOUNT = "refundLoweredByReceivedDiscount"; + @SerializedName(SERIALIZED_NAME_REFUND_LOWERED_BY_RECEIVED_DISCOUNT) + @javax.annotation.Nonnull + private Boolean refundLoweredByReceivedDiscount; + + public static final String SERIALIZED_NAME_BUSINESS_RETURN_ALLOWED = "businessReturnAllowed"; + @SerializedName(SERIALIZED_NAME_BUSINESS_RETURN_ALLOWED) + @javax.annotation.Nonnull + private Boolean businessReturnAllowed; + + public static final String SERIALIZED_NAME_COLLECT_BY_SELLER_ONLY = "collectBySellerOnly"; + @SerializedName(SERIALIZED_NAME_COLLECT_BY_SELLER_ONLY) + @javax.annotation.Nonnull + private Boolean collectBySellerOnly; + + public ReturnPolicyOptions() { + } + + public ReturnPolicyOptions cashOnDeliveryNotAllowed(@javax.annotation.Nonnull Boolean cashOnDeliveryNotAllowed) { + this.cashOnDeliveryNotAllowed = cashOnDeliveryNotAllowed; + return this; + } + + /** + * Order sent back with cash on pickup is not allowed + * @return cashOnDeliveryNotAllowed + */ + @javax.annotation.Nonnull + public Boolean getCashOnDeliveryNotAllowed() { + return cashOnDeliveryNotAllowed; + } + + public void setCashOnDeliveryNotAllowed(@javax.annotation.Nonnull Boolean cashOnDeliveryNotAllowed) { + this.cashOnDeliveryNotAllowed = cashOnDeliveryNotAllowed; + } + + + public ReturnPolicyOptions freeAccessoriesReturnRequired(@javax.annotation.Nonnull Boolean freeAccessoriesReturnRequired) { + this.freeAccessoriesReturnRequired = freeAccessoriesReturnRequired; + return this; + } + + /** + * If free accessories were added to the order, the client needs to send them back + * @return freeAccessoriesReturnRequired + */ + @javax.annotation.Nonnull + public Boolean getFreeAccessoriesReturnRequired() { + return freeAccessoriesReturnRequired; + } + + public void setFreeAccessoriesReturnRequired(@javax.annotation.Nonnull Boolean freeAccessoriesReturnRequired) { + this.freeAccessoriesReturnRequired = freeAccessoriesReturnRequired; + } + + + public ReturnPolicyOptions refundLoweredByReceivedDiscount(@javax.annotation.Nonnull Boolean refundLoweredByReceivedDiscount) { + this.refundLoweredByReceivedDiscount = refundLoweredByReceivedDiscount; + return this; + } + + /** + * If there was a discount granted after the order, the return is lowered by the received discount + * @return refundLoweredByReceivedDiscount + */ + @javax.annotation.Nonnull + public Boolean getRefundLoweredByReceivedDiscount() { + return refundLoweredByReceivedDiscount; + } + + public void setRefundLoweredByReceivedDiscount(@javax.annotation.Nonnull Boolean refundLoweredByReceivedDiscount) { + this.refundLoweredByReceivedDiscount = refundLoweredByReceivedDiscount; + } + + + public ReturnPolicyOptions businessReturnAllowed(@javax.annotation.Nonnull Boolean businessReturnAllowed) { + this.businessReturnAllowed = businessReturnAllowed; + return this; + } + + /** + * Returns for B2B purchases allowed + * @return businessReturnAllowed + */ + @javax.annotation.Nonnull + public Boolean getBusinessReturnAllowed() { + return businessReturnAllowed; + } + + public void setBusinessReturnAllowed(@javax.annotation.Nonnull Boolean businessReturnAllowed) { + this.businessReturnAllowed = businessReturnAllowed; + } + + + public ReturnPolicyOptions collectBySellerOnly(@javax.annotation.Nonnull Boolean collectBySellerOnly) { + this.collectBySellerOnly = collectBySellerOnly; + return this; + } + + /** + * Return items are picked up by the seller + * @return collectBySellerOnly + */ + @javax.annotation.Nonnull + public Boolean getCollectBySellerOnly() { + return collectBySellerOnly; + } + + public void setCollectBySellerOnly(@javax.annotation.Nonnull Boolean collectBySellerOnly) { + this.collectBySellerOnly = collectBySellerOnly; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnPolicyOptions returnPolicyOptions = (ReturnPolicyOptions) o; + return Objects.equals(this.cashOnDeliveryNotAllowed, returnPolicyOptions.cashOnDeliveryNotAllowed) && + Objects.equals(this.freeAccessoriesReturnRequired, returnPolicyOptions.freeAccessoriesReturnRequired) && + Objects.equals(this.refundLoweredByReceivedDiscount, returnPolicyOptions.refundLoweredByReceivedDiscount) && + Objects.equals(this.businessReturnAllowed, returnPolicyOptions.businessReturnAllowed) && + Objects.equals(this.collectBySellerOnly, returnPolicyOptions.collectBySellerOnly); + } + + @Override + public int hashCode() { + return Objects.hash(cashOnDeliveryNotAllowed, freeAccessoriesReturnRequired, refundLoweredByReceivedDiscount, businessReturnAllowed, collectBySellerOnly); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnPolicyOptions {\n"); + sb.append(" cashOnDeliveryNotAllowed: ").append(toIndentedString(cashOnDeliveryNotAllowed)).append("\n"); + sb.append(" freeAccessoriesReturnRequired: ").append(toIndentedString(freeAccessoriesReturnRequired)).append("\n"); + sb.append(" refundLoweredByReceivedDiscount: ").append(toIndentedString(refundLoweredByReceivedDiscount)).append("\n"); + sb.append(" businessReturnAllowed: ").append(toIndentedString(businessReturnAllowed)).append("\n"); + sb.append(" collectBySellerOnly: ").append(toIndentedString(collectBySellerOnly)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("cashOnDeliveryNotAllowed"); + openapiFields.add("freeAccessoriesReturnRequired"); + openapiFields.add("refundLoweredByReceivedDiscount"); + openapiFields.add("businessReturnAllowed"); + openapiFields.add("collectBySellerOnly"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("cashOnDeliveryNotAllowed"); + openapiRequiredFields.add("freeAccessoriesReturnRequired"); + openapiRequiredFields.add("refundLoweredByReceivedDiscount"); + openapiRequiredFields.add("businessReturnAllowed"); + openapiRequiredFields.add("collectBySellerOnly"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnPolicyOptions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnPolicyOptions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnPolicyOptions is not found in the empty JSON string", ReturnPolicyOptions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnPolicyOptions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnPolicyOptions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnPolicyOptions.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnPolicyOptions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnPolicyOptions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnPolicyOptions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnPolicyOptions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnPolicyOptions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnPolicyOptions given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnPolicyOptions + * @throws IOException if the JSON string is invalid with respect to ReturnPolicyOptions + */ + public static ReturnPolicyOptions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnPolicyOptions.class); + } + + /** + * Convert an instance of ReturnPolicyOptions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyRequest.java new file mode 100644 index 0000000..a3ecfbd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyRequest.java @@ -0,0 +1,412 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.ReturnPolicyAddress; +import pl.wtx.allegro.api.client.model.ReturnPolicyAvailability; +import pl.wtx.allegro.api.client.model.ReturnPolicyContact; +import pl.wtx.allegro.api.client.model.ReturnPolicyOptions; +import pl.wtx.allegro.api.client.model.ReturnPolicyReturnCost; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ReturnPolicyRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReturnPolicyRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_AVAILABILITY = "availability"; + @SerializedName(SERIALIZED_NAME_AVAILABILITY) + @javax.annotation.Nonnull + private ReturnPolicyAvailability availability; + + public static final String SERIALIZED_NAME_WITHDRAWAL_PERIOD = "withdrawalPeriod"; + @SerializedName(SERIALIZED_NAME_WITHDRAWAL_PERIOD) + @javax.annotation.Nullable + private String withdrawalPeriod; + + public static final String SERIALIZED_NAME_RETURN_COST = "returnCost"; + @SerializedName(SERIALIZED_NAME_RETURN_COST) + @javax.annotation.Nullable + private ReturnPolicyReturnCost returnCost; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private ReturnPolicyAddress address; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + @javax.annotation.Nullable + private ReturnPolicyContact contact; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + @SerializedName(SERIALIZED_NAME_OPTIONS) + @javax.annotation.Nullable + private ReturnPolicyOptions options; + + public ReturnPolicyRequest() { + } + + public ReturnPolicyRequest name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Return policy name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ReturnPolicyRequest availability(@javax.annotation.Nonnull ReturnPolicyAvailability availability) { + this.availability = availability; + return this; + } + + /** + * Get availability + * @return availability + */ + @javax.annotation.Nonnull + public ReturnPolicyAvailability getAvailability() { + return availability; + } + + public void setAvailability(@javax.annotation.Nonnull ReturnPolicyAvailability availability) { + this.availability = availability; + } + + + public ReturnPolicyRequest withdrawalPeriod(@javax.annotation.Nullable String withdrawalPeriod) { + this.withdrawalPeriod = withdrawalPeriod; + return this; + } + + /** + * Period in ISO 8601 format. Only periods in full days are accepted. + * @return withdrawalPeriod + */ + @javax.annotation.Nullable + public String getWithdrawalPeriod() { + return withdrawalPeriod; + } + + public void setWithdrawalPeriod(@javax.annotation.Nullable String withdrawalPeriod) { + this.withdrawalPeriod = withdrawalPeriod; + } + + + public ReturnPolicyRequest returnCost(@javax.annotation.Nullable ReturnPolicyReturnCost returnCost) { + this.returnCost = returnCost; + return this; + } + + /** + * Get returnCost + * @return returnCost + */ + @javax.annotation.Nullable + public ReturnPolicyReturnCost getReturnCost() { + return returnCost; + } + + public void setReturnCost(@javax.annotation.Nullable ReturnPolicyReturnCost returnCost) { + this.returnCost = returnCost; + } + + + public ReturnPolicyRequest address(@javax.annotation.Nullable ReturnPolicyAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public ReturnPolicyAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable ReturnPolicyAddress address) { + this.address = address; + } + + + public ReturnPolicyRequest contact(@javax.annotation.Nullable ReturnPolicyContact contact) { + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + */ + @javax.annotation.Nullable + public ReturnPolicyContact getContact() { + return contact; + } + + public void setContact(@javax.annotation.Nullable ReturnPolicyContact contact) { + this.contact = contact; + } + + + public ReturnPolicyRequest options(@javax.annotation.Nullable ReturnPolicyOptions options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + public ReturnPolicyOptions getOptions() { + return options; + } + + public void setOptions(@javax.annotation.Nullable ReturnPolicyOptions options) { + this.options = options; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnPolicyRequest returnPolicyRequest = (ReturnPolicyRequest) o; + return Objects.equals(this.name, returnPolicyRequest.name) && + Objects.equals(this.availability, returnPolicyRequest.availability) && + Objects.equals(this.withdrawalPeriod, returnPolicyRequest.withdrawalPeriod) && + Objects.equals(this.returnCost, returnPolicyRequest.returnCost) && + Objects.equals(this.address, returnPolicyRequest.address) && + Objects.equals(this.contact, returnPolicyRequest.contact) && + Objects.equals(this.options, returnPolicyRequest.options); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, availability, withdrawalPeriod, returnCost, address, contact, options); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnPolicyRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" availability: ").append(toIndentedString(availability)).append("\n"); + sb.append(" withdrawalPeriod: ").append(toIndentedString(withdrawalPeriod)).append("\n"); + sb.append(" returnCost: ").append(toIndentedString(returnCost)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("availability"); + openapiFields.add("withdrawalPeriod"); + openapiFields.add("returnCost"); + openapiFields.add("address"); + openapiFields.add("contact"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("availability"); + openapiRequiredFields.add("returnCost"); + openapiRequiredFields.add("address"); + openapiRequiredFields.add("options"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnPolicyRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnPolicyRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnPolicyRequest is not found in the empty JSON string", ReturnPolicyRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnPolicyRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnPolicyRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnPolicyRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the required field `availability` + ReturnPolicyAvailability.validateJsonElement(jsonObj.get("availability")); + if ((jsonObj.get("withdrawalPeriod") != null && !jsonObj.get("withdrawalPeriod").isJsonNull()) && !jsonObj.get("withdrawalPeriod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `withdrawalPeriod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("withdrawalPeriod").toString())); + } + // validate the required field `returnCost` + ReturnPolicyReturnCost.validateJsonElement(jsonObj.get("returnCost")); + // validate the required field `address` + ReturnPolicyAddress.validateJsonElement(jsonObj.get("address")); + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + ReturnPolicyContact.validateJsonElement(jsonObj.get("contact")); + } + // validate the required field `options` + ReturnPolicyOptions.validateJsonElement(jsonObj.get("options")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnPolicyRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnPolicyRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnPolicyRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnPolicyRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnPolicyRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnPolicyRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnPolicyRequest + * @throws IOException if the JSON string is invalid with respect to ReturnPolicyRequest + */ + public static ReturnPolicyRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnPolicyRequest.class); + } + + /** + * Convert an instance of ReturnPolicyRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyResponse.java new file mode 100644 index 0000000..53b48d2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyResponse.java @@ -0,0 +1,478 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.ReturnPolicyAddress; +import pl.wtx.allegro.api.client.model.ReturnPolicyAvailability; +import pl.wtx.allegro.api.client.model.ReturnPolicyContact; +import pl.wtx.allegro.api.client.model.ReturnPolicyOptions; +import pl.wtx.allegro.api.client.model.ReturnPolicyReturnCost; +import pl.wtx.allegro.api.client.model.Seller; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ReturnPolicyResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReturnPolicyResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_SELLER = "seller"; + @SerializedName(SERIALIZED_NAME_SELLER) + @javax.annotation.Nonnull + private Seller seller; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_AVAILABILITY = "availability"; + @SerializedName(SERIALIZED_NAME_AVAILABILITY) + @javax.annotation.Nonnull + private ReturnPolicyAvailability availability; + + public static final String SERIALIZED_NAME_WITHDRAWAL_PERIOD = "withdrawalPeriod"; + @SerializedName(SERIALIZED_NAME_WITHDRAWAL_PERIOD) + @javax.annotation.Nullable + private String withdrawalPeriod; + + public static final String SERIALIZED_NAME_RETURN_COST = "returnCost"; + @SerializedName(SERIALIZED_NAME_RETURN_COST) + @javax.annotation.Nullable + private ReturnPolicyReturnCost returnCost; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private ReturnPolicyAddress address; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + @javax.annotation.Nullable + private ReturnPolicyContact contact; + + public static final String SERIALIZED_NAME_OPTIONS = "options"; + @SerializedName(SERIALIZED_NAME_OPTIONS) + @javax.annotation.Nullable + private ReturnPolicyOptions options; + + public ReturnPolicyResponse() { + } + + public ReturnPolicyResponse id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the return policy definition. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + public ReturnPolicyResponse seller(@javax.annotation.Nonnull Seller seller) { + this.seller = seller; + return this; + } + + /** + * Get seller + * @return seller + */ + @javax.annotation.Nonnull + public Seller getSeller() { + return seller; + } + + public void setSeller(@javax.annotation.Nonnull Seller seller) { + this.seller = seller; + } + + + public ReturnPolicyResponse name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Return policy name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ReturnPolicyResponse availability(@javax.annotation.Nonnull ReturnPolicyAvailability availability) { + this.availability = availability; + return this; + } + + /** + * Get availability + * @return availability + */ + @javax.annotation.Nonnull + public ReturnPolicyAvailability getAvailability() { + return availability; + } + + public void setAvailability(@javax.annotation.Nonnull ReturnPolicyAvailability availability) { + this.availability = availability; + } + + + public ReturnPolicyResponse withdrawalPeriod(@javax.annotation.Nullable String withdrawalPeriod) { + this.withdrawalPeriod = withdrawalPeriod; + return this; + } + + /** + * Period in ISO 8601 format. Can be null if availability range is 'DISABLED'. + * @return withdrawalPeriod + */ + @javax.annotation.Nullable + public String getWithdrawalPeriod() { + return withdrawalPeriod; + } + + public void setWithdrawalPeriod(@javax.annotation.Nullable String withdrawalPeriod) { + this.withdrawalPeriod = withdrawalPeriod; + } + + + public ReturnPolicyResponse returnCost(@javax.annotation.Nullable ReturnPolicyReturnCost returnCost) { + this.returnCost = returnCost; + return this; + } + + /** + * Get returnCost + * @return returnCost + */ + @javax.annotation.Nullable + public ReturnPolicyReturnCost getReturnCost() { + return returnCost; + } + + public void setReturnCost(@javax.annotation.Nullable ReturnPolicyReturnCost returnCost) { + this.returnCost = returnCost; + } + + + public ReturnPolicyResponse address(@javax.annotation.Nullable ReturnPolicyAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public ReturnPolicyAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable ReturnPolicyAddress address) { + this.address = address; + } + + + public ReturnPolicyResponse contact(@javax.annotation.Nullable ReturnPolicyContact contact) { + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + */ + @javax.annotation.Nullable + public ReturnPolicyContact getContact() { + return contact; + } + + public void setContact(@javax.annotation.Nullable ReturnPolicyContact contact) { + this.contact = contact; + } + + + public ReturnPolicyResponse options(@javax.annotation.Nullable ReturnPolicyOptions options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + public ReturnPolicyOptions getOptions() { + return options; + } + + public void setOptions(@javax.annotation.Nullable ReturnPolicyOptions options) { + this.options = options; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnPolicyResponse returnPolicyResponse = (ReturnPolicyResponse) o; + return Objects.equals(this.id, returnPolicyResponse.id) && + Objects.equals(this.seller, returnPolicyResponse.seller) && + Objects.equals(this.name, returnPolicyResponse.name) && + Objects.equals(this.availability, returnPolicyResponse.availability) && + Objects.equals(this.withdrawalPeriod, returnPolicyResponse.withdrawalPeriod) && + Objects.equals(this.returnCost, returnPolicyResponse.returnCost) && + Objects.equals(this.address, returnPolicyResponse.address) && + Objects.equals(this.contact, returnPolicyResponse.contact) && + Objects.equals(this.options, returnPolicyResponse.options); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, seller, name, availability, withdrawalPeriod, returnCost, address, contact, options); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnPolicyResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" seller: ").append(toIndentedString(seller)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" availability: ").append(toIndentedString(availability)).append("\n"); + sb.append(" withdrawalPeriod: ").append(toIndentedString(withdrawalPeriod)).append("\n"); + sb.append(" returnCost: ").append(toIndentedString(returnCost)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("seller"); + openapiFields.add("name"); + openapiFields.add("availability"); + openapiFields.add("withdrawalPeriod"); + openapiFields.add("returnCost"); + openapiFields.add("address"); + openapiFields.add("contact"); + openapiFields.add("options"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("seller"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("availability"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnPolicyResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnPolicyResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnPolicyResponse is not found in the empty JSON string", ReturnPolicyResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnPolicyResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnPolicyResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReturnPolicyResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `seller` + Seller.validateJsonElement(jsonObj.get("seller")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the required field `availability` + ReturnPolicyAvailability.validateJsonElement(jsonObj.get("availability")); + if ((jsonObj.get("withdrawalPeriod") != null && !jsonObj.get("withdrawalPeriod").isJsonNull()) && !jsonObj.get("withdrawalPeriod").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `withdrawalPeriod` to be a primitive type in the JSON string but got `%s`", jsonObj.get("withdrawalPeriod").toString())); + } + // validate the optional field `returnCost` + if (jsonObj.get("returnCost") != null && !jsonObj.get("returnCost").isJsonNull()) { + ReturnPolicyReturnCost.validateJsonElement(jsonObj.get("returnCost")); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + ReturnPolicyAddress.validateJsonElement(jsonObj.get("address")); + } + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + ReturnPolicyContact.validateJsonElement(jsonObj.get("contact")); + } + // validate the optional field `options` + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { + ReturnPolicyOptions.validateJsonElement(jsonObj.get("options")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnPolicyResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnPolicyResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnPolicyResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnPolicyResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnPolicyResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnPolicyResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnPolicyResponse + * @throws IOException if the JSON string is invalid with respect to ReturnPolicyResponse + */ + public static ReturnPolicyResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnPolicyResponse.class); + } + + /** + * Convert an instance of ReturnPolicyResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyReturnCost.java b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyReturnCost.java new file mode 100644 index 0000000..5a46d9d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ReturnPolicyReturnCost.java @@ -0,0 +1,262 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Can be null if availability range is 'DISABLED'. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ReturnPolicyReturnCost { + /** + * Indicates who covers the return delivery costs. + */ + @JsonAdapter(CoveredByEnum.Adapter.class) + public enum CoveredByEnum { + SELLER("SELLER"), + + BUYER("BUYER"); + + private String value; + + CoveredByEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CoveredByEnum fromValue(String value) { + for (CoveredByEnum b : CoveredByEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CoveredByEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CoveredByEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CoveredByEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + CoveredByEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_COVERED_BY = "coveredBy"; + @SerializedName(SERIALIZED_NAME_COVERED_BY) + @javax.annotation.Nullable + private CoveredByEnum coveredBy; + + public ReturnPolicyReturnCost() { + } + + public ReturnPolicyReturnCost coveredBy(@javax.annotation.Nullable CoveredByEnum coveredBy) { + this.coveredBy = coveredBy; + return this; + } + + /** + * Indicates who covers the return delivery costs. + * @return coveredBy + */ + @javax.annotation.Nullable + public CoveredByEnum getCoveredBy() { + return coveredBy; + } + + public void setCoveredBy(@javax.annotation.Nullable CoveredByEnum coveredBy) { + this.coveredBy = coveredBy; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReturnPolicyReturnCost returnPolicyReturnCost = (ReturnPolicyReturnCost) o; + return Objects.equals(this.coveredBy, returnPolicyReturnCost.coveredBy); + } + + @Override + public int hashCode() { + return Objects.hash(coveredBy); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReturnPolicyReturnCost {\n"); + sb.append(" coveredBy: ").append(toIndentedString(coveredBy)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("coveredBy"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReturnPolicyReturnCost + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReturnPolicyReturnCost.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReturnPolicyReturnCost is not found in the empty JSON string", ReturnPolicyReturnCost.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReturnPolicyReturnCost.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReturnPolicyReturnCost` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("coveredBy") != null && !jsonObj.get("coveredBy").isJsonNull()) && !jsonObj.get("coveredBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `coveredBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("coveredBy").toString())); + } + // validate the optional field `coveredBy` + if (jsonObj.get("coveredBy") != null && !jsonObj.get("coveredBy").isJsonNull()) { + CoveredByEnum.validateJsonElement(jsonObj.get("coveredBy")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReturnPolicyReturnCost.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReturnPolicyReturnCost' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReturnPolicyReturnCost.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReturnPolicyReturnCost value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReturnPolicyReturnCost read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReturnPolicyReturnCost given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReturnPolicyReturnCost + * @throws IOException if the JSON string is invalid with respect to ReturnPolicyReturnCost + */ + public static ReturnPolicyReturnCost fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReturnPolicyReturnCost.class); + } + + /** + * Convert an instance of ReturnPolicyReturnCost to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponse.java new file mode 100644 index 0000000..0a39f1d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponse.java @@ -0,0 +1,308 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import pl.wtx.allegro.api.client.model.SalePartialProductOfferResponseAdditionalMarketplacesValue; +import pl.wtx.allegro.api.client.model.SalePartialProductOfferResponseSellingMode; +import pl.wtx.allegro.api.client.model.SalePartialProductOfferResponseStock; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SalePartialProductOfferResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SalePartialProductOfferResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_STOCK = "stock"; + @SerializedName(SERIALIZED_NAME_STOCK) + @javax.annotation.Nullable + private SalePartialProductOfferResponseStock stock; + + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private SalePartialProductOfferResponseSellingMode sellingMode; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private Map additionalMarketplaces = new HashMap<>(); + + public SalePartialProductOfferResponse() { + } + + public SalePartialProductOfferResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Offer's ID + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public SalePartialProductOfferResponse stock(@javax.annotation.Nullable SalePartialProductOfferResponseStock stock) { + this.stock = stock; + return this; + } + + /** + * Get stock + * @return stock + */ + @javax.annotation.Nullable + public SalePartialProductOfferResponseStock getStock() { + return stock; + } + + public void setStock(@javax.annotation.Nullable SalePartialProductOfferResponseStock stock) { + this.stock = stock; + } + + + public SalePartialProductOfferResponse sellingMode(@javax.annotation.Nullable SalePartialProductOfferResponseSellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public SalePartialProductOfferResponseSellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable SalePartialProductOfferResponseSellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + public SalePartialProductOfferResponse additionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public SalePartialProductOfferResponse putAdditionalMarketplacesItem(String key, SalePartialProductOfferResponseAdditionalMarketplacesValue additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new HashMap<>(); + } + this.additionalMarketplaces.put(key, additionalMarketplacesItem); + return this; + } + + /** + * Information about this offer in additional marketplaces (available for <var>include=price</var>). + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public Map getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SalePartialProductOfferResponse salePartialProductOfferResponse = (SalePartialProductOfferResponse) o; + return Objects.equals(this.id, salePartialProductOfferResponse.id) && + Objects.equals(this.stock, salePartialProductOfferResponse.stock) && + Objects.equals(this.sellingMode, salePartialProductOfferResponse.sellingMode) && + Objects.equals(this.additionalMarketplaces, salePartialProductOfferResponse.additionalMarketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(id, stock, sellingMode, additionalMarketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SalePartialProductOfferResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" stock: ").append(toIndentedString(stock)).append("\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("stock"); + openapiFields.add("sellingMode"); + openapiFields.add("additionalMarketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SalePartialProductOfferResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SalePartialProductOfferResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SalePartialProductOfferResponse is not found in the empty JSON string", SalePartialProductOfferResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SalePartialProductOfferResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SalePartialProductOfferResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `stock` + if (jsonObj.get("stock") != null && !jsonObj.get("stock").isJsonNull()) { + SalePartialProductOfferResponseStock.validateJsonElement(jsonObj.get("stock")); + } + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + SalePartialProductOfferResponseSellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SalePartialProductOfferResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SalePartialProductOfferResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SalePartialProductOfferResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SalePartialProductOfferResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SalePartialProductOfferResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SalePartialProductOfferResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SalePartialProductOfferResponse + * @throws IOException if the JSON string is invalid with respect to SalePartialProductOfferResponse + */ + public static SalePartialProductOfferResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SalePartialProductOfferResponse.class); + } + + /** + * Convert an instance of SalePartialProductOfferResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseAdditionalMarketplacesValue.java b/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseAdditionalMarketplacesValue.java new file mode 100644 index 0000000..2d2d21b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseAdditionalMarketplacesValue.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SalePartialProductOfferResponseAdditionalMarketplacesValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SalePartialProductOfferResponseAdditionalMarketplacesValue { + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode sellingMode; + + public SalePartialProductOfferResponseAdditionalMarketplacesValue() { + } + + public SalePartialProductOfferResponseAdditionalMarketplacesValue sellingMode(@javax.annotation.Nullable SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SalePartialProductOfferResponseAdditionalMarketplacesValue salePartialProductOfferResponseAdditionalMarketplacesValue = (SalePartialProductOfferResponseAdditionalMarketplacesValue) o; + return Objects.equals(this.sellingMode, salePartialProductOfferResponseAdditionalMarketplacesValue.sellingMode); + } + + @Override + public int hashCode() { + return Objects.hash(sellingMode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SalePartialProductOfferResponseAdditionalMarketplacesValue {\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sellingMode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SalePartialProductOfferResponseAdditionalMarketplacesValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SalePartialProductOfferResponseAdditionalMarketplacesValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SalePartialProductOfferResponseAdditionalMarketplacesValue is not found in the empty JSON string", SalePartialProductOfferResponseAdditionalMarketplacesValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SalePartialProductOfferResponseAdditionalMarketplacesValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SalePartialProductOfferResponseAdditionalMarketplacesValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SalePartialProductOfferResponseAdditionalMarketplacesValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SalePartialProductOfferResponseAdditionalMarketplacesValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SalePartialProductOfferResponseAdditionalMarketplacesValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SalePartialProductOfferResponseAdditionalMarketplacesValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SalePartialProductOfferResponseAdditionalMarketplacesValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SalePartialProductOfferResponseAdditionalMarketplacesValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of SalePartialProductOfferResponseAdditionalMarketplacesValue + * @throws IOException if the JSON string is invalid with respect to SalePartialProductOfferResponseAdditionalMarketplacesValue + */ + public static SalePartialProductOfferResponseAdditionalMarketplacesValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SalePartialProductOfferResponseAdditionalMarketplacesValue.class); + } + + /** + * Convert an instance of SalePartialProductOfferResponseAdditionalMarketplacesValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.java b/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.java new file mode 100644 index 0000000..63d65c5 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Price information for given addtional marketplace. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode { + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private Price price; + + public SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode() { + } + + public SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode price(@javax.annotation.Nullable Price price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nullable + public Price getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable Price price) { + this.price = price; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode salePartialProductOfferResponseAdditionalMarketplacesValueSellingMode = (SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode) o; + return Objects.equals(this.price, salePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.price); + } + + @Override + public int hashCode() { + return Objects.hash(price); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode {\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("price"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode is not found in the empty JSON string", SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `price` + if (jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("price")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode given an JSON string + * + * @param jsonString JSON string + * @return An instance of SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode + * @throws IOException if the JSON string is invalid with respect to SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode + */ + public static SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode.class); + } + + /** + * Convert an instance of SalePartialProductOfferResponseAdditionalMarketplacesValueSellingMode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseSellingMode.java b/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseSellingMode.java new file mode 100644 index 0000000..e374dbb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseSellingMode.java @@ -0,0 +1,208 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Price; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer's price information for base marketplace (available for <var>include=price</var>). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SalePartialProductOfferResponseSellingMode { + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private Price price; + + public SalePartialProductOfferResponseSellingMode() { + } + + public SalePartialProductOfferResponseSellingMode price(@javax.annotation.Nullable Price price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nullable + public Price getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable Price price) { + this.price = price; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SalePartialProductOfferResponseSellingMode salePartialProductOfferResponseSellingMode = (SalePartialProductOfferResponseSellingMode) o; + return Objects.equals(this.price, salePartialProductOfferResponseSellingMode.price); + } + + @Override + public int hashCode() { + return Objects.hash(price); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SalePartialProductOfferResponseSellingMode {\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("price"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SalePartialProductOfferResponseSellingMode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SalePartialProductOfferResponseSellingMode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SalePartialProductOfferResponseSellingMode is not found in the empty JSON string", SalePartialProductOfferResponseSellingMode.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SalePartialProductOfferResponseSellingMode.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SalePartialProductOfferResponseSellingMode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `price` + if (jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) { + Price.validateJsonElement(jsonObj.get("price")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SalePartialProductOfferResponseSellingMode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SalePartialProductOfferResponseSellingMode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SalePartialProductOfferResponseSellingMode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SalePartialProductOfferResponseSellingMode value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SalePartialProductOfferResponseSellingMode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SalePartialProductOfferResponseSellingMode given an JSON string + * + * @param jsonString JSON string + * @return An instance of SalePartialProductOfferResponseSellingMode + * @throws IOException if the JSON string is invalid with respect to SalePartialProductOfferResponseSellingMode + */ + public static SalePartialProductOfferResponseSellingMode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SalePartialProductOfferResponseSellingMode.class); + } + + /** + * Convert an instance of SalePartialProductOfferResponseSellingMode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseStock.java b/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseStock.java new file mode 100644 index 0000000..789c74b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SalePartialProductOfferResponseStock.java @@ -0,0 +1,204 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Number of times this offer can be purchased (available for <var>include=stock</var>). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SalePartialProductOfferResponseStock { + public static final String SERIALIZED_NAME_AVAILABLE = "available"; + @SerializedName(SERIALIZED_NAME_AVAILABLE) + @javax.annotation.Nullable + private Integer available; + + public SalePartialProductOfferResponseStock() { + } + + public SalePartialProductOfferResponseStock available(@javax.annotation.Nullable Integer available) { + this.available = available; + return this; + } + + /** + * Get available + * minimum: 0 + * @return available + */ + @javax.annotation.Nullable + public Integer getAvailable() { + return available; + } + + public void setAvailable(@javax.annotation.Nullable Integer available) { + this.available = available; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SalePartialProductOfferResponseStock salePartialProductOfferResponseStock = (SalePartialProductOfferResponseStock) o; + return Objects.equals(this.available, salePartialProductOfferResponseStock.available); + } + + @Override + public int hashCode() { + return Objects.hash(available); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SalePartialProductOfferResponseStock {\n"); + sb.append(" available: ").append(toIndentedString(available)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("available"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SalePartialProductOfferResponseStock + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SalePartialProductOfferResponseStock.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SalePartialProductOfferResponseStock is not found in the empty JSON string", SalePartialProductOfferResponseStock.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SalePartialProductOfferResponseStock.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SalePartialProductOfferResponseStock` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SalePartialProductOfferResponseStock.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SalePartialProductOfferResponseStock' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SalePartialProductOfferResponseStock.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SalePartialProductOfferResponseStock value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SalePartialProductOfferResponseStock read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SalePartialProductOfferResponseStock given an JSON string + * + * @param jsonString JSON string + * @return An instance of SalePartialProductOfferResponseStock + * @throws IOException if the JSON string is invalid with respect to SalePartialProductOfferResponseStock + */ + public static SalePartialProductOfferResponseStock fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SalePartialProductOfferResponseStock.class); + } + + /** + * Convert an instance of SalePartialProductOfferResponseStock to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductCompatibilityList.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductCompatibilityList.java new file mode 100644 index 0000000..3aa05bd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductCompatibilityList.java @@ -0,0 +1,297 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CompatibilityListItemProductBased; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Compatibility list assigned to this product, based on information from TecDoc database. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductCompatibilityList { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type = "PRODUCT_BASED"; + + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nullable + private List items = new ArrayList<>(); + + public SaleProductCompatibilityList() { + } + + public SaleProductCompatibilityList id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Id of product-based compatibility list. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public SaleProductCompatibilityList type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Type of compatibility list. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public SaleProductCompatibilityList items(@javax.annotation.Nullable List items) { + this.items = items; + return this; + } + + public SaleProductCompatibilityList addItemsItem(CompatibilityListItemProductBased itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * List of the compatible items. + * @return items + */ + @javax.annotation.Nullable + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nullable List items) { + this.items = items; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductCompatibilityList saleProductCompatibilityList = (SaleProductCompatibilityList) o; + return Objects.equals(this.id, saleProductCompatibilityList.id) && + Objects.equals(this.type, saleProductCompatibilityList.type) && + Objects.equals(this.items, saleProductCompatibilityList.items); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, items); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductCompatibilityList {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("type"); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductCompatibilityList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductCompatibilityList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductCompatibilityList is not found in the empty JSON string", SaleProductCompatibilityList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductCompatibilityList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductCompatibilityList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SaleProductCompatibilityList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + if (jsonArrayitems != null) { + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + // validate the optional field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + CompatibilityListItemProductBased.validateJsonElement(jsonArrayitems.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductCompatibilityList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductCompatibilityList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductCompatibilityList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductCompatibilityList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductCompatibilityList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductCompatibilityList given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductCompatibilityList + * @throws IOException if the JSON string is invalid with respect to SaleProductCompatibilityList + */ + public static SaleProductCompatibilityList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductCompatibilityList.class); + } + + /** + * Convert an instance of SaleProductCompatibilityList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductDto.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductDto.java new file mode 100644 index 0000000..584004b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductDto.java @@ -0,0 +1,700 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.AiCoCreatedContent; +import pl.wtx.allegro.api.client.model.ImageUrl; +import pl.wtx.allegro.api.client.model.OfferRequirements; +import pl.wtx.allegro.api.client.model.ProductCategoryWithPath; +import pl.wtx.allegro.api.client.model.ProductParameterDto; +import pl.wtx.allegro.api.client.model.ProductSafetyDto; +import pl.wtx.allegro.api.client.model.SaleProductCompatibilityList; +import pl.wtx.allegro.api.client.model.SaleProductDtoPublication; +import pl.wtx.allegro.api.client.model.StandardizedDescription; +import pl.wtx.allegro.api.client.model.TecdocSpecification; +import pl.wtx.allegro.api.client.model.TrustedContent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nonnull + private ProductCategoryWithPath category; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_OFFER_REQUIREMENTS = "offerRequirements"; + @SerializedName(SERIALIZED_NAME_OFFER_REQUIREMENTS) + @javax.annotation.Nullable + private OfferRequirements offerRequirements; + + public static final String SERIALIZED_NAME_COMPATIBILITY_LIST = "compatibilityList"; + @SerializedName(SERIALIZED_NAME_COMPATIBILITY_LIST) + @javax.annotation.Nullable + private SaleProductCompatibilityList compatibilityList; + + public static final String SERIALIZED_NAME_TECDOC_SPECIFICATION = "tecdocSpecification"; + @SerializedName(SERIALIZED_NAME_TECDOC_SPECIFICATION) + @javax.annotation.Nullable + private TecdocSpecification tecdocSpecification; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private StandardizedDescription description; + + public static final String SERIALIZED_NAME_IS_DRAFT = "isDraft"; + @SerializedName(SERIALIZED_NAME_IS_DRAFT) + @javax.annotation.Nullable + private Boolean isDraft; + + public static final String SERIALIZED_NAME_AI_CO_CREATED_CONTENT = "aiCoCreatedContent"; + @SerializedName(SERIALIZED_NAME_AI_CO_CREATED_CONTENT) + @javax.annotation.Nullable + private AiCoCreatedContent aiCoCreatedContent; + + public static final String SERIALIZED_NAME_TRUSTED_CONTENT = "trustedContent"; + @SerializedName(SERIALIZED_NAME_TRUSTED_CONTENT) + @javax.annotation.Nullable + private TrustedContent trustedContent; + + public static final String SERIALIZED_NAME_HAS_PROTECTED_BRAND = "hasProtectedBrand"; + @SerializedName(SERIALIZED_NAME_HAS_PROTECTED_BRAND) + @javax.annotation.Nullable + private Boolean hasProtectedBrand; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private SaleProductDtoPublication publication; + + public static final String SERIALIZED_NAME_PRODUCT_SAFETY = "productSafety"; + @SerializedName(SERIALIZED_NAME_PRODUCT_SAFETY) + @javax.annotation.Nullable + private ProductSafetyDto productSafety; + + public SaleProductDto() { + } + + public SaleProductDto id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Product id. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public SaleProductDto name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Product name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public SaleProductDto category(@javax.annotation.Nonnull ProductCategoryWithPath category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nonnull + public ProductCategoryWithPath getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nonnull ProductCategoryWithPath category) { + this.category = category; + } + + + public SaleProductDto images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public SaleProductDto addImagesItem(ImageUrl imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * List of product images. + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public SaleProductDto parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public SaleProductDto addParametersItem(ProductParameterDto parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * List of product parameters. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public SaleProductDto offerRequirements(@javax.annotation.Nullable OfferRequirements offerRequirements) { + this.offerRequirements = offerRequirements; + return this; + } + + /** + * Get offerRequirements + * @return offerRequirements + */ + @javax.annotation.Nullable + public OfferRequirements getOfferRequirements() { + return offerRequirements; + } + + public void setOfferRequirements(@javax.annotation.Nullable OfferRequirements offerRequirements) { + this.offerRequirements = offerRequirements; + } + + + public SaleProductDto compatibilityList(@javax.annotation.Nullable SaleProductCompatibilityList compatibilityList) { + this.compatibilityList = compatibilityList; + return this; + } + + /** + * Get compatibilityList + * @return compatibilityList + */ + @javax.annotation.Nullable + public SaleProductCompatibilityList getCompatibilityList() { + return compatibilityList; + } + + public void setCompatibilityList(@javax.annotation.Nullable SaleProductCompatibilityList compatibilityList) { + this.compatibilityList = compatibilityList; + } + + + public SaleProductDto tecdocSpecification(@javax.annotation.Nullable TecdocSpecification tecdocSpecification) { + this.tecdocSpecification = tecdocSpecification; + return this; + } + + /** + * Get tecdocSpecification + * @return tecdocSpecification + */ + @javax.annotation.Nullable + public TecdocSpecification getTecdocSpecification() { + return tecdocSpecification; + } + + public void setTecdocSpecification(@javax.annotation.Nullable TecdocSpecification tecdocSpecification) { + this.tecdocSpecification = tecdocSpecification; + } + + + public SaleProductDto description(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public StandardizedDescription getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + } + + + public SaleProductDto isDraft(@javax.annotation.Nullable Boolean isDraft) { + this.isDraft = isDraft; + return this; + } + + /** + * Flag that informs if product is waiting for resolution of basic parameters change proposal. + * @return isDraft + */ + @javax.annotation.Nullable + public Boolean getIsDraft() { + return isDraft; + } + + public void setIsDraft(@javax.annotation.Nullable Boolean isDraft) { + this.isDraft = isDraft; + } + + + public SaleProductDto aiCoCreatedContent(@javax.annotation.Nullable AiCoCreatedContent aiCoCreatedContent) { + this.aiCoCreatedContent = aiCoCreatedContent; + return this; + } + + /** + * Get aiCoCreatedContent + * @return aiCoCreatedContent + */ + @javax.annotation.Nullable + public AiCoCreatedContent getAiCoCreatedContent() { + return aiCoCreatedContent; + } + + public void setAiCoCreatedContent(@javax.annotation.Nullable AiCoCreatedContent aiCoCreatedContent) { + this.aiCoCreatedContent = aiCoCreatedContent; + } + + + public SaleProductDto trustedContent(@javax.annotation.Nullable TrustedContent trustedContent) { + this.trustedContent = trustedContent; + return this; + } + + /** + * Get trustedContent + * @return trustedContent + */ + @javax.annotation.Nullable + public TrustedContent getTrustedContent() { + return trustedContent; + } + + public void setTrustedContent(@javax.annotation.Nullable TrustedContent trustedContent) { + this.trustedContent = trustedContent; + } + + + public SaleProductDto hasProtectedBrand(@javax.annotation.Nullable Boolean hasProtectedBrand) { + this.hasProtectedBrand = hasProtectedBrand; + return this; + } + + /** + * Flag that informs if product is a part of a protected brand's assortment and its use may be restricted. + * @return hasProtectedBrand + */ + @javax.annotation.Nullable + public Boolean getHasProtectedBrand() { + return hasProtectedBrand; + } + + public void setHasProtectedBrand(@javax.annotation.Nullable Boolean hasProtectedBrand) { + this.hasProtectedBrand = hasProtectedBrand; + } + + + public SaleProductDto publication(@javax.annotation.Nullable SaleProductDtoPublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public SaleProductDtoPublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable SaleProductDtoPublication publication) { + this.publication = publication; + } + + + public SaleProductDto productSafety(@javax.annotation.Nullable ProductSafetyDto productSafety) { + this.productSafety = productSafety; + return this; + } + + /** + * Get productSafety + * @return productSafety + */ + @javax.annotation.Nullable + public ProductSafetyDto getProductSafety() { + return productSafety; + } + + public void setProductSafety(@javax.annotation.Nullable ProductSafetyDto productSafety) { + this.productSafety = productSafety; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductDto saleProductDto = (SaleProductDto) o; + return Objects.equals(this.id, saleProductDto.id) && + Objects.equals(this.name, saleProductDto.name) && + Objects.equals(this.category, saleProductDto.category) && + Objects.equals(this.images, saleProductDto.images) && + Objects.equals(this.parameters, saleProductDto.parameters) && + Objects.equals(this.offerRequirements, saleProductDto.offerRequirements) && + Objects.equals(this.compatibilityList, saleProductDto.compatibilityList) && + Objects.equals(this.tecdocSpecification, saleProductDto.tecdocSpecification) && + Objects.equals(this.description, saleProductDto.description) && + Objects.equals(this.isDraft, saleProductDto.isDraft) && + Objects.equals(this.aiCoCreatedContent, saleProductDto.aiCoCreatedContent) && + Objects.equals(this.trustedContent, saleProductDto.trustedContent) && + Objects.equals(this.hasProtectedBrand, saleProductDto.hasProtectedBrand) && + Objects.equals(this.publication, saleProductDto.publication) && + Objects.equals(this.productSafety, saleProductDto.productSafety); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, category, images, parameters, offerRequirements, compatibilityList, tecdocSpecification, description, isDraft, aiCoCreatedContent, trustedContent, hasProtectedBrand, publication, productSafety); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" offerRequirements: ").append(toIndentedString(offerRequirements)).append("\n"); + sb.append(" compatibilityList: ").append(toIndentedString(compatibilityList)).append("\n"); + sb.append(" tecdocSpecification: ").append(toIndentedString(tecdocSpecification)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" isDraft: ").append(toIndentedString(isDraft)).append("\n"); + sb.append(" aiCoCreatedContent: ").append(toIndentedString(aiCoCreatedContent)).append("\n"); + sb.append(" trustedContent: ").append(toIndentedString(trustedContent)).append("\n"); + sb.append(" hasProtectedBrand: ").append(toIndentedString(hasProtectedBrand)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" productSafety: ").append(toIndentedString(productSafety)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("category"); + openapiFields.add("images"); + openapiFields.add("parameters"); + openapiFields.add("offerRequirements"); + openapiFields.add("compatibilityList"); + openapiFields.add("tecdocSpecification"); + openapiFields.add("description"); + openapiFields.add("isDraft"); + openapiFields.add("aiCoCreatedContent"); + openapiFields.add("trustedContent"); + openapiFields.add("hasProtectedBrand"); + openapiFields.add("publication"); + openapiFields.add("productSafety"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("category"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductDto is not found in the empty JSON string", SaleProductDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SaleProductDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the required field `category` + ProductCategoryWithPath.validateJsonElement(jsonObj.get("category")); + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull()) { + JsonArray jsonArrayimages = jsonObj.getAsJsonArray("images"); + if (jsonArrayimages != null) { + // ensure the json data is an array + if (!jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + + // validate the optional field `images` (array) + for (int i = 0; i < jsonArrayimages.size(); i++) { + ImageUrl.validateJsonElement(jsonArrayimages.get(i)); + }; + } + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ProductParameterDto.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + // validate the optional field `offerRequirements` + if (jsonObj.get("offerRequirements") != null && !jsonObj.get("offerRequirements").isJsonNull()) { + OfferRequirements.validateJsonElement(jsonObj.get("offerRequirements")); + } + // validate the optional field `compatibilityList` + if (jsonObj.get("compatibilityList") != null && !jsonObj.get("compatibilityList").isJsonNull()) { + SaleProductCompatibilityList.validateJsonElement(jsonObj.get("compatibilityList")); + } + // validate the optional field `tecdocSpecification` + if (jsonObj.get("tecdocSpecification") != null && !jsonObj.get("tecdocSpecification").isJsonNull()) { + TecdocSpecification.validateJsonElement(jsonObj.get("tecdocSpecification")); + } + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + StandardizedDescription.validateJsonElement(jsonObj.get("description")); + } + // validate the optional field `aiCoCreatedContent` + if (jsonObj.get("aiCoCreatedContent") != null && !jsonObj.get("aiCoCreatedContent").isJsonNull()) { + AiCoCreatedContent.validateJsonElement(jsonObj.get("aiCoCreatedContent")); + } + // validate the optional field `trustedContent` + if (jsonObj.get("trustedContent") != null && !jsonObj.get("trustedContent").isJsonNull()) { + TrustedContent.validateJsonElement(jsonObj.get("trustedContent")); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + SaleProductDtoPublication.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `productSafety` + if (jsonObj.get("productSafety") != null && !jsonObj.get("productSafety").isJsonNull()) { + ProductSafetyDto.validateJsonElement(jsonObj.get("productSafety")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductDto + * @throws IOException if the JSON string is invalid with respect to SaleProductDto + */ + public static SaleProductDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductDto.class); + } + + /** + * Convert an instance of SaleProductDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductDtoPublication.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductDtoPublication.java new file mode 100644 index 0000000..dbd7ad3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductDtoPublication.java @@ -0,0 +1,262 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductDtoPublication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductDtoPublication { + /** + * The publication status of the product: - `PROPOSED` - product is proposed and can be during the review process - `LISTED` - product is created and reviewed + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PROPOSED("PROPOSED"), + + LISTED("LISTED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public SaleProductDtoPublication() { + } + + public SaleProductDtoPublication status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * The publication status of the product: - `PROPOSED` - product is proposed and can be during the review process - `LISTED` - product is created and reviewed + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductDtoPublication saleProductDtoPublication = (SaleProductDtoPublication) o; + return Objects.equals(this.status, saleProductDtoPublication.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductDtoPublication {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductDtoPublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductDtoPublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductDtoPublication is not found in the empty JSON string", SaleProductDtoPublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductDtoPublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductDtoPublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductDtoPublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductDtoPublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductDtoPublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductDtoPublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductDtoPublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductDtoPublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductDtoPublication + * @throws IOException if the JSON string is invalid with respect to SaleProductDtoPublication + */ + public static SaleProductDtoPublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductDtoPublication.class); + } + + /** + * Convert an instance of SaleProductDtoPublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOffer.java new file mode 100644 index 0000000..ebcd087 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOffer.java @@ -0,0 +1,503 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ExternalId; +import pl.wtx.allegro.api.client.model.Location; +import pl.wtx.allegro.api.client.model.MessageToSellerSettings; +import pl.wtx.allegro.api.client.model.OfferTaxSettings; +import pl.wtx.allegro.api.client.model.Payments; +import pl.wtx.allegro.api.client.model.SellingMode; +import pl.wtx.allegro.api.client.model.SizeTable; +import pl.wtx.allegro.api.client.model.StandardizedDescription; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Single offer data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOffer { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PAYMENTS = "payments"; + @SerializedName(SERIALIZED_NAME_PAYMENTS) + @javax.annotation.Nullable + private Payments payments; + + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private SellingMode sellingMode; + + public static final String SERIALIZED_NAME_LOCATION = "location"; + @SerializedName(SERIALIZED_NAME_LOCATION) + @javax.annotation.Nullable + private Location location; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private StandardizedDescription description; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nullable + private ExternalId external; + + public static final String SERIALIZED_NAME_SIZE_TABLE = "sizeTable"; + @SerializedName(SERIALIZED_NAME_SIZE_TABLE) + @javax.annotation.Nullable + private SizeTable sizeTable; + + public static final String SERIALIZED_NAME_TAX_SETTINGS = "taxSettings"; + @SerializedName(SERIALIZED_NAME_TAX_SETTINGS) + @javax.annotation.Nullable + private OfferTaxSettings taxSettings; + + public static final String SERIALIZED_NAME_MESSAGE_TO_SELLER_SETTINGS = "messageToSellerSettings"; + @SerializedName(SERIALIZED_NAME_MESSAGE_TO_SELLER_SETTINGS) + @javax.annotation.Nullable + private MessageToSellerSettings messageToSellerSettings; + + public SaleProductOffer() { + } + + public SaleProductOffer name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name (title) of an offer. Length cannot be more than 75 characters. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#tytul-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-title\" target=\"_blank\">EN</a> . + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SaleProductOffer payments(@javax.annotation.Nullable Payments payments) { + this.payments = payments; + return this; + } + + /** + * Get payments + * @return payments + */ + @javax.annotation.Nullable + public Payments getPayments() { + return payments; + } + + public void setPayments(@javax.annotation.Nullable Payments payments) { + this.payments = payments; + } + + + public SaleProductOffer sellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public SellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + public SaleProductOffer location(@javax.annotation.Nullable Location location) { + this.location = location; + return this; + } + + /** + * Get location + * @return location + */ + @javax.annotation.Nullable + public Location getLocation() { + return location; + } + + public void setLocation(@javax.annotation.Nullable Location location) { + this.location = location; + } + + + public SaleProductOffer images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public SaleProductOffer addImagesItem(String imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * Get images + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public SaleProductOffer description(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public StandardizedDescription getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + } + + + public SaleProductOffer external(@javax.annotation.Nullable ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nullable + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nullable ExternalId external) { + this.external = external; + } + + + public SaleProductOffer sizeTable(@javax.annotation.Nullable SizeTable sizeTable) { + this.sizeTable = sizeTable; + return this; + } + + /** + * Get sizeTable + * @return sizeTable + */ + @javax.annotation.Nullable + public SizeTable getSizeTable() { + return sizeTable; + } + + public void setSizeTable(@javax.annotation.Nullable SizeTable sizeTable) { + this.sizeTable = sizeTable; + } + + + public SaleProductOffer taxSettings(@javax.annotation.Nullable OfferTaxSettings taxSettings) { + this.taxSettings = taxSettings; + return this; + } + + /** + * Get taxSettings + * @return taxSettings + */ + @javax.annotation.Nullable + public OfferTaxSettings getTaxSettings() { + return taxSettings; + } + + public void setTaxSettings(@javax.annotation.Nullable OfferTaxSettings taxSettings) { + this.taxSettings = taxSettings; + } + + + public SaleProductOffer messageToSellerSettings(@javax.annotation.Nullable MessageToSellerSettings messageToSellerSettings) { + this.messageToSellerSettings = messageToSellerSettings; + return this; + } + + /** + * Get messageToSellerSettings + * @return messageToSellerSettings + */ + @javax.annotation.Nullable + public MessageToSellerSettings getMessageToSellerSettings() { + return messageToSellerSettings; + } + + public void setMessageToSellerSettings(@javax.annotation.Nullable MessageToSellerSettings messageToSellerSettings) { + this.messageToSellerSettings = messageToSellerSettings; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOffer saleProductOffer = (SaleProductOffer) o; + return Objects.equals(this.name, saleProductOffer.name) && + Objects.equals(this.payments, saleProductOffer.payments) && + Objects.equals(this.sellingMode, saleProductOffer.sellingMode) && + Objects.equals(this.location, saleProductOffer.location) && + Objects.equals(this.images, saleProductOffer.images) && + Objects.equals(this.description, saleProductOffer.description) && + Objects.equals(this.external, saleProductOffer.external) && + Objects.equals(this.sizeTable, saleProductOffer.sizeTable) && + Objects.equals(this.taxSettings, saleProductOffer.taxSettings) && + Objects.equals(this.messageToSellerSettings, saleProductOffer.messageToSellerSettings); + } + + @Override + public int hashCode() { + return Objects.hash(name, payments, sellingMode, location, images, description, external, sizeTable, taxSettings, messageToSellerSettings); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOffer {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" payments: ").append(toIndentedString(payments)).append("\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append(" sizeTable: ").append(toIndentedString(sizeTable)).append("\n"); + sb.append(" taxSettings: ").append(toIndentedString(taxSettings)).append("\n"); + sb.append(" messageToSellerSettings: ").append(toIndentedString(messageToSellerSettings)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("payments"); + openapiFields.add("sellingMode"); + openapiFields.add("location"); + openapiFields.add("images"); + openapiFields.add("description"); + openapiFields.add("external"); + openapiFields.add("sizeTable"); + openapiFields.add("taxSettings"); + openapiFields.add("messageToSellerSettings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOffer is not found in the empty JSON string", SaleProductOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `payments` + if (jsonObj.get("payments") != null && !jsonObj.get("payments").isJsonNull()) { + Payments.validateJsonElement(jsonObj.get("payments")); + } + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + SellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + // validate the optional field `location` + if (jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) { + Location.validateJsonElement(jsonObj.get("location")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull() && !jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + StandardizedDescription.validateJsonElement(jsonObj.get("description")); + } + // validate the optional field `external` + if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { + ExternalId.validateJsonElement(jsonObj.get("external")); + } + // validate the optional field `sizeTable` + if (jsonObj.get("sizeTable") != null && !jsonObj.get("sizeTable").isJsonNull()) { + SizeTable.validateJsonElement(jsonObj.get("sizeTable")); + } + // validate the optional field `taxSettings` + if (jsonObj.get("taxSettings") != null && !jsonObj.get("taxSettings").isJsonNull()) { + OfferTaxSettings.validateJsonElement(jsonObj.get("taxSettings")); + } + // validate the optional field `messageToSellerSettings` + if (jsonObj.get("messageToSellerSettings") != null && !jsonObj.get("messageToSellerSettings").isJsonNull()) { + MessageToSellerSettings.validateJsonElement(jsonObj.get("messageToSellerSettings")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOffer + * @throws IOException if the JSON string is invalid with respect to SaleProductOffer + */ + public static SaleProductOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOffer.class); + } + + /** + * Convert an instance of SaleProductOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1.java new file mode 100644 index 0000000..2cf11fc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1.java @@ -0,0 +1,1068 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacesRequestValue; +import pl.wtx.allegro.api.client.model.AfterSalesServicesProductOfferRequest; +import pl.wtx.allegro.api.client.model.B2b; +import pl.wtx.allegro.api.client.model.CompatibilityListManualType; +import pl.wtx.allegro.api.client.model.DiscountsProductOfferRequest; +import pl.wtx.allegro.api.client.model.ExternalId; +import pl.wtx.allegro.api.client.model.Location; +import pl.wtx.allegro.api.client.model.MessageToSellerSettings; +import pl.wtx.allegro.api.client.model.OfferTaxSettings; +import pl.wtx.allegro.api.client.model.ParameterProductOfferRequest; +import pl.wtx.allegro.api.client.model.Payments; +import pl.wtx.allegro.api.client.model.ProductOfferAdditionalServicesRequest; +import pl.wtx.allegro.api.client.model.ProductOfferAttachmentInner; +import pl.wtx.allegro.api.client.model.ProductOfferFundraisingCampaignRequest; +import pl.wtx.allegro.api.client.model.SaleProductOfferPatchRequestV1AllOfDelivery; +import pl.wtx.allegro.api.client.model.SaleProductOfferPatchRequestV1AllOfProductSet; +import pl.wtx.allegro.api.client.model.SaleProductOfferPublicationRequest; +import pl.wtx.allegro.api.client.model.SaleProductOfferRequestBaseAllOfContact; +import pl.wtx.allegro.api.client.model.SaleProductOffersRequestStock; +import pl.wtx.allegro.api.client.model.SellingMode; +import pl.wtx.allegro.api.client.model.SizeTable; +import pl.wtx.allegro.api.client.model.StandardizedDescription; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferPatchRequestV1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferPatchRequestV1 { + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Object category; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private SaleProductOfferPublicationRequest publication; + + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private SaleProductOfferPatchRequestV1AllOfDelivery delivery; + + public static final String SERIALIZED_NAME_AFTER_SALES_SERVICES = "afterSalesServices"; + @SerializedName(SERIALIZED_NAME_AFTER_SALES_SERVICES) + @javax.annotation.Nullable + private AfterSalesServicesProductOfferRequest afterSalesServices; + + public static final String SERIALIZED_NAME_SIZE_TABLE = "sizeTable"; + @SerializedName(SERIALIZED_NAME_SIZE_TABLE) + @javax.annotation.Nullable + private SizeTable sizeTable; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + @javax.annotation.Nullable + private SaleProductOfferRequestBaseAllOfContact contact; + + public static final String SERIALIZED_NAME_DISCOUNTS = "discounts"; + @SerializedName(SERIALIZED_NAME_DISCOUNTS) + @javax.annotation.Nullable + private DiscountsProductOfferRequest discounts; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PAYMENTS = "payments"; + @SerializedName(SERIALIZED_NAME_PAYMENTS) + @javax.annotation.Nullable + private Payments payments; + + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private SellingMode sellingMode; + + public static final String SERIALIZED_NAME_LOCATION = "location"; + @SerializedName(SERIALIZED_NAME_LOCATION) + @javax.annotation.Nullable + private Location location; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private StandardizedDescription description; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nullable + private ExternalId external; + + public static final String SERIALIZED_NAME_TAX_SETTINGS = "taxSettings"; + @SerializedName(SERIALIZED_NAME_TAX_SETTINGS) + @javax.annotation.Nullable + private OfferTaxSettings taxSettings; + + public static final String SERIALIZED_NAME_MESSAGE_TO_SELLER_SETTINGS = "messageToSellerSettings"; + @SerializedName(SERIALIZED_NAME_MESSAGE_TO_SELLER_SETTINGS) + @javax.annotation.Nullable + private MessageToSellerSettings messageToSellerSettings; + + public static final String SERIALIZED_NAME_PRODUCT_SET = "productSet"; + @SerializedName(SERIALIZED_NAME_PRODUCT_SET) + @javax.annotation.Nullable + private List productSet = new ArrayList<>(); + + public static final String SERIALIZED_NAME_B2B = "b2b"; + @SerializedName(SERIALIZED_NAME_B2B) + @javax.annotation.Nullable + private B2b b2b; + + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nullable + private List attachments = new ArrayList<>(); + + public static final String SERIALIZED_NAME_FUNDRAISING_CAMPAIGN = "fundraisingCampaign"; + @SerializedName(SERIALIZED_NAME_FUNDRAISING_CAMPAIGN) + @javax.annotation.Nullable + private ProductOfferFundraisingCampaignRequest fundraisingCampaign; + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private ProductOfferAdditionalServicesRequest additionalServices; + + public static final String SERIALIZED_NAME_COMPATIBILITY_LIST = "compatibilityList"; + @SerializedName(SERIALIZED_NAME_COMPATIBILITY_LIST) + @javax.annotation.Nullable + private CompatibilityListManualType compatibilityList; + + public static final String SERIALIZED_NAME_STOCK = "stock"; + @SerializedName(SERIALIZED_NAME_STOCK) + @javax.annotation.Nullable + private SaleProductOffersRequestStock stock; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private Map additionalMarketplaces = new HashMap<>(); + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nullable + private String language; + + public SaleProductOfferPatchRequestV1() { + } + + public SaleProductOfferPatchRequestV1 category(@javax.annotation.Nullable Object category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + public Object getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Object category) { + this.category = category; + } + + + public SaleProductOfferPatchRequestV1 parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public SaleProductOfferPatchRequestV1 addParametersItem(ParameterProductOfferRequest parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Get parameters + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public SaleProductOfferPatchRequestV1 publication(@javax.annotation.Nullable SaleProductOfferPublicationRequest publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public SaleProductOfferPublicationRequest getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable SaleProductOfferPublicationRequest publication) { + this.publication = publication; + } + + + public SaleProductOfferPatchRequestV1 delivery(@javax.annotation.Nullable SaleProductOfferPatchRequestV1AllOfDelivery delivery) { + this.delivery = delivery; + return this; + } + + /** + * Get delivery + * @return delivery + */ + @javax.annotation.Nullable + public SaleProductOfferPatchRequestV1AllOfDelivery getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable SaleProductOfferPatchRequestV1AllOfDelivery delivery) { + this.delivery = delivery; + } + + + public SaleProductOfferPatchRequestV1 afterSalesServices(@javax.annotation.Nullable AfterSalesServicesProductOfferRequest afterSalesServices) { + this.afterSalesServices = afterSalesServices; + return this; + } + + /** + * Get afterSalesServices + * @return afterSalesServices + */ + @javax.annotation.Nullable + public AfterSalesServicesProductOfferRequest getAfterSalesServices() { + return afterSalesServices; + } + + public void setAfterSalesServices(@javax.annotation.Nullable AfterSalesServicesProductOfferRequest afterSalesServices) { + this.afterSalesServices = afterSalesServices; + } + + + public SaleProductOfferPatchRequestV1 sizeTable(@javax.annotation.Nullable SizeTable sizeTable) { + this.sizeTable = sizeTable; + return this; + } + + /** + * Get sizeTable + * @return sizeTable + */ + @javax.annotation.Nullable + public SizeTable getSizeTable() { + return sizeTable; + } + + public void setSizeTable(@javax.annotation.Nullable SizeTable sizeTable) { + this.sizeTable = sizeTable; + } + + + public SaleProductOfferPatchRequestV1 contact(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfContact contact) { + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + */ + @javax.annotation.Nullable + public SaleProductOfferRequestBaseAllOfContact getContact() { + return contact; + } + + public void setContact(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfContact contact) { + this.contact = contact; + } + + + public SaleProductOfferPatchRequestV1 discounts(@javax.annotation.Nullable DiscountsProductOfferRequest discounts) { + this.discounts = discounts; + return this; + } + + /** + * Get discounts + * @return discounts + */ + @javax.annotation.Nullable + public DiscountsProductOfferRequest getDiscounts() { + return discounts; + } + + public void setDiscounts(@javax.annotation.Nullable DiscountsProductOfferRequest discounts) { + this.discounts = discounts; + } + + + public SaleProductOfferPatchRequestV1 name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name (title) of an offer. Length cannot be more than 75 characters. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#tytul-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-title\" target=\"_blank\">EN</a> . + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SaleProductOfferPatchRequestV1 payments(@javax.annotation.Nullable Payments payments) { + this.payments = payments; + return this; + } + + /** + * Get payments + * @return payments + */ + @javax.annotation.Nullable + public Payments getPayments() { + return payments; + } + + public void setPayments(@javax.annotation.Nullable Payments payments) { + this.payments = payments; + } + + + public SaleProductOfferPatchRequestV1 sellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public SellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + public SaleProductOfferPatchRequestV1 location(@javax.annotation.Nullable Location location) { + this.location = location; + return this; + } + + /** + * Get location + * @return location + */ + @javax.annotation.Nullable + public Location getLocation() { + return location; + } + + public void setLocation(@javax.annotation.Nullable Location location) { + this.location = location; + } + + + public SaleProductOfferPatchRequestV1 images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public SaleProductOfferPatchRequestV1 addImagesItem(String imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * Get images + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public SaleProductOfferPatchRequestV1 description(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public StandardizedDescription getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + } + + + public SaleProductOfferPatchRequestV1 external(@javax.annotation.Nullable ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nullable + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nullable ExternalId external) { + this.external = external; + } + + + public SaleProductOfferPatchRequestV1 taxSettings(@javax.annotation.Nullable OfferTaxSettings taxSettings) { + this.taxSettings = taxSettings; + return this; + } + + /** + * Get taxSettings + * @return taxSettings + */ + @javax.annotation.Nullable + public OfferTaxSettings getTaxSettings() { + return taxSettings; + } + + public void setTaxSettings(@javax.annotation.Nullable OfferTaxSettings taxSettings) { + this.taxSettings = taxSettings; + } + + + public SaleProductOfferPatchRequestV1 messageToSellerSettings(@javax.annotation.Nullable MessageToSellerSettings messageToSellerSettings) { + this.messageToSellerSettings = messageToSellerSettings; + return this; + } + + /** + * Get messageToSellerSettings + * @return messageToSellerSettings + */ + @javax.annotation.Nullable + public MessageToSellerSettings getMessageToSellerSettings() { + return messageToSellerSettings; + } + + public void setMessageToSellerSettings(@javax.annotation.Nullable MessageToSellerSettings messageToSellerSettings) { + this.messageToSellerSettings = messageToSellerSettings; + } + + + public SaleProductOfferPatchRequestV1 productSet(@javax.annotation.Nullable List productSet) { + this.productSet = productSet; + return this; + } + + public SaleProductOfferPatchRequestV1 addProductSetItem(SaleProductOfferPatchRequestV1AllOfProductSet productSetItem) { + if (this.productSet == null) { + this.productSet = new ArrayList<>(); + } + this.productSet.add(productSetItem); + return this; + } + + /** + * Get productSet + * @return productSet + */ + @javax.annotation.Nullable + public List getProductSet() { + return productSet; + } + + public void setProductSet(@javax.annotation.Nullable List productSet) { + this.productSet = productSet; + } + + + public SaleProductOfferPatchRequestV1 b2b(@javax.annotation.Nullable B2b b2b) { + this.b2b = b2b; + return this; + } + + /** + * Get b2b + * @return b2b + */ + @javax.annotation.Nullable + public B2b getB2b() { + return b2b; + } + + public void setB2b(@javax.annotation.Nullable B2b b2b) { + this.b2b = b2b; + } + + + public SaleProductOfferPatchRequestV1 attachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + return this; + } + + public SaleProductOfferPatchRequestV1 addAttachmentsItem(ProductOfferAttachmentInner attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * An array of offer attachments. + * @return attachments + */ + @javax.annotation.Nullable + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + } + + + public SaleProductOfferPatchRequestV1 fundraisingCampaign(@javax.annotation.Nullable ProductOfferFundraisingCampaignRequest fundraisingCampaign) { + this.fundraisingCampaign = fundraisingCampaign; + return this; + } + + /** + * Get fundraisingCampaign + * @return fundraisingCampaign + */ + @javax.annotation.Nullable + public ProductOfferFundraisingCampaignRequest getFundraisingCampaign() { + return fundraisingCampaign; + } + + public void setFundraisingCampaign(@javax.annotation.Nullable ProductOfferFundraisingCampaignRequest fundraisingCampaign) { + this.fundraisingCampaign = fundraisingCampaign; + } + + + public SaleProductOfferPatchRequestV1 additionalServices(@javax.annotation.Nullable ProductOfferAdditionalServicesRequest additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nullable + public ProductOfferAdditionalServicesRequest getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable ProductOfferAdditionalServicesRequest additionalServices) { + this.additionalServices = additionalServices; + } + + + public SaleProductOfferPatchRequestV1 compatibilityList(@javax.annotation.Nullable CompatibilityListManualType compatibilityList) { + this.compatibilityList = compatibilityList; + return this; + } + + /** + * For the `/sale/product-offers` resources you can send only definition of the MANUAL compatibility list. If compatibility list is provided for the product assigned to the offer, it will be used automatically. + * @return compatibilityList + */ + @javax.annotation.Nullable + public CompatibilityListManualType getCompatibilityList() { + return compatibilityList; + } + + public void setCompatibilityList(@javax.annotation.Nullable CompatibilityListManualType compatibilityList) { + this.compatibilityList = compatibilityList; + } + + + public SaleProductOfferPatchRequestV1 stock(@javax.annotation.Nullable SaleProductOffersRequestStock stock) { + this.stock = stock; + return this; + } + + /** + * Get stock + * @return stock + */ + @javax.annotation.Nullable + public SaleProductOffersRequestStock getStock() { + return stock; + } + + public void setStock(@javax.annotation.Nullable SaleProductOffersRequestStock stock) { + this.stock = stock; + } + + + public SaleProductOfferPatchRequestV1 additionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public SaleProductOfferPatchRequestV1 putAdditionalMarketplacesItem(String key, AdditionalMarketplacesRequestValue additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new HashMap<>(); + } + this.additionalMarketplaces.put(key, additionalMarketplacesItem); + return this; + } + + /** + * Selected information about the offer in each additional service. This field does not contain information about the base marketplace of the offer.<br/> Possible values of `marketplaceId` can be obtained from `GET /marketplaces` resource.</br> See [Allegro foreign marketplaces](https://developer.allegro.pl/tutorials/listing-and-managing-offers-on-foreign-marketplaces-7GndGjeAATn) for more details regarding this field. + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public Map getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + public SaleProductOfferPatchRequestV1 language(@javax.annotation.Nullable String language) { + this.language = language; + return this; + } + + /** + * Declared base language of the offer. + * @return language + */ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nullable String language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferPatchRequestV1 saleProductOfferPatchRequestV1 = (SaleProductOfferPatchRequestV1) o; + return Objects.equals(this.category, saleProductOfferPatchRequestV1.category) && + Objects.equals(this.parameters, saleProductOfferPatchRequestV1.parameters) && + Objects.equals(this.publication, saleProductOfferPatchRequestV1.publication) && + Objects.equals(this.delivery, saleProductOfferPatchRequestV1.delivery) && + Objects.equals(this.afterSalesServices, saleProductOfferPatchRequestV1.afterSalesServices) && + Objects.equals(this.sizeTable, saleProductOfferPatchRequestV1.sizeTable) && + Objects.equals(this.contact, saleProductOfferPatchRequestV1.contact) && + Objects.equals(this.discounts, saleProductOfferPatchRequestV1.discounts) && + Objects.equals(this.name, saleProductOfferPatchRequestV1.name) && + Objects.equals(this.payments, saleProductOfferPatchRequestV1.payments) && + Objects.equals(this.sellingMode, saleProductOfferPatchRequestV1.sellingMode) && + Objects.equals(this.location, saleProductOfferPatchRequestV1.location) && + Objects.equals(this.images, saleProductOfferPatchRequestV1.images) && + Objects.equals(this.description, saleProductOfferPatchRequestV1.description) && + Objects.equals(this.external, saleProductOfferPatchRequestV1.external) && + Objects.equals(this.taxSettings, saleProductOfferPatchRequestV1.taxSettings) && + Objects.equals(this.messageToSellerSettings, saleProductOfferPatchRequestV1.messageToSellerSettings) && + Objects.equals(this.productSet, saleProductOfferPatchRequestV1.productSet) && + Objects.equals(this.b2b, saleProductOfferPatchRequestV1.b2b) && + Objects.equals(this.attachments, saleProductOfferPatchRequestV1.attachments) && + Objects.equals(this.fundraisingCampaign, saleProductOfferPatchRequestV1.fundraisingCampaign) && + Objects.equals(this.additionalServices, saleProductOfferPatchRequestV1.additionalServices) && + Objects.equals(this.compatibilityList, saleProductOfferPatchRequestV1.compatibilityList) && + Objects.equals(this.stock, saleProductOfferPatchRequestV1.stock) && + Objects.equals(this.additionalMarketplaces, saleProductOfferPatchRequestV1.additionalMarketplaces) && + Objects.equals(this.language, saleProductOfferPatchRequestV1.language); + } + + @Override + public int hashCode() { + return Objects.hash(category, parameters, publication, delivery, afterSalesServices, sizeTable, contact, discounts, name, payments, sellingMode, location, images, description, external, taxSettings, messageToSellerSettings, productSet, b2b, attachments, fundraisingCampaign, additionalServices, compatibilityList, stock, additionalMarketplaces, language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferPatchRequestV1 {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" afterSalesServices: ").append(toIndentedString(afterSalesServices)).append("\n"); + sb.append(" sizeTable: ").append(toIndentedString(sizeTable)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" discounts: ").append(toIndentedString(discounts)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" payments: ").append(toIndentedString(payments)).append("\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append(" taxSettings: ").append(toIndentedString(taxSettings)).append("\n"); + sb.append(" messageToSellerSettings: ").append(toIndentedString(messageToSellerSettings)).append("\n"); + sb.append(" productSet: ").append(toIndentedString(productSet)).append("\n"); + sb.append(" b2b: ").append(toIndentedString(b2b)).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append(" fundraisingCampaign: ").append(toIndentedString(fundraisingCampaign)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append(" compatibilityList: ").append(toIndentedString(compatibilityList)).append("\n"); + sb.append(" stock: ").append(toIndentedString(stock)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("category"); + openapiFields.add("parameters"); + openapiFields.add("publication"); + openapiFields.add("delivery"); + openapiFields.add("afterSalesServices"); + openapiFields.add("sizeTable"); + openapiFields.add("contact"); + openapiFields.add("discounts"); + openapiFields.add("name"); + openapiFields.add("payments"); + openapiFields.add("sellingMode"); + openapiFields.add("location"); + openapiFields.add("images"); + openapiFields.add("description"); + openapiFields.add("external"); + openapiFields.add("taxSettings"); + openapiFields.add("messageToSellerSettings"); + openapiFields.add("productSet"); + openapiFields.add("b2b"); + openapiFields.add("attachments"); + openapiFields.add("fundraisingCampaign"); + openapiFields.add("additionalServices"); + openapiFields.add("compatibilityList"); + openapiFields.add("stock"); + openapiFields.add("additionalMarketplaces"); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferPatchRequestV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferPatchRequestV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferPatchRequestV1 is not found in the empty JSON string", SaleProductOfferPatchRequestV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferPatchRequestV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferPatchRequestV1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ParameterProductOfferRequest.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + SaleProductOfferPublicationRequest.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `delivery` + if (jsonObj.get("delivery") != null && !jsonObj.get("delivery").isJsonNull()) { + SaleProductOfferPatchRequestV1AllOfDelivery.validateJsonElement(jsonObj.get("delivery")); + } + // validate the optional field `afterSalesServices` + if (jsonObj.get("afterSalesServices") != null && !jsonObj.get("afterSalesServices").isJsonNull()) { + AfterSalesServicesProductOfferRequest.validateJsonElement(jsonObj.get("afterSalesServices")); + } + // validate the optional field `sizeTable` + if (jsonObj.get("sizeTable") != null && !jsonObj.get("sizeTable").isJsonNull()) { + SizeTable.validateJsonElement(jsonObj.get("sizeTable")); + } + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + SaleProductOfferRequestBaseAllOfContact.validateJsonElement(jsonObj.get("contact")); + } + // validate the optional field `discounts` + if (jsonObj.get("discounts") != null && !jsonObj.get("discounts").isJsonNull()) { + DiscountsProductOfferRequest.validateJsonElement(jsonObj.get("discounts")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `payments` + if (jsonObj.get("payments") != null && !jsonObj.get("payments").isJsonNull()) { + Payments.validateJsonElement(jsonObj.get("payments")); + } + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + SellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + // validate the optional field `location` + if (jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) { + Location.validateJsonElement(jsonObj.get("location")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull() && !jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + StandardizedDescription.validateJsonElement(jsonObj.get("description")); + } + // validate the optional field `external` + if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { + ExternalId.validateJsonElement(jsonObj.get("external")); + } + // validate the optional field `taxSettings` + if (jsonObj.get("taxSettings") != null && !jsonObj.get("taxSettings").isJsonNull()) { + OfferTaxSettings.validateJsonElement(jsonObj.get("taxSettings")); + } + // validate the optional field `messageToSellerSettings` + if (jsonObj.get("messageToSellerSettings") != null && !jsonObj.get("messageToSellerSettings").isJsonNull()) { + MessageToSellerSettings.validateJsonElement(jsonObj.get("messageToSellerSettings")); + } + if (jsonObj.get("productSet") != null && !jsonObj.get("productSet").isJsonNull()) { + JsonArray jsonArrayproductSet = jsonObj.getAsJsonArray("productSet"); + if (jsonArrayproductSet != null) { + // ensure the json data is an array + if (!jsonObj.get("productSet").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `productSet` to be an array in the JSON string but got `%s`", jsonObj.get("productSet").toString())); + } + + // validate the optional field `productSet` (array) + for (int i = 0; i < jsonArrayproductSet.size(); i++) { + SaleProductOfferPatchRequestV1AllOfProductSet.validateJsonElement(jsonArrayproductSet.get(i)); + }; + } + } + // validate the optional field `b2b` + if (jsonObj.get("b2b") != null && !jsonObj.get("b2b").isJsonNull()) { + B2b.validateJsonElement(jsonObj.get("b2b")); + } + if (jsonObj.get("attachments") != null && !jsonObj.get("attachments").isJsonNull()) { + JsonArray jsonArrayattachments = jsonObj.getAsJsonArray("attachments"); + if (jsonArrayattachments != null) { + // ensure the json data is an array + if (!jsonObj.get("attachments").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `attachments` to be an array in the JSON string but got `%s`", jsonObj.get("attachments").toString())); + } + + // validate the optional field `attachments` (array) + for (int i = 0; i < jsonArrayattachments.size(); i++) { + ProductOfferAttachmentInner.validateJsonElement(jsonArrayattachments.get(i)); + }; + } + } + // validate the optional field `fundraisingCampaign` + if (jsonObj.get("fundraisingCampaign") != null && !jsonObj.get("fundraisingCampaign").isJsonNull()) { + ProductOfferFundraisingCampaignRequest.validateJsonElement(jsonObj.get("fundraisingCampaign")); + } + // validate the optional field `additionalServices` + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull()) { + ProductOfferAdditionalServicesRequest.validateJsonElement(jsonObj.get("additionalServices")); + } + // validate the optional field `compatibilityList` + if (jsonObj.get("compatibilityList") != null && !jsonObj.get("compatibilityList").isJsonNull()) { + CompatibilityListManualType.validateJsonElement(jsonObj.get("compatibilityList")); + } + // validate the optional field `stock` + if (jsonObj.get("stock") != null && !jsonObj.get("stock").isJsonNull()) { + SaleProductOffersRequestStock.validateJsonElement(jsonObj.get("stock")); + } + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferPatchRequestV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferPatchRequestV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferPatchRequestV1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferPatchRequestV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferPatchRequestV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferPatchRequestV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferPatchRequestV1 + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferPatchRequestV1 + */ + public static SaleProductOfferPatchRequestV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferPatchRequestV1.class); + } + + /** + * Convert an instance of SaleProductOfferPatchRequestV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1AllOfDelivery.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1AllOfDelivery.java new file mode 100644 index 0000000..333ffba --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1AllOfDelivery.java @@ -0,0 +1,308 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferPatchRequestV1AllOfDelivery + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferPatchRequestV1AllOfDelivery { + public static final String SERIALIZED_NAME_HANDLING_TIME = "handlingTime"; + @SerializedName(SERIALIZED_NAME_HANDLING_TIME) + @javax.annotation.Nullable + private String handlingTime; + + public static final String SERIALIZED_NAME_SHIPPING_RATES = "shippingRates"; + @SerializedName(SERIALIZED_NAME_SHIPPING_RATES) + @javax.annotation.Nullable + private Object shippingRates = null; + + public static final String SERIALIZED_NAME_ADDITIONAL_INFO = "additionalInfo"; + @Deprecated + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFO) + @javax.annotation.Nullable + private String additionalInfo; + + public static final String SERIALIZED_NAME_SHIPMENT_DATE = "shipmentDate"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipmentDate; + + public SaleProductOfferPatchRequestV1AllOfDelivery() { + } + + public SaleProductOfferPatchRequestV1AllOfDelivery handlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + return this; + } + + /** + * Handling time, ISO 8601 duration format. This field must be set to one of the following: PT0S for immediately, PT24H, P2D, P3D, P4D, P5D, P7D, P10D, P14D, P21D, P30D, P60D. + * @return handlingTime + */ + @javax.annotation.Nullable + public String getHandlingTime() { + return handlingTime; + } + + public void setHandlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + } + + + public SaleProductOfferPatchRequestV1AllOfDelivery shippingRates(@javax.annotation.Nullable Object shippingRates) { + this.shippingRates = shippingRates; + return this; + } + + /** + * You should enter the shipping rates identifier or name. + * @return shippingRates + */ + @javax.annotation.Nullable + public Object getShippingRates() { + return shippingRates; + } + + public void setShippingRates(@javax.annotation.Nullable Object shippingRates) { + this.shippingRates = shippingRates; + } + + + @Deprecated + public SaleProductOfferPatchRequestV1AllOfDelivery additionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + /** + * Additional information about delivery. Parameter is deprecated and will be removed in the future. Additional information is only visible on marketplace `allegro-pl`. + * @return additionalInfo + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public String getAdditionalInfo() { + return additionalInfo; + } + + @Deprecated + public void setAdditionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + } + + + public SaleProductOfferPatchRequestV1AllOfDelivery shipmentDate(@javax.annotation.Nullable OffsetDateTime shipmentDate) { + this.shipmentDate = shipmentDate; + return this; + } + + /** + * Shipment date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + * @return shipmentDate + */ + @javax.annotation.Nullable + public OffsetDateTime getShipmentDate() { + return shipmentDate; + } + + public void setShipmentDate(@javax.annotation.Nullable OffsetDateTime shipmentDate) { + this.shipmentDate = shipmentDate; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferPatchRequestV1AllOfDelivery saleProductOfferPatchRequestV1AllOfDelivery = (SaleProductOfferPatchRequestV1AllOfDelivery) o; + return Objects.equals(this.handlingTime, saleProductOfferPatchRequestV1AllOfDelivery.handlingTime) && + Objects.equals(this.shippingRates, saleProductOfferPatchRequestV1AllOfDelivery.shippingRates) && + Objects.equals(this.additionalInfo, saleProductOfferPatchRequestV1AllOfDelivery.additionalInfo) && + Objects.equals(this.shipmentDate, saleProductOfferPatchRequestV1AllOfDelivery.shipmentDate); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(handlingTime, shippingRates, additionalInfo, shipmentDate); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferPatchRequestV1AllOfDelivery {\n"); + sb.append(" handlingTime: ").append(toIndentedString(handlingTime)).append("\n"); + sb.append(" shippingRates: ").append(toIndentedString(shippingRates)).append("\n"); + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append(" shipmentDate: ").append(toIndentedString(shipmentDate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("handlingTime"); + openapiFields.add("shippingRates"); + openapiFields.add("additionalInfo"); + openapiFields.add("shipmentDate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferPatchRequestV1AllOfDelivery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferPatchRequestV1AllOfDelivery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferPatchRequestV1AllOfDelivery is not found in the empty JSON string", SaleProductOfferPatchRequestV1AllOfDelivery.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferPatchRequestV1AllOfDelivery.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferPatchRequestV1AllOfDelivery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("handlingTime") != null && !jsonObj.get("handlingTime").isJsonNull()) && !jsonObj.get("handlingTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `handlingTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("handlingTime").toString())); + } + if ((jsonObj.get("additionalInfo") != null && !jsonObj.get("additionalInfo").isJsonNull()) && !jsonObj.get("additionalInfo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInfo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalInfo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferPatchRequestV1AllOfDelivery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferPatchRequestV1AllOfDelivery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferPatchRequestV1AllOfDelivery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferPatchRequestV1AllOfDelivery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferPatchRequestV1AllOfDelivery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferPatchRequestV1AllOfDelivery given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferPatchRequestV1AllOfDelivery + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferPatchRequestV1AllOfDelivery + */ + public static SaleProductOfferPatchRequestV1AllOfDelivery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferPatchRequestV1AllOfDelivery.class); + } + + /** + * Convert an instance of SaleProductOfferPatchRequestV1AllOfDelivery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1AllOfProductSet.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1AllOfProductSet.java new file mode 100644 index 0000000..4f3e6c4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPatchRequestV1AllOfProductSet.java @@ -0,0 +1,375 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.ProductOffer; +import pl.wtx.allegro.api.client.model.ProductSetElementQuantityQuantity; +import pl.wtx.allegro.api.client.model.ProductSetElementResponsiblePersonRequestResponsiblePerson; +import pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerRequest; +import pl.wtx.allegro.api.client.model.ProductSetElementSafetyInformation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferPatchRequestV1AllOfProductSet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferPatchRequestV1AllOfProductSet { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + @javax.annotation.Nullable + private ProductOffer product; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private ProductSetElementQuantityQuantity quantity; + + public static final String SERIALIZED_NAME_RESPONSIBLE_PERSON = "responsiblePerson"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PERSON) + @javax.annotation.Nullable + private ProductSetElementResponsiblePersonRequestResponsiblePerson responsiblePerson; + + public static final String SERIALIZED_NAME_RESPONSIBLE_PRODUCER = "responsibleProducer"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PRODUCER) + @javax.annotation.Nullable + private ProductSetElementResponsibleProducerRequest responsibleProducer; + + public static final String SERIALIZED_NAME_SAFETY_INFORMATION = "safetyInformation"; + @SerializedName(SERIALIZED_NAME_SAFETY_INFORMATION) + @javax.annotation.Nullable + private ProductSetElementSafetyInformation safetyInformation; + + public static final String SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION = "marketedBeforeGPSRObligation"; + @SerializedName(SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION) + @javax.annotation.Nullable + private Boolean marketedBeforeGPSRObligation; + + public SaleProductOfferPatchRequestV1AllOfProductSet() { + } + + public SaleProductOfferPatchRequestV1AllOfProductSet product(@javax.annotation.Nullable ProductOffer product) { + this.product = product; + return this; + } + + /** + * You should enter the product identifier (UUID or EAN) or a complete product definition. + * @return product + */ + @javax.annotation.Nullable + public ProductOffer getProduct() { + return product; + } + + public void setProduct(@javax.annotation.Nullable ProductOffer product) { + this.product = product; + } + + + public SaleProductOfferPatchRequestV1AllOfProductSet quantity(@javax.annotation.Nullable ProductSetElementQuantityQuantity quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + public ProductSetElementQuantityQuantity getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable ProductSetElementQuantityQuantity quantity) { + this.quantity = quantity; + } + + + public SaleProductOfferPatchRequestV1AllOfProductSet responsiblePerson(@javax.annotation.Nullable ProductSetElementResponsiblePersonRequestResponsiblePerson responsiblePerson) { + this.responsiblePerson = responsiblePerson; + return this; + } + + /** + * Get responsiblePerson + * @return responsiblePerson + */ + @javax.annotation.Nullable + public ProductSetElementResponsiblePersonRequestResponsiblePerson getResponsiblePerson() { + return responsiblePerson; + } + + public void setResponsiblePerson(@javax.annotation.Nullable ProductSetElementResponsiblePersonRequestResponsiblePerson responsiblePerson) { + this.responsiblePerson = responsiblePerson; + } + + + public SaleProductOfferPatchRequestV1AllOfProductSet responsibleProducer(@javax.annotation.Nullable ProductSetElementResponsibleProducerRequest responsibleProducer) { + this.responsibleProducer = responsibleProducer; + return this; + } + + /** + * Get responsibleProducer + * @return responsibleProducer + */ + @javax.annotation.Nullable + public ProductSetElementResponsibleProducerRequest getResponsibleProducer() { + return responsibleProducer; + } + + public void setResponsibleProducer(@javax.annotation.Nullable ProductSetElementResponsibleProducerRequest responsibleProducer) { + this.responsibleProducer = responsibleProducer; + } + + + public SaleProductOfferPatchRequestV1AllOfProductSet safetyInformation(@javax.annotation.Nullable ProductSetElementSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + return this; + } + + /** + * Get safetyInformation + * @return safetyInformation + */ + @javax.annotation.Nullable + public ProductSetElementSafetyInformation getSafetyInformation() { + return safetyInformation; + } + + public void setSafetyInformation(@javax.annotation.Nullable ProductSetElementSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + } + + + public SaleProductOfferPatchRequestV1AllOfProductSet marketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + return this; + } + + /** + * Allows you to declare that the product was introduced before 13 Dec 2024 and therefore does not require GPSR data. + * @return marketedBeforeGPSRObligation + */ + @javax.annotation.Nullable + public Boolean getMarketedBeforeGPSRObligation() { + return marketedBeforeGPSRObligation; + } + + public void setMarketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferPatchRequestV1AllOfProductSet saleProductOfferPatchRequestV1AllOfProductSet = (SaleProductOfferPatchRequestV1AllOfProductSet) o; + return Objects.equals(this.product, saleProductOfferPatchRequestV1AllOfProductSet.product) && + Objects.equals(this.quantity, saleProductOfferPatchRequestV1AllOfProductSet.quantity) && + Objects.equals(this.responsiblePerson, saleProductOfferPatchRequestV1AllOfProductSet.responsiblePerson) && + Objects.equals(this.responsibleProducer, saleProductOfferPatchRequestV1AllOfProductSet.responsibleProducer) && + Objects.equals(this.safetyInformation, saleProductOfferPatchRequestV1AllOfProductSet.safetyInformation) && + Objects.equals(this.marketedBeforeGPSRObligation, saleProductOfferPatchRequestV1AllOfProductSet.marketedBeforeGPSRObligation); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(product, quantity, responsiblePerson, responsibleProducer, safetyInformation, marketedBeforeGPSRObligation); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferPatchRequestV1AllOfProductSet {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" responsiblePerson: ").append(toIndentedString(responsiblePerson)).append("\n"); + sb.append(" responsibleProducer: ").append(toIndentedString(responsibleProducer)).append("\n"); + sb.append(" safetyInformation: ").append(toIndentedString(safetyInformation)).append("\n"); + sb.append(" marketedBeforeGPSRObligation: ").append(toIndentedString(marketedBeforeGPSRObligation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("quantity"); + openapiFields.add("responsiblePerson"); + openapiFields.add("responsibleProducer"); + openapiFields.add("safetyInformation"); + openapiFields.add("marketedBeforeGPSRObligation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferPatchRequestV1AllOfProductSet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferPatchRequestV1AllOfProductSet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferPatchRequestV1AllOfProductSet is not found in the empty JSON string", SaleProductOfferPatchRequestV1AllOfProductSet.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferPatchRequestV1AllOfProductSet.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferPatchRequestV1AllOfProductSet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductOffer.validateJsonElement(jsonObj.get("product")); + } + // validate the optional field `quantity` + if (jsonObj.get("quantity") != null && !jsonObj.get("quantity").isJsonNull()) { + ProductSetElementQuantityQuantity.validateJsonElement(jsonObj.get("quantity")); + } + // validate the optional field `responsiblePerson` + if (jsonObj.get("responsiblePerson") != null && !jsonObj.get("responsiblePerson").isJsonNull()) { + ProductSetElementResponsiblePersonRequestResponsiblePerson.validateJsonElement(jsonObj.get("responsiblePerson")); + } + // validate the optional field `responsibleProducer` + if (jsonObj.get("responsibleProducer") != null && !jsonObj.get("responsibleProducer").isJsonNull()) { + ProductSetElementResponsibleProducerRequest.validateJsonElement(jsonObj.get("responsibleProducer")); + } + // validate the optional field `safetyInformation` + if (jsonObj.get("safetyInformation") != null && !jsonObj.get("safetyInformation").isJsonNull()) { + ProductSetElementSafetyInformation.validateJsonElement(jsonObj.get("safetyInformation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferPatchRequestV1AllOfProductSet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferPatchRequestV1AllOfProductSet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferPatchRequestV1AllOfProductSet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferPatchRequestV1AllOfProductSet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferPatchRequestV1AllOfProductSet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferPatchRequestV1AllOfProductSet given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferPatchRequestV1AllOfProductSet + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferPatchRequestV1AllOfProductSet + */ + public static SaleProductOfferPatchRequestV1AllOfProductSet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferPatchRequestV1AllOfProductSet.class); + } + + /** + * Convert an instance of SaleProductOfferPatchRequestV1AllOfProductSet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationMarketplacesResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationMarketplacesResponse.java new file mode 100644 index 0000000..6fcb945 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationMarketplacesResponse.java @@ -0,0 +1,259 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.JustId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about publication in multiple marketplaces.<br/> See [Changes in listing offers - we will add the possibility to display offers in foreign domains of Allegro's marketplaces](https://developer.allegro.pl/news/changes-in-listing-offers-we-will-add-the-possibility-to-display-offers-in-foreign-domains-of-allegro-s-marketplaces-9gKv0RVzRTK) for more details regarding this field + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferPublicationMarketplacesResponse { + public static final String SERIALIZED_NAME_BASE = "base"; + @SerializedName(SERIALIZED_NAME_BASE) + @javax.annotation.Nullable + private JustId base; + + public static final String SERIALIZED_NAME_ADDITIONAL = "additional"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL) + @javax.annotation.Nullable + private List additional = new ArrayList<>(); + + public SaleProductOfferPublicationMarketplacesResponse() { + } + + public SaleProductOfferPublicationMarketplacesResponse base(@javax.annotation.Nullable JustId base) { + this.base = base; + return this; + } + + /** + * <small>[read-only]</small> Specifies the offer’s base service. We assign the value in the field automatically when the offer is created and it is read-only, it will never change. + * @return base + */ + @javax.annotation.Nullable + public JustId getBase() { + return base; + } + + public void setBase(@javax.annotation.Nullable JustId base) { + this.base = base; + } + + + public SaleProductOfferPublicationMarketplacesResponse additional(@javax.annotation.Nullable List additional) { + this.additional = additional; + return this; + } + + public SaleProductOfferPublicationMarketplacesResponse addAdditionalItem(JustId additionalItem) { + if (this.additional == null) { + this.additional = new ArrayList<>(); + } + this.additional.add(additionalItem); + return this; + } + + /** + * Specifies whether an offer is visible in the additional marketplace. + * @return additional + */ + @javax.annotation.Nullable + public List getAdditional() { + return additional; + } + + public void setAdditional(@javax.annotation.Nullable List additional) { + this.additional = additional; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferPublicationMarketplacesResponse saleProductOfferPublicationMarketplacesResponse = (SaleProductOfferPublicationMarketplacesResponse) o; + return Objects.equals(this.base, saleProductOfferPublicationMarketplacesResponse.base) && + Objects.equals(this.additional, saleProductOfferPublicationMarketplacesResponse.additional); + } + + @Override + public int hashCode() { + return Objects.hash(base, additional); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferPublicationMarketplacesResponse {\n"); + sb.append(" base: ").append(toIndentedString(base)).append("\n"); + sb.append(" additional: ").append(toIndentedString(additional)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("base"); + openapiFields.add("additional"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferPublicationMarketplacesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferPublicationMarketplacesResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferPublicationMarketplacesResponse is not found in the empty JSON string", SaleProductOfferPublicationMarketplacesResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferPublicationMarketplacesResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferPublicationMarketplacesResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `base` + if (jsonObj.get("base") != null && !jsonObj.get("base").isJsonNull()) { + JustId.validateJsonElement(jsonObj.get("base")); + } + if (jsonObj.get("additional") != null && !jsonObj.get("additional").isJsonNull()) { + JsonArray jsonArrayadditional = jsonObj.getAsJsonArray("additional"); + if (jsonArrayadditional != null) { + // ensure the json data is an array + if (!jsonObj.get("additional").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additional` to be an array in the JSON string but got `%s`", jsonObj.get("additional").toString())); + } + + // validate the optional field `additional` (array) + for (int i = 0; i < jsonArrayadditional.size(); i++) { + JustId.validateJsonElement(jsonArrayadditional.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferPublicationMarketplacesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferPublicationMarketplacesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferPublicationMarketplacesResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferPublicationMarketplacesResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferPublicationMarketplacesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferPublicationMarketplacesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferPublicationMarketplacesResponse + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferPublicationMarketplacesResponse + */ + public static SaleProductOfferPublicationMarketplacesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferPublicationMarketplacesResponse.class); + } + + /** + * Convert an instance of SaleProductOfferPublicationMarketplacesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationRequest.java new file mode 100644 index 0000000..9c59690 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationRequest.java @@ -0,0 +1,293 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferPublicationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferPublicationRequest { + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + @javax.annotation.Nullable + private String duration; + + public static final String SERIALIZED_NAME_STARTING_AT = "startingAt"; + @SerializedName(SERIALIZED_NAME_STARTING_AT) + @javax.annotation.Nullable + private OffsetDateTime startingAt; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private OfferStatus status; + + public static final String SERIALIZED_NAME_REPUBLISH = "republish"; + @SerializedName(SERIALIZED_NAME_REPUBLISH) + @javax.annotation.Nullable + private Boolean republish; + + public SaleProductOfferPublicationRequest() { + } + + public SaleProductOfferPublicationRequest duration(@javax.annotation.Nullable String duration) { + this.duration = duration; + return this; + } + + /** + * This field must be set to one of the following:<br/> - for auctions: 1 day, 3 days, 5 days, 7 days, 10 days<br/> - for buy-now offers: 3 days, 5 days, 7 days, 10 days, 20 days, 30 days<br/> - for advertisements: 10 days, 20 days, 30 days.<br/> The value is in ISO 8601 format (example: PT24H, PT72H). + * @return duration + */ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + public void setDuration(@javax.annotation.Nullable String duration) { + this.duration = duration; + } + + + public SaleProductOfferPublicationRequest startingAt(@javax.annotation.Nullable OffsetDateTime startingAt) { + this.startingAt = startingAt; + return this; + } + + /** + * Publication starting date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified after activation or ending of the offer. + * @return startingAt + */ + @javax.annotation.Nullable + public OffsetDateTime getStartingAt() { + return startingAt; + } + + public void setStartingAt(@javax.annotation.Nullable OffsetDateTime startingAt) { + this.startingAt = startingAt; + } + + + public SaleProductOfferPublicationRequest status(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public OfferStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + } + + + public SaleProductOfferPublicationRequest republish(@javax.annotation.Nullable Boolean republish) { + this.republish = republish; + return this; + } + + /** + * Whether to republish an offer after ending. Automatically republish offers or auctions:</br> - `BUY_NOW` offer type are republished with initial stock, regardless of how many items you have sold.</br> - `AUCTION` offer type are republished only if they were not concluded with purchase.</br> - `ADVERTISEMENT` offer type are republished until it will be finished manually. + * @return republish + */ + @javax.annotation.Nullable + public Boolean getRepublish() { + return republish; + } + + public void setRepublish(@javax.annotation.Nullable Boolean republish) { + this.republish = republish; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferPublicationRequest saleProductOfferPublicationRequest = (SaleProductOfferPublicationRequest) o; + return Objects.equals(this.duration, saleProductOfferPublicationRequest.duration) && + Objects.equals(this.startingAt, saleProductOfferPublicationRequest.startingAt) && + Objects.equals(this.status, saleProductOfferPublicationRequest.status) && + Objects.equals(this.republish, saleProductOfferPublicationRequest.republish); + } + + @Override + public int hashCode() { + return Objects.hash(duration, startingAt, status, republish); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferPublicationRequest {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" startingAt: ").append(toIndentedString(startingAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" republish: ").append(toIndentedString(republish)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("duration"); + openapiFields.add("startingAt"); + openapiFields.add("status"); + openapiFields.add("republish"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferPublicationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferPublicationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferPublicationRequest is not found in the empty JSON string", SaleProductOfferPublicationRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferPublicationRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferPublicationRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + OfferStatus.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferPublicationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferPublicationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferPublicationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferPublicationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferPublicationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferPublicationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferPublicationRequest + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferPublicationRequest + */ + public static SaleProductOfferPublicationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferPublicationRequest.class); + } + + /** + * Convert an instance of SaleProductOfferPublicationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationResponse.java new file mode 100644 index 0000000..bb0b5ca --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferPublicationResponse.java @@ -0,0 +1,445 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferStatus; +import pl.wtx.allegro.api.client.model.SaleProductOfferPublicationMarketplacesResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferPublicationResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferPublicationResponse { + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + @javax.annotation.Nullable + private String duration; + + public static final String SERIALIZED_NAME_STARTING_AT = "startingAt"; + @SerializedName(SERIALIZED_NAME_STARTING_AT) + @javax.annotation.Nullable + private OffsetDateTime startingAt; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private OfferStatus status; + + public static final String SERIALIZED_NAME_REPUBLISH = "republish"; + @SerializedName(SERIALIZED_NAME_REPUBLISH) + @javax.annotation.Nullable + private Boolean republish; + + public static final String SERIALIZED_NAME_ENDING_AT = "endingAt"; + @SerializedName(SERIALIZED_NAME_ENDING_AT) + @javax.annotation.Nullable + private OffsetDateTime endingAt; + + /** + * Indicates the reason for ending the offer: - `USER` - offer ended by the seller. - `ADMIN` - offer ended by an admin. - `EXPIRATION` - offer duration had expired (valid for offers with specified duration). - `EMPTY_STOCK` - offer ended because all available items had been sold out. - `PRODUCT_DETACHMENT` - offer ended because its link to the product was removed. Status will only occur if the base marketplace of offer requires full productization. - `ERROR` - offer ended due to internal problem with offer publication. The publication command responded with success status, but further processing failed. + */ + @JsonAdapter(EndedByEnum.Adapter.class) + public enum EndedByEnum { + USER("USER"), + + ADMIN("ADMIN"), + + EXPIRATION("EXPIRATION"), + + EMPTY_STOCK("EMPTY_STOCK"), + + PRODUCT_DETACHMENT("PRODUCT_DETACHMENT"), + + ERROR("ERROR"); + + private String value; + + EndedByEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EndedByEnum fromValue(String value) { + for (EndedByEnum b : EndedByEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EndedByEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EndedByEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EndedByEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EndedByEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ENDED_BY = "endedBy"; + @SerializedName(SERIALIZED_NAME_ENDED_BY) + @javax.annotation.Nullable + private EndedByEnum endedBy; + + public static final String SERIALIZED_NAME_MARKETPLACES = "marketplaces"; + @SerializedName(SERIALIZED_NAME_MARKETPLACES) + @javax.annotation.Nullable + private SaleProductOfferPublicationMarketplacesResponse marketplaces; + + public SaleProductOfferPublicationResponse() { + } + + public SaleProductOfferPublicationResponse( + EndedByEnum endedBy + ) { + this(); + this.endedBy = endedBy; + } + + public SaleProductOfferPublicationResponse duration(@javax.annotation.Nullable String duration) { + this.duration = duration; + return this; + } + + /** + * This field must be set to one of the following:<br/> - for auctions: 1 day, 3 days, 5 days, 7 days, 10 days<br/> - for buy-now offers: 3 days, 5 days, 7 days, 10 days, 20 days, 30 days<br/> - for advertisements: 10 days, 20 days, 30 days.<br/> The value is in ISO 8601 format (example: PT24H, PT72H). + * @return duration + */ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + public void setDuration(@javax.annotation.Nullable String duration) { + this.duration = duration; + } + + + public SaleProductOfferPublicationResponse startingAt(@javax.annotation.Nullable OffsetDateTime startingAt) { + this.startingAt = startingAt; + return this; + } + + /** + * Publication starting date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified after activation or ending of the offer. + * @return startingAt + */ + @javax.annotation.Nullable + public OffsetDateTime getStartingAt() { + return startingAt; + } + + public void setStartingAt(@javax.annotation.Nullable OffsetDateTime startingAt) { + this.startingAt = startingAt; + } + + + public SaleProductOfferPublicationResponse status(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public OfferStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + } + + + public SaleProductOfferPublicationResponse republish(@javax.annotation.Nullable Boolean republish) { + this.republish = republish; + return this; + } + + /** + * Whether to republish an offer after ending. Automatically republish offers or auctions:</br> - `BUY_NOW` offer type are republished with initial stock, regardless of how many items you have sold.</br> - `AUCTION` offer type are republished only if they were not concluded with purchase.</br> - `ADVERTISEMENT` offer type are republished until it will be finished manually. + * @return republish + */ + @javax.annotation.Nullable + public Boolean getRepublish() { + return republish; + } + + public void setRepublish(@javax.annotation.Nullable Boolean republish) { + this.republish = republish; + } + + + public SaleProductOfferPublicationResponse endingAt(@javax.annotation.Nullable OffsetDateTime endingAt) { + this.endingAt = endingAt; + return this; + } + + /** + * Publication ending date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified + * @return endingAt + */ + @javax.annotation.Nullable + public OffsetDateTime getEndingAt() { + return endingAt; + } + + public void setEndingAt(@javax.annotation.Nullable OffsetDateTime endingAt) { + this.endingAt = endingAt; + } + + + /** + * Indicates the reason for ending the offer: - `USER` - offer ended by the seller. - `ADMIN` - offer ended by an admin. - `EXPIRATION` - offer duration had expired (valid for offers with specified duration). - `EMPTY_STOCK` - offer ended because all available items had been sold out. - `PRODUCT_DETACHMENT` - offer ended because its link to the product was removed. Status will only occur if the base marketplace of offer requires full productization. - `ERROR` - offer ended due to internal problem with offer publication. The publication command responded with success status, but further processing failed. + * @return endedBy + */ + @javax.annotation.Nullable + public EndedByEnum getEndedBy() { + return endedBy; + } + + + + public SaleProductOfferPublicationResponse marketplaces(@javax.annotation.Nullable SaleProductOfferPublicationMarketplacesResponse marketplaces) { + this.marketplaces = marketplaces; + return this; + } + + /** + * Get marketplaces + * @return marketplaces + */ + @javax.annotation.Nullable + public SaleProductOfferPublicationMarketplacesResponse getMarketplaces() { + return marketplaces; + } + + public void setMarketplaces(@javax.annotation.Nullable SaleProductOfferPublicationMarketplacesResponse marketplaces) { + this.marketplaces = marketplaces; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferPublicationResponse saleProductOfferPublicationResponse = (SaleProductOfferPublicationResponse) o; + return Objects.equals(this.duration, saleProductOfferPublicationResponse.duration) && + Objects.equals(this.startingAt, saleProductOfferPublicationResponse.startingAt) && + Objects.equals(this.status, saleProductOfferPublicationResponse.status) && + Objects.equals(this.republish, saleProductOfferPublicationResponse.republish) && + Objects.equals(this.endingAt, saleProductOfferPublicationResponse.endingAt) && + Objects.equals(this.endedBy, saleProductOfferPublicationResponse.endedBy) && + Objects.equals(this.marketplaces, saleProductOfferPublicationResponse.marketplaces); + } + + @Override + public int hashCode() { + return Objects.hash(duration, startingAt, status, republish, endingAt, endedBy, marketplaces); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferPublicationResponse {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" startingAt: ").append(toIndentedString(startingAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" republish: ").append(toIndentedString(republish)).append("\n"); + sb.append(" endingAt: ").append(toIndentedString(endingAt)).append("\n"); + sb.append(" endedBy: ").append(toIndentedString(endedBy)).append("\n"); + sb.append(" marketplaces: ").append(toIndentedString(marketplaces)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("duration"); + openapiFields.add("startingAt"); + openapiFields.add("status"); + openapiFields.add("republish"); + openapiFields.add("endingAt"); + openapiFields.add("endedBy"); + openapiFields.add("marketplaces"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferPublicationResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferPublicationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferPublicationResponse is not found in the empty JSON string", SaleProductOfferPublicationResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferPublicationResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferPublicationResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + OfferStatus.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("endedBy") != null && !jsonObj.get("endedBy").isJsonNull()) && !jsonObj.get("endedBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `endedBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endedBy").toString())); + } + // validate the optional field `endedBy` + if (jsonObj.get("endedBy") != null && !jsonObj.get("endedBy").isJsonNull()) { + EndedByEnum.validateJsonElement(jsonObj.get("endedBy")); + } + // validate the optional field `marketplaces` + if (jsonObj.get("marketplaces") != null && !jsonObj.get("marketplaces").isJsonNull()) { + SaleProductOfferPublicationMarketplacesResponse.validateJsonElement(jsonObj.get("marketplaces")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferPublicationResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferPublicationResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferPublicationResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferPublicationResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferPublicationResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferPublicationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferPublicationResponse + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferPublicationResponse + */ + public static SaleProductOfferPublicationResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferPublicationResponse.class); + } + + /** + * Convert an instance of SaleProductOfferPublicationResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBase.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBase.java new file mode 100644 index 0000000..325a385 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBase.java @@ -0,0 +1,740 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AfterSalesServicesProductOfferRequest; +import pl.wtx.allegro.api.client.model.DiscountsProductOfferRequest; +import pl.wtx.allegro.api.client.model.ExternalId; +import pl.wtx.allegro.api.client.model.Location; +import pl.wtx.allegro.api.client.model.MessageToSellerSettings; +import pl.wtx.allegro.api.client.model.OfferTaxSettings; +import pl.wtx.allegro.api.client.model.ParameterProductOfferRequest; +import pl.wtx.allegro.api.client.model.Payments; +import pl.wtx.allegro.api.client.model.SaleProductOfferRequestBaseAllOfContact; +import pl.wtx.allegro.api.client.model.SaleProductOfferRequestBaseAllOfDelivery; +import pl.wtx.allegro.api.client.model.SaleProductOfferRequestBaseAllOfPublication; +import pl.wtx.allegro.api.client.model.SaleProductOfferRequestBaseAllOfSizeTable; +import pl.wtx.allegro.api.client.model.SellingMode; +import pl.wtx.allegro.api.client.model.StandardizedDescription; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferRequestBase + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferRequestBase { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PAYMENTS = "payments"; + @SerializedName(SERIALIZED_NAME_PAYMENTS) + @javax.annotation.Nullable + private Payments payments; + + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private SellingMode sellingMode; + + public static final String SERIALIZED_NAME_LOCATION = "location"; + @SerializedName(SERIALIZED_NAME_LOCATION) + @javax.annotation.Nullable + private Location location; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private StandardizedDescription description; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nullable + private ExternalId external; + + public static final String SERIALIZED_NAME_SIZE_TABLE = "sizeTable"; + @SerializedName(SERIALIZED_NAME_SIZE_TABLE) + @javax.annotation.Nullable + private SaleProductOfferRequestBaseAllOfSizeTable sizeTable; + + public static final String SERIALIZED_NAME_TAX_SETTINGS = "taxSettings"; + @SerializedName(SERIALIZED_NAME_TAX_SETTINGS) + @javax.annotation.Nullable + private OfferTaxSettings taxSettings; + + public static final String SERIALIZED_NAME_MESSAGE_TO_SELLER_SETTINGS = "messageToSellerSettings"; + @SerializedName(SERIALIZED_NAME_MESSAGE_TO_SELLER_SETTINGS) + @javax.annotation.Nullable + private MessageToSellerSettings messageToSellerSettings; + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Object category; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private SaleProductOfferRequestBaseAllOfPublication publication; + + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private SaleProductOfferRequestBaseAllOfDelivery delivery; + + public static final String SERIALIZED_NAME_AFTER_SALES_SERVICES = "afterSalesServices"; + @SerializedName(SERIALIZED_NAME_AFTER_SALES_SERVICES) + @javax.annotation.Nullable + private AfterSalesServicesProductOfferRequest afterSalesServices; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + @javax.annotation.Nullable + private SaleProductOfferRequestBaseAllOfContact contact; + + public static final String SERIALIZED_NAME_DISCOUNTS = "discounts"; + @SerializedName(SERIALIZED_NAME_DISCOUNTS) + @javax.annotation.Nullable + private DiscountsProductOfferRequest discounts; + + public SaleProductOfferRequestBase() { + } + + public SaleProductOfferRequestBase name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name (title) of an offer. Length cannot be more than 75 characters. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#tytul-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-title\" target=\"_blank\">EN</a> . + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SaleProductOfferRequestBase payments(@javax.annotation.Nullable Payments payments) { + this.payments = payments; + return this; + } + + /** + * Get payments + * @return payments + */ + @javax.annotation.Nullable + public Payments getPayments() { + return payments; + } + + public void setPayments(@javax.annotation.Nullable Payments payments) { + this.payments = payments; + } + + + public SaleProductOfferRequestBase sellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public SellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + public SaleProductOfferRequestBase location(@javax.annotation.Nullable Location location) { + this.location = location; + return this; + } + + /** + * Get location + * @return location + */ + @javax.annotation.Nullable + public Location getLocation() { + return location; + } + + public void setLocation(@javax.annotation.Nullable Location location) { + this.location = location; + } + + + public SaleProductOfferRequestBase images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public SaleProductOfferRequestBase addImagesItem(String imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * Get images + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public SaleProductOfferRequestBase description(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public StandardizedDescription getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + } + + + public SaleProductOfferRequestBase external(@javax.annotation.Nullable ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nullable + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nullable ExternalId external) { + this.external = external; + } + + + public SaleProductOfferRequestBase sizeTable(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfSizeTable sizeTable) { + this.sizeTable = sizeTable; + return this; + } + + /** + * Get sizeTable + * @return sizeTable + */ + @javax.annotation.Nullable + public SaleProductOfferRequestBaseAllOfSizeTable getSizeTable() { + return sizeTable; + } + + public void setSizeTable(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfSizeTable sizeTable) { + this.sizeTable = sizeTable; + } + + + public SaleProductOfferRequestBase taxSettings(@javax.annotation.Nullable OfferTaxSettings taxSettings) { + this.taxSettings = taxSettings; + return this; + } + + /** + * Get taxSettings + * @return taxSettings + */ + @javax.annotation.Nullable + public OfferTaxSettings getTaxSettings() { + return taxSettings; + } + + public void setTaxSettings(@javax.annotation.Nullable OfferTaxSettings taxSettings) { + this.taxSettings = taxSettings; + } + + + public SaleProductOfferRequestBase messageToSellerSettings(@javax.annotation.Nullable MessageToSellerSettings messageToSellerSettings) { + this.messageToSellerSettings = messageToSellerSettings; + return this; + } + + /** + * Get messageToSellerSettings + * @return messageToSellerSettings + */ + @javax.annotation.Nullable + public MessageToSellerSettings getMessageToSellerSettings() { + return messageToSellerSettings; + } + + public void setMessageToSellerSettings(@javax.annotation.Nullable MessageToSellerSettings messageToSellerSettings) { + this.messageToSellerSettings = messageToSellerSettings; + } + + + public SaleProductOfferRequestBase category(@javax.annotation.Nullable Object category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + public Object getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Object category) { + this.category = category; + } + + + public SaleProductOfferRequestBase parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public SaleProductOfferRequestBase addParametersItem(ParameterProductOfferRequest parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Get parameters + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public SaleProductOfferRequestBase publication(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfPublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public SaleProductOfferRequestBaseAllOfPublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfPublication publication) { + this.publication = publication; + } + + + public SaleProductOfferRequestBase delivery(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfDelivery delivery) { + this.delivery = delivery; + return this; + } + + /** + * Get delivery + * @return delivery + */ + @javax.annotation.Nullable + public SaleProductOfferRequestBaseAllOfDelivery getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfDelivery delivery) { + this.delivery = delivery; + } + + + public SaleProductOfferRequestBase afterSalesServices(@javax.annotation.Nullable AfterSalesServicesProductOfferRequest afterSalesServices) { + this.afterSalesServices = afterSalesServices; + return this; + } + + /** + * Get afterSalesServices + * @return afterSalesServices + */ + @javax.annotation.Nullable + public AfterSalesServicesProductOfferRequest getAfterSalesServices() { + return afterSalesServices; + } + + public void setAfterSalesServices(@javax.annotation.Nullable AfterSalesServicesProductOfferRequest afterSalesServices) { + this.afterSalesServices = afterSalesServices; + } + + + public SaleProductOfferRequestBase contact(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfContact contact) { + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + */ + @javax.annotation.Nullable + public SaleProductOfferRequestBaseAllOfContact getContact() { + return contact; + } + + public void setContact(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfContact contact) { + this.contact = contact; + } + + + public SaleProductOfferRequestBase discounts(@javax.annotation.Nullable DiscountsProductOfferRequest discounts) { + this.discounts = discounts; + return this; + } + + /** + * Get discounts + * @return discounts + */ + @javax.annotation.Nullable + public DiscountsProductOfferRequest getDiscounts() { + return discounts; + } + + public void setDiscounts(@javax.annotation.Nullable DiscountsProductOfferRequest discounts) { + this.discounts = discounts; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferRequestBase saleProductOfferRequestBase = (SaleProductOfferRequestBase) o; + return Objects.equals(this.name, saleProductOfferRequestBase.name) && + Objects.equals(this.payments, saleProductOfferRequestBase.payments) && + Objects.equals(this.sellingMode, saleProductOfferRequestBase.sellingMode) && + Objects.equals(this.location, saleProductOfferRequestBase.location) && + Objects.equals(this.images, saleProductOfferRequestBase.images) && + Objects.equals(this.description, saleProductOfferRequestBase.description) && + Objects.equals(this.external, saleProductOfferRequestBase.external) && + Objects.equals(this.sizeTable, saleProductOfferRequestBase.sizeTable) && + Objects.equals(this.taxSettings, saleProductOfferRequestBase.taxSettings) && + Objects.equals(this.messageToSellerSettings, saleProductOfferRequestBase.messageToSellerSettings) && + Objects.equals(this.category, saleProductOfferRequestBase.category) && + Objects.equals(this.parameters, saleProductOfferRequestBase.parameters) && + Objects.equals(this.publication, saleProductOfferRequestBase.publication) && + Objects.equals(this.delivery, saleProductOfferRequestBase.delivery) && + Objects.equals(this.afterSalesServices, saleProductOfferRequestBase.afterSalesServices) && + Objects.equals(this.contact, saleProductOfferRequestBase.contact) && + Objects.equals(this.discounts, saleProductOfferRequestBase.discounts); + } + + @Override + public int hashCode() { + return Objects.hash(name, payments, sellingMode, location, images, description, external, sizeTable, taxSettings, messageToSellerSettings, category, parameters, publication, delivery, afterSalesServices, contact, discounts); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferRequestBase {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" payments: ").append(toIndentedString(payments)).append("\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append(" sizeTable: ").append(toIndentedString(sizeTable)).append("\n"); + sb.append(" taxSettings: ").append(toIndentedString(taxSettings)).append("\n"); + sb.append(" messageToSellerSettings: ").append(toIndentedString(messageToSellerSettings)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" afterSalesServices: ").append(toIndentedString(afterSalesServices)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" discounts: ").append(toIndentedString(discounts)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("payments"); + openapiFields.add("sellingMode"); + openapiFields.add("location"); + openapiFields.add("images"); + openapiFields.add("description"); + openapiFields.add("external"); + openapiFields.add("sizeTable"); + openapiFields.add("taxSettings"); + openapiFields.add("messageToSellerSettings"); + openapiFields.add("category"); + openapiFields.add("parameters"); + openapiFields.add("publication"); + openapiFields.add("delivery"); + openapiFields.add("afterSalesServices"); + openapiFields.add("contact"); + openapiFields.add("discounts"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferRequestBase + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferRequestBase.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferRequestBase is not found in the empty JSON string", SaleProductOfferRequestBase.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferRequestBase.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferRequestBase` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `payments` + if (jsonObj.get("payments") != null && !jsonObj.get("payments").isJsonNull()) { + Payments.validateJsonElement(jsonObj.get("payments")); + } + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + SellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + // validate the optional field `location` + if (jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) { + Location.validateJsonElement(jsonObj.get("location")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull() && !jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + StandardizedDescription.validateJsonElement(jsonObj.get("description")); + } + // validate the optional field `external` + if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { + ExternalId.validateJsonElement(jsonObj.get("external")); + } + // validate the optional field `sizeTable` + if (jsonObj.get("sizeTable") != null && !jsonObj.get("sizeTable").isJsonNull()) { + SaleProductOfferRequestBaseAllOfSizeTable.validateJsonElement(jsonObj.get("sizeTable")); + } + // validate the optional field `taxSettings` + if (jsonObj.get("taxSettings") != null && !jsonObj.get("taxSettings").isJsonNull()) { + OfferTaxSettings.validateJsonElement(jsonObj.get("taxSettings")); + } + // validate the optional field `messageToSellerSettings` + if (jsonObj.get("messageToSellerSettings") != null && !jsonObj.get("messageToSellerSettings").isJsonNull()) { + MessageToSellerSettings.validateJsonElement(jsonObj.get("messageToSellerSettings")); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ParameterProductOfferRequest.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + SaleProductOfferRequestBaseAllOfPublication.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `delivery` + if (jsonObj.get("delivery") != null && !jsonObj.get("delivery").isJsonNull()) { + SaleProductOfferRequestBaseAllOfDelivery.validateJsonElement(jsonObj.get("delivery")); + } + // validate the optional field `afterSalesServices` + if (jsonObj.get("afterSalesServices") != null && !jsonObj.get("afterSalesServices").isJsonNull()) { + AfterSalesServicesProductOfferRequest.validateJsonElement(jsonObj.get("afterSalesServices")); + } + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + SaleProductOfferRequestBaseAllOfContact.validateJsonElement(jsonObj.get("contact")); + } + // validate the optional field `discounts` + if (jsonObj.get("discounts") != null && !jsonObj.get("discounts").isJsonNull()) { + DiscountsProductOfferRequest.validateJsonElement(jsonObj.get("discounts")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferRequestBase.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferRequestBase' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferRequestBase.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferRequestBase value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferRequestBase read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferRequestBase given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferRequestBase + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferRequestBase + */ + public static SaleProductOfferRequestBase fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferRequestBase.class); + } + + /** + * Convert an instance of SaleProductOfferRequestBase to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfContact.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfContact.java new file mode 100644 index 0000000..25a940d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfContact.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Identifier of contact data for sales format ADVERTISEMENT (classified ad). You can enter the contact identifier or name. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferRequestBaseAllOfContact { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public SaleProductOfferRequestBaseAllOfContact() { + } + + public SaleProductOfferRequestBaseAllOfContact id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of contact. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public SaleProductOfferRequestBaseAllOfContact name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of the contact definition. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferRequestBaseAllOfContact saleProductOfferRequestBaseAllOfContact = (SaleProductOfferRequestBaseAllOfContact) o; + return Objects.equals(this.id, saleProductOfferRequestBaseAllOfContact.id) && + Objects.equals(this.name, saleProductOfferRequestBaseAllOfContact.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferRequestBaseAllOfContact {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferRequestBaseAllOfContact + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferRequestBaseAllOfContact.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferRequestBaseAllOfContact is not found in the empty JSON string", SaleProductOfferRequestBaseAllOfContact.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferRequestBaseAllOfContact.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferRequestBaseAllOfContact` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferRequestBaseAllOfContact.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferRequestBaseAllOfContact' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferRequestBaseAllOfContact.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferRequestBaseAllOfContact value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferRequestBaseAllOfContact read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferRequestBaseAllOfContact given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferRequestBaseAllOfContact + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferRequestBaseAllOfContact + */ + public static SaleProductOfferRequestBaseAllOfContact fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferRequestBaseAllOfContact.class); + } + + /** + * Convert an instance of SaleProductOfferRequestBaseAllOfContact to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfDelivery.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfDelivery.java new file mode 100644 index 0000000..f20894f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfDelivery.java @@ -0,0 +1,280 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferRequestBaseAllOfDelivery + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferRequestBaseAllOfDelivery { + public static final String SERIALIZED_NAME_HANDLING_TIME = "handlingTime"; + @SerializedName(SERIALIZED_NAME_HANDLING_TIME) + @javax.annotation.Nullable + private String handlingTime; + + public static final String SERIALIZED_NAME_SHIPPING_RATES = "shippingRates"; + @SerializedName(SERIALIZED_NAME_SHIPPING_RATES) + @javax.annotation.Nullable + private Object shippingRates = null; + + public static final String SERIALIZED_NAME_ADDITIONAL_INFO = "additionalInfo"; + @Deprecated + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFO) + @javax.annotation.Nullable + private String additionalInfo; + + public SaleProductOfferRequestBaseAllOfDelivery() { + } + + public SaleProductOfferRequestBaseAllOfDelivery handlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + return this; + } + + /** + * Handling time, ISO 8601 duration format. This field must be set to one of the following: PT0S for immediately, PT24H, P2D, P3D, P4D, P5D, P7D, P10D, P14D, P21D, P30D, P60D. + * @return handlingTime + */ + @javax.annotation.Nullable + public String getHandlingTime() { + return handlingTime; + } + + public void setHandlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + } + + + public SaleProductOfferRequestBaseAllOfDelivery shippingRates(@javax.annotation.Nullable Object shippingRates) { + this.shippingRates = shippingRates; + return this; + } + + /** + * You can enter the shipping rates identifier or name. + * @return shippingRates + */ + @javax.annotation.Nullable + public Object getShippingRates() { + return shippingRates; + } + + public void setShippingRates(@javax.annotation.Nullable Object shippingRates) { + this.shippingRates = shippingRates; + } + + + @Deprecated + public SaleProductOfferRequestBaseAllOfDelivery additionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + /** + * Additional information about delivery. Parameter is deprecated and will be removed in the future. Additional information is only visible on marketplace `allegro-pl`. + * @return additionalInfo + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public String getAdditionalInfo() { + return additionalInfo; + } + + @Deprecated + public void setAdditionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferRequestBaseAllOfDelivery saleProductOfferRequestBaseAllOfDelivery = (SaleProductOfferRequestBaseAllOfDelivery) o; + return Objects.equals(this.handlingTime, saleProductOfferRequestBaseAllOfDelivery.handlingTime) && + Objects.equals(this.shippingRates, saleProductOfferRequestBaseAllOfDelivery.shippingRates) && + Objects.equals(this.additionalInfo, saleProductOfferRequestBaseAllOfDelivery.additionalInfo); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(handlingTime, shippingRates, additionalInfo); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferRequestBaseAllOfDelivery {\n"); + sb.append(" handlingTime: ").append(toIndentedString(handlingTime)).append("\n"); + sb.append(" shippingRates: ").append(toIndentedString(shippingRates)).append("\n"); + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("handlingTime"); + openapiFields.add("shippingRates"); + openapiFields.add("additionalInfo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferRequestBaseAllOfDelivery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferRequestBaseAllOfDelivery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferRequestBaseAllOfDelivery is not found in the empty JSON string", SaleProductOfferRequestBaseAllOfDelivery.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferRequestBaseAllOfDelivery.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferRequestBaseAllOfDelivery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("handlingTime") != null && !jsonObj.get("handlingTime").isJsonNull()) && !jsonObj.get("handlingTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `handlingTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("handlingTime").toString())); + } + if ((jsonObj.get("additionalInfo") != null && !jsonObj.get("additionalInfo").isJsonNull()) && !jsonObj.get("additionalInfo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInfo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalInfo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferRequestBaseAllOfDelivery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferRequestBaseAllOfDelivery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferRequestBaseAllOfDelivery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferRequestBaseAllOfDelivery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferRequestBaseAllOfDelivery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferRequestBaseAllOfDelivery given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferRequestBaseAllOfDelivery + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferRequestBaseAllOfDelivery + */ + public static SaleProductOfferRequestBaseAllOfDelivery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferRequestBaseAllOfDelivery.class); + } + + /** + * Convert an instance of SaleProductOfferRequestBaseAllOfDelivery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfPublication.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfPublication.java new file mode 100644 index 0000000..ef2f790 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfPublication.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferStatus; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferRequestBaseAllOfPublication + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferRequestBaseAllOfPublication { + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + @javax.annotation.Nullable + private String duration; + + public static final String SERIALIZED_NAME_STARTING_AT = "startingAt"; + @SerializedName(SERIALIZED_NAME_STARTING_AT) + @javax.annotation.Nullable + private OffsetDateTime startingAt; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private OfferStatus status; + + public SaleProductOfferRequestBaseAllOfPublication() { + } + + public SaleProductOfferRequestBaseAllOfPublication duration(@javax.annotation.Nullable String duration) { + this.duration = duration; + return this; + } + + /** + * This field must be set to one of the following:<br/> - for auctions: 1 day, 3 days, 5 days, 7 days, 10 days<br/> - for buy-now offers: 3 days, 5 days, 7 days, 10 days, 20 days, 30 days<br/> - for advertisements: 10 days, 20 days, 30 days.<br/> The value is in ISO 8601 format (example: PT24H, PT72H). + * @return duration + */ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + public void setDuration(@javax.annotation.Nullable String duration) { + this.duration = duration; + } + + + public SaleProductOfferRequestBaseAllOfPublication startingAt(@javax.annotation.Nullable OffsetDateTime startingAt) { + this.startingAt = startingAt; + return this; + } + + /** + * Publication starting date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified after activation or ending of the offer. + * @return startingAt + */ + @javax.annotation.Nullable + public OffsetDateTime getStartingAt() { + return startingAt; + } + + public void setStartingAt(@javax.annotation.Nullable OffsetDateTime startingAt) { + this.startingAt = startingAt; + } + + + public SaleProductOfferRequestBaseAllOfPublication status(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public OfferStatus getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable OfferStatus status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferRequestBaseAllOfPublication saleProductOfferRequestBaseAllOfPublication = (SaleProductOfferRequestBaseAllOfPublication) o; + return Objects.equals(this.duration, saleProductOfferRequestBaseAllOfPublication.duration) && + Objects.equals(this.startingAt, saleProductOfferRequestBaseAllOfPublication.startingAt) && + Objects.equals(this.status, saleProductOfferRequestBaseAllOfPublication.status); + } + + @Override + public int hashCode() { + return Objects.hash(duration, startingAt, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferRequestBaseAllOfPublication {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" startingAt: ").append(toIndentedString(startingAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("duration"); + openapiFields.add("startingAt"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferRequestBaseAllOfPublication + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferRequestBaseAllOfPublication.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferRequestBaseAllOfPublication is not found in the empty JSON string", SaleProductOfferRequestBaseAllOfPublication.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferRequestBaseAllOfPublication.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferRequestBaseAllOfPublication` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + OfferStatus.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferRequestBaseAllOfPublication.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferRequestBaseAllOfPublication' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferRequestBaseAllOfPublication.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferRequestBaseAllOfPublication value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferRequestBaseAllOfPublication read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferRequestBaseAllOfPublication given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferRequestBaseAllOfPublication + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferRequestBaseAllOfPublication + */ + public static SaleProductOfferRequestBaseAllOfPublication fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferRequestBaseAllOfPublication.class); + } + + /** + * Convert an instance of SaleProductOfferRequestBaseAllOfPublication to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfSizeTable.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfSizeTable.java new file mode 100644 index 0000000..e03df2e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestBaseAllOfSizeTable.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The size table information. You can enter the size tabe identifier or name. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferRequestBaseAllOfSizeTable { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public SaleProductOfferRequestBaseAllOfSizeTable() { + } + + public SaleProductOfferRequestBaseAllOfSizeTable id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of size table + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public SaleProductOfferRequestBaseAllOfSizeTable name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of the size table definition. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferRequestBaseAllOfSizeTable saleProductOfferRequestBaseAllOfSizeTable = (SaleProductOfferRequestBaseAllOfSizeTable) o; + return Objects.equals(this.id, saleProductOfferRequestBaseAllOfSizeTable.id) && + Objects.equals(this.name, saleProductOfferRequestBaseAllOfSizeTable.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferRequestBaseAllOfSizeTable {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferRequestBaseAllOfSizeTable + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferRequestBaseAllOfSizeTable.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferRequestBaseAllOfSizeTable is not found in the empty JSON string", SaleProductOfferRequestBaseAllOfSizeTable.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferRequestBaseAllOfSizeTable.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferRequestBaseAllOfSizeTable` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferRequestBaseAllOfSizeTable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferRequestBaseAllOfSizeTable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferRequestBaseAllOfSizeTable.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferRequestBaseAllOfSizeTable value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferRequestBaseAllOfSizeTable read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferRequestBaseAllOfSizeTable given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferRequestBaseAllOfSizeTable + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferRequestBaseAllOfSizeTable + */ + public static SaleProductOfferRequestBaseAllOfSizeTable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferRequestBaseAllOfSizeTable.class); + } + + /** + * Convert an instance of SaleProductOfferRequestBaseAllOfSizeTable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1.java new file mode 100644 index 0000000..156c2a8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1.java @@ -0,0 +1,1074 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacesRequestValue; +import pl.wtx.allegro.api.client.model.AfterSalesServicesProductOfferRequest; +import pl.wtx.allegro.api.client.model.B2b; +import pl.wtx.allegro.api.client.model.CompatibilityListManualType; +import pl.wtx.allegro.api.client.model.DiscountsProductOfferRequest; +import pl.wtx.allegro.api.client.model.ExternalId; +import pl.wtx.allegro.api.client.model.Location; +import pl.wtx.allegro.api.client.model.MessageToSellerSettings; +import pl.wtx.allegro.api.client.model.OfferTaxSettings; +import pl.wtx.allegro.api.client.model.ParameterProductOfferRequest; +import pl.wtx.allegro.api.client.model.Payments; +import pl.wtx.allegro.api.client.model.ProductOfferAdditionalServicesRequest; +import pl.wtx.allegro.api.client.model.ProductOfferAttachmentInner; +import pl.wtx.allegro.api.client.model.ProductOfferFundraisingCampaignRequest; +import pl.wtx.allegro.api.client.model.SaleProductOfferPublicationRequest; +import pl.wtx.allegro.api.client.model.SaleProductOfferRequestBaseAllOfContact; +import pl.wtx.allegro.api.client.model.SaleProductOfferRequestV1AllOfDelivery; +import pl.wtx.allegro.api.client.model.SaleProductOfferRequestV1AllOfProductSet; +import pl.wtx.allegro.api.client.model.SaleProductOffersRequestStock; +import pl.wtx.allegro.api.client.model.SellingMode; +import pl.wtx.allegro.api.client.model.SizeTable; +import pl.wtx.allegro.api.client.model.StandardizedDescription; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferRequestV1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferRequestV1 { + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private Object category; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private SaleProductOfferPublicationRequest publication; + + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private SaleProductOfferRequestV1AllOfDelivery delivery; + + public static final String SERIALIZED_NAME_AFTER_SALES_SERVICES = "afterSalesServices"; + @SerializedName(SERIALIZED_NAME_AFTER_SALES_SERVICES) + @javax.annotation.Nullable + private AfterSalesServicesProductOfferRequest afterSalesServices; + + public static final String SERIALIZED_NAME_SIZE_TABLE = "sizeTable"; + @SerializedName(SERIALIZED_NAME_SIZE_TABLE) + @javax.annotation.Nullable + private SizeTable sizeTable; + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + @javax.annotation.Nullable + private SaleProductOfferRequestBaseAllOfContact contact; + + public static final String SERIALIZED_NAME_DISCOUNTS = "discounts"; + @SerializedName(SERIALIZED_NAME_DISCOUNTS) + @javax.annotation.Nullable + private DiscountsProductOfferRequest discounts; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PAYMENTS = "payments"; + @SerializedName(SERIALIZED_NAME_PAYMENTS) + @javax.annotation.Nullable + private Payments payments; + + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private SellingMode sellingMode; + + public static final String SERIALIZED_NAME_LOCATION = "location"; + @SerializedName(SERIALIZED_NAME_LOCATION) + @javax.annotation.Nullable + private Location location; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private StandardizedDescription description; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nullable + private ExternalId external; + + public static final String SERIALIZED_NAME_TAX_SETTINGS = "taxSettings"; + @SerializedName(SERIALIZED_NAME_TAX_SETTINGS) + @javax.annotation.Nullable + private OfferTaxSettings taxSettings; + + public static final String SERIALIZED_NAME_MESSAGE_TO_SELLER_SETTINGS = "messageToSellerSettings"; + @SerializedName(SERIALIZED_NAME_MESSAGE_TO_SELLER_SETTINGS) + @javax.annotation.Nullable + private MessageToSellerSettings messageToSellerSettings; + + public static final String SERIALIZED_NAME_PRODUCT_SET = "productSet"; + @SerializedName(SERIALIZED_NAME_PRODUCT_SET) + @javax.annotation.Nullable + private List productSet = new ArrayList<>(); + + public static final String SERIALIZED_NAME_B2B = "b2b"; + @SerializedName(SERIALIZED_NAME_B2B) + @javax.annotation.Nullable + private B2b b2b; + + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nullable + private List attachments = new ArrayList<>(); + + public static final String SERIALIZED_NAME_FUNDRAISING_CAMPAIGN = "fundraisingCampaign"; + @SerializedName(SERIALIZED_NAME_FUNDRAISING_CAMPAIGN) + @javax.annotation.Nullable + private ProductOfferFundraisingCampaignRequest fundraisingCampaign; + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private ProductOfferAdditionalServicesRequest additionalServices; + + public static final String SERIALIZED_NAME_STOCK = "stock"; + @SerializedName(SERIALIZED_NAME_STOCK) + @javax.annotation.Nonnull + private SaleProductOffersRequestStock stock; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private Map additionalMarketplaces = new HashMap<>(); + + public static final String SERIALIZED_NAME_COMPATIBILITY_LIST = "compatibilityList"; + @SerializedName(SERIALIZED_NAME_COMPATIBILITY_LIST) + @javax.annotation.Nullable + private CompatibilityListManualType compatibilityList; + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nullable + private String language; + + public SaleProductOfferRequestV1() { + } + + public SaleProductOfferRequestV1 category(@javax.annotation.Nullable Object category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + public Object getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable Object category) { + this.category = category; + } + + + public SaleProductOfferRequestV1 parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public SaleProductOfferRequestV1 addParametersItem(ParameterProductOfferRequest parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Get parameters + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public SaleProductOfferRequestV1 publication(@javax.annotation.Nullable SaleProductOfferPublicationRequest publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public SaleProductOfferPublicationRequest getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable SaleProductOfferPublicationRequest publication) { + this.publication = publication; + } + + + public SaleProductOfferRequestV1 delivery(@javax.annotation.Nullable SaleProductOfferRequestV1AllOfDelivery delivery) { + this.delivery = delivery; + return this; + } + + /** + * Get delivery + * @return delivery + */ + @javax.annotation.Nullable + public SaleProductOfferRequestV1AllOfDelivery getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable SaleProductOfferRequestV1AllOfDelivery delivery) { + this.delivery = delivery; + } + + + public SaleProductOfferRequestV1 afterSalesServices(@javax.annotation.Nullable AfterSalesServicesProductOfferRequest afterSalesServices) { + this.afterSalesServices = afterSalesServices; + return this; + } + + /** + * Get afterSalesServices + * @return afterSalesServices + */ + @javax.annotation.Nullable + public AfterSalesServicesProductOfferRequest getAfterSalesServices() { + return afterSalesServices; + } + + public void setAfterSalesServices(@javax.annotation.Nullable AfterSalesServicesProductOfferRequest afterSalesServices) { + this.afterSalesServices = afterSalesServices; + } + + + public SaleProductOfferRequestV1 sizeTable(@javax.annotation.Nullable SizeTable sizeTable) { + this.sizeTable = sizeTable; + return this; + } + + /** + * Get sizeTable + * @return sizeTable + */ + @javax.annotation.Nullable + public SizeTable getSizeTable() { + return sizeTable; + } + + public void setSizeTable(@javax.annotation.Nullable SizeTable sizeTable) { + this.sizeTable = sizeTable; + } + + + public SaleProductOfferRequestV1 contact(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfContact contact) { + this.contact = contact; + return this; + } + + /** + * Get contact + * @return contact + */ + @javax.annotation.Nullable + public SaleProductOfferRequestBaseAllOfContact getContact() { + return contact; + } + + public void setContact(@javax.annotation.Nullable SaleProductOfferRequestBaseAllOfContact contact) { + this.contact = contact; + } + + + public SaleProductOfferRequestV1 discounts(@javax.annotation.Nullable DiscountsProductOfferRequest discounts) { + this.discounts = discounts; + return this; + } + + /** + * Get discounts + * @return discounts + */ + @javax.annotation.Nullable + public DiscountsProductOfferRequest getDiscounts() { + return discounts; + } + + public void setDiscounts(@javax.annotation.Nullable DiscountsProductOfferRequest discounts) { + this.discounts = discounts; + } + + + public SaleProductOfferRequestV1 name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name (title) of an offer. Length cannot be more than 75 characters. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#tytul-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-title\" target=\"_blank\">EN</a> . + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SaleProductOfferRequestV1 payments(@javax.annotation.Nullable Payments payments) { + this.payments = payments; + return this; + } + + /** + * Get payments + * @return payments + */ + @javax.annotation.Nullable + public Payments getPayments() { + return payments; + } + + public void setPayments(@javax.annotation.Nullable Payments payments) { + this.payments = payments; + } + + + public SaleProductOfferRequestV1 sellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public SellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + public SaleProductOfferRequestV1 location(@javax.annotation.Nullable Location location) { + this.location = location; + return this; + } + + /** + * Get location + * @return location + */ + @javax.annotation.Nullable + public Location getLocation() { + return location; + } + + public void setLocation(@javax.annotation.Nullable Location location) { + this.location = location; + } + + + public SaleProductOfferRequestV1 images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public SaleProductOfferRequestV1 addImagesItem(String imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * Get images + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public SaleProductOfferRequestV1 description(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public StandardizedDescription getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + } + + + public SaleProductOfferRequestV1 external(@javax.annotation.Nullable ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nullable + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nullable ExternalId external) { + this.external = external; + } + + + public SaleProductOfferRequestV1 taxSettings(@javax.annotation.Nullable OfferTaxSettings taxSettings) { + this.taxSettings = taxSettings; + return this; + } + + /** + * Get taxSettings + * @return taxSettings + */ + @javax.annotation.Nullable + public OfferTaxSettings getTaxSettings() { + return taxSettings; + } + + public void setTaxSettings(@javax.annotation.Nullable OfferTaxSettings taxSettings) { + this.taxSettings = taxSettings; + } + + + public SaleProductOfferRequestV1 messageToSellerSettings(@javax.annotation.Nullable MessageToSellerSettings messageToSellerSettings) { + this.messageToSellerSettings = messageToSellerSettings; + return this; + } + + /** + * Get messageToSellerSettings + * @return messageToSellerSettings + */ + @javax.annotation.Nullable + public MessageToSellerSettings getMessageToSellerSettings() { + return messageToSellerSettings; + } + + public void setMessageToSellerSettings(@javax.annotation.Nullable MessageToSellerSettings messageToSellerSettings) { + this.messageToSellerSettings = messageToSellerSettings; + } + + + public SaleProductOfferRequestV1 productSet(@javax.annotation.Nullable List productSet) { + this.productSet = productSet; + return this; + } + + public SaleProductOfferRequestV1 addProductSetItem(SaleProductOfferRequestV1AllOfProductSet productSetItem) { + if (this.productSet == null) { + this.productSet = new ArrayList<>(); + } + this.productSet.add(productSetItem); + return this; + } + + /** + * Get productSet + * @return productSet + */ + @javax.annotation.Nullable + public List getProductSet() { + return productSet; + } + + public void setProductSet(@javax.annotation.Nullable List productSet) { + this.productSet = productSet; + } + + + public SaleProductOfferRequestV1 b2b(@javax.annotation.Nullable B2b b2b) { + this.b2b = b2b; + return this; + } + + /** + * Get b2b + * @return b2b + */ + @javax.annotation.Nullable + public B2b getB2b() { + return b2b; + } + + public void setB2b(@javax.annotation.Nullable B2b b2b) { + this.b2b = b2b; + } + + + public SaleProductOfferRequestV1 attachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + return this; + } + + public SaleProductOfferRequestV1 addAttachmentsItem(ProductOfferAttachmentInner attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * An array of offer attachments. + * @return attachments + */ + @javax.annotation.Nullable + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + } + + + public SaleProductOfferRequestV1 fundraisingCampaign(@javax.annotation.Nullable ProductOfferFundraisingCampaignRequest fundraisingCampaign) { + this.fundraisingCampaign = fundraisingCampaign; + return this; + } + + /** + * Get fundraisingCampaign + * @return fundraisingCampaign + */ + @javax.annotation.Nullable + public ProductOfferFundraisingCampaignRequest getFundraisingCampaign() { + return fundraisingCampaign; + } + + public void setFundraisingCampaign(@javax.annotation.Nullable ProductOfferFundraisingCampaignRequest fundraisingCampaign) { + this.fundraisingCampaign = fundraisingCampaign; + } + + + public SaleProductOfferRequestV1 additionalServices(@javax.annotation.Nullable ProductOfferAdditionalServicesRequest additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nullable + public ProductOfferAdditionalServicesRequest getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable ProductOfferAdditionalServicesRequest additionalServices) { + this.additionalServices = additionalServices; + } + + + public SaleProductOfferRequestV1 stock(@javax.annotation.Nonnull SaleProductOffersRequestStock stock) { + this.stock = stock; + return this; + } + + /** + * Get stock + * @return stock + */ + @javax.annotation.Nonnull + public SaleProductOffersRequestStock getStock() { + return stock; + } + + public void setStock(@javax.annotation.Nonnull SaleProductOffersRequestStock stock) { + this.stock = stock; + } + + + public SaleProductOfferRequestV1 additionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public SaleProductOfferRequestV1 putAdditionalMarketplacesItem(String key, AdditionalMarketplacesRequestValue additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new HashMap<>(); + } + this.additionalMarketplaces.put(key, additionalMarketplacesItem); + return this; + } + + /** + * Selected information about the offer in each additional service. This field does not contain information about the base marketplace of the offer.<br/> Possible values of `marketplaceId` can be obtained from `GET /marketplaces` resource.</br> See [Allegro foreign marketplaces](https://developer.allegro.pl/tutorials/listing-and-managing-offers-on-foreign-marketplaces-7GndGjeAATn) for more details regarding this field. + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public Map getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + public SaleProductOfferRequestV1 compatibilityList(@javax.annotation.Nullable CompatibilityListManualType compatibilityList) { + this.compatibilityList = compatibilityList; + return this; + } + + /** + * For the `/sale/product-offers` resources you can send only definition of the MANUAL compatibility list. If compatibility list is provided for the product assigned to the offer, it will be used automatically. + * @return compatibilityList + */ + @javax.annotation.Nullable + public CompatibilityListManualType getCompatibilityList() { + return compatibilityList; + } + + public void setCompatibilityList(@javax.annotation.Nullable CompatibilityListManualType compatibilityList) { + this.compatibilityList = compatibilityList; + } + + + public SaleProductOfferRequestV1 language(@javax.annotation.Nullable String language) { + this.language = language; + return this; + } + + /** + * Declared base language of the offer. + * @return language + */ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nullable String language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferRequestV1 saleProductOfferRequestV1 = (SaleProductOfferRequestV1) o; + return Objects.equals(this.category, saleProductOfferRequestV1.category) && + Objects.equals(this.parameters, saleProductOfferRequestV1.parameters) && + Objects.equals(this.publication, saleProductOfferRequestV1.publication) && + Objects.equals(this.delivery, saleProductOfferRequestV1.delivery) && + Objects.equals(this.afterSalesServices, saleProductOfferRequestV1.afterSalesServices) && + Objects.equals(this.sizeTable, saleProductOfferRequestV1.sizeTable) && + Objects.equals(this.contact, saleProductOfferRequestV1.contact) && + Objects.equals(this.discounts, saleProductOfferRequestV1.discounts) && + Objects.equals(this.name, saleProductOfferRequestV1.name) && + Objects.equals(this.payments, saleProductOfferRequestV1.payments) && + Objects.equals(this.sellingMode, saleProductOfferRequestV1.sellingMode) && + Objects.equals(this.location, saleProductOfferRequestV1.location) && + Objects.equals(this.images, saleProductOfferRequestV1.images) && + Objects.equals(this.description, saleProductOfferRequestV1.description) && + Objects.equals(this.external, saleProductOfferRequestV1.external) && + Objects.equals(this.taxSettings, saleProductOfferRequestV1.taxSettings) && + Objects.equals(this.messageToSellerSettings, saleProductOfferRequestV1.messageToSellerSettings) && + Objects.equals(this.productSet, saleProductOfferRequestV1.productSet) && + Objects.equals(this.b2b, saleProductOfferRequestV1.b2b) && + Objects.equals(this.attachments, saleProductOfferRequestV1.attachments) && + Objects.equals(this.fundraisingCampaign, saleProductOfferRequestV1.fundraisingCampaign) && + Objects.equals(this.additionalServices, saleProductOfferRequestV1.additionalServices) && + Objects.equals(this.stock, saleProductOfferRequestV1.stock) && + Objects.equals(this.additionalMarketplaces, saleProductOfferRequestV1.additionalMarketplaces) && + Objects.equals(this.compatibilityList, saleProductOfferRequestV1.compatibilityList) && + Objects.equals(this.language, saleProductOfferRequestV1.language); + } + + @Override + public int hashCode() { + return Objects.hash(category, parameters, publication, delivery, afterSalesServices, sizeTable, contact, discounts, name, payments, sellingMode, location, images, description, external, taxSettings, messageToSellerSettings, productSet, b2b, attachments, fundraisingCampaign, additionalServices, stock, additionalMarketplaces, compatibilityList, language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferRequestV1 {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" afterSalesServices: ").append(toIndentedString(afterSalesServices)).append("\n"); + sb.append(" sizeTable: ").append(toIndentedString(sizeTable)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" discounts: ").append(toIndentedString(discounts)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" payments: ").append(toIndentedString(payments)).append("\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append(" taxSettings: ").append(toIndentedString(taxSettings)).append("\n"); + sb.append(" messageToSellerSettings: ").append(toIndentedString(messageToSellerSettings)).append("\n"); + sb.append(" productSet: ").append(toIndentedString(productSet)).append("\n"); + sb.append(" b2b: ").append(toIndentedString(b2b)).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append(" fundraisingCampaign: ").append(toIndentedString(fundraisingCampaign)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append(" stock: ").append(toIndentedString(stock)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append(" compatibilityList: ").append(toIndentedString(compatibilityList)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("category"); + openapiFields.add("parameters"); + openapiFields.add("publication"); + openapiFields.add("delivery"); + openapiFields.add("afterSalesServices"); + openapiFields.add("sizeTable"); + openapiFields.add("contact"); + openapiFields.add("discounts"); + openapiFields.add("name"); + openapiFields.add("payments"); + openapiFields.add("sellingMode"); + openapiFields.add("location"); + openapiFields.add("images"); + openapiFields.add("description"); + openapiFields.add("external"); + openapiFields.add("taxSettings"); + openapiFields.add("messageToSellerSettings"); + openapiFields.add("productSet"); + openapiFields.add("b2b"); + openapiFields.add("attachments"); + openapiFields.add("fundraisingCampaign"); + openapiFields.add("additionalServices"); + openapiFields.add("stock"); + openapiFields.add("additionalMarketplaces"); + openapiFields.add("compatibilityList"); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("stock"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferRequestV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferRequestV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferRequestV1 is not found in the empty JSON string", SaleProductOfferRequestV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferRequestV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferRequestV1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SaleProductOfferRequestV1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ParameterProductOfferRequest.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + SaleProductOfferPublicationRequest.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `delivery` + if (jsonObj.get("delivery") != null && !jsonObj.get("delivery").isJsonNull()) { + SaleProductOfferRequestV1AllOfDelivery.validateJsonElement(jsonObj.get("delivery")); + } + // validate the optional field `afterSalesServices` + if (jsonObj.get("afterSalesServices") != null && !jsonObj.get("afterSalesServices").isJsonNull()) { + AfterSalesServicesProductOfferRequest.validateJsonElement(jsonObj.get("afterSalesServices")); + } + // validate the optional field `sizeTable` + if (jsonObj.get("sizeTable") != null && !jsonObj.get("sizeTable").isJsonNull()) { + SizeTable.validateJsonElement(jsonObj.get("sizeTable")); + } + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + SaleProductOfferRequestBaseAllOfContact.validateJsonElement(jsonObj.get("contact")); + } + // validate the optional field `discounts` + if (jsonObj.get("discounts") != null && !jsonObj.get("discounts").isJsonNull()) { + DiscountsProductOfferRequest.validateJsonElement(jsonObj.get("discounts")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `payments` + if (jsonObj.get("payments") != null && !jsonObj.get("payments").isJsonNull()) { + Payments.validateJsonElement(jsonObj.get("payments")); + } + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + SellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + // validate the optional field `location` + if (jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) { + Location.validateJsonElement(jsonObj.get("location")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull() && !jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + StandardizedDescription.validateJsonElement(jsonObj.get("description")); + } + // validate the optional field `external` + if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { + ExternalId.validateJsonElement(jsonObj.get("external")); + } + // validate the optional field `taxSettings` + if (jsonObj.get("taxSettings") != null && !jsonObj.get("taxSettings").isJsonNull()) { + OfferTaxSettings.validateJsonElement(jsonObj.get("taxSettings")); + } + // validate the optional field `messageToSellerSettings` + if (jsonObj.get("messageToSellerSettings") != null && !jsonObj.get("messageToSellerSettings").isJsonNull()) { + MessageToSellerSettings.validateJsonElement(jsonObj.get("messageToSellerSettings")); + } + if (jsonObj.get("productSet") != null && !jsonObj.get("productSet").isJsonNull()) { + JsonArray jsonArrayproductSet = jsonObj.getAsJsonArray("productSet"); + if (jsonArrayproductSet != null) { + // ensure the json data is an array + if (!jsonObj.get("productSet").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `productSet` to be an array in the JSON string but got `%s`", jsonObj.get("productSet").toString())); + } + + // validate the optional field `productSet` (array) + for (int i = 0; i < jsonArrayproductSet.size(); i++) { + SaleProductOfferRequestV1AllOfProductSet.validateJsonElement(jsonArrayproductSet.get(i)); + }; + } + } + // validate the optional field `b2b` + if (jsonObj.get("b2b") != null && !jsonObj.get("b2b").isJsonNull()) { + B2b.validateJsonElement(jsonObj.get("b2b")); + } + if (jsonObj.get("attachments") != null && !jsonObj.get("attachments").isJsonNull()) { + JsonArray jsonArrayattachments = jsonObj.getAsJsonArray("attachments"); + if (jsonArrayattachments != null) { + // ensure the json data is an array + if (!jsonObj.get("attachments").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `attachments` to be an array in the JSON string but got `%s`", jsonObj.get("attachments").toString())); + } + + // validate the optional field `attachments` (array) + for (int i = 0; i < jsonArrayattachments.size(); i++) { + ProductOfferAttachmentInner.validateJsonElement(jsonArrayattachments.get(i)); + }; + } + } + // validate the optional field `fundraisingCampaign` + if (jsonObj.get("fundraisingCampaign") != null && !jsonObj.get("fundraisingCampaign").isJsonNull()) { + ProductOfferFundraisingCampaignRequest.validateJsonElement(jsonObj.get("fundraisingCampaign")); + } + // validate the optional field `additionalServices` + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull()) { + ProductOfferAdditionalServicesRequest.validateJsonElement(jsonObj.get("additionalServices")); + } + // validate the required field `stock` + SaleProductOffersRequestStock.validateJsonElement(jsonObj.get("stock")); + // validate the optional field `compatibilityList` + if (jsonObj.get("compatibilityList") != null && !jsonObj.get("compatibilityList").isJsonNull()) { + CompatibilityListManualType.validateJsonElement(jsonObj.get("compatibilityList")); + } + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferRequestV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferRequestV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferRequestV1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferRequestV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferRequestV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferRequestV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferRequestV1 + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferRequestV1 + */ + public static SaleProductOfferRequestV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferRequestV1.class); + } + + /** + * Convert an instance of SaleProductOfferRequestV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1AllOfDelivery.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1AllOfDelivery.java new file mode 100644 index 0000000..dd247af --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1AllOfDelivery.java @@ -0,0 +1,308 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferRequestV1AllOfDelivery + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferRequestV1AllOfDelivery { + public static final String SERIALIZED_NAME_HANDLING_TIME = "handlingTime"; + @SerializedName(SERIALIZED_NAME_HANDLING_TIME) + @javax.annotation.Nullable + private String handlingTime; + + public static final String SERIALIZED_NAME_SHIPPING_RATES = "shippingRates"; + @SerializedName(SERIALIZED_NAME_SHIPPING_RATES) + @javax.annotation.Nullable + private Object shippingRates = null; + + public static final String SERIALIZED_NAME_ADDITIONAL_INFO = "additionalInfo"; + @Deprecated + @SerializedName(SERIALIZED_NAME_ADDITIONAL_INFO) + @javax.annotation.Nullable + private String additionalInfo; + + public static final String SERIALIZED_NAME_SHIPMENT_DATE = "shipmentDate"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_DATE) + @javax.annotation.Nullable + private OffsetDateTime shipmentDate; + + public SaleProductOfferRequestV1AllOfDelivery() { + } + + public SaleProductOfferRequestV1AllOfDelivery handlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + return this; + } + + /** + * Handling time, ISO 8601 duration format. This field must be set to one of the following: PT0S for immediately, PT24H, P2D, P3D, P4D, P5D, P7D, P10D, P14D, P21D, P30D, P60D. + * @return handlingTime + */ + @javax.annotation.Nullable + public String getHandlingTime() { + return handlingTime; + } + + public void setHandlingTime(@javax.annotation.Nullable String handlingTime) { + this.handlingTime = handlingTime; + } + + + public SaleProductOfferRequestV1AllOfDelivery shippingRates(@javax.annotation.Nullable Object shippingRates) { + this.shippingRates = shippingRates; + return this; + } + + /** + * You should enter the shipping rates identifier or name. + * @return shippingRates + */ + @javax.annotation.Nullable + public Object getShippingRates() { + return shippingRates; + } + + public void setShippingRates(@javax.annotation.Nullable Object shippingRates) { + this.shippingRates = shippingRates; + } + + + @Deprecated + public SaleProductOfferRequestV1AllOfDelivery additionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + return this; + } + + /** + * Additional information about delivery. Parameter is deprecated and will be removed in the future. Additional information is only visible on marketplace `allegro-pl`. + * @return additionalInfo + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public String getAdditionalInfo() { + return additionalInfo; + } + + @Deprecated + public void setAdditionalInfo(@javax.annotation.Nullable String additionalInfo) { + this.additionalInfo = additionalInfo; + } + + + public SaleProductOfferRequestV1AllOfDelivery shipmentDate(@javax.annotation.Nullable OffsetDateTime shipmentDate) { + this.shipmentDate = shipmentDate; + return this; + } + + /** + * Shipment date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + * @return shipmentDate + */ + @javax.annotation.Nullable + public OffsetDateTime getShipmentDate() { + return shipmentDate; + } + + public void setShipmentDate(@javax.annotation.Nullable OffsetDateTime shipmentDate) { + this.shipmentDate = shipmentDate; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferRequestV1AllOfDelivery saleProductOfferRequestV1AllOfDelivery = (SaleProductOfferRequestV1AllOfDelivery) o; + return Objects.equals(this.handlingTime, saleProductOfferRequestV1AllOfDelivery.handlingTime) && + Objects.equals(this.shippingRates, saleProductOfferRequestV1AllOfDelivery.shippingRates) && + Objects.equals(this.additionalInfo, saleProductOfferRequestV1AllOfDelivery.additionalInfo) && + Objects.equals(this.shipmentDate, saleProductOfferRequestV1AllOfDelivery.shipmentDate); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(handlingTime, shippingRates, additionalInfo, shipmentDate); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferRequestV1AllOfDelivery {\n"); + sb.append(" handlingTime: ").append(toIndentedString(handlingTime)).append("\n"); + sb.append(" shippingRates: ").append(toIndentedString(shippingRates)).append("\n"); + sb.append(" additionalInfo: ").append(toIndentedString(additionalInfo)).append("\n"); + sb.append(" shipmentDate: ").append(toIndentedString(shipmentDate)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("handlingTime"); + openapiFields.add("shippingRates"); + openapiFields.add("additionalInfo"); + openapiFields.add("shipmentDate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferRequestV1AllOfDelivery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferRequestV1AllOfDelivery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferRequestV1AllOfDelivery is not found in the empty JSON string", SaleProductOfferRequestV1AllOfDelivery.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferRequestV1AllOfDelivery.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferRequestV1AllOfDelivery` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("handlingTime") != null && !jsonObj.get("handlingTime").isJsonNull()) && !jsonObj.get("handlingTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `handlingTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("handlingTime").toString())); + } + if ((jsonObj.get("additionalInfo") != null && !jsonObj.get("additionalInfo").isJsonNull()) && !jsonObj.get("additionalInfo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalInfo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("additionalInfo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferRequestV1AllOfDelivery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferRequestV1AllOfDelivery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferRequestV1AllOfDelivery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferRequestV1AllOfDelivery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferRequestV1AllOfDelivery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferRequestV1AllOfDelivery given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferRequestV1AllOfDelivery + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferRequestV1AllOfDelivery + */ + public static SaleProductOfferRequestV1AllOfDelivery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferRequestV1AllOfDelivery.class); + } + + /** + * Convert an instance of SaleProductOfferRequestV1AllOfDelivery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1AllOfProductSet.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1AllOfProductSet.java new file mode 100644 index 0000000..1600d9c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferRequestV1AllOfProductSet.java @@ -0,0 +1,375 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.ProductOffer; +import pl.wtx.allegro.api.client.model.ProductSetElementQuantityQuantity; +import pl.wtx.allegro.api.client.model.ProductSetElementResponsiblePersonRequestResponsiblePerson; +import pl.wtx.allegro.api.client.model.ProductSetElementResponsibleProducerRequest; +import pl.wtx.allegro.api.client.model.ProductSetElementSafetyInformation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferRequestV1AllOfProductSet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferRequestV1AllOfProductSet { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + @javax.annotation.Nullable + private ProductOffer product; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private ProductSetElementQuantityQuantity quantity; + + public static final String SERIALIZED_NAME_RESPONSIBLE_PERSON = "responsiblePerson"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PERSON) + @javax.annotation.Nullable + private ProductSetElementResponsiblePersonRequestResponsiblePerson responsiblePerson; + + public static final String SERIALIZED_NAME_RESPONSIBLE_PRODUCER = "responsibleProducer"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PRODUCER) + @javax.annotation.Nullable + private ProductSetElementResponsibleProducerRequest responsibleProducer; + + public static final String SERIALIZED_NAME_SAFETY_INFORMATION = "safetyInformation"; + @SerializedName(SERIALIZED_NAME_SAFETY_INFORMATION) + @javax.annotation.Nullable + private ProductSetElementSafetyInformation safetyInformation; + + public static final String SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION = "marketedBeforeGPSRObligation"; + @SerializedName(SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION) + @javax.annotation.Nullable + private Boolean marketedBeforeGPSRObligation; + + public SaleProductOfferRequestV1AllOfProductSet() { + } + + public SaleProductOfferRequestV1AllOfProductSet product(@javax.annotation.Nullable ProductOffer product) { + this.product = product; + return this; + } + + /** + * You should enter the product identifier (UUID or EAN) or a complete product definition. + * @return product + */ + @javax.annotation.Nullable + public ProductOffer getProduct() { + return product; + } + + public void setProduct(@javax.annotation.Nullable ProductOffer product) { + this.product = product; + } + + + public SaleProductOfferRequestV1AllOfProductSet quantity(@javax.annotation.Nullable ProductSetElementQuantityQuantity quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + public ProductSetElementQuantityQuantity getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable ProductSetElementQuantityQuantity quantity) { + this.quantity = quantity; + } + + + public SaleProductOfferRequestV1AllOfProductSet responsiblePerson(@javax.annotation.Nullable ProductSetElementResponsiblePersonRequestResponsiblePerson responsiblePerson) { + this.responsiblePerson = responsiblePerson; + return this; + } + + /** + * Get responsiblePerson + * @return responsiblePerson + */ + @javax.annotation.Nullable + public ProductSetElementResponsiblePersonRequestResponsiblePerson getResponsiblePerson() { + return responsiblePerson; + } + + public void setResponsiblePerson(@javax.annotation.Nullable ProductSetElementResponsiblePersonRequestResponsiblePerson responsiblePerson) { + this.responsiblePerson = responsiblePerson; + } + + + public SaleProductOfferRequestV1AllOfProductSet responsibleProducer(@javax.annotation.Nullable ProductSetElementResponsibleProducerRequest responsibleProducer) { + this.responsibleProducer = responsibleProducer; + return this; + } + + /** + * Get responsibleProducer + * @return responsibleProducer + */ + @javax.annotation.Nullable + public ProductSetElementResponsibleProducerRequest getResponsibleProducer() { + return responsibleProducer; + } + + public void setResponsibleProducer(@javax.annotation.Nullable ProductSetElementResponsibleProducerRequest responsibleProducer) { + this.responsibleProducer = responsibleProducer; + } + + + public SaleProductOfferRequestV1AllOfProductSet safetyInformation(@javax.annotation.Nullable ProductSetElementSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + return this; + } + + /** + * Get safetyInformation + * @return safetyInformation + */ + @javax.annotation.Nullable + public ProductSetElementSafetyInformation getSafetyInformation() { + return safetyInformation; + } + + public void setSafetyInformation(@javax.annotation.Nullable ProductSetElementSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + } + + + public SaleProductOfferRequestV1AllOfProductSet marketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + return this; + } + + /** + * Allows you to declare that the product was introduced before 13 Dec 2024 and therefore does not require GPSR data. + * @return marketedBeforeGPSRObligation + */ + @javax.annotation.Nullable + public Boolean getMarketedBeforeGPSRObligation() { + return marketedBeforeGPSRObligation; + } + + public void setMarketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferRequestV1AllOfProductSet saleProductOfferRequestV1AllOfProductSet = (SaleProductOfferRequestV1AllOfProductSet) o; + return Objects.equals(this.product, saleProductOfferRequestV1AllOfProductSet.product) && + Objects.equals(this.quantity, saleProductOfferRequestV1AllOfProductSet.quantity) && + Objects.equals(this.responsiblePerson, saleProductOfferRequestV1AllOfProductSet.responsiblePerson) && + Objects.equals(this.responsibleProducer, saleProductOfferRequestV1AllOfProductSet.responsibleProducer) && + Objects.equals(this.safetyInformation, saleProductOfferRequestV1AllOfProductSet.safetyInformation) && + Objects.equals(this.marketedBeforeGPSRObligation, saleProductOfferRequestV1AllOfProductSet.marketedBeforeGPSRObligation); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(product, quantity, responsiblePerson, responsibleProducer, safetyInformation, marketedBeforeGPSRObligation); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferRequestV1AllOfProductSet {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" responsiblePerson: ").append(toIndentedString(responsiblePerson)).append("\n"); + sb.append(" responsibleProducer: ").append(toIndentedString(responsibleProducer)).append("\n"); + sb.append(" safetyInformation: ").append(toIndentedString(safetyInformation)).append("\n"); + sb.append(" marketedBeforeGPSRObligation: ").append(toIndentedString(marketedBeforeGPSRObligation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("quantity"); + openapiFields.add("responsiblePerson"); + openapiFields.add("responsibleProducer"); + openapiFields.add("safetyInformation"); + openapiFields.add("marketedBeforeGPSRObligation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferRequestV1AllOfProductSet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferRequestV1AllOfProductSet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferRequestV1AllOfProductSet is not found in the empty JSON string", SaleProductOfferRequestV1AllOfProductSet.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferRequestV1AllOfProductSet.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferRequestV1AllOfProductSet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductOffer.validateJsonElement(jsonObj.get("product")); + } + // validate the optional field `quantity` + if (jsonObj.get("quantity") != null && !jsonObj.get("quantity").isJsonNull()) { + ProductSetElementQuantityQuantity.validateJsonElement(jsonObj.get("quantity")); + } + // validate the optional field `responsiblePerson` + if (jsonObj.get("responsiblePerson") != null && !jsonObj.get("responsiblePerson").isJsonNull()) { + ProductSetElementResponsiblePersonRequestResponsiblePerson.validateJsonElement(jsonObj.get("responsiblePerson")); + } + // validate the optional field `responsibleProducer` + if (jsonObj.get("responsibleProducer") != null && !jsonObj.get("responsibleProducer").isJsonNull()) { + ProductSetElementResponsibleProducerRequest.validateJsonElement(jsonObj.get("responsibleProducer")); + } + // validate the optional field `safetyInformation` + if (jsonObj.get("safetyInformation") != null && !jsonObj.get("safetyInformation").isJsonNull()) { + ProductSetElementSafetyInformation.validateJsonElement(jsonObj.get("safetyInformation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferRequestV1AllOfProductSet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferRequestV1AllOfProductSet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferRequestV1AllOfProductSet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferRequestV1AllOfProductSet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferRequestV1AllOfProductSet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferRequestV1AllOfProductSet given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferRequestV1AllOfProductSet + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferRequestV1AllOfProductSet + */ + public static SaleProductOfferRequestV1AllOfProductSet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferRequestV1AllOfProductSet.class); + } + + /** + * Convert an instance of SaleProductOfferRequestV1AllOfProductSet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1.java new file mode 100644 index 0000000..47bfa78 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1.java @@ -0,0 +1,1222 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import pl.wtx.allegro.api.client.model.AdditionalMarketplacesResponseValue; +import pl.wtx.allegro.api.client.model.AfterSalesServices; +import pl.wtx.allegro.api.client.model.B2b; +import pl.wtx.allegro.api.client.model.CompatibilityListProductOfferResponse; +import pl.wtx.allegro.api.client.model.Contact; +import pl.wtx.allegro.api.client.model.DeliveryProductOfferResponse; +import pl.wtx.allegro.api.client.model.DiscountsProductOfferResponse; +import pl.wtx.allegro.api.client.model.ExternalId; +import pl.wtx.allegro.api.client.model.Location; +import pl.wtx.allegro.api.client.model.MessageToSellerSettings; +import pl.wtx.allegro.api.client.model.OfferCategory; +import pl.wtx.allegro.api.client.model.OfferTaxSettings; +import pl.wtx.allegro.api.client.model.ParameterProductOfferResponse; +import pl.wtx.allegro.api.client.model.Payments; +import pl.wtx.allegro.api.client.model.ProductOfferAdditionalServicesResponse; +import pl.wtx.allegro.api.client.model.ProductOfferAttachmentInner; +import pl.wtx.allegro.api.client.model.ProductOfferFundraisingCampaignResponse; +import pl.wtx.allegro.api.client.model.SaleProductOfferPublicationResponse; +import pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1AllOfProductSet; +import pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1AllOfWarnings; +import pl.wtx.allegro.api.client.model.SellingMode; +import pl.wtx.allegro.api.client.model.SizeTable; +import pl.wtx.allegro.api.client.model.StandardizedDescription; +import pl.wtx.allegro.api.client.model.Stock; +import pl.wtx.allegro.api.client.model.Validation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferResponseV1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferResponseV1 { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PAYMENTS = "payments"; + @SerializedName(SERIALIZED_NAME_PAYMENTS) + @javax.annotation.Nullable + private Payments payments; + + public static final String SERIALIZED_NAME_SELLING_MODE = "sellingMode"; + @SerializedName(SERIALIZED_NAME_SELLING_MODE) + @javax.annotation.Nullable + private SellingMode sellingMode; + + public static final String SERIALIZED_NAME_LOCATION = "location"; + @SerializedName(SERIALIZED_NAME_LOCATION) + @javax.annotation.Nullable + private Location location; + + public static final String SERIALIZED_NAME_IMAGES = "images"; + @SerializedName(SERIALIZED_NAME_IMAGES) + @javax.annotation.Nullable + private List images = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private StandardizedDescription description; + + public static final String SERIALIZED_NAME_EXTERNAL = "external"; + @SerializedName(SERIALIZED_NAME_EXTERNAL) + @javax.annotation.Nullable + private ExternalId external; + + public static final String SERIALIZED_NAME_SIZE_TABLE = "sizeTable"; + @SerializedName(SERIALIZED_NAME_SIZE_TABLE) + @javax.annotation.Nullable + private SizeTable sizeTable; + + public static final String SERIALIZED_NAME_TAX_SETTINGS = "taxSettings"; + @SerializedName(SERIALIZED_NAME_TAX_SETTINGS) + @javax.annotation.Nullable + private OfferTaxSettings taxSettings; + + public static final String SERIALIZED_NAME_MESSAGE_TO_SELLER_SETTINGS = "messageToSellerSettings"; + @SerializedName(SERIALIZED_NAME_MESSAGE_TO_SELLER_SETTINGS) + @javax.annotation.Nullable + private MessageToSellerSettings messageToSellerSettings; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_PRODUCT_SET = "productSet"; + @SerializedName(SERIALIZED_NAME_PRODUCT_SET) + @javax.annotation.Nullable + private List productSet = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private OfferCategory category; + + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nullable + private List attachments = new ArrayList<>(); + + public static final String SERIALIZED_NAME_FUNDRAISING_CAMPAIGN = "fundraisingCampaign"; + @SerializedName(SERIALIZED_NAME_FUNDRAISING_CAMPAIGN) + @javax.annotation.Nullable + private ProductOfferFundraisingCampaignResponse fundraisingCampaign; + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private ProductOfferAdditionalServicesResponse additionalServices; + + public static final String SERIALIZED_NAME_DELIVERY = "delivery"; + @SerializedName(SERIALIZED_NAME_DELIVERY) + @javax.annotation.Nullable + private DeliveryProductOfferResponse delivery; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private SaleProductOfferPublicationResponse publication; + + public static final String SERIALIZED_NAME_ADDITIONAL_MARKETPLACES = "additionalMarketplaces"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_MARKETPLACES) + @javax.annotation.Nullable + private Map additionalMarketplaces = new HashMap<>(); + + public static final String SERIALIZED_NAME_B2B = "b2b"; + @SerializedName(SERIALIZED_NAME_B2B) + @javax.annotation.Nullable + private B2b b2b; + + public static final String SERIALIZED_NAME_COMPATIBILITY_LIST = "compatibilityList"; + @SerializedName(SERIALIZED_NAME_COMPATIBILITY_LIST) + @javax.annotation.Nullable + private CompatibilityListProductOfferResponse compatibilityList; + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + @javax.annotation.Nullable + private String language; + + public static final String SERIALIZED_NAME_VALIDATION = "validation"; + @SerializedName(SERIALIZED_NAME_VALIDATION) + @javax.annotation.Nullable + private Validation validation; + + public static final String SERIALIZED_NAME_WARNINGS = "warnings"; + @SerializedName(SERIALIZED_NAME_WARNINGS) + @javax.annotation.Nullable + private SaleProductOfferResponseV1AllOfWarnings warnings; + + public static final String SERIALIZED_NAME_AFTER_SALES_SERVICES = "afterSalesServices"; + @SerializedName(SERIALIZED_NAME_AFTER_SALES_SERVICES) + @javax.annotation.Nullable + private AfterSalesServices afterSalesServices; + + public static final String SERIALIZED_NAME_DISCOUNTS = "discounts"; + @SerializedName(SERIALIZED_NAME_DISCOUNTS) + @javax.annotation.Nullable + private DiscountsProductOfferResponse discounts; + + public static final String SERIALIZED_NAME_STOCK = "stock"; + @SerializedName(SERIALIZED_NAME_STOCK) + @javax.annotation.Nullable + private Stock stock; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CONTACT = "contact"; + @SerializedName(SERIALIZED_NAME_CONTACT) + @javax.annotation.Nullable + private Contact contact; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public SaleProductOfferResponseV1() { + } + + public SaleProductOfferResponseV1 name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Name (title) of an offer. Length cannot be more than 75 characters. Read more: <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA#tytul-oferty\" target=\"_blank\">PL</a> / <a href=\"../../tutorials/list-offer-assigned-product-one-request-D7Kj9M71Bu6#offer-title\" target=\"_blank\">EN</a> . + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SaleProductOfferResponseV1 payments(@javax.annotation.Nullable Payments payments) { + this.payments = payments; + return this; + } + + /** + * Get payments + * @return payments + */ + @javax.annotation.Nullable + public Payments getPayments() { + return payments; + } + + public void setPayments(@javax.annotation.Nullable Payments payments) { + this.payments = payments; + } + + + public SaleProductOfferResponseV1 sellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + return this; + } + + /** + * Get sellingMode + * @return sellingMode + */ + @javax.annotation.Nullable + public SellingMode getSellingMode() { + return sellingMode; + } + + public void setSellingMode(@javax.annotation.Nullable SellingMode sellingMode) { + this.sellingMode = sellingMode; + } + + + public SaleProductOfferResponseV1 location(@javax.annotation.Nullable Location location) { + this.location = location; + return this; + } + + /** + * Get location + * @return location + */ + @javax.annotation.Nullable + public Location getLocation() { + return location; + } + + public void setLocation(@javax.annotation.Nullable Location location) { + this.location = location; + } + + + public SaleProductOfferResponseV1 images(@javax.annotation.Nullable List images) { + this.images = images; + return this; + } + + public SaleProductOfferResponseV1 addImagesItem(String imagesItem) { + if (this.images == null) { + this.images = new ArrayList<>(); + } + this.images.add(imagesItem); + return this; + } + + /** + * Get images + * @return images + */ + @javax.annotation.Nullable + public List getImages() { + return images; + } + + public void setImages(@javax.annotation.Nullable List images) { + this.images = images; + } + + + public SaleProductOfferResponseV1 description(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public StandardizedDescription getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable StandardizedDescription description) { + this.description = description; + } + + + public SaleProductOfferResponseV1 external(@javax.annotation.Nullable ExternalId external) { + this.external = external; + return this; + } + + /** + * Get external + * @return external + */ + @javax.annotation.Nullable + public ExternalId getExternal() { + return external; + } + + public void setExternal(@javax.annotation.Nullable ExternalId external) { + this.external = external; + } + + + public SaleProductOfferResponseV1 sizeTable(@javax.annotation.Nullable SizeTable sizeTable) { + this.sizeTable = sizeTable; + return this; + } + + /** + * Get sizeTable + * @return sizeTable + */ + @javax.annotation.Nullable + public SizeTable getSizeTable() { + return sizeTable; + } + + public void setSizeTable(@javax.annotation.Nullable SizeTable sizeTable) { + this.sizeTable = sizeTable; + } + + + public SaleProductOfferResponseV1 taxSettings(@javax.annotation.Nullable OfferTaxSettings taxSettings) { + this.taxSettings = taxSettings; + return this; + } + + /** + * Get taxSettings + * @return taxSettings + */ + @javax.annotation.Nullable + public OfferTaxSettings getTaxSettings() { + return taxSettings; + } + + public void setTaxSettings(@javax.annotation.Nullable OfferTaxSettings taxSettings) { + this.taxSettings = taxSettings; + } + + + public SaleProductOfferResponseV1 messageToSellerSettings(@javax.annotation.Nullable MessageToSellerSettings messageToSellerSettings) { + this.messageToSellerSettings = messageToSellerSettings; + return this; + } + + /** + * Get messageToSellerSettings + * @return messageToSellerSettings + */ + @javax.annotation.Nullable + public MessageToSellerSettings getMessageToSellerSettings() { + return messageToSellerSettings; + } + + public void setMessageToSellerSettings(@javax.annotation.Nullable MessageToSellerSettings messageToSellerSettings) { + this.messageToSellerSettings = messageToSellerSettings; + } + + + public SaleProductOfferResponseV1 id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public SaleProductOfferResponseV1 productSet(@javax.annotation.Nullable List productSet) { + this.productSet = productSet; + return this; + } + + public SaleProductOfferResponseV1 addProductSetItem(SaleProductOfferResponseV1AllOfProductSet productSetItem) { + if (this.productSet == null) { + this.productSet = new ArrayList<>(); + } + this.productSet.add(productSetItem); + return this; + } + + /** + * Get productSet + * @return productSet + */ + @javax.annotation.Nullable + public List getProductSet() { + return productSet; + } + + public void setProductSet(@javax.annotation.Nullable List productSet) { + this.productSet = productSet; + } + + + public SaleProductOfferResponseV1 category(@javax.annotation.Nullable OfferCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + public OfferCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable OfferCategory category) { + this.category = category; + } + + + public SaleProductOfferResponseV1 attachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + return this; + } + + public SaleProductOfferResponseV1 addAttachmentsItem(ProductOfferAttachmentInner attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * An array of offer attachments. + * @return attachments + */ + @javax.annotation.Nullable + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + } + + + public SaleProductOfferResponseV1 fundraisingCampaign(@javax.annotation.Nullable ProductOfferFundraisingCampaignResponse fundraisingCampaign) { + this.fundraisingCampaign = fundraisingCampaign; + return this; + } + + /** + * Get fundraisingCampaign + * @return fundraisingCampaign + */ + @javax.annotation.Nullable + public ProductOfferFundraisingCampaignResponse getFundraisingCampaign() { + return fundraisingCampaign; + } + + public void setFundraisingCampaign(@javax.annotation.Nullable ProductOfferFundraisingCampaignResponse fundraisingCampaign) { + this.fundraisingCampaign = fundraisingCampaign; + } + + + public SaleProductOfferResponseV1 additionalServices(@javax.annotation.Nullable ProductOfferAdditionalServicesResponse additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + /** + * Get additionalServices + * @return additionalServices + */ + @javax.annotation.Nullable + public ProductOfferAdditionalServicesResponse getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable ProductOfferAdditionalServicesResponse additionalServices) { + this.additionalServices = additionalServices; + } + + + public SaleProductOfferResponseV1 delivery(@javax.annotation.Nullable DeliveryProductOfferResponse delivery) { + this.delivery = delivery; + return this; + } + + /** + * Get delivery + * @return delivery + */ + @javax.annotation.Nullable + public DeliveryProductOfferResponse getDelivery() { + return delivery; + } + + public void setDelivery(@javax.annotation.Nullable DeliveryProductOfferResponse delivery) { + this.delivery = delivery; + } + + + public SaleProductOfferResponseV1 publication(@javax.annotation.Nullable SaleProductOfferPublicationResponse publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public SaleProductOfferPublicationResponse getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable SaleProductOfferPublicationResponse publication) { + this.publication = publication; + } + + + public SaleProductOfferResponseV1 additionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + return this; + } + + public SaleProductOfferResponseV1 putAdditionalMarketplacesItem(String key, AdditionalMarketplacesResponseValue additionalMarketplacesItem) { + if (this.additionalMarketplaces == null) { + this.additionalMarketplaces = new HashMap<>(); + } + this.additionalMarketplaces.put(key, additionalMarketplacesItem); + return this; + } + + /** + * Selected information about the offer in each additional service. This field does not contain information about the base marketplace of the offer. You will find all available marketplaces here. Even if the seller does not want the offer to be visible in the additional service, we will return it in response. + * @return additionalMarketplaces + */ + @javax.annotation.Nullable + public Map getAdditionalMarketplaces() { + return additionalMarketplaces; + } + + public void setAdditionalMarketplaces(@javax.annotation.Nullable Map additionalMarketplaces) { + this.additionalMarketplaces = additionalMarketplaces; + } + + + public SaleProductOfferResponseV1 b2b(@javax.annotation.Nullable B2b b2b) { + this.b2b = b2b; + return this; + } + + /** + * Get b2b + * @return b2b + */ + @javax.annotation.Nullable + public B2b getB2b() { + return b2b; + } + + public void setB2b(@javax.annotation.Nullable B2b b2b) { + this.b2b = b2b; + } + + + public SaleProductOfferResponseV1 compatibilityList(@javax.annotation.Nullable CompatibilityListProductOfferResponse compatibilityList) { + this.compatibilityList = compatibilityList; + return this; + } + + /** + * Get compatibilityList + * @return compatibilityList + */ + @javax.annotation.Nullable + public CompatibilityListProductOfferResponse getCompatibilityList() { + return compatibilityList; + } + + public void setCompatibilityList(@javax.annotation.Nullable CompatibilityListProductOfferResponse compatibilityList) { + this.compatibilityList = compatibilityList; + } + + + public SaleProductOfferResponseV1 language(@javax.annotation.Nullable String language) { + this.language = language; + return this; + } + + /** + * Declared base language of the offer. + * @return language + */ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + public void setLanguage(@javax.annotation.Nullable String language) { + this.language = language; + } + + + public SaleProductOfferResponseV1 validation(@javax.annotation.Nullable Validation validation) { + this.validation = validation; + return this; + } + + /** + * Get validation + * @return validation + */ + @javax.annotation.Nullable + public Validation getValidation() { + return validation; + } + + public void setValidation(@javax.annotation.Nullable Validation validation) { + this.validation = validation; + } + + + public SaleProductOfferResponseV1 warnings(@javax.annotation.Nullable SaleProductOfferResponseV1AllOfWarnings warnings) { + this.warnings = warnings; + return this; + } + + /** + * Get warnings + * @return warnings + */ + @javax.annotation.Nullable + public SaleProductOfferResponseV1AllOfWarnings getWarnings() { + return warnings; + } + + public void setWarnings(@javax.annotation.Nullable SaleProductOfferResponseV1AllOfWarnings warnings) { + this.warnings = warnings; + } + + + public SaleProductOfferResponseV1 afterSalesServices(@javax.annotation.Nullable AfterSalesServices afterSalesServices) { + this.afterSalesServices = afterSalesServices; + return this; + } + + /** + * Get afterSalesServices + * @return afterSalesServices + */ + @javax.annotation.Nullable + public AfterSalesServices getAfterSalesServices() { + return afterSalesServices; + } + + public void setAfterSalesServices(@javax.annotation.Nullable AfterSalesServices afterSalesServices) { + this.afterSalesServices = afterSalesServices; + } + + + public SaleProductOfferResponseV1 discounts(@javax.annotation.Nullable DiscountsProductOfferResponse discounts) { + this.discounts = discounts; + return this; + } + + /** + * Get discounts + * @return discounts + */ + @javax.annotation.Nullable + public DiscountsProductOfferResponse getDiscounts() { + return discounts; + } + + public void setDiscounts(@javax.annotation.Nullable DiscountsProductOfferResponse discounts) { + this.discounts = discounts; + } + + + public SaleProductOfferResponseV1 stock(@javax.annotation.Nullable Stock stock) { + this.stock = stock; + return this; + } + + /** + * Get stock + * @return stock + */ + @javax.annotation.Nullable + public Stock getStock() { + return stock; + } + + public void setStock(@javax.annotation.Nullable Stock stock) { + this.stock = stock; + } + + + public SaleProductOfferResponseV1 parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public SaleProductOfferResponseV1 addParametersItem(ParameterProductOfferResponse parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * List of offer parameters. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public SaleProductOfferResponseV1 contact(@javax.annotation.Nullable Contact contact) { + this.contact = contact; + return this; + } + + /** + * Identifier of contact data for sales format ADVERTISEMENT (classified ad); retrieve it via GET /sale/offer-contacts. + * @return contact + */ + @javax.annotation.Nullable + public Contact getContact() { + return contact; + } + + public void setContact(@javax.annotation.Nullable Contact contact) { + this.contact = contact; + } + + + public SaleProductOfferResponseV1 createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public SaleProductOfferResponseV1 updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Last update date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferResponseV1 saleProductOfferResponseV1 = (SaleProductOfferResponseV1) o; + return Objects.equals(this.name, saleProductOfferResponseV1.name) && + Objects.equals(this.payments, saleProductOfferResponseV1.payments) && + Objects.equals(this.sellingMode, saleProductOfferResponseV1.sellingMode) && + Objects.equals(this.location, saleProductOfferResponseV1.location) && + Objects.equals(this.images, saleProductOfferResponseV1.images) && + Objects.equals(this.description, saleProductOfferResponseV1.description) && + Objects.equals(this.external, saleProductOfferResponseV1.external) && + Objects.equals(this.sizeTable, saleProductOfferResponseV1.sizeTable) && + Objects.equals(this.taxSettings, saleProductOfferResponseV1.taxSettings) && + Objects.equals(this.messageToSellerSettings, saleProductOfferResponseV1.messageToSellerSettings) && + Objects.equals(this.id, saleProductOfferResponseV1.id) && + Objects.equals(this.productSet, saleProductOfferResponseV1.productSet) && + Objects.equals(this.category, saleProductOfferResponseV1.category) && + Objects.equals(this.attachments, saleProductOfferResponseV1.attachments) && + Objects.equals(this.fundraisingCampaign, saleProductOfferResponseV1.fundraisingCampaign) && + Objects.equals(this.additionalServices, saleProductOfferResponseV1.additionalServices) && + Objects.equals(this.delivery, saleProductOfferResponseV1.delivery) && + Objects.equals(this.publication, saleProductOfferResponseV1.publication) && + Objects.equals(this.additionalMarketplaces, saleProductOfferResponseV1.additionalMarketplaces) && + Objects.equals(this.b2b, saleProductOfferResponseV1.b2b) && + Objects.equals(this.compatibilityList, saleProductOfferResponseV1.compatibilityList) && + Objects.equals(this.language, saleProductOfferResponseV1.language) && + Objects.equals(this.validation, saleProductOfferResponseV1.validation) && + Objects.equals(this.warnings, saleProductOfferResponseV1.warnings) && + Objects.equals(this.afterSalesServices, saleProductOfferResponseV1.afterSalesServices) && + Objects.equals(this.discounts, saleProductOfferResponseV1.discounts) && + Objects.equals(this.stock, saleProductOfferResponseV1.stock) && + Objects.equals(this.parameters, saleProductOfferResponseV1.parameters) && + Objects.equals(this.contact, saleProductOfferResponseV1.contact) && + Objects.equals(this.createdAt, saleProductOfferResponseV1.createdAt) && + Objects.equals(this.updatedAt, saleProductOfferResponseV1.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(name, payments, sellingMode, location, images, description, external, sizeTable, taxSettings, messageToSellerSettings, id, productSet, category, attachments, fundraisingCampaign, additionalServices, delivery, publication, additionalMarketplaces, b2b, compatibilityList, language, validation, warnings, afterSalesServices, discounts, stock, parameters, contact, createdAt, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferResponseV1 {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" payments: ").append(toIndentedString(payments)).append("\n"); + sb.append(" sellingMode: ").append(toIndentedString(sellingMode)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" images: ").append(toIndentedString(images)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" external: ").append(toIndentedString(external)).append("\n"); + sb.append(" sizeTable: ").append(toIndentedString(sizeTable)).append("\n"); + sb.append(" taxSettings: ").append(toIndentedString(taxSettings)).append("\n"); + sb.append(" messageToSellerSettings: ").append(toIndentedString(messageToSellerSettings)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" productSet: ").append(toIndentedString(productSet)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append(" fundraisingCampaign: ").append(toIndentedString(fundraisingCampaign)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append(" delivery: ").append(toIndentedString(delivery)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" additionalMarketplaces: ").append(toIndentedString(additionalMarketplaces)).append("\n"); + sb.append(" b2b: ").append(toIndentedString(b2b)).append("\n"); + sb.append(" compatibilityList: ").append(toIndentedString(compatibilityList)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" validation: ").append(toIndentedString(validation)).append("\n"); + sb.append(" warnings: ").append(toIndentedString(warnings)).append("\n"); + sb.append(" afterSalesServices: ").append(toIndentedString(afterSalesServices)).append("\n"); + sb.append(" discounts: ").append(toIndentedString(discounts)).append("\n"); + sb.append(" stock: ").append(toIndentedString(stock)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" contact: ").append(toIndentedString(contact)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("payments"); + openapiFields.add("sellingMode"); + openapiFields.add("location"); + openapiFields.add("images"); + openapiFields.add("description"); + openapiFields.add("external"); + openapiFields.add("sizeTable"); + openapiFields.add("taxSettings"); + openapiFields.add("messageToSellerSettings"); + openapiFields.add("id"); + openapiFields.add("productSet"); + openapiFields.add("category"); + openapiFields.add("attachments"); + openapiFields.add("fundraisingCampaign"); + openapiFields.add("additionalServices"); + openapiFields.add("delivery"); + openapiFields.add("publication"); + openapiFields.add("additionalMarketplaces"); + openapiFields.add("b2b"); + openapiFields.add("compatibilityList"); + openapiFields.add("language"); + openapiFields.add("validation"); + openapiFields.add("warnings"); + openapiFields.add("afterSalesServices"); + openapiFields.add("discounts"); + openapiFields.add("stock"); + openapiFields.add("parameters"); + openapiFields.add("contact"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferResponseV1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferResponseV1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferResponseV1 is not found in the empty JSON string", SaleProductOfferResponseV1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferResponseV1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferResponseV1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `payments` + if (jsonObj.get("payments") != null && !jsonObj.get("payments").isJsonNull()) { + Payments.validateJsonElement(jsonObj.get("payments")); + } + // validate the optional field `sellingMode` + if (jsonObj.get("sellingMode") != null && !jsonObj.get("sellingMode").isJsonNull()) { + SellingMode.validateJsonElement(jsonObj.get("sellingMode")); + } + // validate the optional field `location` + if (jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) { + Location.validateJsonElement(jsonObj.get("location")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("images") != null && !jsonObj.get("images").isJsonNull() && !jsonObj.get("images").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `images` to be an array in the JSON string but got `%s`", jsonObj.get("images").toString())); + } + // validate the optional field `description` + if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) { + StandardizedDescription.validateJsonElement(jsonObj.get("description")); + } + // validate the optional field `external` + if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { + ExternalId.validateJsonElement(jsonObj.get("external")); + } + // validate the optional field `sizeTable` + if (jsonObj.get("sizeTable") != null && !jsonObj.get("sizeTable").isJsonNull()) { + SizeTable.validateJsonElement(jsonObj.get("sizeTable")); + } + // validate the optional field `taxSettings` + if (jsonObj.get("taxSettings") != null && !jsonObj.get("taxSettings").isJsonNull()) { + OfferTaxSettings.validateJsonElement(jsonObj.get("taxSettings")); + } + // validate the optional field `messageToSellerSettings` + if (jsonObj.get("messageToSellerSettings") != null && !jsonObj.get("messageToSellerSettings").isJsonNull()) { + MessageToSellerSettings.validateJsonElement(jsonObj.get("messageToSellerSettings")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (jsonObj.get("productSet") != null && !jsonObj.get("productSet").isJsonNull()) { + JsonArray jsonArrayproductSet = jsonObj.getAsJsonArray("productSet"); + if (jsonArrayproductSet != null) { + // ensure the json data is an array + if (!jsonObj.get("productSet").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `productSet` to be an array in the JSON string but got `%s`", jsonObj.get("productSet").toString())); + } + + // validate the optional field `productSet` (array) + for (int i = 0; i < jsonArrayproductSet.size(); i++) { + SaleProductOfferResponseV1AllOfProductSet.validateJsonElement(jsonArrayproductSet.get(i)); + }; + } + } + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + OfferCategory.validateJsonElement(jsonObj.get("category")); + } + if (jsonObj.get("attachments") != null && !jsonObj.get("attachments").isJsonNull()) { + JsonArray jsonArrayattachments = jsonObj.getAsJsonArray("attachments"); + if (jsonArrayattachments != null) { + // ensure the json data is an array + if (!jsonObj.get("attachments").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `attachments` to be an array in the JSON string but got `%s`", jsonObj.get("attachments").toString())); + } + + // validate the optional field `attachments` (array) + for (int i = 0; i < jsonArrayattachments.size(); i++) { + ProductOfferAttachmentInner.validateJsonElement(jsonArrayattachments.get(i)); + }; + } + } + // validate the optional field `fundraisingCampaign` + if (jsonObj.get("fundraisingCampaign") != null && !jsonObj.get("fundraisingCampaign").isJsonNull()) { + ProductOfferFundraisingCampaignResponse.validateJsonElement(jsonObj.get("fundraisingCampaign")); + } + // validate the optional field `additionalServices` + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull()) { + ProductOfferAdditionalServicesResponse.validateJsonElement(jsonObj.get("additionalServices")); + } + // validate the optional field `delivery` + if (jsonObj.get("delivery") != null && !jsonObj.get("delivery").isJsonNull()) { + DeliveryProductOfferResponse.validateJsonElement(jsonObj.get("delivery")); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + SaleProductOfferPublicationResponse.validateJsonElement(jsonObj.get("publication")); + } + // validate the optional field `b2b` + if (jsonObj.get("b2b") != null && !jsonObj.get("b2b").isJsonNull()) { + B2b.validateJsonElement(jsonObj.get("b2b")); + } + // validate the optional field `compatibilityList` + if (jsonObj.get("compatibilityList") != null && !jsonObj.get("compatibilityList").isJsonNull()) { + CompatibilityListProductOfferResponse.validateJsonElement(jsonObj.get("compatibilityList")); + } + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + // validate the optional field `validation` + if (jsonObj.get("validation") != null && !jsonObj.get("validation").isJsonNull()) { + Validation.validateJsonElement(jsonObj.get("validation")); + } + // validate the optional field `warnings` + if (jsonObj.get("warnings") != null && !jsonObj.get("warnings").isJsonNull()) { + SaleProductOfferResponseV1AllOfWarnings.validateJsonElement(jsonObj.get("warnings")); + } + // validate the optional field `afterSalesServices` + if (jsonObj.get("afterSalesServices") != null && !jsonObj.get("afterSalesServices").isJsonNull()) { + AfterSalesServices.validateJsonElement(jsonObj.get("afterSalesServices")); + } + // validate the optional field `discounts` + if (jsonObj.get("discounts") != null && !jsonObj.get("discounts").isJsonNull()) { + DiscountsProductOfferResponse.validateJsonElement(jsonObj.get("discounts")); + } + // validate the optional field `stock` + if (jsonObj.get("stock") != null && !jsonObj.get("stock").isJsonNull()) { + Stock.validateJsonElement(jsonObj.get("stock")); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ParameterProductOfferResponse.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + // validate the optional field `contact` + if (jsonObj.get("contact") != null && !jsonObj.get("contact").isJsonNull()) { + Contact.validateJsonElement(jsonObj.get("contact")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferResponseV1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferResponseV1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferResponseV1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferResponseV1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferResponseV1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferResponseV1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferResponseV1 + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferResponseV1 + */ + public static SaleProductOfferResponseV1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferResponseV1.class); + } + + /** + * Convert an instance of SaleProductOfferResponseV1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSet.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSet.java new file mode 100644 index 0000000..45491b9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSet.java @@ -0,0 +1,375 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.ProductSetElementQuantityQuantity; +import pl.wtx.allegro.api.client.model.ProductSetElementSafetyInformation; +import pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1AllOfProductSetAllOfProduct; +import pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson; +import pl.wtx.allegro.api.client.model.SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferResponseV1AllOfProductSet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferResponseV1AllOfProductSet { + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private ProductSetElementQuantityQuantity quantity; + + public static final String SERIALIZED_NAME_SAFETY_INFORMATION = "safetyInformation"; + @SerializedName(SERIALIZED_NAME_SAFETY_INFORMATION) + @javax.annotation.Nullable + private ProductSetElementSafetyInformation safetyInformation; + + public static final String SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION = "marketedBeforeGPSRObligation"; + @SerializedName(SERIALIZED_NAME_MARKETED_BEFORE_G_P_S_R_OBLIGATION) + @javax.annotation.Nullable + private Boolean marketedBeforeGPSRObligation; + + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + @javax.annotation.Nullable + private SaleProductOfferResponseV1AllOfProductSetAllOfProduct product; + + public static final String SERIALIZED_NAME_RESPONSIBLE_PERSON = "responsiblePerson"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PERSON) + @javax.annotation.Nullable + private SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson responsiblePerson; + + public static final String SERIALIZED_NAME_RESPONSIBLE_PRODUCER = "responsibleProducer"; + @SerializedName(SERIALIZED_NAME_RESPONSIBLE_PRODUCER) + @javax.annotation.Nullable + private SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer responsibleProducer; + + public SaleProductOfferResponseV1AllOfProductSet() { + } + + public SaleProductOfferResponseV1AllOfProductSet quantity(@javax.annotation.Nullable ProductSetElementQuantityQuantity quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + public ProductSetElementQuantityQuantity getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable ProductSetElementQuantityQuantity quantity) { + this.quantity = quantity; + } + + + public SaleProductOfferResponseV1AllOfProductSet safetyInformation(@javax.annotation.Nullable ProductSetElementSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + return this; + } + + /** + * Get safetyInformation + * @return safetyInformation + */ + @javax.annotation.Nullable + public ProductSetElementSafetyInformation getSafetyInformation() { + return safetyInformation; + } + + public void setSafetyInformation(@javax.annotation.Nullable ProductSetElementSafetyInformation safetyInformation) { + this.safetyInformation = safetyInformation; + } + + + public SaleProductOfferResponseV1AllOfProductSet marketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + return this; + } + + /** + * Allows you to declare that the product was introduced before 13 Dec 2024 and therefore does not require GPSR data. + * @return marketedBeforeGPSRObligation + */ + @javax.annotation.Nullable + public Boolean getMarketedBeforeGPSRObligation() { + return marketedBeforeGPSRObligation; + } + + public void setMarketedBeforeGPSRObligation(@javax.annotation.Nullable Boolean marketedBeforeGPSRObligation) { + this.marketedBeforeGPSRObligation = marketedBeforeGPSRObligation; + } + + + public SaleProductOfferResponseV1AllOfProductSet product(@javax.annotation.Nullable SaleProductOfferResponseV1AllOfProductSetAllOfProduct product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public SaleProductOfferResponseV1AllOfProductSetAllOfProduct getProduct() { + return product; + } + + public void setProduct(@javax.annotation.Nullable SaleProductOfferResponseV1AllOfProductSetAllOfProduct product) { + this.product = product; + } + + + public SaleProductOfferResponseV1AllOfProductSet responsiblePerson(@javax.annotation.Nullable SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson responsiblePerson) { + this.responsiblePerson = responsiblePerson; + return this; + } + + /** + * Get responsiblePerson + * @return responsiblePerson + */ + @javax.annotation.Nullable + public SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson getResponsiblePerson() { + return responsiblePerson; + } + + public void setResponsiblePerson(@javax.annotation.Nullable SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson responsiblePerson) { + this.responsiblePerson = responsiblePerson; + } + + + public SaleProductOfferResponseV1AllOfProductSet responsibleProducer(@javax.annotation.Nullable SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer responsibleProducer) { + this.responsibleProducer = responsibleProducer; + return this; + } + + /** + * Get responsibleProducer + * @return responsibleProducer + */ + @javax.annotation.Nullable + public SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer getResponsibleProducer() { + return responsibleProducer; + } + + public void setResponsibleProducer(@javax.annotation.Nullable SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer responsibleProducer) { + this.responsibleProducer = responsibleProducer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferResponseV1AllOfProductSet saleProductOfferResponseV1AllOfProductSet = (SaleProductOfferResponseV1AllOfProductSet) o; + return Objects.equals(this.quantity, saleProductOfferResponseV1AllOfProductSet.quantity) && + Objects.equals(this.safetyInformation, saleProductOfferResponseV1AllOfProductSet.safetyInformation) && + Objects.equals(this.marketedBeforeGPSRObligation, saleProductOfferResponseV1AllOfProductSet.marketedBeforeGPSRObligation) && + Objects.equals(this.product, saleProductOfferResponseV1AllOfProductSet.product) && + Objects.equals(this.responsiblePerson, saleProductOfferResponseV1AllOfProductSet.responsiblePerson) && + Objects.equals(this.responsibleProducer, saleProductOfferResponseV1AllOfProductSet.responsibleProducer); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(quantity, safetyInformation, marketedBeforeGPSRObligation, product, responsiblePerson, responsibleProducer); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferResponseV1AllOfProductSet {\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" safetyInformation: ").append(toIndentedString(safetyInformation)).append("\n"); + sb.append(" marketedBeforeGPSRObligation: ").append(toIndentedString(marketedBeforeGPSRObligation)).append("\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" responsiblePerson: ").append(toIndentedString(responsiblePerson)).append("\n"); + sb.append(" responsibleProducer: ").append(toIndentedString(responsibleProducer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("quantity"); + openapiFields.add("safetyInformation"); + openapiFields.add("marketedBeforeGPSRObligation"); + openapiFields.add("product"); + openapiFields.add("responsiblePerson"); + openapiFields.add("responsibleProducer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferResponseV1AllOfProductSet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferResponseV1AllOfProductSet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferResponseV1AllOfProductSet is not found in the empty JSON string", SaleProductOfferResponseV1AllOfProductSet.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferResponseV1AllOfProductSet.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferResponseV1AllOfProductSet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `quantity` + if (jsonObj.get("quantity") != null && !jsonObj.get("quantity").isJsonNull()) { + ProductSetElementQuantityQuantity.validateJsonElement(jsonObj.get("quantity")); + } + // validate the optional field `safetyInformation` + if (jsonObj.get("safetyInformation") != null && !jsonObj.get("safetyInformation").isJsonNull()) { + ProductSetElementSafetyInformation.validateJsonElement(jsonObj.get("safetyInformation")); + } + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + SaleProductOfferResponseV1AllOfProductSetAllOfProduct.validateJsonElement(jsonObj.get("product")); + } + // validate the optional field `responsiblePerson` + if (jsonObj.get("responsiblePerson") != null && !jsonObj.get("responsiblePerson").isJsonNull()) { + SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.validateJsonElement(jsonObj.get("responsiblePerson")); + } + // validate the optional field `responsibleProducer` + if (jsonObj.get("responsibleProducer") != null && !jsonObj.get("responsibleProducer").isJsonNull()) { + SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.validateJsonElement(jsonObj.get("responsibleProducer")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferResponseV1AllOfProductSet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferResponseV1AllOfProductSet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferResponseV1AllOfProductSet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferResponseV1AllOfProductSet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferResponseV1AllOfProductSet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferResponseV1AllOfProductSet given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferResponseV1AllOfProductSet + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferResponseV1AllOfProductSet + */ + public static SaleProductOfferResponseV1AllOfProductSet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferResponseV1AllOfProductSet.class); + } + + /** + * Convert an instance of SaleProductOfferResponseV1AllOfProductSet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfProduct.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfProduct.java new file mode 100644 index 0000000..7d3a4ca --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfProduct.java @@ -0,0 +1,290 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ParameterProductOfferResponse; +import pl.wtx.allegro.api.client.model.ProductOfferResponsePublication; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferResponseV1AllOfProductSetAllOfProduct + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferResponseV1AllOfProductSetAllOfProduct { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_PUBLICATION = "publication"; + @SerializedName(SERIALIZED_NAME_PUBLICATION) + @javax.annotation.Nullable + private ProductOfferResponsePublication publication; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public SaleProductOfferResponseV1AllOfProductSetAllOfProduct() { + } + + public SaleProductOfferResponseV1AllOfProductSetAllOfProduct id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Product id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public SaleProductOfferResponseV1AllOfProductSetAllOfProduct publication(@javax.annotation.Nullable ProductOfferResponsePublication publication) { + this.publication = publication; + return this; + } + + /** + * Get publication + * @return publication + */ + @javax.annotation.Nullable + public ProductOfferResponsePublication getPublication() { + return publication; + } + + public void setPublication(@javax.annotation.Nullable ProductOfferResponsePublication publication) { + this.publication = publication; + } + + + public SaleProductOfferResponseV1AllOfProductSetAllOfProduct parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public SaleProductOfferResponseV1AllOfProductSetAllOfProduct addParametersItem(ParameterProductOfferResponse parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Product parameters in the offer. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferResponseV1AllOfProductSetAllOfProduct saleProductOfferResponseV1AllOfProductSetAllOfProduct = (SaleProductOfferResponseV1AllOfProductSetAllOfProduct) o; + return Objects.equals(this.id, saleProductOfferResponseV1AllOfProductSetAllOfProduct.id) && + Objects.equals(this.publication, saleProductOfferResponseV1AllOfProductSetAllOfProduct.publication) && + Objects.equals(this.parameters, saleProductOfferResponseV1AllOfProductSetAllOfProduct.parameters); + } + + @Override + public int hashCode() { + return Objects.hash(id, publication, parameters); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferResponseV1AllOfProductSetAllOfProduct {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" publication: ").append(toIndentedString(publication)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("publication"); + openapiFields.add("parameters"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferResponseV1AllOfProductSetAllOfProduct + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferResponseV1AllOfProductSetAllOfProduct.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferResponseV1AllOfProductSetAllOfProduct is not found in the empty JSON string", SaleProductOfferResponseV1AllOfProductSetAllOfProduct.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferResponseV1AllOfProductSetAllOfProduct.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferResponseV1AllOfProductSetAllOfProduct` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `publication` + if (jsonObj.get("publication") != null && !jsonObj.get("publication").isJsonNull()) { + ProductOfferResponsePublication.validateJsonElement(jsonObj.get("publication")); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + ParameterProductOfferResponse.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferResponseV1AllOfProductSetAllOfProduct.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferResponseV1AllOfProductSetAllOfProduct' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferResponseV1AllOfProductSetAllOfProduct.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferResponseV1AllOfProductSetAllOfProduct value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferResponseV1AllOfProductSetAllOfProduct read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferResponseV1AllOfProductSetAllOfProduct given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferResponseV1AllOfProductSetAllOfProduct + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferResponseV1AllOfProductSetAllOfProduct + */ + public static SaleProductOfferResponseV1AllOfProductSetAllOfProduct fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferResponseV1AllOfProductSetAllOfProduct.class); + } + + /** + * Convert an instance of SaleProductOfferResponseV1AllOfProductSetAllOfProduct to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.java new file mode 100644 index 0000000..9f7f7da --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Reference to the responsible person configured using <a href=\"https://developer.allegro.pl/documentation#tag/Responsible-persons\">Responsible Persons API</a>. Note that this is a different field than <code>responsibleProducer</code>. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson() { + } + + public SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson saleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson = (SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson) o; + return Objects.equals(this.id, saleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson is not found in the empty JSON string", SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson + */ + public static SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson.class); + } + + /** + * Convert an instance of SaleProductOfferResponseV1AllOfProductSetAllOfResponsiblePerson to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.java new file mode 100644 index 0000000..c132338 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Reference to the responsible producer configured using Responsible Producer API. Note that this is a different field than <code>responsiblePerson</code>. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer() { + } + + public SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer saleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer = (SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer) o; + return Objects.equals(this.id, saleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer is not found in the empty JSON string", SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer + */ + public static SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer.class); + } + + /** + * Convert an instance of SaleProductOfferResponseV1AllOfProductSetAllOfResponsibleProducer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfWarnings.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfWarnings.java new file mode 100644 index 0000000..df5e0bf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferResponseV1AllOfWarnings.java @@ -0,0 +1,170 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferResponseV1AllOfWarnings + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferResponseV1AllOfWarnings { + public SaleProductOfferResponseV1AllOfWarnings() { + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferResponseV1AllOfWarnings {\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferResponseV1AllOfWarnings + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferResponseV1AllOfWarnings.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferResponseV1AllOfWarnings is not found in the empty JSON string", SaleProductOfferResponseV1AllOfWarnings.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferResponseV1AllOfWarnings.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferResponseV1AllOfWarnings` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferResponseV1AllOfWarnings.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferResponseV1AllOfWarnings' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferResponseV1AllOfWarnings.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferResponseV1AllOfWarnings value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferResponseV1AllOfWarnings read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferResponseV1AllOfWarnings given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferResponseV1AllOfWarnings + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferResponseV1AllOfWarnings + */ + public static SaleProductOfferResponseV1AllOfWarnings fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferResponseV1AllOfWarnings.class); + } + + /** + * Convert an instance of SaleProductOfferResponseV1AllOfWarnings to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferStatusResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferStatusResponse.java new file mode 100644 index 0000000..a7ee0f3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferStatusResponse.java @@ -0,0 +1,240 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OfferId; +import pl.wtx.allegro.api.client.model.SaleProductOfferStatusResponseOperation; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Single opertion data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferStatusResponse { + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private OfferId offer; + + public static final String SERIALIZED_NAME_OPERATION = "operation"; + @SerializedName(SERIALIZED_NAME_OPERATION) + @javax.annotation.Nullable + private SaleProductOfferStatusResponseOperation operation; + + public SaleProductOfferStatusResponse() { + } + + public SaleProductOfferStatusResponse offer(@javax.annotation.Nullable OfferId offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public OfferId getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable OfferId offer) { + this.offer = offer; + } + + + public SaleProductOfferStatusResponse operation(@javax.annotation.Nullable SaleProductOfferStatusResponseOperation operation) { + this.operation = operation; + return this; + } + + /** + * Get operation + * @return operation + */ + @javax.annotation.Nullable + public SaleProductOfferStatusResponseOperation getOperation() { + return operation; + } + + public void setOperation(@javax.annotation.Nullable SaleProductOfferStatusResponseOperation operation) { + this.operation = operation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferStatusResponse saleProductOfferStatusResponse = (SaleProductOfferStatusResponse) o; + return Objects.equals(this.offer, saleProductOfferStatusResponse.offer) && + Objects.equals(this.operation, saleProductOfferStatusResponse.operation); + } + + @Override + public int hashCode() { + return Objects.hash(offer, operation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferStatusResponse {\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offer"); + openapiFields.add("operation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferStatusResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferStatusResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferStatusResponse is not found in the empty JSON string", SaleProductOfferStatusResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferStatusResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferStatusResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + OfferId.validateJsonElement(jsonObj.get("offer")); + } + // validate the optional field `operation` + if (jsonObj.get("operation") != null && !jsonObj.get("operation").isJsonNull()) { + SaleProductOfferStatusResponseOperation.validateJsonElement(jsonObj.get("operation")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferStatusResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferStatusResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferStatusResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferStatusResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferStatusResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferStatusResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferStatusResponse + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferStatusResponse + */ + public static SaleProductOfferStatusResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferStatusResponse.class); + } + + /** + * Convert an instance of SaleProductOfferStatusResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferStatusResponseOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferStatusResponseOperation.java new file mode 100644 index 0000000..2f80ca9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOfferStatusResponseOperation.java @@ -0,0 +1,324 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOfferStatusResponseOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOfferStatusResponseOperation { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + /** + * Status of the operation. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("PENDING"), + + IN_PROGRESS("IN_PROGRESS"), + + COMPLETED("COMPLETED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_STARTED_AT = "startedAt"; + @SerializedName(SERIALIZED_NAME_STARTED_AT) + @javax.annotation.Nullable + private String startedAt; + + public SaleProductOfferStatusResponseOperation() { + } + + public SaleProductOfferStatusResponseOperation id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * The unique operation identifier (UUID). + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public SaleProductOfferStatusResponseOperation status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Status of the operation. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public SaleProductOfferStatusResponseOperation startedAt(@javax.annotation.Nullable String startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + * The starting date and time of operation. + * @return startedAt + */ + @javax.annotation.Nullable + public String getStartedAt() { + return startedAt; + } + + public void setStartedAt(@javax.annotation.Nullable String startedAt) { + this.startedAt = startedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOfferStatusResponseOperation saleProductOfferStatusResponseOperation = (SaleProductOfferStatusResponseOperation) o; + return Objects.equals(this.id, saleProductOfferStatusResponseOperation.id) && + Objects.equals(this.status, saleProductOfferStatusResponseOperation.status) && + Objects.equals(this.startedAt, saleProductOfferStatusResponseOperation.startedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, startedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOfferStatusResponseOperation {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" startedAt: ").append(toIndentedString(startedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("status"); + openapiFields.add("startedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOfferStatusResponseOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOfferStatusResponseOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOfferStatusResponseOperation is not found in the empty JSON string", SaleProductOfferStatusResponseOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOfferStatusResponseOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOfferStatusResponseOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("startedAt") != null && !jsonObj.get("startedAt").isJsonNull()) && !jsonObj.get("startedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `startedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("startedAt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOfferStatusResponseOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOfferStatusResponseOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOfferStatusResponseOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOfferStatusResponseOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOfferStatusResponseOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOfferStatusResponseOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOfferStatusResponseOperation + * @throws IOException if the JSON string is invalid with respect to SaleProductOfferStatusResponseOperation + */ + public static SaleProductOfferStatusResponseOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOfferStatusResponseOperation.class); + } + + /** + * Convert an instance of SaleProductOfferStatusResponseOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOffersRequestStock.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOffersRequestStock.java new file mode 100644 index 0000000..2cf63c3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductOffersRequestStock.java @@ -0,0 +1,292 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductOffersRequestStock + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductOffersRequestStock { + public static final String SERIALIZED_NAME_AVAILABLE = "available"; + @SerializedName(SERIALIZED_NAME_AVAILABLE) + @javax.annotation.Nullable + private Integer available; + + /** + * Stock unit + */ + @JsonAdapter(UnitEnum.Adapter.class) + public enum UnitEnum { + UNIT("UNIT"), + + PAIR("PAIR"), + + SET("SET"); + + private String value; + + UnitEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static UnitEnum fromValue(String value) { + for (UnitEnum b : UnitEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final UnitEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public UnitEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return UnitEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + UnitEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private UnitEnum unit; + + public SaleProductOffersRequestStock() { + } + + public SaleProductOffersRequestStock available(@javax.annotation.Nullable Integer available) { + this.available = available; + return this; + } + + /** + * Quantity of this offer available for sale - how many times this offer can be sold. Offer can be activated only with stock being greater then 0. Setting this quantity to 0 for 'ACTIVE' or 'ACTIVATING' offer will trigger changing its status to 'ENDED'. + * minimum: 0 + * @return available + */ + @javax.annotation.Nullable + public Integer getAvailable() { + return available; + } + + public void setAvailable(@javax.annotation.Nullable Integer available) { + this.available = available; + } + + + public SaleProductOffersRequestStock unit(@javax.annotation.Nullable UnitEnum unit) { + this.unit = unit; + return this; + } + + /** + * Stock unit + * @return unit + */ + @javax.annotation.Nullable + public UnitEnum getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable UnitEnum unit) { + this.unit = unit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductOffersRequestStock saleProductOffersRequestStock = (SaleProductOffersRequestStock) o; + return Objects.equals(this.available, saleProductOffersRequestStock.available) && + Objects.equals(this.unit, saleProductOffersRequestStock.unit); + } + + @Override + public int hashCode() { + return Objects.hash(available, unit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductOffersRequestStock {\n"); + sb.append(" available: ").append(toIndentedString(available)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("available"); + openapiFields.add("unit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductOffersRequestStock + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductOffersRequestStock.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductOffersRequestStock is not found in the empty JSON string", SaleProductOffersRequestStock.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductOffersRequestStock.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductOffersRequestStock` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) && !jsonObj.get("unit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unit").toString())); + } + // validate the optional field `unit` + if (jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) { + UnitEnum.validateJsonElement(jsonObj.get("unit")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductOffersRequestStock.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductOffersRequestStock' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductOffersRequestStock.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductOffersRequestStock value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductOffersRequestStock read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductOffersRequestStock given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductOffersRequestStock + * @throws IOException if the JSON string is invalid with respect to SaleProductOffersRequestStock + */ + public static SaleProductOffersRequestStock fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductOffersRequestStock.class); + } + + /** + * Convert an instance of SaleProductOffersRequestStock to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SaleProductResponseCategoriesDto.java b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductResponseCategoriesDto.java new file mode 100644 index 0000000..644c104 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SaleProductResponseCategoriesDto.java @@ -0,0 +1,278 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ProductsCategoryPath; +import pl.wtx.allegro.api.client.model.ProductsCategorySubcategories; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SaleProductResponseCategoriesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SaleProductResponseCategoriesDto { + public static final String SERIALIZED_NAME_SUBCATEGORIES = "subcategories"; + @SerializedName(SERIALIZED_NAME_SUBCATEGORIES) + @javax.annotation.Nullable + private List subcategories = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private List path = new ArrayList<>(); + + public SaleProductResponseCategoriesDto() { + } + + public SaleProductResponseCategoriesDto subcategories(@javax.annotation.Nullable List subcategories) { + this.subcategories = subcategories; + return this; + } + + public SaleProductResponseCategoriesDto addSubcategoriesItem(ProductsCategorySubcategories subcategoriesItem) { + if (this.subcategories == null) { + this.subcategories = new ArrayList<>(); + } + this.subcategories.add(subcategoriesItem); + return this; + } + + /** + * A list of categories that contain results for given search parameters. + * @return subcategories + */ + @javax.annotation.Nullable + public List getSubcategories() { + return subcategories; + } + + public void setSubcategories(@javax.annotation.Nullable List subcategories) { + this.subcategories = subcategories; + } + + + public SaleProductResponseCategoriesDto path(@javax.annotation.Nullable List path) { + this.path = path; + return this; + } + + public SaleProductResponseCategoriesDto addPathItem(ProductsCategoryPath pathItem) { + if (this.path == null) { + this.path = new ArrayList<>(); + } + this.path.add(pathItem); + return this; + } + + /** + * The path of current category used as categrory filter in search. + * @return path + */ + @javax.annotation.Nullable + public List getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable List path) { + this.path = path; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaleProductResponseCategoriesDto saleProductResponseCategoriesDto = (SaleProductResponseCategoriesDto) o; + return Objects.equals(this.subcategories, saleProductResponseCategoriesDto.subcategories) && + Objects.equals(this.path, saleProductResponseCategoriesDto.path); + } + + @Override + public int hashCode() { + return Objects.hash(subcategories, path); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaleProductResponseCategoriesDto {\n"); + sb.append(" subcategories: ").append(toIndentedString(subcategories)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("subcategories"); + openapiFields.add("path"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SaleProductResponseCategoriesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SaleProductResponseCategoriesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SaleProductResponseCategoriesDto is not found in the empty JSON string", SaleProductResponseCategoriesDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SaleProductResponseCategoriesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SaleProductResponseCategoriesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("subcategories") != null && !jsonObj.get("subcategories").isJsonNull()) { + JsonArray jsonArraysubcategories = jsonObj.getAsJsonArray("subcategories"); + if (jsonArraysubcategories != null) { + // ensure the json data is an array + if (!jsonObj.get("subcategories").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `subcategories` to be an array in the JSON string but got `%s`", jsonObj.get("subcategories").toString())); + } + + // validate the optional field `subcategories` (array) + for (int i = 0; i < jsonArraysubcategories.size(); i++) { + ProductsCategorySubcategories.validateJsonElement(jsonArraysubcategories.get(i)); + }; + } + } + if (jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) { + JsonArray jsonArraypath = jsonObj.getAsJsonArray("path"); + if (jsonArraypath != null) { + // ensure the json data is an array + if (!jsonObj.get("path").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be an array in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + + // validate the optional field `path` (array) + for (int i = 0; i < jsonArraypath.size(); i++) { + ProductsCategoryPath.validateJsonElement(jsonArraypath.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SaleProductResponseCategoriesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SaleProductResponseCategoriesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SaleProductResponseCategoriesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SaleProductResponseCategoriesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SaleProductResponseCategoriesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SaleProductResponseCategoriesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SaleProductResponseCategoriesDto + * @throws IOException if the JSON string is invalid with respect to SaleProductResponseCategoriesDto + */ + public static SaleProductResponseCategoriesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SaleProductResponseCategoriesDto.class); + } + + /** + * Convert an instance of SaleProductResponseCategoriesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SalesQualityForDay.java b/src/main/java/pl/wtx/allegro/api/client/model/SalesQualityForDay.java new file mode 100644 index 0000000..110073f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SalesQualityForDay.java @@ -0,0 +1,349 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.SalesQualityMetric; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SalesQualityForDay + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SalesQualityForDay { + public static final String SERIALIZED_NAME_RESULT_FOR = "resultFor"; + @SerializedName(SERIALIZED_NAME_RESULT_FOR) + @javax.annotation.Nonnull + private LocalDate resultFor; + + public static final String SERIALIZED_NAME_SCORE = "score"; + @SerializedName(SERIALIZED_NAME_SCORE) + @javax.annotation.Nonnull + private BigDecimal score; + + public static final String SERIALIZED_NAME_GRADE = "grade"; + @SerializedName(SERIALIZED_NAME_GRADE) + @javax.annotation.Nonnull + private String grade; + + public static final String SERIALIZED_NAME_MAX_SCORE = "maxScore"; + @SerializedName(SERIALIZED_NAME_MAX_SCORE) + @javax.annotation.Nonnull + private BigDecimal maxScore; + + public static final String SERIALIZED_NAME_METRICS = "metrics"; + @SerializedName(SERIALIZED_NAME_METRICS) + @javax.annotation.Nonnull + private List metrics = new ArrayList<>(); + + public SalesQualityForDay() { + } + + public SalesQualityForDay resultFor(@javax.annotation.Nonnull LocalDate resultFor) { + this.resultFor = resultFor; + return this; + } + + /** + * Date for which the result is calculated. + * @return resultFor + */ + @javax.annotation.Nonnull + public LocalDate getResultFor() { + return resultFor; + } + + public void setResultFor(@javax.annotation.Nonnull LocalDate resultFor) { + this.resultFor = resultFor; + } + + + public SalesQualityForDay score(@javax.annotation.Nonnull BigDecimal score) { + this.score = score; + return this; + } + + /** + * The total score for the given day. + * @return score + */ + @javax.annotation.Nonnull + public BigDecimal getScore() { + return score; + } + + public void setScore(@javax.annotation.Nonnull BigDecimal score) { + this.score = score; + } + + + public SalesQualityForDay grade(@javax.annotation.Nonnull String grade) { + this.grade = grade; + return this; + } + + /** + * The main sales quality level for the given day. + * @return grade + */ + @javax.annotation.Nonnull + public String getGrade() { + return grade; + } + + public void setGrade(@javax.annotation.Nonnull String grade) { + this.grade = grade; + } + + + public SalesQualityForDay maxScore(@javax.annotation.Nonnull BigDecimal maxScore) { + this.maxScore = maxScore; + return this; + } + + /** + * The maximum possible total score for the given day. + * @return maxScore + */ + @javax.annotation.Nonnull + public BigDecimal getMaxScore() { + return maxScore; + } + + public void setMaxScore(@javax.annotation.Nonnull BigDecimal maxScore) { + this.maxScore = maxScore; + } + + + public SalesQualityForDay metrics(@javax.annotation.Nonnull List metrics) { + this.metrics = metrics; + return this; + } + + public SalesQualityForDay addMetricsItem(SalesQualityMetric metricsItem) { + if (this.metrics == null) { + this.metrics = new ArrayList<>(); + } + this.metrics.add(metricsItem); + return this; + } + + /** + * Get metrics + * @return metrics + */ + @javax.annotation.Nonnull + public List getMetrics() { + return metrics; + } + + public void setMetrics(@javax.annotation.Nonnull List metrics) { + this.metrics = metrics; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SalesQualityForDay salesQualityForDay = (SalesQualityForDay) o; + return Objects.equals(this.resultFor, salesQualityForDay.resultFor) && + Objects.equals(this.score, salesQualityForDay.score) && + Objects.equals(this.grade, salesQualityForDay.grade) && + Objects.equals(this.maxScore, salesQualityForDay.maxScore) && + Objects.equals(this.metrics, salesQualityForDay.metrics); + } + + @Override + public int hashCode() { + return Objects.hash(resultFor, score, grade, maxScore, metrics); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SalesQualityForDay {\n"); + sb.append(" resultFor: ").append(toIndentedString(resultFor)).append("\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append(" grade: ").append(toIndentedString(grade)).append("\n"); + sb.append(" maxScore: ").append(toIndentedString(maxScore)).append("\n"); + sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("resultFor"); + openapiFields.add("score"); + openapiFields.add("grade"); + openapiFields.add("maxScore"); + openapiFields.add("metrics"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("resultFor"); + openapiRequiredFields.add("score"); + openapiRequiredFields.add("grade"); + openapiRequiredFields.add("maxScore"); + openapiRequiredFields.add("metrics"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SalesQualityForDay + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SalesQualityForDay.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SalesQualityForDay is not found in the empty JSON string", SalesQualityForDay.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SalesQualityForDay.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SalesQualityForDay` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SalesQualityForDay.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("grade").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `grade` to be a primitive type in the JSON string but got `%s`", jsonObj.get("grade").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("metrics").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `metrics` to be an array in the JSON string but got `%s`", jsonObj.get("metrics").toString())); + } + + JsonArray jsonArraymetrics = jsonObj.getAsJsonArray("metrics"); + // validate the required field `metrics` (array) + for (int i = 0; i < jsonArraymetrics.size(); i++) { + SalesQualityMetric.validateJsonElement(jsonArraymetrics.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SalesQualityForDay.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SalesQualityForDay' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SalesQualityForDay.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SalesQualityForDay value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SalesQualityForDay read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SalesQualityForDay given an JSON string + * + * @param jsonString JSON string + * @return An instance of SalesQualityForDay + * @throws IOException if the JSON string is invalid with respect to SalesQualityForDay + */ + public static SalesQualityForDay fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SalesQualityForDay.class); + } + + /** + * Convert an instance of SalesQualityForDay to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SalesQualityHistoryResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/SalesQualityHistoryResponse.java new file mode 100644 index 0000000..b131572 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SalesQualityHistoryResponse.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.SalesQualityForDay; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * At most 30 day sales quality history, if seller doesn't have sales quality for given day, it won't be present in `quality` array. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SalesQualityHistoryResponse { + public static final String SERIALIZED_NAME_QUALITY = "quality"; + @SerializedName(SERIALIZED_NAME_QUALITY) + @javax.annotation.Nonnull + private List quality = new ArrayList<>(); + + public SalesQualityHistoryResponse() { + } + + public SalesQualityHistoryResponse quality(@javax.annotation.Nonnull List quality) { + this.quality = quality; + return this; + } + + public SalesQualityHistoryResponse addQualityItem(SalesQualityForDay qualityItem) { + if (this.quality == null) { + this.quality = new ArrayList<>(); + } + this.quality.add(qualityItem); + return this; + } + + /** + * Get quality + * @return quality + */ + @javax.annotation.Nonnull + public List getQuality() { + return quality; + } + + public void setQuality(@javax.annotation.Nonnull List quality) { + this.quality = quality; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SalesQualityHistoryResponse salesQualityHistoryResponse = (SalesQualityHistoryResponse) o; + return Objects.equals(this.quality, salesQualityHistoryResponse.quality); + } + + @Override + public int hashCode() { + return Objects.hash(quality); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SalesQualityHistoryResponse {\n"); + sb.append(" quality: ").append(toIndentedString(quality)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("quality"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("quality"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SalesQualityHistoryResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SalesQualityHistoryResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SalesQualityHistoryResponse is not found in the empty JSON string", SalesQualityHistoryResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SalesQualityHistoryResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SalesQualityHistoryResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SalesQualityHistoryResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("quality").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `quality` to be an array in the JSON string but got `%s`", jsonObj.get("quality").toString())); + } + + JsonArray jsonArrayquality = jsonObj.getAsJsonArray("quality"); + // validate the required field `quality` (array) + for (int i = 0; i < jsonArrayquality.size(); i++) { + SalesQualityForDay.validateJsonElement(jsonArrayquality.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SalesQualityHistoryResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SalesQualityHistoryResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SalesQualityHistoryResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SalesQualityHistoryResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SalesQualityHistoryResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SalesQualityHistoryResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SalesQualityHistoryResponse + * @throws IOException if the JSON string is invalid with respect to SalesQualityHistoryResponse + */ + public static SalesQualityHistoryResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SalesQualityHistoryResponse.class); + } + + /** + * Convert an instance of SalesQualityHistoryResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SalesQualityMetric.java b/src/main/java/pl/wtx/allegro/api/client/model/SalesQualityMetric.java new file mode 100644 index 0000000..29330d0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SalesQualityMetric.java @@ -0,0 +1,301 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SalesQualityMetric + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SalesQualityMetric { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private String code; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_SCORE = "score"; + @SerializedName(SERIALIZED_NAME_SCORE) + @javax.annotation.Nonnull + private BigDecimal score; + + public static final String SERIALIZED_NAME_MAX_SCORE = "maxScore"; + @SerializedName(SERIALIZED_NAME_MAX_SCORE) + @javax.annotation.Nullable + private BigDecimal maxScore; + + public SalesQualityMetric() { + } + + public SalesQualityMetric code(@javax.annotation.Nonnull String code) { + this.code = code; + return this; + } + + /** + * The code name of the metric. + * @return code + */ + @javax.annotation.Nonnull + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull String code) { + this.code = code; + } + + + public SalesQualityMetric name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Translated name of the metric. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public SalesQualityMetric score(@javax.annotation.Nonnull BigDecimal score) { + this.score = score; + return this; + } + + /** + * The score for the given metric. + * @return score + */ + @javax.annotation.Nonnull + public BigDecimal getScore() { + return score; + } + + public void setScore(@javax.annotation.Nonnull BigDecimal score) { + this.score = score; + } + + + public SalesQualityMetric maxScore(@javax.annotation.Nullable BigDecimal maxScore) { + this.maxScore = maxScore; + return this; + } + + /** + * The maximum possible score for the given metric. + * @return maxScore + */ + @javax.annotation.Nullable + public BigDecimal getMaxScore() { + return maxScore; + } + + public void setMaxScore(@javax.annotation.Nullable BigDecimal maxScore) { + this.maxScore = maxScore; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SalesQualityMetric salesQualityMetric = (SalesQualityMetric) o; + return Objects.equals(this.code, salesQualityMetric.code) && + Objects.equals(this.name, salesQualityMetric.name) && + Objects.equals(this.score, salesQualityMetric.score) && + Objects.equals(this.maxScore, salesQualityMetric.maxScore); + } + + @Override + public int hashCode() { + return Objects.hash(code, name, score, maxScore); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SalesQualityMetric {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append(" maxScore: ").append(toIndentedString(maxScore)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("name"); + openapiFields.add("score"); + openapiFields.add("maxScore"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("code"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("score"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SalesQualityMetric + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SalesQualityMetric.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SalesQualityMetric is not found in the empty JSON string", SalesQualityMetric.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SalesQualityMetric.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SalesQualityMetric` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SalesQualityMetric.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SalesQualityMetric.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SalesQualityMetric' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SalesQualityMetric.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SalesQualityMetric value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SalesQualityMetric read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SalesQualityMetric given an JSON string + * + * @param jsonString JSON string + * @return An instance of SalesQualityMetric + * @throws IOException if the JSON string is invalid with respect to SalesQualityMetric + */ + public static SalesQualityMetric fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SalesQualityMetric.class); + } + + /** + * Convert an instance of SalesQualityMetric to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SearchResult.java b/src/main/java/pl/wtx/allegro/api/client/model/SearchResult.java new file mode 100644 index 0000000..2c5b5a9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SearchResult.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Pos; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SearchResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SearchResult { + public static final String SERIALIZED_NAME_POS_LIST = "posList"; + @SerializedName(SERIALIZED_NAME_POS_LIST) + @javax.annotation.Nullable + private List posList = new ArrayList<>(); + + public SearchResult() { + } + + public SearchResult posList(@javax.annotation.Nullable List posList) { + this.posList = posList; + return this; + } + + public SearchResult addPosListItem(Pos posListItem) { + if (this.posList == null) { + this.posList = new ArrayList<>(); + } + this.posList.add(posListItem); + return this; + } + + /** + * Get posList + * @return posList + */ + @javax.annotation.Nullable + public List getPosList() { + return posList; + } + + public void setPosList(@javax.annotation.Nullable List posList) { + this.posList = posList; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchResult searchResult = (SearchResult) o; + return Objects.equals(this.posList, searchResult.posList); + } + + @Override + public int hashCode() { + return Objects.hash(posList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchResult {\n"); + sb.append(" posList: ").append(toIndentedString(posList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("posList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SearchResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SearchResult is not found in the empty JSON string", SearchResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SearchResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SearchResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("posList") != null && !jsonObj.get("posList").isJsonNull()) { + JsonArray jsonArrayposList = jsonObj.getAsJsonArray("posList"); + if (jsonArrayposList != null) { + // ensure the json data is an array + if (!jsonObj.get("posList").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `posList` to be an array in the JSON string but got `%s`", jsonObj.get("posList").toString())); + } + + // validate the optional field `posList` (array) + for (int i = 0; i < jsonArrayposList.size(); i++) { + Pos.validateJsonElement(jsonArrayposList.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SearchResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchResult + * @throws IOException if the JSON string is invalid with respect to SearchResult + */ + public static SearchResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchResult.class); + } + + /** + * Convert an instance of SearchResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Seller.java b/src/main/java/pl/wtx/allegro/api/client/model/Seller.java new file mode 100644 index 0000000..e20c967 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Seller.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Seller + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Seller { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public Seller() { + } + + public Seller id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Seller seller = (Seller) o; + return Objects.equals(this.id, seller.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Seller {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Seller + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Seller.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Seller is not found in the empty JSON string", Seller.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Seller.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Seller` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Seller.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Seller.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Seller' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Seller.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Seller value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Seller read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Seller given an JSON string + * + * @param jsonString JSON string + * @return An instance of Seller + * @throws IOException if the JSON string is invalid with respect to Seller + */ + public static Seller fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Seller.class); + } + + /** + * Convert an instance of Seller to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellerCreateRebateRequestDto.java b/src/main/java/pl/wtx/allegro/api/client/model/SellerCreateRebateRequestDto.java new file mode 100644 index 0000000..08363ce --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellerCreateRebateRequestDto.java @@ -0,0 +1,279 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Benefit; +import pl.wtx.allegro.api.client.model.SellerRebateOfferCriterion; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SellerCreateRebateRequestDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellerCreateRebateRequestDto { + public static final String SERIALIZED_NAME_BENEFITS = "benefits"; + @SerializedName(SERIALIZED_NAME_BENEFITS) + @javax.annotation.Nonnull + private List benefits = new ArrayList<>(); + + public static final String SERIALIZED_NAME_OFFER_CRITERIA = "offerCriteria"; + @SerializedName(SERIALIZED_NAME_OFFER_CRITERIA) + @javax.annotation.Nonnull + private List offerCriteria = new ArrayList<>(); + + public SellerCreateRebateRequestDto() { + } + + public SellerCreateRebateRequestDto benefits(@javax.annotation.Nonnull List benefits) { + this.benefits = benefits; + return this; + } + + public SellerCreateRebateRequestDto addBenefitsItem(Benefit benefitsItem) { + if (this.benefits == null) { + this.benefits = new ArrayList<>(); + } + this.benefits.add(benefitsItem); + return this; + } + + /** + * What kind of rebate will be given + * @return benefits + */ + @javax.annotation.Nonnull + public List getBenefits() { + return benefits; + } + + public void setBenefits(@javax.annotation.Nonnull List benefits) { + this.benefits = benefits; + } + + + public SellerCreateRebateRequestDto offerCriteria(@javax.annotation.Nonnull List offerCriteria) { + this.offerCriteria = offerCriteria; + return this; + } + + public SellerCreateRebateRequestDto addOfferCriteriaItem(SellerRebateOfferCriterion offerCriteriaItem) { + if (this.offerCriteria == null) { + this.offerCriteria = new ArrayList<>(); + } + this.offerCriteria.add(offerCriteriaItem); + return this; + } + + /** + * What offers will be included + * @return offerCriteria + */ + @javax.annotation.Nonnull + public List getOfferCriteria() { + return offerCriteria; + } + + public void setOfferCriteria(@javax.annotation.Nonnull List offerCriteria) { + this.offerCriteria = offerCriteria; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellerCreateRebateRequestDto sellerCreateRebateRequestDto = (SellerCreateRebateRequestDto) o; + return Objects.equals(this.benefits, sellerCreateRebateRequestDto.benefits) && + Objects.equals(this.offerCriteria, sellerCreateRebateRequestDto.offerCriteria); + } + + @Override + public int hashCode() { + return Objects.hash(benefits, offerCriteria); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellerCreateRebateRequestDto {\n"); + sb.append(" benefits: ").append(toIndentedString(benefits)).append("\n"); + sb.append(" offerCriteria: ").append(toIndentedString(offerCriteria)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("benefits"); + openapiFields.add("offerCriteria"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("benefits"); + openapiRequiredFields.add("offerCriteria"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellerCreateRebateRequestDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellerCreateRebateRequestDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellerCreateRebateRequestDto is not found in the empty JSON string", SellerCreateRebateRequestDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SellerCreateRebateRequestDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SellerCreateRebateRequestDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SellerCreateRebateRequestDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("benefits").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `benefits` to be an array in the JSON string but got `%s`", jsonObj.get("benefits").toString())); + } + + JsonArray jsonArraybenefits = jsonObj.getAsJsonArray("benefits"); + // validate the required field `benefits` (array) + for (int i = 0; i < jsonArraybenefits.size(); i++) { + Benefit.validateJsonElement(jsonArraybenefits.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("offerCriteria").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerCriteria` to be an array in the JSON string but got `%s`", jsonObj.get("offerCriteria").toString())); + } + + JsonArray jsonArrayofferCriteria = jsonObj.getAsJsonArray("offerCriteria"); + // validate the required field `offerCriteria` (array) + for (int i = 0; i < jsonArrayofferCriteria.size(); i++) { + SellerRebateOfferCriterion.validateJsonElement(jsonArrayofferCriteria.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SellerCreateRebateRequestDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SellerCreateRebateRequestDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SellerCreateRebateRequestDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SellerCreateRebateRequestDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SellerCreateRebateRequestDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SellerCreateRebateRequestDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellerCreateRebateRequestDto + * @throws IOException if the JSON string is invalid with respect to SellerCreateRebateRequestDto + */ + public static SellerCreateRebateRequestDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellerCreateRebateRequestDto.class); + } + + /** + * Convert an instance of SellerCreateRebateRequestDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellerOfferBaseEvent.java b/src/main/java/pl/wtx/allegro/api/client/model/SellerOfferBaseEvent.java new file mode 100644 index 0000000..2567281 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellerOfferBaseEvent.java @@ -0,0 +1,261 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The data of an event. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellerOfferBaseEvent { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_OCCURRED_AT = "occurredAt"; + @SerializedName(SERIALIZED_NAME_OCCURRED_AT) + @javax.annotation.Nonnull + private OffsetDateTime occurredAt; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + protected String type; + + public SellerOfferBaseEvent() { + this.type = this.getClass().getSimpleName(); + } + + public SellerOfferBaseEvent id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The ID of the event. It can be used in the `from` parameter of the query. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public SellerOfferBaseEvent occurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + return this; + } + + /** + * The date and time when the event occurred, provided in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + * @return occurredAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getOccurredAt() { + return occurredAt; + } + + public void setOccurredAt(@javax.annotation.Nonnull OffsetDateTime occurredAt) { + this.occurredAt = occurredAt; + } + + + public SellerOfferBaseEvent type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The type of the event. + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellerOfferBaseEvent sellerOfferBaseEvent = (SellerOfferBaseEvent) o; + return Objects.equals(this.id, sellerOfferBaseEvent.id) && + Objects.equals(this.occurredAt, sellerOfferBaseEvent.occurredAt) && + Objects.equals(this.type, sellerOfferBaseEvent.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, occurredAt, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellerOfferBaseEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" occurredAt: ").append(toIndentedString(occurredAt)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("occurredAt"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("occurredAt"); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellerOfferBaseEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellerOfferBaseEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellerOfferBaseEvent is not found in the empty JSON string", SellerOfferBaseEvent.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("type").getAsString(); + switch (discriminatorValue) { + case "OFFER_ACTIVATED": + OfferActivatedEvent.validateJsonElement(jsonElement); + break; + case "OFFER_ARCHIVED": + OfferArchivedEvent.validateJsonElement(jsonElement); + break; + case "OFFER_BID_CANCELED": + OfferBidCanceledEvent.validateJsonElement(jsonElement); + break; + case "OFFER_BID_PLACED": + OfferBidPlacedEvent.validateJsonElement(jsonElement); + break; + case "OFFER_CHANGED": + OfferChangedEvent.validateJsonElement(jsonElement); + break; + case "OFFER_ENDED": + OfferEndedEvent.validateJsonElement(jsonElement); + break; + case "OFFER_PRICE_CHANGED": + OfferPriceChangedEvent.validateJsonElement(jsonElement); + break; + case "OFFER_STOCK_CHANGED": + OfferStockChangedEvent.validateJsonElement(jsonElement); + break; + case "OFFER_TRANSLATION_UPDATED": + OfferTranslationUpdatedEvent.validateJsonElement(jsonElement); + break; + case "OFFER_VISIBILITY_CHANGED": + OfferVisibilityChangedEvent.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `type` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of SellerOfferBaseEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellerOfferBaseEvent + * @throws IOException if the JSON string is invalid with respect to SellerOfferBaseEvent + */ + public static SellerOfferBaseEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellerOfferBaseEvent.class); + } + + /** + * Convert an instance of SellerOfferBaseEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellerOfferEventsResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/SellerOfferEventsResponse.java new file mode 100644 index 0000000..77760cb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellerOfferEventsResponse.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.SellerOfferBaseEvent; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SellerOfferEventsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellerOfferEventsResponse { + public static final String SERIALIZED_NAME_OFFER_EVENTS = "offerEvents"; + @SerializedName(SERIALIZED_NAME_OFFER_EVENTS) + @javax.annotation.Nonnull + private List offerEvents = new ArrayList<>(); + + public SellerOfferEventsResponse() { + } + + public SellerOfferEventsResponse offerEvents(@javax.annotation.Nonnull List offerEvents) { + this.offerEvents = offerEvents; + return this; + } + + public SellerOfferEventsResponse addOfferEventsItem(SellerOfferBaseEvent offerEventsItem) { + if (this.offerEvents == null) { + this.offerEvents = new ArrayList<>(); + } + this.offerEvents.add(offerEventsItem); + return this; + } + + /** + * The list of events. + * @return offerEvents + */ + @javax.annotation.Nonnull + public List getOfferEvents() { + return offerEvents; + } + + public void setOfferEvents(@javax.annotation.Nonnull List offerEvents) { + this.offerEvents = offerEvents; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellerOfferEventsResponse sellerOfferEventsResponse = (SellerOfferEventsResponse) o; + return Objects.equals(this.offerEvents, sellerOfferEventsResponse.offerEvents); + } + + @Override + public int hashCode() { + return Objects.hash(offerEvents); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellerOfferEventsResponse {\n"); + sb.append(" offerEvents: ").append(toIndentedString(offerEvents)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offerEvents"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offerEvents"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellerOfferEventsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellerOfferEventsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellerOfferEventsResponse is not found in the empty JSON string", SellerOfferEventsResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SellerOfferEventsResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SellerOfferEventsResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SellerOfferEventsResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("offerEvents").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerEvents` to be an array in the JSON string but got `%s`", jsonObj.get("offerEvents").toString())); + } + + JsonArray jsonArrayofferEvents = jsonObj.getAsJsonArray("offerEvents"); + // validate the required field `offerEvents` (array) + for (int i = 0; i < jsonArrayofferEvents.size(); i++) { + SellerOfferBaseEvent.validateJsonElement(jsonArrayofferEvents.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SellerOfferEventsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SellerOfferEventsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SellerOfferEventsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SellerOfferEventsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SellerOfferEventsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SellerOfferEventsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellerOfferEventsResponse + * @throws IOException if the JSON string is invalid with respect to SellerOfferEventsResponse + */ + public static SellerOfferEventsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellerOfferEventsResponse.class); + } + + /** + * Convert an instance of SellerOfferEventsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellerOfferStatsResponseDto.java b/src/main/java/pl/wtx/allegro/api/client/model/SellerOfferStatsResponseDto.java new file mode 100644 index 0000000..8b4d336 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellerOfferStatsResponseDto.java @@ -0,0 +1,278 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ClassifiedDailyEventStatResponseDto; +import pl.wtx.allegro.api.client.model.ClassifiedEventStat; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Data class for a specific seller events. Includes a list of OfferStatResponseDto grouped by date and a list of ClassifiedEventStat grouped by EventType for a specific period. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellerOfferStatsResponseDto { + public static final String SERIALIZED_NAME_EVENT_STATS_TOTAL = "eventStatsTotal"; + @SerializedName(SERIALIZED_NAME_EVENT_STATS_TOTAL) + @javax.annotation.Nullable + private List eventStatsTotal = new ArrayList<>(); + + public static final String SERIALIZED_NAME_EVENTS_PER_DAY = "eventsPerDay"; + @SerializedName(SERIALIZED_NAME_EVENTS_PER_DAY) + @javax.annotation.Nullable + private List eventsPerDay = new ArrayList<>(); + + public SellerOfferStatsResponseDto() { + } + + public SellerOfferStatsResponseDto eventStatsTotal(@javax.annotation.Nullable List eventStatsTotal) { + this.eventStatsTotal = eventStatsTotal; + return this; + } + + public SellerOfferStatsResponseDto addEventStatsTotalItem(ClassifiedEventStat eventStatsTotalItem) { + if (this.eventStatsTotal == null) { + this.eventStatsTotal = new ArrayList<>(); + } + this.eventStatsTotal.add(eventStatsTotalItem); + return this; + } + + /** + * Get eventStatsTotal + * @return eventStatsTotal + */ + @javax.annotation.Nullable + public List getEventStatsTotal() { + return eventStatsTotal; + } + + public void setEventStatsTotal(@javax.annotation.Nullable List eventStatsTotal) { + this.eventStatsTotal = eventStatsTotal; + } + + + public SellerOfferStatsResponseDto eventsPerDay(@javax.annotation.Nullable List eventsPerDay) { + this.eventsPerDay = eventsPerDay; + return this; + } + + public SellerOfferStatsResponseDto addEventsPerDayItem(ClassifiedDailyEventStatResponseDto eventsPerDayItem) { + if (this.eventsPerDay == null) { + this.eventsPerDay = new ArrayList<>(); + } + this.eventsPerDay.add(eventsPerDayItem); + return this; + } + + /** + * Get eventsPerDay + * @return eventsPerDay + */ + @javax.annotation.Nullable + public List getEventsPerDay() { + return eventsPerDay; + } + + public void setEventsPerDay(@javax.annotation.Nullable List eventsPerDay) { + this.eventsPerDay = eventsPerDay; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellerOfferStatsResponseDto sellerOfferStatsResponseDto = (SellerOfferStatsResponseDto) o; + return Objects.equals(this.eventStatsTotal, sellerOfferStatsResponseDto.eventStatsTotal) && + Objects.equals(this.eventsPerDay, sellerOfferStatsResponseDto.eventsPerDay); + } + + @Override + public int hashCode() { + return Objects.hash(eventStatsTotal, eventsPerDay); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellerOfferStatsResponseDto {\n"); + sb.append(" eventStatsTotal: ").append(toIndentedString(eventStatsTotal)).append("\n"); + sb.append(" eventsPerDay: ").append(toIndentedString(eventsPerDay)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventStatsTotal"); + openapiFields.add("eventsPerDay"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellerOfferStatsResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellerOfferStatsResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellerOfferStatsResponseDto is not found in the empty JSON string", SellerOfferStatsResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SellerOfferStatsResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SellerOfferStatsResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("eventStatsTotal") != null && !jsonObj.get("eventStatsTotal").isJsonNull()) { + JsonArray jsonArrayeventStatsTotal = jsonObj.getAsJsonArray("eventStatsTotal"); + if (jsonArrayeventStatsTotal != null) { + // ensure the json data is an array + if (!jsonObj.get("eventStatsTotal").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `eventStatsTotal` to be an array in the JSON string but got `%s`", jsonObj.get("eventStatsTotal").toString())); + } + + // validate the optional field `eventStatsTotal` (array) + for (int i = 0; i < jsonArrayeventStatsTotal.size(); i++) { + ClassifiedEventStat.validateJsonElement(jsonArrayeventStatsTotal.get(i)); + }; + } + } + if (jsonObj.get("eventsPerDay") != null && !jsonObj.get("eventsPerDay").isJsonNull()) { + JsonArray jsonArrayeventsPerDay = jsonObj.getAsJsonArray("eventsPerDay"); + if (jsonArrayeventsPerDay != null) { + // ensure the json data is an array + if (!jsonObj.get("eventsPerDay").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `eventsPerDay` to be an array in the JSON string but got `%s`", jsonObj.get("eventsPerDay").toString())); + } + + // validate the optional field `eventsPerDay` (array) + for (int i = 0; i < jsonArrayeventsPerDay.size(); i++) { + ClassifiedDailyEventStatResponseDto.validateJsonElement(jsonArrayeventsPerDay.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SellerOfferStatsResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SellerOfferStatsResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SellerOfferStatsResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SellerOfferStatsResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SellerOfferStatsResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SellerOfferStatsResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellerOfferStatsResponseDto + * @throws IOException if the JSON string is invalid with respect to SellerOfferStatsResponseDto + */ + public static SellerOfferStatsResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellerOfferStatsResponseDto.class); + } + + /** + * Convert an instance of SellerOfferStatsResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellerParticipant.java b/src/main/java/pl/wtx/allegro/api/client/model/SellerParticipant.java new file mode 100644 index 0000000..d4ea6e7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellerParticipant.java @@ -0,0 +1,369 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.OperationParticipantAddress; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The seller's data. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellerParticipant { + public static final String SERIALIZED_NAME_COMPANY_NAME = "companyName"; + @SerializedName(SERIALIZED_NAME_COMPANY_NAME) + @javax.annotation.Nullable + private String companyName; + + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nonnull + private String login; + + public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; + @SerializedName(SERIALIZED_NAME_FIRST_NAME) + @javax.annotation.Nonnull + private String firstName; + + public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; + @SerializedName(SERIALIZED_NAME_LAST_NAME) + @javax.annotation.Nonnull + private String lastName; + + public static final String SERIALIZED_NAME_ADDRESS = "address"; + @SerializedName(SERIALIZED_NAME_ADDRESS) + @javax.annotation.Nullable + private OperationParticipantAddress address; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public SellerParticipant() { + } + + public SellerParticipant companyName(@javax.annotation.Nullable String companyName) { + this.companyName = companyName; + return this; + } + + /** + * Company name. + * @return companyName + */ + @javax.annotation.Nullable + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(@javax.annotation.Nullable String companyName) { + this.companyName = companyName; + } + + + public SellerParticipant login(@javax.annotation.Nonnull String login) { + this.login = login; + return this; + } + + /** + * Login. + * @return login + */ + @javax.annotation.Nonnull + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nonnull String login) { + this.login = login; + } + + + public SellerParticipant firstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + return this; + } + + /** + * First name. + * @return firstName + */ + @javax.annotation.Nonnull + public String getFirstName() { + return firstName; + } + + public void setFirstName(@javax.annotation.Nonnull String firstName) { + this.firstName = firstName; + } + + + public SellerParticipant lastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Last name. + * @return lastName + */ + @javax.annotation.Nonnull + public String getLastName() { + return lastName; + } + + public void setLastName(@javax.annotation.Nonnull String lastName) { + this.lastName = lastName; + } + + + public SellerParticipant address(@javax.annotation.Nullable OperationParticipantAddress address) { + this.address = address; + return this; + } + + /** + * Get address + * @return address + */ + @javax.annotation.Nullable + public OperationParticipantAddress getAddress() { + return address; + } + + public void setAddress(@javax.annotation.Nullable OperationParticipantAddress address) { + this.address = address; + } + + + public SellerParticipant id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * The seller's ID. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellerParticipant sellerParticipant = (SellerParticipant) o; + return Objects.equals(this.companyName, sellerParticipant.companyName) && + Objects.equals(this.login, sellerParticipant.login) && + Objects.equals(this.firstName, sellerParticipant.firstName) && + Objects.equals(this.lastName, sellerParticipant.lastName) && + Objects.equals(this.address, sellerParticipant.address) && + Objects.equals(this.id, sellerParticipant.id); + } + + @Override + public int hashCode() { + return Objects.hash(companyName, login, firstName, lastName, address, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellerParticipant {\n"); + sb.append(" companyName: ").append(toIndentedString(companyName)).append("\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("companyName"); + openapiFields.add("login"); + openapiFields.add("firstName"); + openapiFields.add("lastName"); + openapiFields.add("address"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("login"); + openapiRequiredFields.add("firstName"); + openapiRequiredFields.add("lastName"); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellerParticipant + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellerParticipant.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellerParticipant is not found in the empty JSON string", SellerParticipant.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SellerParticipant.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SellerParticipant` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SellerParticipant.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("companyName") != null && !jsonObj.get("companyName").isJsonNull()) && !jsonObj.get("companyName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `companyName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("companyName").toString())); + } + if (!jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + if (!jsonObj.get("firstName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); + } + if (!jsonObj.get("lastName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); + } + // validate the optional field `address` + if (jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) { + OperationParticipantAddress.validateJsonElement(jsonObj.get("address")); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SellerParticipant.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SellerParticipant' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SellerParticipant.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SellerParticipant value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SellerParticipant read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SellerParticipant given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellerParticipant + * @throws IOException if the JSON string is invalid with respect to SellerParticipant + */ + public static SellerParticipant fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellerParticipant.class); + } + + /** + * Convert an instance of SellerParticipant to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellerRebateDto.java b/src/main/java/pl/wtx/allegro/api/client/model/SellerRebateDto.java new file mode 100644 index 0000000..64877d1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellerRebateDto.java @@ -0,0 +1,425 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Benefit; +import pl.wtx.allegro.api.client.model.SellerRebateOfferCriterion; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SellerRebateDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellerRebateDto { + public static final String SERIALIZED_NAME_BENEFITS = "benefits"; + @SerializedName(SERIALIZED_NAME_BENEFITS) + @javax.annotation.Nonnull + private List benefits = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_OFFER_CRITERIA = "offerCriteria"; + @SerializedName(SERIALIZED_NAME_OFFER_CRITERIA) + @javax.annotation.Nonnull + private List offerCriteria = new ArrayList<>(); + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVE("ACTIVE"), + + INACTIVE("INACTIVE"), + + SUSPENDED("SUSPENDED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public SellerRebateDto() { + } + + public SellerRebateDto benefits(@javax.annotation.Nonnull List benefits) { + this.benefits = benefits; + return this; + } + + public SellerRebateDto addBenefitsItem(Benefit benefitsItem) { + if (this.benefits == null) { + this.benefits = new ArrayList<>(); + } + this.benefits.add(benefitsItem); + return this; + } + + /** + * What kind of rebate will be given + * @return benefits + */ + @javax.annotation.Nonnull + public List getBenefits() { + return benefits; + } + + public void setBenefits(@javax.annotation.Nonnull List benefits) { + this.benefits = benefits; + } + + + public SellerRebateDto createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * when was this rebate created + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public SellerRebateDto id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Rebate identifier + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public SellerRebateDto offerCriteria(@javax.annotation.Nonnull List offerCriteria) { + this.offerCriteria = offerCriteria; + return this; + } + + public SellerRebateDto addOfferCriteriaItem(SellerRebateOfferCriterion offerCriteriaItem) { + if (this.offerCriteria == null) { + this.offerCriteria = new ArrayList<>(); + } + this.offerCriteria.add(offerCriteriaItem); + return this; + } + + /** + * What offers will be included + * @return offerCriteria + */ + @javax.annotation.Nonnull + public List getOfferCriteria() { + return offerCriteria; + } + + public void setOfferCriteria(@javax.annotation.Nonnull List offerCriteria) { + this.offerCriteria = offerCriteria; + } + + + public SellerRebateDto status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellerRebateDto sellerRebateDto = (SellerRebateDto) o; + return Objects.equals(this.benefits, sellerRebateDto.benefits) && + Objects.equals(this.createdAt, sellerRebateDto.createdAt) && + Objects.equals(this.id, sellerRebateDto.id) && + Objects.equals(this.offerCriteria, sellerRebateDto.offerCriteria) && + Objects.equals(this.status, sellerRebateDto.status); + } + + @Override + public int hashCode() { + return Objects.hash(benefits, createdAt, id, offerCriteria, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellerRebateDto {\n"); + sb.append(" benefits: ").append(toIndentedString(benefits)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" offerCriteria: ").append(toIndentedString(offerCriteria)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("benefits"); + openapiFields.add("createdAt"); + openapiFields.add("id"); + openapiFields.add("offerCriteria"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("benefits"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("offerCriteria"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellerRebateDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellerRebateDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellerRebateDto is not found in the empty JSON string", SellerRebateDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SellerRebateDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SellerRebateDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SellerRebateDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("benefits").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `benefits` to be an array in the JSON string but got `%s`", jsonObj.get("benefits").toString())); + } + + JsonArray jsonArraybenefits = jsonObj.getAsJsonArray("benefits"); + // validate the required field `benefits` (array) + for (int i = 0; i < jsonArraybenefits.size(); i++) { + Benefit.validateJsonElement(jsonArraybenefits.get(i)); + }; + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("offerCriteria").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerCriteria` to be an array in the JSON string but got `%s`", jsonObj.get("offerCriteria").toString())); + } + + JsonArray jsonArrayofferCriteria = jsonObj.getAsJsonArray("offerCriteria"); + // validate the required field `offerCriteria` (array) + for (int i = 0; i < jsonArrayofferCriteria.size(); i++) { + SellerRebateOfferCriterion.validateJsonElement(jsonArrayofferCriteria.get(i)); + }; + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SellerRebateDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SellerRebateDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SellerRebateDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SellerRebateDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SellerRebateDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SellerRebateDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellerRebateDto + * @throws IOException if the JSON string is invalid with respect to SellerRebateDto + */ + public static SellerRebateDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellerRebateDto.class); + } + + /** + * Convert an instance of SellerRebateDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellerRebateOfferCriterion.java b/src/main/java/pl/wtx/allegro/api/client/model/SellerRebateOfferCriterion.java new file mode 100644 index 0000000..ce24690 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellerRebateOfferCriterion.java @@ -0,0 +1,322 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.SellerRebateOfferCriterionOffersInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SellerRebateOfferCriterion + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellerRebateOfferCriterion { + public static final String SERIALIZED_NAME_OFFERS = "offers"; + @SerializedName(SERIALIZED_NAME_OFFERS) + @javax.annotation.Nullable + private List offers = new ArrayList<>(); + + /** + * Criteria type: CONTAINS_OFFERS or OFFERS_ASSIGNED_EXTERNALLY + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CONTAINS_OFFERS("CONTAINS_OFFERS"), + + OFFERS_ASSIGNED_EXTERNALLY("OFFERS_ASSIGNED_EXTERNALLY"), + + ALL_OFFERS("ALL_OFFERS"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public SellerRebateOfferCriterion() { + } + + public SellerRebateOfferCriterion offers(@javax.annotation.Nullable List offers) { + this.offers = offers; + return this; + } + + public SellerRebateOfferCriterion addOffersItem(SellerRebateOfferCriterionOffersInner offersItem) { + if (this.offers == null) { + this.offers = new ArrayList<>(); + } + this.offers.add(offersItem); + return this; + } + + /** + * Set of offers – only if `type` is `CONTAINS_OFFERS` + * @return offers + */ + @javax.annotation.Nullable + public List getOffers() { + return offers; + } + + public void setOffers(@javax.annotation.Nullable List offers) { + this.offers = offers; + } + + + public SellerRebateOfferCriterion type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Criteria type: CONTAINS_OFFERS or OFFERS_ASSIGNED_EXTERNALLY + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellerRebateOfferCriterion sellerRebateOfferCriterion = (SellerRebateOfferCriterion) o; + return Objects.equals(this.offers, sellerRebateOfferCriterion.offers) && + Objects.equals(this.type, sellerRebateOfferCriterion.type); + } + + @Override + public int hashCode() { + return Objects.hash(offers, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellerRebateOfferCriterion {\n"); + sb.append(" offers: ").append(toIndentedString(offers)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offers"); + openapiFields.add("type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellerRebateOfferCriterion + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellerRebateOfferCriterion.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellerRebateOfferCriterion is not found in the empty JSON string", SellerRebateOfferCriterion.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SellerRebateOfferCriterion.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SellerRebateOfferCriterion` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SellerRebateOfferCriterion.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("offers") != null && !jsonObj.get("offers").isJsonNull()) { + JsonArray jsonArrayoffers = jsonObj.getAsJsonArray("offers"); + if (jsonArrayoffers != null) { + // ensure the json data is an array + if (!jsonObj.get("offers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offers` to be an array in the JSON string but got `%s`", jsonObj.get("offers").toString())); + } + + // validate the optional field `offers` (array) + for (int i = 0; i < jsonArrayoffers.size(); i++) { + SellerRebateOfferCriterionOffersInner.validateJsonElement(jsonArrayoffers.get(i)); + }; + } + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SellerRebateOfferCriterion.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SellerRebateOfferCriterion' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SellerRebateOfferCriterion.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SellerRebateOfferCriterion value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SellerRebateOfferCriterion read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SellerRebateOfferCriterion given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellerRebateOfferCriterion + * @throws IOException if the JSON string is invalid with respect to SellerRebateOfferCriterion + */ + public static SellerRebateOfferCriterion fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellerRebateOfferCriterion.class); + } + + /** + * Convert an instance of SellerRebateOfferCriterion to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellerRebateOfferCriterionOffersInner.java b/src/main/java/pl/wtx/allegro/api/client/model/SellerRebateOfferCriterionOffersInner.java new file mode 100644 index 0000000..97d7574 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellerRebateOfferCriterionOffersInner.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SellerRebateOfferCriterionOffersInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellerRebateOfferCriterionOffersInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public SellerRebateOfferCriterionOffersInner() { + } + + public SellerRebateOfferCriterionOffersInner id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Offer id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellerRebateOfferCriterionOffersInner sellerRebateOfferCriterionOffersInner = (SellerRebateOfferCriterionOffersInner) o; + return Objects.equals(this.id, sellerRebateOfferCriterionOffersInner.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellerRebateOfferCriterionOffersInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellerRebateOfferCriterionOffersInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellerRebateOfferCriterionOffersInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellerRebateOfferCriterionOffersInner is not found in the empty JSON string", SellerRebateOfferCriterionOffersInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SellerRebateOfferCriterionOffersInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SellerRebateOfferCriterionOffersInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SellerRebateOfferCriterionOffersInner.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SellerRebateOfferCriterionOffersInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SellerRebateOfferCriterionOffersInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SellerRebateOfferCriterionOffersInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SellerRebateOfferCriterionOffersInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SellerRebateOfferCriterionOffersInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SellerRebateOfferCriterionOffersInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellerRebateOfferCriterionOffersInner + * @throws IOException if the JSON string is invalid with respect to SellerRebateOfferCriterionOffersInner + */ + public static SellerRebateOfferCriterionOffersInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellerRebateOfferCriterionOffersInner.class); + } + + /** + * Convert an instance of SellerRebateOfferCriterionOffersInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellerRebatesDto.java b/src/main/java/pl/wtx/allegro/api/client/model/SellerRebatesDto.java new file mode 100644 index 0000000..484509a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellerRebatesDto.java @@ -0,0 +1,261 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.SellerRebateDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SellerRebatesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellerRebatesDto { + public static final String SERIALIZED_NAME_PROMOTIONS = "promotions"; + @SerializedName(SERIALIZED_NAME_PROMOTIONS) + @javax.annotation.Nonnull + private List promotions = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nonnull + private Long totalCount; + + public SellerRebatesDto() { + } + + public SellerRebatesDto promotions(@javax.annotation.Nonnull List promotions) { + this.promotions = promotions; + return this; + } + + public SellerRebatesDto addPromotionsItem(SellerRebateDto promotionsItem) { + if (this.promotions == null) { + this.promotions = new ArrayList<>(); + } + this.promotions.add(promotionsItem); + return this; + } + + /** + * Get promotions + * @return promotions + */ + @javax.annotation.Nonnull + public List getPromotions() { + return promotions; + } + + public void setPromotions(@javax.annotation.Nonnull List promotions) { + this.promotions = promotions; + } + + + public SellerRebatesDto totalCount(@javax.annotation.Nonnull Long totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Get totalCount + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nonnull + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nonnull Long totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellerRebatesDto sellerRebatesDto = (SellerRebatesDto) o; + return Objects.equals(this.promotions, sellerRebatesDto.promotions) && + Objects.equals(this.totalCount, sellerRebatesDto.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(promotions, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellerRebatesDto {\n"); + sb.append(" promotions: ").append(toIndentedString(promotions)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("promotions"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("promotions"); + openapiRequiredFields.add("totalCount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellerRebatesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellerRebatesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellerRebatesDto is not found in the empty JSON string", SellerRebatesDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SellerRebatesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SellerRebatesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SellerRebatesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("promotions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `promotions` to be an array in the JSON string but got `%s`", jsonObj.get("promotions").toString())); + } + + JsonArray jsonArraypromotions = jsonObj.getAsJsonArray("promotions"); + // validate the required field `promotions` (array) + for (int i = 0; i < jsonArraypromotions.size(); i++) { + SellerRebateDto.validateJsonElement(jsonArraypromotions.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SellerRebatesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SellerRebatesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SellerRebatesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SellerRebatesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SellerRebatesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SellerRebatesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellerRebatesDto + * @throws IOException if the JSON string is invalid with respect to SellerRebatesDto + */ + public static SellerRebatesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellerRebatesDto.class); + } + + /** + * Convert an instance of SellerRebatesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellerReference.java b/src/main/java/pl/wtx/allegro/api/client/model/SellerReference.java new file mode 100644 index 0000000..6929230 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellerReference.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Seller identifier + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellerReference { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public SellerReference() { + } + + public SellerReference id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellerReference sellerReference = (SellerReference) o; + return Objects.equals(this.id, sellerReference.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellerReference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellerReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellerReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellerReference is not found in the empty JSON string", SellerReference.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SellerReference.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SellerReference` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SellerReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SellerReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SellerReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SellerReference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SellerReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SellerReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SellerReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellerReference + * @throws IOException if the JSON string is invalid with respect to SellerReference + */ + public static SellerReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellerReference.class); + } + + /** + * Convert an instance of SellerReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellingMode.java b/src/main/java/pl/wtx/allegro/api/client/model/SellingMode.java new file mode 100644 index 0000000..7be1c62 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellingMode.java @@ -0,0 +1,304 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BuyNowPrice; +import pl.wtx.allegro.api.client.model.MinimalPrice; +import pl.wtx.allegro.api.client.model.SellingModeFormat; +import pl.wtx.allegro.api.client.model.StartingPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information on the offer's selling mode. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellingMode { + public static final String SERIALIZED_NAME_FORMAT = "format"; + @SerializedName(SERIALIZED_NAME_FORMAT) + @javax.annotation.Nullable + private SellingModeFormat format; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private BuyNowPrice price; + + public static final String SERIALIZED_NAME_MINIMAL_PRICE = "minimalPrice"; + @SerializedName(SERIALIZED_NAME_MINIMAL_PRICE) + @javax.annotation.Nullable + private MinimalPrice minimalPrice; + + public static final String SERIALIZED_NAME_STARTING_PRICE = "startingPrice"; + @SerializedName(SERIALIZED_NAME_STARTING_PRICE) + @javax.annotation.Nullable + private StartingPrice startingPrice; + + public SellingMode() { + } + + public SellingMode format(@javax.annotation.Nullable SellingModeFormat format) { + this.format = format; + return this; + } + + /** + * Get format + * @return format + */ + @javax.annotation.Nullable + public SellingModeFormat getFormat() { + return format; + } + + public void setFormat(@javax.annotation.Nullable SellingModeFormat format) { + this.format = format; + } + + + public SellingMode price(@javax.annotation.Nullable BuyNowPrice price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nullable + public BuyNowPrice getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable BuyNowPrice price) { + this.price = price; + } + + + public SellingMode minimalPrice(@javax.annotation.Nullable MinimalPrice minimalPrice) { + this.minimalPrice = minimalPrice; + return this; + } + + /** + * Get minimalPrice + * @return minimalPrice + */ + @javax.annotation.Nullable + public MinimalPrice getMinimalPrice() { + return minimalPrice; + } + + public void setMinimalPrice(@javax.annotation.Nullable MinimalPrice minimalPrice) { + this.minimalPrice = minimalPrice; + } + + + public SellingMode startingPrice(@javax.annotation.Nullable StartingPrice startingPrice) { + this.startingPrice = startingPrice; + return this; + } + + /** + * Get startingPrice + * @return startingPrice + */ + @javax.annotation.Nullable + public StartingPrice getStartingPrice() { + return startingPrice; + } + + public void setStartingPrice(@javax.annotation.Nullable StartingPrice startingPrice) { + this.startingPrice = startingPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellingMode sellingMode = (SellingMode) o; + return Objects.equals(this.format, sellingMode.format) && + Objects.equals(this.price, sellingMode.price) && + Objects.equals(this.minimalPrice, sellingMode.minimalPrice) && + Objects.equals(this.startingPrice, sellingMode.startingPrice); + } + + @Override + public int hashCode() { + return Objects.hash(format, price, minimalPrice, startingPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellingMode {\n"); + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" minimalPrice: ").append(toIndentedString(minimalPrice)).append("\n"); + sb.append(" startingPrice: ").append(toIndentedString(startingPrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("format"); + openapiFields.add("price"); + openapiFields.add("minimalPrice"); + openapiFields.add("startingPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellingMode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellingMode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellingMode is not found in the empty JSON string", SellingMode.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SellingMode.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SellingMode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `format` + if (jsonObj.get("format") != null && !jsonObj.get("format").isJsonNull()) { + SellingModeFormat.validateJsonElement(jsonObj.get("format")); + } + // validate the optional field `price` + if (jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) { + BuyNowPrice.validateJsonElement(jsonObj.get("price")); + } + // validate the optional field `minimalPrice` + if (jsonObj.get("minimalPrice") != null && !jsonObj.get("minimalPrice").isJsonNull()) { + MinimalPrice.validateJsonElement(jsonObj.get("minimalPrice")); + } + // validate the optional field `startingPrice` + if (jsonObj.get("startingPrice") != null && !jsonObj.get("startingPrice").isJsonNull()) { + StartingPrice.validateJsonElement(jsonObj.get("startingPrice")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SellingMode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SellingMode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SellingMode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SellingMode value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SellingMode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SellingMode given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellingMode + * @throws IOException if the JSON string is invalid with respect to SellingMode + */ + public static SellingMode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellingMode.class); + } + + /** + * Convert an instance of SellingMode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellingModeFormat.java b/src/main/java/pl/wtx/allegro/api/client/model/SellingModeFormat.java new file mode 100644 index 0000000..4a17dae --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellingModeFormat.java @@ -0,0 +1,80 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The selling format of the offer. + */ +@JsonAdapter(SellingModeFormat.Adapter.class) +public enum SellingModeFormat { + + BUY_NOW("BUY_NOW"), + + AUCTION("AUCTION"), + + ADVERTISEMENT("ADVERTISEMENT"); + + private String value; + + SellingModeFormat(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SellingModeFormat fromValue(String value) { + for (SellingModeFormat b : SellingModeFormat.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SellingModeFormat enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SellingModeFormat read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SellingModeFormat.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SellingModeFormat.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SellingModeWithNetPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/SellingModeWithNetPrice.java new file mode 100644 index 0000000..82e07da --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SellingModeWithNetPrice.java @@ -0,0 +1,336 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BuyNowPrice; +import pl.wtx.allegro.api.client.model.MinimalPrice; +import pl.wtx.allegro.api.client.model.NetPrice; +import pl.wtx.allegro.api.client.model.SellingModeFormat; +import pl.wtx.allegro.api.client.model.StartingPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information on the offer's selling mode. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SellingModeWithNetPrice { + public static final String SERIALIZED_NAME_FORMAT = "format"; + @SerializedName(SERIALIZED_NAME_FORMAT) + @javax.annotation.Nullable + private SellingModeFormat format; + + public static final String SERIALIZED_NAME_PRICE = "price"; + @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable + private BuyNowPrice price; + + public static final String SERIALIZED_NAME_MINIMAL_PRICE = "minimalPrice"; + @SerializedName(SERIALIZED_NAME_MINIMAL_PRICE) + @javax.annotation.Nullable + private MinimalPrice minimalPrice; + + public static final String SERIALIZED_NAME_STARTING_PRICE = "startingPrice"; + @SerializedName(SERIALIZED_NAME_STARTING_PRICE) + @javax.annotation.Nullable + private StartingPrice startingPrice; + + public static final String SERIALIZED_NAME_NET_PRICE = "netPrice"; + @SerializedName(SERIALIZED_NAME_NET_PRICE) + @javax.annotation.Nullable + private NetPrice netPrice; + + public SellingModeWithNetPrice() { + } + + public SellingModeWithNetPrice format(@javax.annotation.Nullable SellingModeFormat format) { + this.format = format; + return this; + } + + /** + * Get format + * @return format + */ + @javax.annotation.Nullable + public SellingModeFormat getFormat() { + return format; + } + + public void setFormat(@javax.annotation.Nullable SellingModeFormat format) { + this.format = format; + } + + + public SellingModeWithNetPrice price(@javax.annotation.Nullable BuyNowPrice price) { + this.price = price; + return this; + } + + /** + * Get price + * @return price + */ + @javax.annotation.Nullable + public BuyNowPrice getPrice() { + return price; + } + + public void setPrice(@javax.annotation.Nullable BuyNowPrice price) { + this.price = price; + } + + + public SellingModeWithNetPrice minimalPrice(@javax.annotation.Nullable MinimalPrice minimalPrice) { + this.minimalPrice = minimalPrice; + return this; + } + + /** + * Get minimalPrice + * @return minimalPrice + */ + @javax.annotation.Nullable + public MinimalPrice getMinimalPrice() { + return minimalPrice; + } + + public void setMinimalPrice(@javax.annotation.Nullable MinimalPrice minimalPrice) { + this.minimalPrice = minimalPrice; + } + + + public SellingModeWithNetPrice startingPrice(@javax.annotation.Nullable StartingPrice startingPrice) { + this.startingPrice = startingPrice; + return this; + } + + /** + * Get startingPrice + * @return startingPrice + */ + @javax.annotation.Nullable + public StartingPrice getStartingPrice() { + return startingPrice; + } + + public void setStartingPrice(@javax.annotation.Nullable StartingPrice startingPrice) { + this.startingPrice = startingPrice; + } + + + public SellingModeWithNetPrice netPrice(@javax.annotation.Nullable NetPrice netPrice) { + this.netPrice = netPrice; + return this; + } + + /** + * Get netPrice + * @return netPrice + */ + @javax.annotation.Nullable + public NetPrice getNetPrice() { + return netPrice; + } + + public void setNetPrice(@javax.annotation.Nullable NetPrice netPrice) { + this.netPrice = netPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SellingModeWithNetPrice sellingModeWithNetPrice = (SellingModeWithNetPrice) o; + return Objects.equals(this.format, sellingModeWithNetPrice.format) && + Objects.equals(this.price, sellingModeWithNetPrice.price) && + Objects.equals(this.minimalPrice, sellingModeWithNetPrice.minimalPrice) && + Objects.equals(this.startingPrice, sellingModeWithNetPrice.startingPrice) && + Objects.equals(this.netPrice, sellingModeWithNetPrice.netPrice); + } + + @Override + public int hashCode() { + return Objects.hash(format, price, minimalPrice, startingPrice, netPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SellingModeWithNetPrice {\n"); + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" price: ").append(toIndentedString(price)).append("\n"); + sb.append(" minimalPrice: ").append(toIndentedString(minimalPrice)).append("\n"); + sb.append(" startingPrice: ").append(toIndentedString(startingPrice)).append("\n"); + sb.append(" netPrice: ").append(toIndentedString(netPrice)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("format"); + openapiFields.add("price"); + openapiFields.add("minimalPrice"); + openapiFields.add("startingPrice"); + openapiFields.add("netPrice"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SellingModeWithNetPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SellingModeWithNetPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SellingModeWithNetPrice is not found in the empty JSON string", SellingModeWithNetPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SellingModeWithNetPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SellingModeWithNetPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `format` + if (jsonObj.get("format") != null && !jsonObj.get("format").isJsonNull()) { + SellingModeFormat.validateJsonElement(jsonObj.get("format")); + } + // validate the optional field `price` + if (jsonObj.get("price") != null && !jsonObj.get("price").isJsonNull()) { + BuyNowPrice.validateJsonElement(jsonObj.get("price")); + } + // validate the optional field `minimalPrice` + if (jsonObj.get("minimalPrice") != null && !jsonObj.get("minimalPrice").isJsonNull()) { + MinimalPrice.validateJsonElement(jsonObj.get("minimalPrice")); + } + // validate the optional field `startingPrice` + if (jsonObj.get("startingPrice") != null && !jsonObj.get("startingPrice").isJsonNull()) { + StartingPrice.validateJsonElement(jsonObj.get("startingPrice")); + } + // validate the optional field `netPrice` + if (jsonObj.get("netPrice") != null && !jsonObj.get("netPrice").isJsonNull()) { + NetPrice.validateJsonElement(jsonObj.get("netPrice")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SellingModeWithNetPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SellingModeWithNetPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SellingModeWithNetPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SellingModeWithNetPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SellingModeWithNetPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SellingModeWithNetPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of SellingModeWithNetPrice + * @throws IOException if the JSON string is invalid with respect to SellingModeWithNetPrice + */ + public static SellingModeWithNetPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SellingModeWithNetPrice.class); + } + + /** + * Convert an instance of SellingModeWithNetPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SenderAddressDto.java b/src/main/java/pl/wtx/allegro/api/client/model/SenderAddressDto.java new file mode 100644 index 0000000..7215019 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SenderAddressDto.java @@ -0,0 +1,489 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Shipment owner data. This address will be provided on label and will be used to operation return. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SenderAddressDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_COMPANY = "company"; + @SerializedName(SERIALIZED_NAME_COMPANY) + @javax.annotation.Nullable + private String company; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_POSTAL_CODE = "postalCode"; + @SerializedName(SERIALIZED_NAME_POSTAL_CODE) + @javax.annotation.Nonnull + private String postalCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nullable + private String state; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode = "PL"; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nonnull + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nonnull + private String phone; + + public static final String SERIALIZED_NAME_POINT = "point"; + @SerializedName(SERIALIZED_NAME_POINT) + @javax.annotation.Nullable + private String point; + + public SenderAddressDto() { + } + + public SenderAddressDto name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Person name. Name or Company are required. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SenderAddressDto company(@javax.annotation.Nullable String company) { + this.company = company; + return this; + } + + /** + * Company name. Name or Company are required. + * @return company + */ + @javax.annotation.Nullable + public String getCompany() { + return company; + } + + public void setCompany(@javax.annotation.Nullable String company) { + this.company = company; + } + + + public SenderAddressDto street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Get street + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public SenderAddressDto postalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * Get postalCode + * @return postalCode + */ + @javax.annotation.Nonnull + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + } + + + public SenderAddressDto city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * Get city + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public SenderAddressDto state(@javax.annotation.Nullable String state) { + this.state = state; + return this; + } + + /** + * Required for shipments to Ireland( county name ), United States ( state abbreviation / ISO code ), Canada ( province postal code / ISO code ) + * @return state + */ + @javax.annotation.Nullable + public String getState() { + return state; + } + + public void setState(@javax.annotation.Nullable String state) { + this.state = state; + } + + + public SenderAddressDto countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code in ISO 3166-1 alfa-2 format (two-letter code). + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + public SenderAddressDto email(@javax.annotation.Nonnull String email) { + this.email = email; + return this; + } + + /** + * Email address. For receiver, must be a valid buyer email generated by Allegro (eg. hamu7udk3p+17454c1b6@allegromail.pl). + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nonnull String email) { + this.email = email; + } + + + public SenderAddressDto phone(@javax.annotation.Nonnull String phone) { + this.phone = phone; + return this; + } + + /** + * Cell phone + * @return phone + */ + @javax.annotation.Nonnull + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nonnull String phone) { + this.phone = phone; + } + + + public SenderAddressDto point(@javax.annotation.Nullable String point) { + this.point = point; + return this; + } + + /** + * Drop off point id. You can get it directly from courier service. + * @return point + */ + @javax.annotation.Nullable + public String getPoint() { + return point; + } + + public void setPoint(@javax.annotation.Nullable String point) { + this.point = point; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SenderAddressDto senderAddressDto = (SenderAddressDto) o; + return Objects.equals(this.name, senderAddressDto.name) && + Objects.equals(this.company, senderAddressDto.company) && + Objects.equals(this.street, senderAddressDto.street) && + Objects.equals(this.postalCode, senderAddressDto.postalCode) && + Objects.equals(this.city, senderAddressDto.city) && + Objects.equals(this.state, senderAddressDto.state) && + Objects.equals(this.countryCode, senderAddressDto.countryCode) && + Objects.equals(this.email, senderAddressDto.email) && + Objects.equals(this.phone, senderAddressDto.phone) && + Objects.equals(this.point, senderAddressDto.point); + } + + @Override + public int hashCode() { + return Objects.hash(name, company, street, postalCode, city, state, countryCode, email, phone, point); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SenderAddressDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" company: ").append(toIndentedString(company)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" point: ").append(toIndentedString(point)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("company"); + openapiFields.add("street"); + openapiFields.add("postalCode"); + openapiFields.add("city"); + openapiFields.add("state"); + openapiFields.add("countryCode"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("point"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("postalCode"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("countryCode"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SenderAddressDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SenderAddressDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SenderAddressDto is not found in the empty JSON string", SenderAddressDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SenderAddressDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SenderAddressDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SenderAddressDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("company") != null && !jsonObj.get("company").isJsonNull()) && !jsonObj.get("company").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `company` to be a primitive type in the JSON string but got `%s`", jsonObj.get("company").toString())); + } + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("postalCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postalCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postalCode").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + if ((jsonObj.get("point") != null && !jsonObj.get("point").isJsonNull()) && !jsonObj.get("point").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `point` to be a primitive type in the JSON string but got `%s`", jsonObj.get("point").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SenderAddressDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SenderAddressDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SenderAddressDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SenderAddressDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SenderAddressDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SenderAddressDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SenderAddressDto + * @throws IOException if the JSON string is invalid with respect to SenderAddressDto + */ + public static SenderAddressDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SenderAddressDto.class); + } + + /** + * Convert an instance of SenderAddressDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCancelCommandDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCancelCommandDto.java new file mode 100644 index 0000000..bdfff31 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCancelCommandDto.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ShipmentCancelRequestDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ShipmentCancelCommandDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShipmentCancelCommandDto { + public static final String SERIALIZED_NAME_COMMAND_ID = "commandId"; + @SerializedName(SERIALIZED_NAME_COMMAND_ID) + @javax.annotation.Nullable + private String commandId; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nonnull + private ShipmentCancelRequestDto input; + + public ShipmentCancelCommandDto() { + } + + public ShipmentCancelCommandDto commandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + return this; + } + + /** + * Command UUID. If empty, then system generate new one. + * @return commandId + */ + @javax.annotation.Nullable + public String getCommandId() { + return commandId; + } + + public void setCommandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + } + + + public ShipmentCancelCommandDto input(@javax.annotation.Nonnull ShipmentCancelRequestDto input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nonnull + public ShipmentCancelRequestDto getInput() { + return input; + } + + public void setInput(@javax.annotation.Nonnull ShipmentCancelRequestDto input) { + this.input = input; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShipmentCancelCommandDto shipmentCancelCommandDto = (ShipmentCancelCommandDto) o; + return Objects.equals(this.commandId, shipmentCancelCommandDto.commandId) && + Objects.equals(this.input, shipmentCancelCommandDto.input); + } + + @Override + public int hashCode() { + return Objects.hash(commandId, input); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShipmentCancelCommandDto {\n"); + sb.append(" commandId: ").append(toIndentedString(commandId)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("commandId"); + openapiFields.add("input"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("input"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShipmentCancelCommandDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShipmentCancelCommandDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShipmentCancelCommandDto is not found in the empty JSON string", ShipmentCancelCommandDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShipmentCancelCommandDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShipmentCancelCommandDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ShipmentCancelCommandDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("commandId") != null && !jsonObj.get("commandId").isJsonNull()) && !jsonObj.get("commandId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commandId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commandId").toString())); + } + // validate the required field `input` + ShipmentCancelRequestDto.validateJsonElement(jsonObj.get("input")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShipmentCancelCommandDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShipmentCancelCommandDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShipmentCancelCommandDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShipmentCancelCommandDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShipmentCancelCommandDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShipmentCancelCommandDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShipmentCancelCommandDto + * @throws IOException if the JSON string is invalid with respect to ShipmentCancelCommandDto + */ + public static ShipmentCancelCommandDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShipmentCancelCommandDto.class); + } + + /** + * Convert an instance of ShipmentCancelCommandDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCancelRequestDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCancelRequestDto.java new file mode 100644 index 0000000..cd76475 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCancelRequestDto.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ShipmentCancelRequestDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShipmentCancelRequestDto { + public static final String SERIALIZED_NAME_SHIPMENT_ID = "shipmentId"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_ID) + @javax.annotation.Nonnull + private String shipmentId; + + public ShipmentCancelRequestDto() { + } + + public ShipmentCancelRequestDto shipmentId(@javax.annotation.Nonnull String shipmentId) { + this.shipmentId = shipmentId; + return this; + } + + /** + * Get shipmentId + * @return shipmentId + */ + @javax.annotation.Nonnull + public String getShipmentId() { + return shipmentId; + } + + public void setShipmentId(@javax.annotation.Nonnull String shipmentId) { + this.shipmentId = shipmentId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShipmentCancelRequestDto shipmentCancelRequestDto = (ShipmentCancelRequestDto) o; + return Objects.equals(this.shipmentId, shipmentCancelRequestDto.shipmentId); + } + + @Override + public int hashCode() { + return Objects.hash(shipmentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShipmentCancelRequestDto {\n"); + sb.append(" shipmentId: ").append(toIndentedString(shipmentId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shipmentId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("shipmentId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShipmentCancelRequestDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShipmentCancelRequestDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShipmentCancelRequestDto is not found in the empty JSON string", ShipmentCancelRequestDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShipmentCancelRequestDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShipmentCancelRequestDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ShipmentCancelRequestDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("shipmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `shipmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shipmentId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShipmentCancelRequestDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShipmentCancelRequestDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShipmentCancelRequestDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShipmentCancelRequestDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShipmentCancelRequestDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShipmentCancelRequestDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShipmentCancelRequestDto + * @throws IOException if the JSON string is invalid with respect to ShipmentCancelRequestDto + */ + public static ShipmentCancelRequestDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShipmentCancelRequestDto.class); + } + + /** + * Convert an instance of ShipmentCancelRequestDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCreateCommandDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCreateCommandDto.java new file mode 100644 index 0000000..cfe29dd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCreateCommandDto.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ShipmentCreateRequestDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ShipmentCreateCommandDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShipmentCreateCommandDto { + public static final String SERIALIZED_NAME_COMMAND_ID = "commandId"; + @SerializedName(SERIALIZED_NAME_COMMAND_ID) + @javax.annotation.Nullable + private String commandId; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nonnull + private ShipmentCreateRequestDto input; + + public ShipmentCreateCommandDto() { + } + + public ShipmentCreateCommandDto commandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + return this; + } + + /** + * Command UUID. If empty, then system generate new one. + * @return commandId + */ + @javax.annotation.Nullable + public String getCommandId() { + return commandId; + } + + public void setCommandId(@javax.annotation.Nullable String commandId) { + this.commandId = commandId; + } + + + public ShipmentCreateCommandDto input(@javax.annotation.Nonnull ShipmentCreateRequestDto input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nonnull + public ShipmentCreateRequestDto getInput() { + return input; + } + + public void setInput(@javax.annotation.Nonnull ShipmentCreateRequestDto input) { + this.input = input; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShipmentCreateCommandDto shipmentCreateCommandDto = (ShipmentCreateCommandDto) o; + return Objects.equals(this.commandId, shipmentCreateCommandDto.commandId) && + Objects.equals(this.input, shipmentCreateCommandDto.input); + } + + @Override + public int hashCode() { + return Objects.hash(commandId, input); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShipmentCreateCommandDto {\n"); + sb.append(" commandId: ").append(toIndentedString(commandId)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("commandId"); + openapiFields.add("input"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("input"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShipmentCreateCommandDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShipmentCreateCommandDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShipmentCreateCommandDto is not found in the empty JSON string", ShipmentCreateCommandDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShipmentCreateCommandDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShipmentCreateCommandDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ShipmentCreateCommandDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("commandId") != null && !jsonObj.get("commandId").isJsonNull()) && !jsonObj.get("commandId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commandId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commandId").toString())); + } + // validate the required field `input` + ShipmentCreateRequestDto.validateJsonElement(jsonObj.get("input")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShipmentCreateCommandDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShipmentCreateCommandDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShipmentCreateCommandDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShipmentCreateCommandDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShipmentCreateCommandDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShipmentCreateCommandDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShipmentCreateCommandDto + * @throws IOException if the JSON string is invalid with respect to ShipmentCreateCommandDto + */ + public static ShipmentCreateCommandDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShipmentCreateCommandDto.class); + } + + /** + * Convert an instance of ShipmentCreateCommandDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCreateRequestDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCreateRequestDto.java new file mode 100644 index 0000000..6bf272b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentCreateRequestDto.java @@ -0,0 +1,648 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import pl.wtx.allegro.api.client.model.CashOnDeliveryDto; +import pl.wtx.allegro.api.client.model.InsuranceDto; +import pl.wtx.allegro.api.client.model.PackageRequestDto; +import pl.wtx.allegro.api.client.model.ReceiverAddressDto; +import pl.wtx.allegro.api.client.model.SenderAddressDto; +import pl.wtx.allegro.api.client.model.ShipmentPickupAddressDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ShipmentCreateRequestDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShipmentCreateRequestDto { + public static final String SERIALIZED_NAME_DELIVERY_METHOD_ID = "deliveryMethodId"; + @SerializedName(SERIALIZED_NAME_DELIVERY_METHOD_ID) + @javax.annotation.Nonnull + private String deliveryMethodId; + + public static final String SERIALIZED_NAME_CREDENTIALS_ID = "credentialsId"; + @SerializedName(SERIALIZED_NAME_CREDENTIALS_ID) + @javax.annotation.Nullable + private String credentialsId; + + public static final String SERIALIZED_NAME_SENDER = "sender"; + @SerializedName(SERIALIZED_NAME_SENDER) + @javax.annotation.Nonnull + private SenderAddressDto sender; + + public static final String SERIALIZED_NAME_RECEIVER = "receiver"; + @SerializedName(SERIALIZED_NAME_RECEIVER) + @javax.annotation.Nonnull + private ReceiverAddressDto receiver; + + public static final String SERIALIZED_NAME_PICKUP = "pickup"; + @Deprecated + @SerializedName(SERIALIZED_NAME_PICKUP) + @javax.annotation.Nullable + private ShipmentPickupAddressDto pickup; + + public static final String SERIALIZED_NAME_REFERENCE_NUMBER = "referenceNumber"; + @SerializedName(SERIALIZED_NAME_REFERENCE_NUMBER) + @javax.annotation.Nullable + private String referenceNumber; + + public static final String SERIALIZED_NAME_PACKAGES = "packages"; + @SerializedName(SERIALIZED_NAME_PACKAGES) + @javax.annotation.Nonnull + private List packages = new ArrayList<>(); + + public static final String SERIALIZED_NAME_INSURANCE = "insurance"; + @SerializedName(SERIALIZED_NAME_INSURANCE) + @javax.annotation.Nullable + private InsuranceDto insurance; + + public static final String SERIALIZED_NAME_CASH_ON_DELIVERY = "cashOnDelivery"; + @SerializedName(SERIALIZED_NAME_CASH_ON_DELIVERY) + @javax.annotation.Nullable + private CashOnDeliveryDto cashOnDelivery; + + /** + * Label file format. + */ + @JsonAdapter(LabelFormatEnum.Adapter.class) + public enum LabelFormatEnum { + PDF("PDF"), + + ZPL("ZPL"); + + private String value; + + LabelFormatEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static LabelFormatEnum fromValue(String value) { + for (LabelFormatEnum b : LabelFormatEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final LabelFormatEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public LabelFormatEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return LabelFormatEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + LabelFormatEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_LABEL_FORMAT = "labelFormat"; + @SerializedName(SERIALIZED_NAME_LABEL_FORMAT) + @javax.annotation.Nullable + private LabelFormatEnum labelFormat; + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private List additionalServices = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ADDITIONAL_PROPERTIES = "additionalProperties"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_PROPERTIES) + @javax.annotation.Nullable + private Map additionalProperties = new HashMap<>(); + + public ShipmentCreateRequestDto() { + } + + public ShipmentCreateRequestDto deliveryMethodId(@javax.annotation.Nonnull String deliveryMethodId) { + this.deliveryMethodId = deliveryMethodId; + return this; + } + + /** + * Id of delivery method, chosen by buyer in order. + * @return deliveryMethodId + */ + @javax.annotation.Nonnull + public String getDeliveryMethodId() { + return deliveryMethodId; + } + + public void setDeliveryMethodId(@javax.annotation.Nonnull String deliveryMethodId) { + this.deliveryMethodId = deliveryMethodId; + } + + + public ShipmentCreateRequestDto credentialsId(@javax.annotation.Nullable String credentialsId) { + this.credentialsId = credentialsId; + return this; + } + + /** + * ID of merchant agreement, registered in WZA. Value should be read from /shipment-management/delivery-services. For Allegro Standard methods, this field should be null. + * @return credentialsId + */ + @javax.annotation.Nullable + public String getCredentialsId() { + return credentialsId; + } + + public void setCredentialsId(@javax.annotation.Nullable String credentialsId) { + this.credentialsId = credentialsId; + } + + + public ShipmentCreateRequestDto sender(@javax.annotation.Nonnull SenderAddressDto sender) { + this.sender = sender; + return this; + } + + /** + * Get sender + * @return sender + */ + @javax.annotation.Nonnull + public SenderAddressDto getSender() { + return sender; + } + + public void setSender(@javax.annotation.Nonnull SenderAddressDto sender) { + this.sender = sender; + } + + + public ShipmentCreateRequestDto receiver(@javax.annotation.Nonnull ReceiverAddressDto receiver) { + this.receiver = receiver; + return this; + } + + /** + * Get receiver + * @return receiver + */ + @javax.annotation.Nonnull + public ReceiverAddressDto getReceiver() { + return receiver; + } + + public void setReceiver(@javax.annotation.Nonnull ReceiverAddressDto receiver) { + this.receiver = receiver; + } + + + @Deprecated + public ShipmentCreateRequestDto pickup(@javax.annotation.Nullable ShipmentPickupAddressDto pickup) { + this.pickup = pickup; + return this; + } + + /** + * Get pickup + * @return pickup + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public ShipmentPickupAddressDto getPickup() { + return pickup; + } + + @Deprecated + public void setPickup(@javax.annotation.Nullable ShipmentPickupAddressDto pickup) { + this.pickup = pickup; + } + + + public ShipmentCreateRequestDto referenceNumber(@javax.annotation.Nullable String referenceNumber) { + this.referenceNumber = referenceNumber; + return this; + } + + /** + * Shipment identifier in own system. Example: `Ordering number`. + * @return referenceNumber + */ + @javax.annotation.Nullable + public String getReferenceNumber() { + return referenceNumber; + } + + public void setReferenceNumber(@javax.annotation.Nullable String referenceNumber) { + this.referenceNumber = referenceNumber; + } + + + public ShipmentCreateRequestDto packages(@javax.annotation.Nonnull List packages) { + this.packages = packages; + return this; + } + + public ShipmentCreateRequestDto addPackagesItem(PackageRequestDto packagesItem) { + if (this.packages == null) { + this.packages = new ArrayList<>(); + } + this.packages.add(packagesItem); + return this; + } + + /** + * Get packages + * @return packages + */ + @javax.annotation.Nonnull + public List getPackages() { + return packages; + } + + public void setPackages(@javax.annotation.Nonnull List packages) { + this.packages = packages; + } + + + public ShipmentCreateRequestDto insurance(@javax.annotation.Nullable InsuranceDto insurance) { + this.insurance = insurance; + return this; + } + + /** + * Get insurance + * @return insurance + */ + @javax.annotation.Nullable + public InsuranceDto getInsurance() { + return insurance; + } + + public void setInsurance(@javax.annotation.Nullable InsuranceDto insurance) { + this.insurance = insurance; + } + + + public ShipmentCreateRequestDto cashOnDelivery(@javax.annotation.Nullable CashOnDeliveryDto cashOnDelivery) { + this.cashOnDelivery = cashOnDelivery; + return this; + } + + /** + * Get cashOnDelivery + * @return cashOnDelivery + */ + @javax.annotation.Nullable + public CashOnDeliveryDto getCashOnDelivery() { + return cashOnDelivery; + } + + public void setCashOnDelivery(@javax.annotation.Nullable CashOnDeliveryDto cashOnDelivery) { + this.cashOnDelivery = cashOnDelivery; + } + + + public ShipmentCreateRequestDto labelFormat(@javax.annotation.Nullable LabelFormatEnum labelFormat) { + this.labelFormat = labelFormat; + return this; + } + + /** + * Label file format. + * @return labelFormat + */ + @javax.annotation.Nullable + public LabelFormatEnum getLabelFormat() { + return labelFormat; + } + + public void setLabelFormat(@javax.annotation.Nullable LabelFormatEnum labelFormat) { + this.labelFormat = labelFormat; + } + + + public ShipmentCreateRequestDto additionalServices(@javax.annotation.Nullable List additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + public ShipmentCreateRequestDto addAdditionalServicesItem(String additionalServicesItem) { + if (this.additionalServices == null) { + this.additionalServices = new ArrayList<>(); + } + this.additionalServices.add(additionalServicesItem); + return this; + } + + /** + * List of additional services. + * @return additionalServices + */ + @javax.annotation.Nullable + public List getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable List additionalServices) { + this.additionalServices = additionalServices; + } + + + public ShipmentCreateRequestDto additionalProperties(@javax.annotation.Nullable Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + public ShipmentCreateRequestDto putAdditionalPropertiesItem(String key, String additionalPropertiesItem) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<>(); + } + this.additionalProperties.put(key, additionalPropertiesItem); + return this; + } + + /** + * Key-Value map defining non-standard, carrier specific features. List of the supported properties is located as sub-resource in /shipment-management/delivery-services. + * @return additionalProperties + */ + @javax.annotation.Nullable + public Map getAdditionalProperties() { + return additionalProperties; + } + + public void setAdditionalProperties(@javax.annotation.Nullable Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShipmentCreateRequestDto shipmentCreateRequestDto = (ShipmentCreateRequestDto) o; + return Objects.equals(this.deliveryMethodId, shipmentCreateRequestDto.deliveryMethodId) && + Objects.equals(this.credentialsId, shipmentCreateRequestDto.credentialsId) && + Objects.equals(this.sender, shipmentCreateRequestDto.sender) && + Objects.equals(this.receiver, shipmentCreateRequestDto.receiver) && + Objects.equals(this.pickup, shipmentCreateRequestDto.pickup) && + Objects.equals(this.referenceNumber, shipmentCreateRequestDto.referenceNumber) && + Objects.equals(this.packages, shipmentCreateRequestDto.packages) && + Objects.equals(this.insurance, shipmentCreateRequestDto.insurance) && + Objects.equals(this.cashOnDelivery, shipmentCreateRequestDto.cashOnDelivery) && + Objects.equals(this.labelFormat, shipmentCreateRequestDto.labelFormat) && + Objects.equals(this.additionalServices, shipmentCreateRequestDto.additionalServices) && + Objects.equals(this.additionalProperties, shipmentCreateRequestDto.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(deliveryMethodId, credentialsId, sender, receiver, pickup, referenceNumber, packages, insurance, cashOnDelivery, labelFormat, additionalServices, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShipmentCreateRequestDto {\n"); + sb.append(" deliveryMethodId: ").append(toIndentedString(deliveryMethodId)).append("\n"); + sb.append(" credentialsId: ").append(toIndentedString(credentialsId)).append("\n"); + sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); + sb.append(" receiver: ").append(toIndentedString(receiver)).append("\n"); + sb.append(" pickup: ").append(toIndentedString(pickup)).append("\n"); + sb.append(" referenceNumber: ").append(toIndentedString(referenceNumber)).append("\n"); + sb.append(" packages: ").append(toIndentedString(packages)).append("\n"); + sb.append(" insurance: ").append(toIndentedString(insurance)).append("\n"); + sb.append(" cashOnDelivery: ").append(toIndentedString(cashOnDelivery)).append("\n"); + sb.append(" labelFormat: ").append(toIndentedString(labelFormat)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("deliveryMethodId"); + openapiFields.add("credentialsId"); + openapiFields.add("sender"); + openapiFields.add("receiver"); + openapiFields.add("pickup"); + openapiFields.add("referenceNumber"); + openapiFields.add("packages"); + openapiFields.add("insurance"); + openapiFields.add("cashOnDelivery"); + openapiFields.add("labelFormat"); + openapiFields.add("additionalServices"); + openapiFields.add("additionalProperties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("deliveryMethodId"); + openapiRequiredFields.add("sender"); + openapiRequiredFields.add("receiver"); + openapiRequiredFields.add("packages"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShipmentCreateRequestDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShipmentCreateRequestDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShipmentCreateRequestDto is not found in the empty JSON string", ShipmentCreateRequestDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShipmentCreateRequestDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShipmentCreateRequestDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ShipmentCreateRequestDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("deliveryMethodId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `deliveryMethodId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deliveryMethodId").toString())); + } + if ((jsonObj.get("credentialsId") != null && !jsonObj.get("credentialsId").isJsonNull()) && !jsonObj.get("credentialsId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `credentialsId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("credentialsId").toString())); + } + // validate the required field `sender` + SenderAddressDto.validateJsonElement(jsonObj.get("sender")); + // validate the required field `receiver` + ReceiverAddressDto.validateJsonElement(jsonObj.get("receiver")); + // validate the optional field `pickup` + if (jsonObj.get("pickup") != null && !jsonObj.get("pickup").isJsonNull()) { + ShipmentPickupAddressDto.validateJsonElement(jsonObj.get("pickup")); + } + if ((jsonObj.get("referenceNumber") != null && !jsonObj.get("referenceNumber").isJsonNull()) && !jsonObj.get("referenceNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `referenceNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("referenceNumber").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("packages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `packages` to be an array in the JSON string but got `%s`", jsonObj.get("packages").toString())); + } + + JsonArray jsonArraypackages = jsonObj.getAsJsonArray("packages"); + // validate the required field `packages` (array) + for (int i = 0; i < jsonArraypackages.size(); i++) { + PackageRequestDto.validateJsonElement(jsonArraypackages.get(i)); + }; + // validate the optional field `insurance` + if (jsonObj.get("insurance") != null && !jsonObj.get("insurance").isJsonNull()) { + InsuranceDto.validateJsonElement(jsonObj.get("insurance")); + } + // validate the optional field `cashOnDelivery` + if (jsonObj.get("cashOnDelivery") != null && !jsonObj.get("cashOnDelivery").isJsonNull()) { + CashOnDeliveryDto.validateJsonElement(jsonObj.get("cashOnDelivery")); + } + if ((jsonObj.get("labelFormat") != null && !jsonObj.get("labelFormat").isJsonNull()) && !jsonObj.get("labelFormat").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `labelFormat` to be a primitive type in the JSON string but got `%s`", jsonObj.get("labelFormat").toString())); + } + // validate the optional field `labelFormat` + if (jsonObj.get("labelFormat") != null && !jsonObj.get("labelFormat").isJsonNull()) { + LabelFormatEnum.validateJsonElement(jsonObj.get("labelFormat")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull() && !jsonObj.get("additionalServices").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalServices` to be an array in the JSON string but got `%s`", jsonObj.get("additionalServices").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShipmentCreateRequestDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShipmentCreateRequestDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShipmentCreateRequestDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShipmentCreateRequestDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShipmentCreateRequestDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShipmentCreateRequestDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShipmentCreateRequestDto + * @throws IOException if the JSON string is invalid with respect to ShipmentCreateRequestDto + */ + public static ShipmentCreateRequestDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShipmentCreateRequestDto.class); + } + + /** + * Convert an instance of ShipmentCreateRequestDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShipmentDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentDto.java new file mode 100644 index 0000000..b941822 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentDto.java @@ -0,0 +1,833 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import pl.wtx.allegro.api.client.model.CashOnDeliveryDto; +import pl.wtx.allegro.api.client.model.InsuranceDto; +import pl.wtx.allegro.api.client.model.PackageDto; +import pl.wtx.allegro.api.client.model.ReceiverAddressDto; +import pl.wtx.allegro.api.client.model.SenderAddressDto; +import pl.wtx.allegro.api.client.model.ShipmentPickupAddressDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ShipmentDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShipmentDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_DELIVERY_METHOD_ID = "deliveryMethodId"; + @SerializedName(SERIALIZED_NAME_DELIVERY_METHOD_ID) + @javax.annotation.Nullable + private String deliveryMethodId; + + public static final String SERIALIZED_NAME_CREDENTIALS_ID = "credentialsId"; + @SerializedName(SERIALIZED_NAME_CREDENTIALS_ID) + @javax.annotation.Nullable + private String credentialsId; + + public static final String SERIALIZED_NAME_SENDER = "sender"; + @SerializedName(SERIALIZED_NAME_SENDER) + @javax.annotation.Nullable + private SenderAddressDto sender; + + public static final String SERIALIZED_NAME_RECEIVER = "receiver"; + @SerializedName(SERIALIZED_NAME_RECEIVER) + @javax.annotation.Nullable + private ReceiverAddressDto receiver; + + public static final String SERIALIZED_NAME_PICKUP = "pickup"; + @Deprecated + @SerializedName(SERIALIZED_NAME_PICKUP) + @javax.annotation.Nullable + private ShipmentPickupAddressDto pickup; + + public static final String SERIALIZED_NAME_REFERENCE_NUMBER = "referenceNumber"; + @SerializedName(SERIALIZED_NAME_REFERENCE_NUMBER) + @javax.annotation.Nullable + private String referenceNumber; + + public static final String SERIALIZED_NAME_PACKAGES = "packages"; + @SerializedName(SERIALIZED_NAME_PACKAGES) + @javax.annotation.Nullable + private List packages = new ArrayList<>(); + + public static final String SERIALIZED_NAME_INSURANCE = "insurance"; + @SerializedName(SERIALIZED_NAME_INSURANCE) + @javax.annotation.Nullable + private InsuranceDto insurance; + + public static final String SERIALIZED_NAME_CASH_ON_DELIVERY = "cashOnDelivery"; + @SerializedName(SERIALIZED_NAME_CASH_ON_DELIVERY) + @javax.annotation.Nullable + private CashOnDeliveryDto cashOnDelivery; + + public static final String SERIALIZED_NAME_CREATED_DATE = "createdDate"; + @SerializedName(SERIALIZED_NAME_CREATED_DATE) + @javax.annotation.Nullable + private String createdDate; + + public static final String SERIALIZED_NAME_CANCELED_DATE = "canceledDate"; + @SerializedName(SERIALIZED_NAME_CANCELED_DATE) + @javax.annotation.Nullable + private String canceledDate; + + public static final String SERIALIZED_NAME_CARRIER = "carrier"; + @SerializedName(SERIALIZED_NAME_CARRIER) + @javax.annotation.Nullable + private String carrier; + + /** + * Label file format. + */ + @JsonAdapter(LabelFormatEnum.Adapter.class) + public enum LabelFormatEnum { + PDF("PDF"), + + ZPL("ZPL"), + + EPL("EPL"); + + private String value; + + LabelFormatEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static LabelFormatEnum fromValue(String value) { + for (LabelFormatEnum b : LabelFormatEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final LabelFormatEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public LabelFormatEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return LabelFormatEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + LabelFormatEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_LABEL_FORMAT = "labelFormat"; + @SerializedName(SERIALIZED_NAME_LABEL_FORMAT) + @javax.annotation.Nullable + private LabelFormatEnum labelFormat; + + public static final String SERIALIZED_NAME_ADDITIONAL_SERVICES = "additionalServices"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_SERVICES) + @javax.annotation.Nullable + private List additionalServices = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ADDITIONAL_PROPERTIES = "additionalProperties"; + @SerializedName(SERIALIZED_NAME_ADDITIONAL_PROPERTIES) + @javax.annotation.Nullable + private Map additionalProperties = new HashMap<>(); + + public static final String SERIALIZED_NAME_TRANSPORT = "transport"; + @SerializedName(SERIALIZED_NAME_TRANSPORT) + @javax.annotation.Nullable + private List transport = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PICKUP_AVAILABLE = "pickupAvailable"; + @SerializedName(SERIALIZED_NAME_PICKUP_AVAILABLE) + @javax.annotation.Nullable + private Boolean pickupAvailable; + + public ShipmentDto() { + } + + public ShipmentDto id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ShipmentDto deliveryMethodId(@javax.annotation.Nullable String deliveryMethodId) { + this.deliveryMethodId = deliveryMethodId; + return this; + } + + /** + * Id of delivery method, chosen by buyer in order. + * @return deliveryMethodId + */ + @javax.annotation.Nullable + public String getDeliveryMethodId() { + return deliveryMethodId; + } + + public void setDeliveryMethodId(@javax.annotation.Nullable String deliveryMethodId) { + this.deliveryMethodId = deliveryMethodId; + } + + + public ShipmentDto credentialsId(@javax.annotation.Nullable String credentialsId) { + this.credentialsId = credentialsId; + return this; + } + + /** + * ID of merchant agreement, registered in WZA. For Allegro methods, this field is null. + * @return credentialsId + */ + @javax.annotation.Nullable + public String getCredentialsId() { + return credentialsId; + } + + public void setCredentialsId(@javax.annotation.Nullable String credentialsId) { + this.credentialsId = credentialsId; + } + + + public ShipmentDto sender(@javax.annotation.Nullable SenderAddressDto sender) { + this.sender = sender; + return this; + } + + /** + * Get sender + * @return sender + */ + @javax.annotation.Nullable + public SenderAddressDto getSender() { + return sender; + } + + public void setSender(@javax.annotation.Nullable SenderAddressDto sender) { + this.sender = sender; + } + + + public ShipmentDto receiver(@javax.annotation.Nullable ReceiverAddressDto receiver) { + this.receiver = receiver; + return this; + } + + /** + * Get receiver + * @return receiver + */ + @javax.annotation.Nullable + public ReceiverAddressDto getReceiver() { + return receiver; + } + + public void setReceiver(@javax.annotation.Nullable ReceiverAddressDto receiver) { + this.receiver = receiver; + } + + + @Deprecated + public ShipmentDto pickup(@javax.annotation.Nullable ShipmentPickupAddressDto pickup) { + this.pickup = pickup; + return this; + } + + /** + * Get pickup + * @return pickup + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public ShipmentPickupAddressDto getPickup() { + return pickup; + } + + @Deprecated + public void setPickup(@javax.annotation.Nullable ShipmentPickupAddressDto pickup) { + this.pickup = pickup; + } + + + public ShipmentDto referenceNumber(@javax.annotation.Nullable String referenceNumber) { + this.referenceNumber = referenceNumber; + return this; + } + + /** + * Shipment identifier in own system. Example: `Ordering number`. + * @return referenceNumber + */ + @javax.annotation.Nullable + public String getReferenceNumber() { + return referenceNumber; + } + + public void setReferenceNumber(@javax.annotation.Nullable String referenceNumber) { + this.referenceNumber = referenceNumber; + } + + + public ShipmentDto packages(@javax.annotation.Nullable List packages) { + this.packages = packages; + return this; + } + + public ShipmentDto addPackagesItem(PackageDto packagesItem) { + if (this.packages == null) { + this.packages = new ArrayList<>(); + } + this.packages.add(packagesItem); + return this; + } + + /** + * Get packages + * @return packages + */ + @javax.annotation.Nullable + public List getPackages() { + return packages; + } + + public void setPackages(@javax.annotation.Nullable List packages) { + this.packages = packages; + } + + + public ShipmentDto insurance(@javax.annotation.Nullable InsuranceDto insurance) { + this.insurance = insurance; + return this; + } + + /** + * Get insurance + * @return insurance + */ + @javax.annotation.Nullable + public InsuranceDto getInsurance() { + return insurance; + } + + public void setInsurance(@javax.annotation.Nullable InsuranceDto insurance) { + this.insurance = insurance; + } + + + public ShipmentDto cashOnDelivery(@javax.annotation.Nullable CashOnDeliveryDto cashOnDelivery) { + this.cashOnDelivery = cashOnDelivery; + return this; + } + + /** + * Get cashOnDelivery + * @return cashOnDelivery + */ + @javax.annotation.Nullable + public CashOnDeliveryDto getCashOnDelivery() { + return cashOnDelivery; + } + + public void setCashOnDelivery(@javax.annotation.Nullable CashOnDeliveryDto cashOnDelivery) { + this.cashOnDelivery = cashOnDelivery; + } + + + public ShipmentDto createdDate(@javax.annotation.Nullable String createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Shipment creation date + * @return createdDate + */ + @javax.annotation.Nullable + public String getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(@javax.annotation.Nullable String createdDate) { + this.createdDate = createdDate; + } + + + public ShipmentDto canceledDate(@javax.annotation.Nullable String canceledDate) { + this.canceledDate = canceledDate; + return this; + } + + /** + * Shipment cancellation date. Only for canceled shipments, in all other cases is null. + * @return canceledDate + */ + @javax.annotation.Nullable + public String getCanceledDate() { + return canceledDate; + } + + public void setCanceledDate(@javax.annotation.Nullable String canceledDate) { + this.canceledDate = canceledDate; + } + + + public ShipmentDto carrier(@javax.annotation.Nullable String carrier) { + this.carrier = carrier; + return this; + } + + /** + * ID of carrier which carries out a shipment + * @return carrier + */ + @javax.annotation.Nullable + public String getCarrier() { + return carrier; + } + + public void setCarrier(@javax.annotation.Nullable String carrier) { + this.carrier = carrier; + } + + + public ShipmentDto labelFormat(@javax.annotation.Nullable LabelFormatEnum labelFormat) { + this.labelFormat = labelFormat; + return this; + } + + /** + * Label file format. + * @return labelFormat + */ + @javax.annotation.Nullable + public LabelFormatEnum getLabelFormat() { + return labelFormat; + } + + public void setLabelFormat(@javax.annotation.Nullable LabelFormatEnum labelFormat) { + this.labelFormat = labelFormat; + } + + + public ShipmentDto additionalServices(@javax.annotation.Nullable List additionalServices) { + this.additionalServices = additionalServices; + return this; + } + + public ShipmentDto addAdditionalServicesItem(String additionalServicesItem) { + if (this.additionalServices == null) { + this.additionalServices = new ArrayList<>(); + } + this.additionalServices.add(additionalServicesItem); + return this; + } + + /** + * List of additional services. + * @return additionalServices + */ + @javax.annotation.Nullable + public List getAdditionalServices() { + return additionalServices; + } + + public void setAdditionalServices(@javax.annotation.Nullable List additionalServices) { + this.additionalServices = additionalServices; + } + + + public ShipmentDto additionalProperties(@javax.annotation.Nullable Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + public ShipmentDto putAdditionalPropertiesItem(String key, String additionalPropertiesItem) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<>(); + } + this.additionalProperties.put(key, additionalPropertiesItem); + return this; + } + + /** + * Key-Value map defining non-standard, carrier specific features. List of the supported properties is located as sub-resource in /shipment-management/delivery-services. + * @return additionalProperties + */ + @javax.annotation.Nullable + public Map getAdditionalProperties() { + return additionalProperties; + } + + public void setAdditionalProperties(@javax.annotation.Nullable Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + + public ShipmentDto transport(@javax.annotation.Nullable List transport) { + this.transport = transport; + return this; + } + + public ShipmentDto addTransportItem(String transportItem) { + if (this.transport == null) { + this.transport = new ArrayList<>(); + } + this.transport.add(transportItem); + return this; + } + + /** + * List with identifiers of the carriers that take part in the transport of this shipment. Often it is a single value list, when only one carrier is involved. There are shipments where multiple carriers are used to deliver the package, mainly in a case of international shipments, then there will be two or more values. + * @return transport + */ + @javax.annotation.Nullable + public List getTransport() { + return transport; + } + + public void setTransport(@javax.annotation.Nullable List transport) { + this.transport = transport; + } + + + public ShipmentDto pickupAvailable(@javax.annotation.Nullable Boolean pickupAvailable) { + this.pickupAvailable = pickupAvailable; + return this; + } + + /** + * Information about pickup order option availability for this shipment. True if it is possible to order a pickup for given shipment. + * @return pickupAvailable + */ + @javax.annotation.Nullable + public Boolean getPickupAvailable() { + return pickupAvailable; + } + + public void setPickupAvailable(@javax.annotation.Nullable Boolean pickupAvailable) { + this.pickupAvailable = pickupAvailable; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShipmentDto shipmentDto = (ShipmentDto) o; + return Objects.equals(this.id, shipmentDto.id) && + Objects.equals(this.deliveryMethodId, shipmentDto.deliveryMethodId) && + Objects.equals(this.credentialsId, shipmentDto.credentialsId) && + Objects.equals(this.sender, shipmentDto.sender) && + Objects.equals(this.receiver, shipmentDto.receiver) && + Objects.equals(this.pickup, shipmentDto.pickup) && + Objects.equals(this.referenceNumber, shipmentDto.referenceNumber) && + Objects.equals(this.packages, shipmentDto.packages) && + Objects.equals(this.insurance, shipmentDto.insurance) && + Objects.equals(this.cashOnDelivery, shipmentDto.cashOnDelivery) && + Objects.equals(this.createdDate, shipmentDto.createdDate) && + Objects.equals(this.canceledDate, shipmentDto.canceledDate) && + Objects.equals(this.carrier, shipmentDto.carrier) && + Objects.equals(this.labelFormat, shipmentDto.labelFormat) && + Objects.equals(this.additionalServices, shipmentDto.additionalServices) && + Objects.equals(this.additionalProperties, shipmentDto.additionalProperties) && + Objects.equals(this.transport, shipmentDto.transport) && + Objects.equals(this.pickupAvailable, shipmentDto.pickupAvailable); + } + + @Override + public int hashCode() { + return Objects.hash(id, deliveryMethodId, credentialsId, sender, receiver, pickup, referenceNumber, packages, insurance, cashOnDelivery, createdDate, canceledDate, carrier, labelFormat, additionalServices, additionalProperties, transport, pickupAvailable); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShipmentDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" deliveryMethodId: ").append(toIndentedString(deliveryMethodId)).append("\n"); + sb.append(" credentialsId: ").append(toIndentedString(credentialsId)).append("\n"); + sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); + sb.append(" receiver: ").append(toIndentedString(receiver)).append("\n"); + sb.append(" pickup: ").append(toIndentedString(pickup)).append("\n"); + sb.append(" referenceNumber: ").append(toIndentedString(referenceNumber)).append("\n"); + sb.append(" packages: ").append(toIndentedString(packages)).append("\n"); + sb.append(" insurance: ").append(toIndentedString(insurance)).append("\n"); + sb.append(" cashOnDelivery: ").append(toIndentedString(cashOnDelivery)).append("\n"); + sb.append(" createdDate: ").append(toIndentedString(createdDate)).append("\n"); + sb.append(" canceledDate: ").append(toIndentedString(canceledDate)).append("\n"); + sb.append(" carrier: ").append(toIndentedString(carrier)).append("\n"); + sb.append(" labelFormat: ").append(toIndentedString(labelFormat)).append("\n"); + sb.append(" additionalServices: ").append(toIndentedString(additionalServices)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append(" transport: ").append(toIndentedString(transport)).append("\n"); + sb.append(" pickupAvailable: ").append(toIndentedString(pickupAvailable)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("deliveryMethodId"); + openapiFields.add("credentialsId"); + openapiFields.add("sender"); + openapiFields.add("receiver"); + openapiFields.add("pickup"); + openapiFields.add("referenceNumber"); + openapiFields.add("packages"); + openapiFields.add("insurance"); + openapiFields.add("cashOnDelivery"); + openapiFields.add("createdDate"); + openapiFields.add("canceledDate"); + openapiFields.add("carrier"); + openapiFields.add("labelFormat"); + openapiFields.add("additionalServices"); + openapiFields.add("additionalProperties"); + openapiFields.add("transport"); + openapiFields.add("pickupAvailable"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShipmentDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShipmentDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShipmentDto is not found in the empty JSON string", ShipmentDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShipmentDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShipmentDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("deliveryMethodId") != null && !jsonObj.get("deliveryMethodId").isJsonNull()) && !jsonObj.get("deliveryMethodId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `deliveryMethodId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deliveryMethodId").toString())); + } + if ((jsonObj.get("credentialsId") != null && !jsonObj.get("credentialsId").isJsonNull()) && !jsonObj.get("credentialsId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `credentialsId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("credentialsId").toString())); + } + // validate the optional field `sender` + if (jsonObj.get("sender") != null && !jsonObj.get("sender").isJsonNull()) { + SenderAddressDto.validateJsonElement(jsonObj.get("sender")); + } + // validate the optional field `receiver` + if (jsonObj.get("receiver") != null && !jsonObj.get("receiver").isJsonNull()) { + ReceiverAddressDto.validateJsonElement(jsonObj.get("receiver")); + } + // validate the optional field `pickup` + if (jsonObj.get("pickup") != null && !jsonObj.get("pickup").isJsonNull()) { + ShipmentPickupAddressDto.validateJsonElement(jsonObj.get("pickup")); + } + if ((jsonObj.get("referenceNumber") != null && !jsonObj.get("referenceNumber").isJsonNull()) && !jsonObj.get("referenceNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `referenceNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("referenceNumber").toString())); + } + if (jsonObj.get("packages") != null && !jsonObj.get("packages").isJsonNull()) { + JsonArray jsonArraypackages = jsonObj.getAsJsonArray("packages"); + if (jsonArraypackages != null) { + // ensure the json data is an array + if (!jsonObj.get("packages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `packages` to be an array in the JSON string but got `%s`", jsonObj.get("packages").toString())); + } + + // validate the optional field `packages` (array) + for (int i = 0; i < jsonArraypackages.size(); i++) { + PackageDto.validateJsonElement(jsonArraypackages.get(i)); + }; + } + } + // validate the optional field `insurance` + if (jsonObj.get("insurance") != null && !jsonObj.get("insurance").isJsonNull()) { + InsuranceDto.validateJsonElement(jsonObj.get("insurance")); + } + // validate the optional field `cashOnDelivery` + if (jsonObj.get("cashOnDelivery") != null && !jsonObj.get("cashOnDelivery").isJsonNull()) { + CashOnDeliveryDto.validateJsonElement(jsonObj.get("cashOnDelivery")); + } + if ((jsonObj.get("createdDate") != null && !jsonObj.get("createdDate").isJsonNull()) && !jsonObj.get("createdDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdDate").toString())); + } + if ((jsonObj.get("canceledDate") != null && !jsonObj.get("canceledDate").isJsonNull()) && !jsonObj.get("canceledDate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `canceledDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("canceledDate").toString())); + } + if ((jsonObj.get("carrier") != null && !jsonObj.get("carrier").isJsonNull()) && !jsonObj.get("carrier").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `carrier` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrier").toString())); + } + if ((jsonObj.get("labelFormat") != null && !jsonObj.get("labelFormat").isJsonNull()) && !jsonObj.get("labelFormat").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `labelFormat` to be a primitive type in the JSON string but got `%s`", jsonObj.get("labelFormat").toString())); + } + // validate the optional field `labelFormat` + if (jsonObj.get("labelFormat") != null && !jsonObj.get("labelFormat").isJsonNull()) { + LabelFormatEnum.validateJsonElement(jsonObj.get("labelFormat")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("additionalServices") != null && !jsonObj.get("additionalServices").isJsonNull() && !jsonObj.get("additionalServices").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `additionalServices` to be an array in the JSON string but got `%s`", jsonObj.get("additionalServices").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("transport") != null && !jsonObj.get("transport").isJsonNull() && !jsonObj.get("transport").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `transport` to be an array in the JSON string but got `%s`", jsonObj.get("transport").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShipmentDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShipmentDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShipmentDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShipmentDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShipmentDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShipmentDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShipmentDto + * @throws IOException if the JSON string is invalid with respect to ShipmentDto + */ + public static ShipmentDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShipmentDto.class); + } + + /** + * Convert an instance of ShipmentDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShipmentIdsDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentIdsDto.java new file mode 100644 index 0000000..62856ba --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentIdsDto.java @@ -0,0 +1,227 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ShipmentIdsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShipmentIdsDto { + public static final String SERIALIZED_NAME_SHIPMENT_IDS = "shipmentIds"; + @SerializedName(SERIALIZED_NAME_SHIPMENT_IDS) + @javax.annotation.Nonnull + private List shipmentIds = new ArrayList<>(); + + public ShipmentIdsDto() { + } + + public ShipmentIdsDto shipmentIds(@javax.annotation.Nonnull List shipmentIds) { + this.shipmentIds = shipmentIds; + return this; + } + + public ShipmentIdsDto addShipmentIdsItem(String shipmentIdsItem) { + if (this.shipmentIds == null) { + this.shipmentIds = new ArrayList<>(); + } + this.shipmentIds.add(shipmentIdsItem); + return this; + } + + /** + * Get shipmentIds + * @return shipmentIds + */ + @javax.annotation.Nonnull + public List getShipmentIds() { + return shipmentIds; + } + + public void setShipmentIds(@javax.annotation.Nonnull List shipmentIds) { + this.shipmentIds = shipmentIds; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShipmentIdsDto shipmentIdsDto = (ShipmentIdsDto) o; + return Objects.equals(this.shipmentIds, shipmentIdsDto.shipmentIds); + } + + @Override + public int hashCode() { + return Objects.hash(shipmentIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShipmentIdsDto {\n"); + sb.append(" shipmentIds: ").append(toIndentedString(shipmentIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("shipmentIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("shipmentIds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShipmentIdsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShipmentIdsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShipmentIdsDto is not found in the empty JSON string", ShipmentIdsDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShipmentIdsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShipmentIdsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ShipmentIdsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("shipmentIds") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("shipmentIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `shipmentIds` to be an array in the JSON string but got `%s`", jsonObj.get("shipmentIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShipmentIdsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShipmentIdsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShipmentIdsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShipmentIdsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShipmentIdsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShipmentIdsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShipmentIdsDto + * @throws IOException if the JSON string is invalid with respect to ShipmentIdsDto + */ + public static ShipmentIdsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShipmentIdsDto.class); + } + + /** + * Convert an instance of ShipmentIdsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShipmentPickupAddressDto.java b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentPickupAddressDto.java new file mode 100644 index 0000000..7e855be --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShipmentPickupAddressDto.java @@ -0,0 +1,491 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Optional pickup address with optional drop-off point. If empty, then sender object will be used. Parameter is deprecated and will be removed in the future. Pickup address should be provided when requesting Pickup. + * @deprecated + */ +@Deprecated +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShipmentPickupAddressDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_COMPANY = "company"; + @SerializedName(SERIALIZED_NAME_COMPANY) + @javax.annotation.Nullable + private String company; + + public static final String SERIALIZED_NAME_STREET = "street"; + @SerializedName(SERIALIZED_NAME_STREET) + @javax.annotation.Nonnull + private String street; + + public static final String SERIALIZED_NAME_POSTAL_CODE = "postalCode"; + @SerializedName(SERIALIZED_NAME_POSTAL_CODE) + @javax.annotation.Nonnull + private String postalCode; + + public static final String SERIALIZED_NAME_CITY = "city"; + @SerializedName(SERIALIZED_NAME_CITY) + @javax.annotation.Nonnull + private String city; + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nullable + private String state; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nonnull + private String countryCode = "PL"; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nonnull + private String email; + + public static final String SERIALIZED_NAME_PHONE = "phone"; + @SerializedName(SERIALIZED_NAME_PHONE) + @javax.annotation.Nonnull + private String phone; + + public static final String SERIALIZED_NAME_POINT = "point"; + @SerializedName(SERIALIZED_NAME_POINT) + @javax.annotation.Nullable + private String point; + + public ShipmentPickupAddressDto() { + } + + public ShipmentPickupAddressDto name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Person name. Name or Company are required. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ShipmentPickupAddressDto company(@javax.annotation.Nullable String company) { + this.company = company; + return this; + } + + /** + * Company name. Name or Company are required. + * @return company + */ + @javax.annotation.Nullable + public String getCompany() { + return company; + } + + public void setCompany(@javax.annotation.Nullable String company) { + this.company = company; + } + + + public ShipmentPickupAddressDto street(@javax.annotation.Nonnull String street) { + this.street = street; + return this; + } + + /** + * Get street + * @return street + */ + @javax.annotation.Nonnull + public String getStreet() { + return street; + } + + public void setStreet(@javax.annotation.Nonnull String street) { + this.street = street; + } + + + public ShipmentPickupAddressDto postalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * Get postalCode + * @return postalCode + */ + @javax.annotation.Nonnull + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(@javax.annotation.Nonnull String postalCode) { + this.postalCode = postalCode; + } + + + public ShipmentPickupAddressDto city(@javax.annotation.Nonnull String city) { + this.city = city; + return this; + } + + /** + * Get city + * @return city + */ + @javax.annotation.Nonnull + public String getCity() { + return city; + } + + public void setCity(@javax.annotation.Nonnull String city) { + this.city = city; + } + + + public ShipmentPickupAddressDto state(@javax.annotation.Nullable String state) { + this.state = state; + return this; + } + + /** + * Required for shipments to Ireland( county name ), United States ( state abbreviation / ISO code ), Canada ( province postal code / ISO code ) + * @return state + */ + @javax.annotation.Nullable + public String getState() { + return state; + } + + public void setState(@javax.annotation.Nullable String state) { + this.state = state; + } + + + public ShipmentPickupAddressDto countryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code in ISO 3166-1 alfa-2 format (two-letter code). + * @return countryCode + */ + @javax.annotation.Nonnull + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nonnull String countryCode) { + this.countryCode = countryCode; + } + + + public ShipmentPickupAddressDto email(@javax.annotation.Nonnull String email) { + this.email = email; + return this; + } + + /** + * Email address. For receiver, must be a valid buyer email generated by Allegro (eg. hamu7udk3p+17454c1b6@allegromail.pl). + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nonnull String email) { + this.email = email; + } + + + public ShipmentPickupAddressDto phone(@javax.annotation.Nonnull String phone) { + this.phone = phone; + return this; + } + + /** + * Cell phone + * @return phone + */ + @javax.annotation.Nonnull + public String getPhone() { + return phone; + } + + public void setPhone(@javax.annotation.Nonnull String phone) { + this.phone = phone; + } + + + public ShipmentPickupAddressDto point(@javax.annotation.Nullable String point) { + this.point = point; + return this; + } + + /** + * Drop off point id. You can get it directly from courier service. + * @return point + */ + @javax.annotation.Nullable + public String getPoint() { + return point; + } + + public void setPoint(@javax.annotation.Nullable String point) { + this.point = point; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShipmentPickupAddressDto shipmentPickupAddressDto = (ShipmentPickupAddressDto) o; + return Objects.equals(this.name, shipmentPickupAddressDto.name) && + Objects.equals(this.company, shipmentPickupAddressDto.company) && + Objects.equals(this.street, shipmentPickupAddressDto.street) && + Objects.equals(this.postalCode, shipmentPickupAddressDto.postalCode) && + Objects.equals(this.city, shipmentPickupAddressDto.city) && + Objects.equals(this.state, shipmentPickupAddressDto.state) && + Objects.equals(this.countryCode, shipmentPickupAddressDto.countryCode) && + Objects.equals(this.email, shipmentPickupAddressDto.email) && + Objects.equals(this.phone, shipmentPickupAddressDto.phone) && + Objects.equals(this.point, shipmentPickupAddressDto.point); + } + + @Override + public int hashCode() { + return Objects.hash(name, company, street, postalCode, city, state, countryCode, email, phone, point); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShipmentPickupAddressDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" company: ").append(toIndentedString(company)).append("\n"); + sb.append(" street: ").append(toIndentedString(street)).append("\n"); + sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" point: ").append(toIndentedString(point)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("company"); + openapiFields.add("street"); + openapiFields.add("postalCode"); + openapiFields.add("city"); + openapiFields.add("state"); + openapiFields.add("countryCode"); + openapiFields.add("email"); + openapiFields.add("phone"); + openapiFields.add("point"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("street"); + openapiRequiredFields.add("postalCode"); + openapiRequiredFields.add("city"); + openapiRequiredFields.add("countryCode"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("phone"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShipmentPickupAddressDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShipmentPickupAddressDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShipmentPickupAddressDto is not found in the empty JSON string", ShipmentPickupAddressDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShipmentPickupAddressDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShipmentPickupAddressDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ShipmentPickupAddressDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("company") != null && !jsonObj.get("company").isJsonNull()) && !jsonObj.get("company").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `company` to be a primitive type in the JSON string but got `%s`", jsonObj.get("company").toString())); + } + if (!jsonObj.get("street").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `street` to be a primitive type in the JSON string but got `%s`", jsonObj.get("street").toString())); + } + if (!jsonObj.get("postalCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `postalCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postalCode").toString())); + } + if (!jsonObj.get("city").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("city").toString())); + } + if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if (!jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if (!jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("phone").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); + } + if ((jsonObj.get("point") != null && !jsonObj.get("point").isJsonNull()) && !jsonObj.get("point").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `point` to be a primitive type in the JSON string but got `%s`", jsonObj.get("point").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShipmentPickupAddressDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShipmentPickupAddressDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShipmentPickupAddressDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShipmentPickupAddressDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShipmentPickupAddressDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShipmentPickupAddressDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShipmentPickupAddressDto + * @throws IOException if the JSON string is invalid with respect to ShipmentPickupAddressDto + */ + public static ShipmentPickupAddressDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShipmentPickupAddressDto.class); + } + + /** + * Convert an instance of ShipmentPickupAddressDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Shipping.java b/src/main/java/pl/wtx/allegro/api/client/model/Shipping.java new file mode 100644 index 0000000..0460b1c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Shipping.java @@ -0,0 +1,183 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents information about package shipment. Constraints: * for method OWN_TRANSPORT: truckLicencePlate, estimatedTimeOfArrival and countryCode are required. * for method COURIER_BY_SELLER: courier, estimatedTimeOfArrival and countryCode are required. * for method THIRD_PARTY_DELIVERY: thirdParty, estimatedTimeOfArrival and countryCode are required. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Shipping { + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + @javax.annotation.Nonnull + protected String method; + + public Shipping() { + this.method = this.getClass().getSimpleName(); + } + + public Shipping method(@javax.annotation.Nonnull String method) { + this.method = method; + return this; + } + + /** + * The delivery method of the Advance Ship Notice. Not required when Advance Ship Notice in DRAFT status + * @return method + */ + @javax.annotation.Nonnull + public String getMethod() { + return method; + } + + public void setMethod(@javax.annotation.Nonnull String method) { + this.method = method; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Shipping shipping = (Shipping) o; + return Objects.equals(this.method, shipping.method); + } + + @Override + public int hashCode() { + return Objects.hash(method); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Shipping {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("method"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("method"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Shipping + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Shipping.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Shipping is not found in the empty JSON string", Shipping.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("method").getAsString(); + switch (discriminatorValue) { + case "COURIER_BY_SELLER": + CourierBySellerShipping.validateJsonElement(jsonElement); + break; + case "OWN_TRANSPORT": + OwnTransportShipping.validateJsonElement(jsonElement); + break; + case "THIRD_PARTY_DELIVERY": + ThirdPartyDeliveryShipping.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `method` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of Shipping given an JSON string + * + * @param jsonString JSON string + * @return An instance of Shipping + * @throws IOException if the JSON string is invalid with respect to Shipping + */ + public static Shipping fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Shipping.class); + } + + /** + * Convert an instance of Shipping to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShippingExtended.java b/src/main/java/pl/wtx/allegro/api/client/model/ShippingExtended.java new file mode 100644 index 0000000..59e75a8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShippingExtended.java @@ -0,0 +1,186 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents information about package shipment. Constraints: * for method OWN_TRANSPORT: truckLicencePlate, estimatedTimeOfArrival and countryCode are required. * for method COURIER_BY_SELLER: courier, estimatedTimeOfArrival and countryCode are required. * for method THIRD_PARTY_DELIVERY: thirdParty, estimatedTimeOfArrival and countryCode are required. * for method ALREADY_IN_WAREHOUSE: estimatedTimeOfArrival and countryCode are required. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShippingExtended { + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + @javax.annotation.Nonnull + protected String method; + + public ShippingExtended() { + this.method = this.getClass().getSimpleName(); + } + + public ShippingExtended method(@javax.annotation.Nonnull String method) { + this.method = method; + return this; + } + + /** + * The delivery method of the Advance Ship Notice. Not required when Advance Ship Notice in DRAFT status + * @return method + */ + @javax.annotation.Nonnull + public String getMethod() { + return method; + } + + public void setMethod(@javax.annotation.Nonnull String method) { + this.method = method; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShippingExtended shippingExtended = (ShippingExtended) o; + return Objects.equals(this.method, shippingExtended.method); + } + + @Override + public int hashCode() { + return Objects.hash(method); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShippingExtended {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("method"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("method"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShippingExtended + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShippingExtended.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShippingExtended is not found in the empty JSON string", ShippingExtended.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("method").getAsString(); + switch (discriminatorValue) { + case "ALREADY_IN_WAREHOUSE": + AlreadyInWarehouseShipping.validateJsonElement(jsonElement); + break; + case "COURIER_BY_SELLER": + CourierBySellerShipping.validateJsonElement(jsonElement); + break; + case "OWN_TRANSPORT": + OwnTransportShipping.validateJsonElement(jsonElement); + break; + case "THIRD_PARTY_DELIVERY": + ThirdPartyDeliveryShipping.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `method` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of ShippingExtended given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShippingExtended + * @throws IOException if the JSON string is invalid with respect to ShippingExtended + */ + public static ShippingExtended fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShippingExtended.class); + } + + /** + * Convert an instance of ShippingExtended to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShippingRate.java b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRate.java new file mode 100644 index 0000000..4e334e3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRate.java @@ -0,0 +1,369 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ShippingRateDeliveryMethod; +import pl.wtx.allegro.api.client.model.ShippingRateFirstItemRate; +import pl.wtx.allegro.api.client.model.ShippingRateMaxPackageWeight; +import pl.wtx.allegro.api.client.model.ShippingRateNextItemRate; +import pl.wtx.allegro.api.client.model.ShippingRateShippingTime; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ShippingRate + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShippingRate { + public static final String SERIALIZED_NAME_DELIVERY_METHOD = "deliveryMethod"; + @SerializedName(SERIALIZED_NAME_DELIVERY_METHOD) + @javax.annotation.Nonnull + private ShippingRateDeliveryMethod deliveryMethod; + + public static final String SERIALIZED_NAME_MAX_QUANTITY_PER_PACKAGE = "maxQuantityPerPackage"; + @SerializedName(SERIALIZED_NAME_MAX_QUANTITY_PER_PACKAGE) + @javax.annotation.Nonnull + private Integer maxQuantityPerPackage; + + public static final String SERIALIZED_NAME_MAX_PACKAGE_WEIGHT = "maxPackageWeight"; + @SerializedName(SERIALIZED_NAME_MAX_PACKAGE_WEIGHT) + @javax.annotation.Nullable + private ShippingRateMaxPackageWeight maxPackageWeight; + + public static final String SERIALIZED_NAME_FIRST_ITEM_RATE = "firstItemRate"; + @SerializedName(SERIALIZED_NAME_FIRST_ITEM_RATE) + @javax.annotation.Nonnull + private ShippingRateFirstItemRate firstItemRate; + + public static final String SERIALIZED_NAME_NEXT_ITEM_RATE = "nextItemRate"; + @SerializedName(SERIALIZED_NAME_NEXT_ITEM_RATE) + @javax.annotation.Nonnull + private ShippingRateNextItemRate nextItemRate; + + public static final String SERIALIZED_NAME_SHIPPING_TIME = "shippingTime"; + @SerializedName(SERIALIZED_NAME_SHIPPING_TIME) + @javax.annotation.Nullable + private ShippingRateShippingTime shippingTime; + + public ShippingRate() { + } + + public ShippingRate deliveryMethod(@javax.annotation.Nonnull ShippingRateDeliveryMethod deliveryMethod) { + this.deliveryMethod = deliveryMethod; + return this; + } + + /** + * Get deliveryMethod + * @return deliveryMethod + */ + @javax.annotation.Nonnull + public ShippingRateDeliveryMethod getDeliveryMethod() { + return deliveryMethod; + } + + public void setDeliveryMethod(@javax.annotation.Nonnull ShippingRateDeliveryMethod deliveryMethod) { + this.deliveryMethod = deliveryMethod; + } + + + public ShippingRate maxQuantityPerPackage(@javax.annotation.Nonnull Integer maxQuantityPerPackage) { + this.maxQuantityPerPackage = maxQuantityPerPackage; + return this; + } + + /** + * Maximum quantity per package for the given delivery method. Minimum value is 1. + * minimum: 1 + * @return maxQuantityPerPackage + */ + @javax.annotation.Nonnull + public Integer getMaxQuantityPerPackage() { + return maxQuantityPerPackage; + } + + public void setMaxQuantityPerPackage(@javax.annotation.Nonnull Integer maxQuantityPerPackage) { + this.maxQuantityPerPackage = maxQuantityPerPackage; + } + + + public ShippingRate maxPackageWeight(@javax.annotation.Nullable ShippingRateMaxPackageWeight maxPackageWeight) { + this.maxPackageWeight = maxPackageWeight; + return this; + } + + /** + * Get maxPackageWeight + * @return maxPackageWeight + */ + @javax.annotation.Nullable + public ShippingRateMaxPackageWeight getMaxPackageWeight() { + return maxPackageWeight; + } + + public void setMaxPackageWeight(@javax.annotation.Nullable ShippingRateMaxPackageWeight maxPackageWeight) { + this.maxPackageWeight = maxPackageWeight; + } + + + public ShippingRate firstItemRate(@javax.annotation.Nonnull ShippingRateFirstItemRate firstItemRate) { + this.firstItemRate = firstItemRate; + return this; + } + + /** + * Get firstItemRate + * @return firstItemRate + */ + @javax.annotation.Nonnull + public ShippingRateFirstItemRate getFirstItemRate() { + return firstItemRate; + } + + public void setFirstItemRate(@javax.annotation.Nonnull ShippingRateFirstItemRate firstItemRate) { + this.firstItemRate = firstItemRate; + } + + + public ShippingRate nextItemRate(@javax.annotation.Nonnull ShippingRateNextItemRate nextItemRate) { + this.nextItemRate = nextItemRate; + return this; + } + + /** + * Get nextItemRate + * @return nextItemRate + */ + @javax.annotation.Nonnull + public ShippingRateNextItemRate getNextItemRate() { + return nextItemRate; + } + + public void setNextItemRate(@javax.annotation.Nonnull ShippingRateNextItemRate nextItemRate) { + this.nextItemRate = nextItemRate; + } + + + public ShippingRate shippingTime(@javax.annotation.Nullable ShippingRateShippingTime shippingTime) { + this.shippingTime = shippingTime; + return this; + } + + /** + * Get shippingTime + * @return shippingTime + */ + @javax.annotation.Nullable + public ShippingRateShippingTime getShippingTime() { + return shippingTime; + } + + public void setShippingTime(@javax.annotation.Nullable ShippingRateShippingTime shippingTime) { + this.shippingTime = shippingTime; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShippingRate shippingRate = (ShippingRate) o; + return Objects.equals(this.deliveryMethod, shippingRate.deliveryMethod) && + Objects.equals(this.maxQuantityPerPackage, shippingRate.maxQuantityPerPackage) && + Objects.equals(this.maxPackageWeight, shippingRate.maxPackageWeight) && + Objects.equals(this.firstItemRate, shippingRate.firstItemRate) && + Objects.equals(this.nextItemRate, shippingRate.nextItemRate) && + Objects.equals(this.shippingTime, shippingRate.shippingTime); + } + + @Override + public int hashCode() { + return Objects.hash(deliveryMethod, maxQuantityPerPackage, maxPackageWeight, firstItemRate, nextItemRate, shippingTime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShippingRate {\n"); + sb.append(" deliveryMethod: ").append(toIndentedString(deliveryMethod)).append("\n"); + sb.append(" maxQuantityPerPackage: ").append(toIndentedString(maxQuantityPerPackage)).append("\n"); + sb.append(" maxPackageWeight: ").append(toIndentedString(maxPackageWeight)).append("\n"); + sb.append(" firstItemRate: ").append(toIndentedString(firstItemRate)).append("\n"); + sb.append(" nextItemRate: ").append(toIndentedString(nextItemRate)).append("\n"); + sb.append(" shippingTime: ").append(toIndentedString(shippingTime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("deliveryMethod"); + openapiFields.add("maxQuantityPerPackage"); + openapiFields.add("maxPackageWeight"); + openapiFields.add("firstItemRate"); + openapiFields.add("nextItemRate"); + openapiFields.add("shippingTime"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("deliveryMethod"); + openapiRequiredFields.add("maxQuantityPerPackage"); + openapiRequiredFields.add("firstItemRate"); + openapiRequiredFields.add("nextItemRate"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShippingRate + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShippingRate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShippingRate is not found in the empty JSON string", ShippingRate.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShippingRate.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShippingRate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ShippingRate.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `deliveryMethod` + ShippingRateDeliveryMethod.validateJsonElement(jsonObj.get("deliveryMethod")); + // validate the optional field `maxPackageWeight` + if (jsonObj.get("maxPackageWeight") != null && !jsonObj.get("maxPackageWeight").isJsonNull()) { + ShippingRateMaxPackageWeight.validateJsonElement(jsonObj.get("maxPackageWeight")); + } + // validate the required field `firstItemRate` + ShippingRateFirstItemRate.validateJsonElement(jsonObj.get("firstItemRate")); + // validate the required field `nextItemRate` + ShippingRateNextItemRate.validateJsonElement(jsonObj.get("nextItemRate")); + // validate the optional field `shippingTime` + if (jsonObj.get("shippingTime") != null && !jsonObj.get("shippingTime").isJsonNull()) { + ShippingRateShippingTime.validateJsonElement(jsonObj.get("shippingTime")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShippingRate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShippingRate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShippingRate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShippingRate value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShippingRate read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShippingRate given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShippingRate + * @throws IOException if the JSON string is invalid with respect to ShippingRate + */ + public static ShippingRate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShippingRate.class); + } + + /** + * Convert an instance of ShippingRate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateDeliveryMethod.java b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateDeliveryMethod.java new file mode 100644 index 0000000..d23bfb1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateDeliveryMethod.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ShippingRateDeliveryMethod + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShippingRateDeliveryMethod { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ShippingRateDeliveryMethod() { + } + + public ShippingRateDeliveryMethod id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * ID of the delivery method + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShippingRateDeliveryMethod shippingRateDeliveryMethod = (ShippingRateDeliveryMethod) o; + return Objects.equals(this.id, shippingRateDeliveryMethod.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShippingRateDeliveryMethod {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShippingRateDeliveryMethod + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShippingRateDeliveryMethod.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShippingRateDeliveryMethod is not found in the empty JSON string", ShippingRateDeliveryMethod.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShippingRateDeliveryMethod.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShippingRateDeliveryMethod` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShippingRateDeliveryMethod.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShippingRateDeliveryMethod' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShippingRateDeliveryMethod.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShippingRateDeliveryMethod value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShippingRateDeliveryMethod read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShippingRateDeliveryMethod given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShippingRateDeliveryMethod + * @throws IOException if the JSON string is invalid with respect to ShippingRateDeliveryMethod + */ + public static ShippingRateDeliveryMethod fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShippingRateDeliveryMethod.class); + } + + /** + * Convert an instance of ShippingRateDeliveryMethod to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateFirstItemRate.java b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateFirstItemRate.java new file mode 100644 index 0000000..7044692 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateFirstItemRate.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Rate for the first item in the parcel for the given delivery method. The rate amount and currency must comply with the shippingRatesConstraints.firstItemRate restrictions described in the delivery-methods resource. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShippingRateFirstItemRate { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public ShippingRateFirstItemRate() { + } + + public ShippingRateFirstItemRate amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public ShippingRateFirstItemRate currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * ISO 4217 currency code + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShippingRateFirstItemRate shippingRateFirstItemRate = (ShippingRateFirstItemRate) o; + return Objects.equals(this.amount, shippingRateFirstItemRate.amount) && + Objects.equals(this.currency, shippingRateFirstItemRate.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShippingRateFirstItemRate {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShippingRateFirstItemRate + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShippingRateFirstItemRate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShippingRateFirstItemRate is not found in the empty JSON string", ShippingRateFirstItemRate.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShippingRateFirstItemRate.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShippingRateFirstItemRate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShippingRateFirstItemRate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShippingRateFirstItemRate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShippingRateFirstItemRate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShippingRateFirstItemRate value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShippingRateFirstItemRate read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShippingRateFirstItemRate given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShippingRateFirstItemRate + * @throws IOException if the JSON string is invalid with respect to ShippingRateFirstItemRate + */ + public static ShippingRateFirstItemRate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShippingRateFirstItemRate.class); + } + + /** + * Convert an instance of ShippingRateFirstItemRate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateMaxPackageWeight.java b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateMaxPackageWeight.java new file mode 100644 index 0000000..6c942af --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateMaxPackageWeight.java @@ -0,0 +1,248 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Maximum weight of a package for the given delivery method (allowed only for methods with shippingRatesConstraints.maxPackageWeight.supported set to true in the delivery-methods resource). If not set, only maxQuantityPerPackage will be used to calculate the number of packages. Please note that the weight value must be the same for both related delivery methods, i.e. with `IN_ADVANCE` and `CASH_ON_DELIVERY` payment policy if both methods are in the shipping rates set. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShippingRateMaxPackageWeight { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private String unit; + + public ShippingRateMaxPackageWeight() { + } + + public ShippingRateMaxPackageWeight value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Weight value with an accuracy of three decimal places. + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public ShippingRateMaxPackageWeight unit(@javax.annotation.Nullable String unit) { + this.unit = unit; + return this; + } + + /** + * Weight unit. Currently only `KILOGRAM` is supported. + * @return unit + */ + @javax.annotation.Nullable + public String getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable String unit) { + this.unit = unit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShippingRateMaxPackageWeight shippingRateMaxPackageWeight = (ShippingRateMaxPackageWeight) o; + return Objects.equals(this.value, shippingRateMaxPackageWeight.value) && + Objects.equals(this.unit, shippingRateMaxPackageWeight.unit); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(value, unit); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShippingRateMaxPackageWeight {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + openapiFields.add("unit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShippingRateMaxPackageWeight + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShippingRateMaxPackageWeight.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShippingRateMaxPackageWeight is not found in the empty JSON string", ShippingRateMaxPackageWeight.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShippingRateMaxPackageWeight.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShippingRateMaxPackageWeight` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + if ((jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) && !jsonObj.get("unit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unit").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShippingRateMaxPackageWeight.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShippingRateMaxPackageWeight' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShippingRateMaxPackageWeight.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShippingRateMaxPackageWeight value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShippingRateMaxPackageWeight read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShippingRateMaxPackageWeight given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShippingRateMaxPackageWeight + * @throws IOException if the JSON string is invalid with respect to ShippingRateMaxPackageWeight + */ + public static ShippingRateMaxPackageWeight fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShippingRateMaxPackageWeight.class); + } + + /** + * Convert an instance of ShippingRateMaxPackageWeight to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateNextItemRate.java b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateNextItemRate.java new file mode 100644 index 0000000..52fc04e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateNextItemRate.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Rate for every other item, after the first, in the same parcel for the given delivery method. The rate amount and currency must comply with the shippingRatesConstraints.nextItemRate restrictions described in the delivery-methods resource. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShippingRateNextItemRate { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public ShippingRateNextItemRate() { + } + + public ShippingRateNextItemRate amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public ShippingRateNextItemRate currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * ISO 4217 currency code + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShippingRateNextItemRate shippingRateNextItemRate = (ShippingRateNextItemRate) o; + return Objects.equals(this.amount, shippingRateNextItemRate.amount) && + Objects.equals(this.currency, shippingRateNextItemRate.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShippingRateNextItemRate {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShippingRateNextItemRate + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShippingRateNextItemRate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShippingRateNextItemRate is not found in the empty JSON string", ShippingRateNextItemRate.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShippingRateNextItemRate.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShippingRateNextItemRate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShippingRateNextItemRate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShippingRateNextItemRate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShippingRateNextItemRate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShippingRateNextItemRate value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShippingRateNextItemRate read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShippingRateNextItemRate given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShippingRateNextItemRate + * @throws IOException if the JSON string is invalid with respect to ShippingRateNextItemRate + */ + public static ShippingRateNextItemRate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShippingRateNextItemRate.class); + } + + /** + * Convert an instance of ShippingRateNextItemRate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateShippingTime.java b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateShippingTime.java new file mode 100644 index 0000000..8e43394 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRateShippingTime.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Custom shipping time for the given delivery method (allowed only for methods with shippingRatesConstraints.shippingTime.customizable set to true in the delivery-methods resource). If not set the default shipping time specified in the delivery-methods resource is used. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShippingRateShippingTime { + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private String to; + + public ShippingRateShippingTime() { + } + + public ShippingRateShippingTime from(@javax.annotation.Nullable String from) { + this.from = from; + return this; + } + + /** + * ISO 8601 duration format, e.g. P3D for 3 days + * @return from + */ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable String from) { + this.from = from; + } + + + public ShippingRateShippingTime to(@javax.annotation.Nullable String to) { + this.to = to; + return this; + } + + /** + * ISO 8601 duration format, e.g. P3D for 3 days + * @return to + */ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable String to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShippingRateShippingTime shippingRateShippingTime = (ShippingRateShippingTime) o; + return Objects.equals(this.from, shippingRateShippingTime.from) && + Objects.equals(this.to, shippingRateShippingTime.to); + } + + @Override + public int hashCode() { + return Objects.hash(from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShippingRateShippingTime {\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShippingRateShippingTime + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShippingRateShippingTime.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShippingRateShippingTime is not found in the empty JSON string", ShippingRateShippingTime.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShippingRateShippingTime.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShippingRateShippingTime` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShippingRateShippingTime.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShippingRateShippingTime' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShippingRateShippingTime.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShippingRateShippingTime value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShippingRateShippingTime read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShippingRateShippingTime given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShippingRateShippingTime + * @throws IOException if the JSON string is invalid with respect to ShippingRateShippingTime + */ + public static ShippingRateShippingTime fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShippingRateShippingTime.class); + } + + /** + * Convert an instance of ShippingRateShippingTime to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShippingRates.java b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRates.java new file mode 100644 index 0000000..2627aaf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRates.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ShippingRates + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShippingRates { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public ShippingRates() { + } + + public ShippingRates id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of shipping rates + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShippingRates shippingRates = (ShippingRates) o; + return Objects.equals(this.id, shippingRates.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShippingRates {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShippingRates + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShippingRates.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShippingRates is not found in the empty JSON string", ShippingRates.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShippingRates.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShippingRates` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShippingRates.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShippingRates' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShippingRates.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShippingRates value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShippingRates read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShippingRates given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShippingRates + * @throws IOException if the JSON string is invalid with respect to ShippingRates + */ + public static ShippingRates fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShippingRates.class); + } + + /** + * Convert an instance of ShippingRates to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ShippingRatesSet.java b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRatesSet.java new file mode 100644 index 0000000..f7777f6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ShippingRatesSet.java @@ -0,0 +1,322 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ShippingRate; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ShippingRatesSet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ShippingRatesSet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_RATES = "rates"; + @SerializedName(SERIALIZED_NAME_RATES) + @javax.annotation.Nonnull + private List rates = new ArrayList<>(); + + public static final String SERIALIZED_NAME_LAST_MODIFIED = "lastModified"; + @SerializedName(SERIALIZED_NAME_LAST_MODIFIED) + @javax.annotation.Nullable + private String lastModified; + + public ShippingRatesSet() { + } + + public ShippingRatesSet id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Shipping rates set ID (UUID) When creating a shipping rates set (Post) the field is ignored. It is required when updating (Put) a shipping rates. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public ShippingRatesSet name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * User defined name of the shipping rates set. It may only contain: letters, numbers, hyphens, dots, commas and spaces. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ShippingRatesSet rates(@javax.annotation.Nonnull List rates) { + this.rates = rates; + return this; + } + + public ShippingRatesSet addRatesItem(ShippingRate ratesItem) { + if (this.rates == null) { + this.rates = new ArrayList<>(); + } + this.rates.add(ratesItem); + return this; + } + + /** + * Get rates + * @return rates + */ + @javax.annotation.Nonnull + public List getRates() { + return rates; + } + + public void setRates(@javax.annotation.Nonnull List rates) { + this.rates = rates; + } + + + public ShippingRatesSet lastModified(@javax.annotation.Nullable String lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * Date and time of the last modification of the set in UTC ISO 8601 format. When creating (Post) or updating (Put) a shipping rates set the field is ignored. + * @return lastModified + */ + @javax.annotation.Nullable + public String getLastModified() { + return lastModified; + } + + public void setLastModified(@javax.annotation.Nullable String lastModified) { + this.lastModified = lastModified; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShippingRatesSet shippingRatesSet = (ShippingRatesSet) o; + return Objects.equals(this.id, shippingRatesSet.id) && + Objects.equals(this.name, shippingRatesSet.name) && + Objects.equals(this.rates, shippingRatesSet.rates) && + Objects.equals(this.lastModified, shippingRatesSet.lastModified); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, rates, lastModified); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShippingRatesSet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" rates: ").append(toIndentedString(rates)).append("\n"); + sb.append(" lastModified: ").append(toIndentedString(lastModified)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("rates"); + openapiFields.add("lastModified"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("rates"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ShippingRatesSet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ShippingRatesSet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ShippingRatesSet is not found in the empty JSON string", ShippingRatesSet.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ShippingRatesSet.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ShippingRatesSet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ShippingRatesSet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("rates").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rates` to be an array in the JSON string but got `%s`", jsonObj.get("rates").toString())); + } + + JsonArray jsonArrayrates = jsonObj.getAsJsonArray("rates"); + // validate the required field `rates` (array) + for (int i = 0; i < jsonArrayrates.size(); i++) { + ShippingRate.validateJsonElement(jsonArrayrates.get(i)); + }; + if ((jsonObj.get("lastModified") != null && !jsonObj.get("lastModified").isJsonNull()) && !jsonObj.get("lastModified").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastModified` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastModified").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ShippingRatesSet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ShippingRatesSet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ShippingRatesSet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ShippingRatesSet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ShippingRatesSet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ShippingRatesSet given an JSON string + * + * @param jsonString JSON string + * @return An instance of ShippingRatesSet + * @throws IOException if the JSON string is invalid with respect to ShippingRatesSet + */ + public static ShippingRatesSet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ShippingRatesSet.class); + } + + /** + * Convert an instance of ShippingRatesSet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SinglePromotionCampaignResponseDto.java b/src/main/java/pl/wtx/allegro/api/client/model/SinglePromotionCampaignResponseDto.java new file mode 100644 index 0000000..e4ca0ce --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SinglePromotionCampaignResponseDto.java @@ -0,0 +1,332 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.CampaignResponseDto; +import pl.wtx.allegro.api.client.model.PromotionResponseDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SinglePromotionCampaignResponseDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SinglePromotionCampaignResponseDto { + public static final String SERIALIZED_NAME_CAMPAIGN = "campaign"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN) + @javax.annotation.Nonnull + private CampaignResponseDto campaign; + + public static final String SERIALIZED_NAME_PROMOTION = "promotion"; + @SerializedName(SERIALIZED_NAME_PROMOTION) + @javax.annotation.Nonnull + private PromotionResponseDto promotion; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + PENDING("PENDING"), + + ACTIVE("ACTIVE"), + + SUSPENDED("SUSPENDED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public SinglePromotionCampaignResponseDto() { + } + + public SinglePromotionCampaignResponseDto campaign(@javax.annotation.Nonnull CampaignResponseDto campaign) { + this.campaign = campaign; + return this; + } + + /** + * Get campaign + * @return campaign + */ + @javax.annotation.Nonnull + public CampaignResponseDto getCampaign() { + return campaign; + } + + public void setCampaign(@javax.annotation.Nonnull CampaignResponseDto campaign) { + this.campaign = campaign; + } + + + public SinglePromotionCampaignResponseDto promotion(@javax.annotation.Nonnull PromotionResponseDto promotion) { + this.promotion = promotion; + return this; + } + + /** + * Get promotion + * @return promotion + */ + @javax.annotation.Nonnull + public PromotionResponseDto getPromotion() { + return promotion; + } + + public void setPromotion(@javax.annotation.Nonnull PromotionResponseDto promotion) { + this.promotion = promotion; + } + + + public SinglePromotionCampaignResponseDto status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SinglePromotionCampaignResponseDto singlePromotionCampaignResponseDto = (SinglePromotionCampaignResponseDto) o; + return Objects.equals(this.campaign, singlePromotionCampaignResponseDto.campaign) && + Objects.equals(this.promotion, singlePromotionCampaignResponseDto.promotion) && + Objects.equals(this.status, singlePromotionCampaignResponseDto.status); + } + + @Override + public int hashCode() { + return Objects.hash(campaign, promotion, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SinglePromotionCampaignResponseDto {\n"); + sb.append(" campaign: ").append(toIndentedString(campaign)).append("\n"); + sb.append(" promotion: ").append(toIndentedString(promotion)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("campaign"); + openapiFields.add("promotion"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("campaign"); + openapiRequiredFields.add("promotion"); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SinglePromotionCampaignResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SinglePromotionCampaignResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SinglePromotionCampaignResponseDto is not found in the empty JSON string", SinglePromotionCampaignResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SinglePromotionCampaignResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SinglePromotionCampaignResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SinglePromotionCampaignResponseDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `campaign` + CampaignResponseDto.validateJsonElement(jsonObj.get("campaign")); + // validate the required field `promotion` + PromotionResponseDto.validateJsonElement(jsonObj.get("promotion")); + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SinglePromotionCampaignResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SinglePromotionCampaignResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SinglePromotionCampaignResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SinglePromotionCampaignResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SinglePromotionCampaignResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SinglePromotionCampaignResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SinglePromotionCampaignResponseDto + * @throws IOException if the JSON string is invalid with respect to SinglePromotionCampaignResponseDto + */ + public static SinglePromotionCampaignResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SinglePromotionCampaignResponseDto.class); + } + + /** + * Convert an instance of SinglePromotionCampaignResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SizeTable.java b/src/main/java/pl/wtx/allegro/api/client/model/SizeTable.java new file mode 100644 index 0000000..4560471 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SizeTable.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SizeTable + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SizeTable { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public SizeTable() { + } + + public SizeTable id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Id of size table + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SizeTable sizeTable = (SizeTable) o; + return Objects.equals(this.id, sizeTable.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SizeTable {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SizeTable + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SizeTable.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SizeTable is not found in the empty JSON string", SizeTable.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SizeTable.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SizeTable` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SizeTable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SizeTable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SizeTable.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SizeTable value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SizeTable read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SizeTable given an JSON string + * + * @param jsonString JSON string + * @return An instance of SizeTable + * @throws IOException if the JSON string is invalid with respect to SizeTable + */ + public static SizeTable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SizeTable.class); + } + + /** + * Convert an instance of SizeTable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SizeTablePostRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/SizeTablePostRequest.java new file mode 100644 index 0000000..9480f75 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SizeTablePostRequest.java @@ -0,0 +1,341 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Cells; +import pl.wtx.allegro.api.client.model.Header; +import pl.wtx.allegro.api.client.model.JustId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SizeTablePostRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SizeTablePostRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_TEMPLATE = "template"; + @SerializedName(SERIALIZED_NAME_TEMPLATE) + @javax.annotation.Nonnull + private JustId template; + + public static final String SERIALIZED_NAME_HEADERS = "headers"; + @SerializedName(SERIALIZED_NAME_HEADERS) + @javax.annotation.Nonnull + private List
headers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nonnull + private List values = new ArrayList<>(); + + public SizeTablePostRequest() { + } + + public SizeTablePostRequest name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * size table name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public SizeTablePostRequest template(@javax.annotation.Nonnull JustId template) { + this.template = template; + return this; + } + + /** + * Get template + * @return template + */ + @javax.annotation.Nonnull + public JustId getTemplate() { + return template; + } + + public void setTemplate(@javax.annotation.Nonnull JustId template) { + this.template = template; + } + + + public SizeTablePostRequest headers(@javax.annotation.Nonnull List
headers) { + this.headers = headers; + return this; + } + + public SizeTablePostRequest addHeadersItem(Header headersItem) { + if (this.headers == null) { + this.headers = new ArrayList<>(); + } + this.headers.add(headersItem); + return this; + } + + /** + * size table headers + * @return headers + */ + @javax.annotation.Nonnull + public List
getHeaders() { + return headers; + } + + public void setHeaders(@javax.annotation.Nonnull List
headers) { + this.headers = headers; + } + + + public SizeTablePostRequest values(@javax.annotation.Nonnull List values) { + this.values = values; + return this; + } + + public SizeTablePostRequest addValuesItem(Cells valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * size table cells + * @return values + */ + @javax.annotation.Nonnull + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nonnull List values) { + this.values = values; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SizeTablePostRequest sizeTablePostRequest = (SizeTablePostRequest) o; + return Objects.equals(this.name, sizeTablePostRequest.name) && + Objects.equals(this.template, sizeTablePostRequest.template) && + Objects.equals(this.headers, sizeTablePostRequest.headers) && + Objects.equals(this.values, sizeTablePostRequest.values); + } + + @Override + public int hashCode() { + return Objects.hash(name, template, headers, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SizeTablePostRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" template: ").append(toIndentedString(template)).append("\n"); + sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("template"); + openapiFields.add("headers"); + openapiFields.add("values"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("template"); + openapiRequiredFields.add("headers"); + openapiRequiredFields.add("values"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SizeTablePostRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SizeTablePostRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SizeTablePostRequest is not found in the empty JSON string", SizeTablePostRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SizeTablePostRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SizeTablePostRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SizeTablePostRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the required field `template` + JustId.validateJsonElement(jsonObj.get("template")); + // ensure the json data is an array + if (!jsonObj.get("headers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `headers` to be an array in the JSON string but got `%s`", jsonObj.get("headers").toString())); + } + + JsonArray jsonArrayheaders = jsonObj.getAsJsonArray("headers"); + // validate the required field `headers` (array) + for (int i = 0; i < jsonArrayheaders.size(); i++) { + Header.validateJsonElement(jsonArrayheaders.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + + JsonArray jsonArrayvalues = jsonObj.getAsJsonArray("values"); + // validate the required field `values` (array) + for (int i = 0; i < jsonArrayvalues.size(); i++) { + Cells.validateJsonElement(jsonArrayvalues.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SizeTablePostRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SizeTablePostRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SizeTablePostRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SizeTablePostRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SizeTablePostRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SizeTablePostRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of SizeTablePostRequest + * @throws IOException if the JSON string is invalid with respect to SizeTablePostRequest + */ + public static SizeTablePostRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SizeTablePostRequest.class); + } + + /** + * Convert an instance of SizeTablePostRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SizeTablePutRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/SizeTablePutRequest.java new file mode 100644 index 0000000..ab9d50e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SizeTablePutRequest.java @@ -0,0 +1,310 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Cells; +import pl.wtx.allegro.api.client.model.Header; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SizeTablePutRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SizeTablePutRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_HEADERS = "headers"; + @SerializedName(SERIALIZED_NAME_HEADERS) + @javax.annotation.Nonnull + private List
headers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nonnull + private List values = new ArrayList<>(); + + public SizeTablePutRequest() { + } + + public SizeTablePutRequest name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * size table name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public SizeTablePutRequest headers(@javax.annotation.Nonnull List
headers) { + this.headers = headers; + return this; + } + + public SizeTablePutRequest addHeadersItem(Header headersItem) { + if (this.headers == null) { + this.headers = new ArrayList<>(); + } + this.headers.add(headersItem); + return this; + } + + /** + * size table headers + * @return headers + */ + @javax.annotation.Nonnull + public List
getHeaders() { + return headers; + } + + public void setHeaders(@javax.annotation.Nonnull List
headers) { + this.headers = headers; + } + + + public SizeTablePutRequest values(@javax.annotation.Nonnull List values) { + this.values = values; + return this; + } + + public SizeTablePutRequest addValuesItem(Cells valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * size table cells + * @return values + */ + @javax.annotation.Nonnull + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nonnull List values) { + this.values = values; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SizeTablePutRequest sizeTablePutRequest = (SizeTablePutRequest) o; + return Objects.equals(this.name, sizeTablePutRequest.name) && + Objects.equals(this.headers, sizeTablePutRequest.headers) && + Objects.equals(this.values, sizeTablePutRequest.values); + } + + @Override + public int hashCode() { + return Objects.hash(name, headers, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SizeTablePutRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("headers"); + openapiFields.add("values"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("headers"); + openapiRequiredFields.add("values"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SizeTablePutRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SizeTablePutRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SizeTablePutRequest is not found in the empty JSON string", SizeTablePutRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SizeTablePutRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SizeTablePutRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SizeTablePutRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("headers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `headers` to be an array in the JSON string but got `%s`", jsonObj.get("headers").toString())); + } + + JsonArray jsonArrayheaders = jsonObj.getAsJsonArray("headers"); + // validate the required field `headers` (array) + for (int i = 0; i < jsonArrayheaders.size(); i++) { + Header.validateJsonElement(jsonArrayheaders.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + + JsonArray jsonArrayvalues = jsonObj.getAsJsonArray("values"); + // validate the required field `values` (array) + for (int i = 0; i < jsonArrayvalues.size(); i++) { + Cells.validateJsonElement(jsonArrayvalues.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SizeTablePutRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SizeTablePutRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SizeTablePutRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SizeTablePutRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SizeTablePutRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SizeTablePutRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of SizeTablePutRequest + * @throws IOException if the JSON string is invalid with respect to SizeTablePutRequest + */ + public static SizeTablePutRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SizeTablePutRequest.class); + } + + /** + * Convert an instance of SizeTablePutRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplateImageResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplateImageResponse.java new file mode 100644 index 0000000..8c4bc2a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplateImageResponse.java @@ -0,0 +1,263 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Caption; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * size table template image + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SizeTableTemplateImageResponse { + public static final String SERIALIZED_NAME_CAPTIONS = "captions"; + @SerializedName(SERIALIZED_NAME_CAPTIONS) + @javax.annotation.Nonnull + private List captions = new ArrayList<>(); + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nonnull + private String url; + + public SizeTableTemplateImageResponse() { + } + + public SizeTableTemplateImageResponse captions(@javax.annotation.Nonnull List captions) { + this.captions = captions; + return this; + } + + public SizeTableTemplateImageResponse addCaptionsItem(Caption captionsItem) { + if (this.captions == null) { + this.captions = new ArrayList<>(); + } + this.captions.add(captionsItem); + return this; + } + + /** + * Get captions + * @return captions + */ + @javax.annotation.Nonnull + public List getCaptions() { + return captions; + } + + public void setCaptions(@javax.annotation.Nonnull List captions) { + this.captions = captions; + } + + + public SizeTableTemplateImageResponse url(@javax.annotation.Nonnull String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nonnull String url) { + this.url = url; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SizeTableTemplateImageResponse sizeTableTemplateImageResponse = (SizeTableTemplateImageResponse) o; + return Objects.equals(this.captions, sizeTableTemplateImageResponse.captions) && + Objects.equals(this.url, sizeTableTemplateImageResponse.url); + } + + @Override + public int hashCode() { + return Objects.hash(captions, url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SizeTableTemplateImageResponse {\n"); + sb.append(" captions: ").append(toIndentedString(captions)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("captions"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("captions"); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SizeTableTemplateImageResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SizeTableTemplateImageResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SizeTableTemplateImageResponse is not found in the empty JSON string", SizeTableTemplateImageResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SizeTableTemplateImageResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SizeTableTemplateImageResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SizeTableTemplateImageResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("captions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `captions` to be an array in the JSON string but got `%s`", jsonObj.get("captions").toString())); + } + + JsonArray jsonArraycaptions = jsonObj.getAsJsonArray("captions"); + // validate the required field `captions` (array) + for (int i = 0; i < jsonArraycaptions.size(); i++) { + Caption.validateJsonElement(jsonArraycaptions.get(i)); + }; + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SizeTableTemplateImageResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SizeTableTemplateImageResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SizeTableTemplateImageResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SizeTableTemplateImageResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SizeTableTemplateImageResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SizeTableTemplateImageResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SizeTableTemplateImageResponse + * @throws IOException if the JSON string is invalid with respect to SizeTableTemplateImageResponse + */ + public static SizeTableTemplateImageResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SizeTableTemplateImageResponse.class); + } + + /** + * Convert an instance of SizeTableTemplateImageResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplateResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplateResponse.java new file mode 100644 index 0000000..af2887d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplateResponse.java @@ -0,0 +1,373 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Cells; +import pl.wtx.allegro.api.client.model.Header; +import pl.wtx.allegro.api.client.model.SizeTableTemplateImageResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SizeTableTemplateResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SizeTableTemplateResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_IMAGE = "image"; + @SerializedName(SERIALIZED_NAME_IMAGE) + @javax.annotation.Nullable + private SizeTableTemplateImageResponse image; + + public static final String SERIALIZED_NAME_HEADERS = "headers"; + @SerializedName(SERIALIZED_NAME_HEADERS) + @javax.annotation.Nonnull + private List
headers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nonnull + private List values = new ArrayList<>(); + + public SizeTableTemplateResponse() { + } + + public SizeTableTemplateResponse id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * size table template id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public SizeTableTemplateResponse name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * size table template name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public SizeTableTemplateResponse image(@javax.annotation.Nullable SizeTableTemplateImageResponse image) { + this.image = image; + return this; + } + + /** + * Get image + * @return image + */ + @javax.annotation.Nullable + public SizeTableTemplateImageResponse getImage() { + return image; + } + + public void setImage(@javax.annotation.Nullable SizeTableTemplateImageResponse image) { + this.image = image; + } + + + public SizeTableTemplateResponse headers(@javax.annotation.Nonnull List
headers) { + this.headers = headers; + return this; + } + + public SizeTableTemplateResponse addHeadersItem(Header headersItem) { + if (this.headers == null) { + this.headers = new ArrayList<>(); + } + this.headers.add(headersItem); + return this; + } + + /** + * size table template headers + * @return headers + */ + @javax.annotation.Nonnull + public List
getHeaders() { + return headers; + } + + public void setHeaders(@javax.annotation.Nonnull List
headers) { + this.headers = headers; + } + + + public SizeTableTemplateResponse values(@javax.annotation.Nonnull List values) { + this.values = values; + return this; + } + + public SizeTableTemplateResponse addValuesItem(Cells valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * size table template cells + * @return values + */ + @javax.annotation.Nonnull + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nonnull List values) { + this.values = values; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SizeTableTemplateResponse sizeTableTemplateResponse = (SizeTableTemplateResponse) o; + return Objects.equals(this.id, sizeTableTemplateResponse.id) && + Objects.equals(this.name, sizeTableTemplateResponse.name) && + Objects.equals(this.image, sizeTableTemplateResponse.image) && + Objects.equals(this.headers, sizeTableTemplateResponse.headers) && + Objects.equals(this.values, sizeTableTemplateResponse.values); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, image, headers, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SizeTableTemplateResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" image: ").append(toIndentedString(image)).append("\n"); + sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("image"); + openapiFields.add("headers"); + openapiFields.add("values"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("headers"); + openapiRequiredFields.add("values"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SizeTableTemplateResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SizeTableTemplateResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SizeTableTemplateResponse is not found in the empty JSON string", SizeTableTemplateResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SizeTableTemplateResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SizeTableTemplateResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SizeTableTemplateResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `image` + if (jsonObj.get("image") != null && !jsonObj.get("image").isJsonNull()) { + SizeTableTemplateImageResponse.validateJsonElement(jsonObj.get("image")); + } + // ensure the json data is an array + if (!jsonObj.get("headers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `headers` to be an array in the JSON string but got `%s`", jsonObj.get("headers").toString())); + } + + JsonArray jsonArrayheaders = jsonObj.getAsJsonArray("headers"); + // validate the required field `headers` (array) + for (int i = 0; i < jsonArrayheaders.size(); i++) { + Header.validateJsonElement(jsonArrayheaders.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + + JsonArray jsonArrayvalues = jsonObj.getAsJsonArray("values"); + // validate the required field `values` (array) + for (int i = 0; i < jsonArrayvalues.size(); i++) { + Cells.validateJsonElement(jsonArrayvalues.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SizeTableTemplateResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SizeTableTemplateResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SizeTableTemplateResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SizeTableTemplateResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SizeTableTemplateResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SizeTableTemplateResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SizeTableTemplateResponse + * @throws IOException if the JSON string is invalid with respect to SizeTableTemplateResponse + */ + public static SizeTableTemplateResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SizeTableTemplateResponse.class); + } + + /** + * Convert an instance of SizeTableTemplateResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplatesResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplatesResponse.java new file mode 100644 index 0000000..714f241 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SizeTableTemplatesResponse.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.SizeTableTemplateResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SizeTableTemplatesResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SizeTableTemplatesResponse { + public static final String SERIALIZED_NAME_TEMPLATES = "templates"; + @SerializedName(SERIALIZED_NAME_TEMPLATES) + @javax.annotation.Nonnull + private List templates = new ArrayList<>(); + + public SizeTableTemplatesResponse() { + } + + public SizeTableTemplatesResponse templates(@javax.annotation.Nonnull List templates) { + this.templates = templates; + return this; + } + + public SizeTableTemplatesResponse addTemplatesItem(SizeTableTemplateResponse templatesItem) { + if (this.templates == null) { + this.templates = new ArrayList<>(); + } + this.templates.add(templatesItem); + return this; + } + + /** + * size tables templates + * @return templates + */ + @javax.annotation.Nonnull + public List getTemplates() { + return templates; + } + + public void setTemplates(@javax.annotation.Nonnull List templates) { + this.templates = templates; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SizeTableTemplatesResponse sizeTableTemplatesResponse = (SizeTableTemplatesResponse) o; + return Objects.equals(this.templates, sizeTableTemplatesResponse.templates); + } + + @Override + public int hashCode() { + return Objects.hash(templates); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SizeTableTemplatesResponse {\n"); + sb.append(" templates: ").append(toIndentedString(templates)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("templates"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("templates"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SizeTableTemplatesResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SizeTableTemplatesResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SizeTableTemplatesResponse is not found in the empty JSON string", SizeTableTemplatesResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SizeTableTemplatesResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SizeTableTemplatesResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SizeTableTemplatesResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("templates").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `templates` to be an array in the JSON string but got `%s`", jsonObj.get("templates").toString())); + } + + JsonArray jsonArraytemplates = jsonObj.getAsJsonArray("templates"); + // validate the required field `templates` (array) + for (int i = 0; i < jsonArraytemplates.size(); i++) { + SizeTableTemplateResponse.validateJsonElement(jsonArraytemplates.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SizeTableTemplatesResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SizeTableTemplatesResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SizeTableTemplatesResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SizeTableTemplatesResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SizeTableTemplatesResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SizeTableTemplatesResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SizeTableTemplatesResponse + * @throws IOException if the JSON string is invalid with respect to SizeTableTemplatesResponse + */ + public static SizeTableTemplatesResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SizeTableTemplatesResponse.class); + } + + /** + * Convert an instance of SizeTableTemplatesResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SmartDeliveryMethod.java b/src/main/java/pl/wtx/allegro/api/client/model/SmartDeliveryMethod.java new file mode 100644 index 0000000..5a72bd7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SmartDeliveryMethod.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SmartDeliveryMethod + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SmartDeliveryMethod { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public SmartDeliveryMethod() { + } + + public SmartDeliveryMethod id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Delivery method id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SmartDeliveryMethod smartDeliveryMethod = (SmartDeliveryMethod) o; + return Objects.equals(this.id, smartDeliveryMethod.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SmartDeliveryMethod {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SmartDeliveryMethod + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SmartDeliveryMethod.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SmartDeliveryMethod is not found in the empty JSON string", SmartDeliveryMethod.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SmartDeliveryMethod.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SmartDeliveryMethod` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SmartDeliveryMethod.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SmartDeliveryMethod' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SmartDeliveryMethod.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SmartDeliveryMethod value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SmartDeliveryMethod read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SmartDeliveryMethod given an JSON string + * + * @param jsonString JSON string + * @return An instance of SmartDeliveryMethod + * @throws IOException if the JSON string is invalid with respect to SmartDeliveryMethod + */ + public static SmartDeliveryMethod fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SmartDeliveryMethod.class); + } + + /** + * Convert an instance of SmartDeliveryMethod to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReport.java b/src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReport.java new file mode 100644 index 0000000..d239989 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReport.java @@ -0,0 +1,337 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.SmartDeliveryMethod; +import pl.wtx.allegro.api.client.model.SmartOfferClassificationReportClassification; +import pl.wtx.allegro.api.client.model.SmartOfferClassificationReportConditionsInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SmartOfferClassificationReport + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SmartOfferClassificationReport { + public static final String SERIALIZED_NAME_CLASSIFICATION = "classification"; + @SerializedName(SERIALIZED_NAME_CLASSIFICATION) + @javax.annotation.Nullable + private SmartOfferClassificationReportClassification classification; + + public static final String SERIALIZED_NAME_SCHEDULED_FOR_RECLASSIFICATION = "scheduledForReclassification"; + @SerializedName(SERIALIZED_NAME_SCHEDULED_FOR_RECLASSIFICATION) + @javax.annotation.Nullable + private Boolean scheduledForReclassification; + + public static final String SERIALIZED_NAME_SMART_DELIVERY_METHODS = "smartDeliveryMethods"; + @SerializedName(SERIALIZED_NAME_SMART_DELIVERY_METHODS) + @javax.annotation.Nullable + private List smartDeliveryMethods = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CONDITIONS = "conditions"; + @SerializedName(SERIALIZED_NAME_CONDITIONS) + @javax.annotation.Nullable + private List conditions = new ArrayList<>(); + + public SmartOfferClassificationReport() { + } + + public SmartOfferClassificationReport classification(@javax.annotation.Nullable SmartOfferClassificationReportClassification classification) { + this.classification = classification; + return this; + } + + /** + * Get classification + * @return classification + */ + @javax.annotation.Nullable + public SmartOfferClassificationReportClassification getClassification() { + return classification; + } + + public void setClassification(@javax.annotation.Nullable SmartOfferClassificationReportClassification classification) { + this.classification = classification; + } + + + public SmartOfferClassificationReport scheduledForReclassification(@javax.annotation.Nullable Boolean scheduledForReclassification) { + this.scheduledForReclassification = scheduledForReclassification; + return this; + } + + /** + * Indicates whether that particular offer is set to be reclassified in the next 24 hours + * @return scheduledForReclassification + */ + @javax.annotation.Nullable + public Boolean getScheduledForReclassification() { + return scheduledForReclassification; + } + + public void setScheduledForReclassification(@javax.annotation.Nullable Boolean scheduledForReclassification) { + this.scheduledForReclassification = scheduledForReclassification; + } + + + public SmartOfferClassificationReport smartDeliveryMethods(@javax.annotation.Nullable List smartDeliveryMethods) { + this.smartDeliveryMethods = smartDeliveryMethods; + return this; + } + + public SmartOfferClassificationReport addSmartDeliveryMethodsItem(SmartDeliveryMethod smartDeliveryMethodsItem) { + if (this.smartDeliveryMethods == null) { + this.smartDeliveryMethods = new ArrayList<>(); + } + this.smartDeliveryMethods.add(smartDeliveryMethodsItem); + return this; + } + + /** + * Delivery methods marked with Smart! label + * @return smartDeliveryMethods + */ + @javax.annotation.Nullable + public List getSmartDeliveryMethods() { + return smartDeliveryMethods; + } + + public void setSmartDeliveryMethods(@javax.annotation.Nullable List smartDeliveryMethods) { + this.smartDeliveryMethods = smartDeliveryMethods; + } + + + public SmartOfferClassificationReport conditions(@javax.annotation.Nullable List conditions) { + this.conditions = conditions; + return this; + } + + public SmartOfferClassificationReport addConditionsItem(SmartOfferClassificationReportConditionsInner conditionsItem) { + if (this.conditions == null) { + this.conditions = new ArrayList<>(); + } + this.conditions.add(conditionsItem); + return this; + } + + /** + * Set of conditions to be met in order for that particular offer to be Smart!. Each condition filters out improperly configured delivery methods or checks some offer attributes. Order of conditions matters. Please keep in mind that this is a **PREVIEW** of an offer classification if being conducted right now - actual classification is triggered only by attribute changes and as of now it cannot be manually done on demand. + * @return conditions + */ + @javax.annotation.Nullable + public List getConditions() { + return conditions; + } + + public void setConditions(@javax.annotation.Nullable List conditions) { + this.conditions = conditions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SmartOfferClassificationReport smartOfferClassificationReport = (SmartOfferClassificationReport) o; + return Objects.equals(this.classification, smartOfferClassificationReport.classification) && + Objects.equals(this.scheduledForReclassification, smartOfferClassificationReport.scheduledForReclassification) && + Objects.equals(this.smartDeliveryMethods, smartOfferClassificationReport.smartDeliveryMethods) && + Objects.equals(this.conditions, smartOfferClassificationReport.conditions); + } + + @Override + public int hashCode() { + return Objects.hash(classification, scheduledForReclassification, smartDeliveryMethods, conditions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SmartOfferClassificationReport {\n"); + sb.append(" classification: ").append(toIndentedString(classification)).append("\n"); + sb.append(" scheduledForReclassification: ").append(toIndentedString(scheduledForReclassification)).append("\n"); + sb.append(" smartDeliveryMethods: ").append(toIndentedString(smartDeliveryMethods)).append("\n"); + sb.append(" conditions: ").append(toIndentedString(conditions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("classification"); + openapiFields.add("scheduledForReclassification"); + openapiFields.add("smartDeliveryMethods"); + openapiFields.add("conditions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SmartOfferClassificationReport + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SmartOfferClassificationReport.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SmartOfferClassificationReport is not found in the empty JSON string", SmartOfferClassificationReport.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SmartOfferClassificationReport.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SmartOfferClassificationReport` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `classification` + if (jsonObj.get("classification") != null && !jsonObj.get("classification").isJsonNull()) { + SmartOfferClassificationReportClassification.validateJsonElement(jsonObj.get("classification")); + } + if (jsonObj.get("smartDeliveryMethods") != null && !jsonObj.get("smartDeliveryMethods").isJsonNull()) { + JsonArray jsonArraysmartDeliveryMethods = jsonObj.getAsJsonArray("smartDeliveryMethods"); + if (jsonArraysmartDeliveryMethods != null) { + // ensure the json data is an array + if (!jsonObj.get("smartDeliveryMethods").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `smartDeliveryMethods` to be an array in the JSON string but got `%s`", jsonObj.get("smartDeliveryMethods").toString())); + } + + // validate the optional field `smartDeliveryMethods` (array) + for (int i = 0; i < jsonArraysmartDeliveryMethods.size(); i++) { + SmartDeliveryMethod.validateJsonElement(jsonArraysmartDeliveryMethods.get(i)); + }; + } + } + if (jsonObj.get("conditions") != null && !jsonObj.get("conditions").isJsonNull()) { + JsonArray jsonArrayconditions = jsonObj.getAsJsonArray("conditions"); + if (jsonArrayconditions != null) { + // ensure the json data is an array + if (!jsonObj.get("conditions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `conditions` to be an array in the JSON string but got `%s`", jsonObj.get("conditions").toString())); + } + + // validate the optional field `conditions` (array) + for (int i = 0; i < jsonArrayconditions.size(); i++) { + SmartOfferClassificationReportConditionsInner.validateJsonElement(jsonArrayconditions.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SmartOfferClassificationReport.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SmartOfferClassificationReport' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SmartOfferClassificationReport.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SmartOfferClassificationReport value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SmartOfferClassificationReport read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SmartOfferClassificationReport given an JSON string + * + * @param jsonString JSON string + * @return An instance of SmartOfferClassificationReport + * @throws IOException if the JSON string is invalid with respect to SmartOfferClassificationReport + */ + public static SmartOfferClassificationReport fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SmartOfferClassificationReport.class); + } + + /** + * Convert an instance of SmartOfferClassificationReport to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReportClassification.java b/src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReportClassification.java new file mode 100644 index 0000000..e00b0dd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReportClassification.java @@ -0,0 +1,231 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offer Smart! eligibility status + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SmartOfferClassificationReportClassification { + public static final String SERIALIZED_NAME_FULFILLED = "fulfilled"; + @SerializedName(SERIALIZED_NAME_FULFILLED) + @javax.annotation.Nullable + private Boolean fulfilled; + + public static final String SERIALIZED_NAME_LAST_CHANGED = "lastChanged"; + @SerializedName(SERIALIZED_NAME_LAST_CHANGED) + @javax.annotation.Nullable + private OffsetDateTime lastChanged; + + public SmartOfferClassificationReportClassification() { + } + + public SmartOfferClassificationReportClassification fulfilled(@javax.annotation.Nullable Boolean fulfilled) { + this.fulfilled = fulfilled; + return this; + } + + /** + * Indicates whether that particular offer is currently Smart! + * @return fulfilled + */ + @javax.annotation.Nullable + public Boolean getFulfilled() { + return fulfilled; + } + + public void setFulfilled(@javax.annotation.Nullable Boolean fulfilled) { + this.fulfilled = fulfilled; + } + + + public SmartOfferClassificationReportClassification lastChanged(@javax.annotation.Nullable OffsetDateTime lastChanged) { + this.lastChanged = lastChanged; + return this; + } + + /** + * Date of the most recent status change + * @return lastChanged + */ + @javax.annotation.Nullable + public OffsetDateTime getLastChanged() { + return lastChanged; + } + + public void setLastChanged(@javax.annotation.Nullable OffsetDateTime lastChanged) { + this.lastChanged = lastChanged; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SmartOfferClassificationReportClassification smartOfferClassificationReportClassification = (SmartOfferClassificationReportClassification) o; + return Objects.equals(this.fulfilled, smartOfferClassificationReportClassification.fulfilled) && + Objects.equals(this.lastChanged, smartOfferClassificationReportClassification.lastChanged); + } + + @Override + public int hashCode() { + return Objects.hash(fulfilled, lastChanged); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SmartOfferClassificationReportClassification {\n"); + sb.append(" fulfilled: ").append(toIndentedString(fulfilled)).append("\n"); + sb.append(" lastChanged: ").append(toIndentedString(lastChanged)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fulfilled"); + openapiFields.add("lastChanged"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SmartOfferClassificationReportClassification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SmartOfferClassificationReportClassification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SmartOfferClassificationReportClassification is not found in the empty JSON string", SmartOfferClassificationReportClassification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SmartOfferClassificationReportClassification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SmartOfferClassificationReportClassification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SmartOfferClassificationReportClassification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SmartOfferClassificationReportClassification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SmartOfferClassificationReportClassification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SmartOfferClassificationReportClassification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SmartOfferClassificationReportClassification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SmartOfferClassificationReportClassification given an JSON string + * + * @param jsonString JSON string + * @return An instance of SmartOfferClassificationReportClassification + * @throws IOException if the JSON string is invalid with respect to SmartOfferClassificationReportClassification + */ + public static SmartOfferClassificationReportClassification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SmartOfferClassificationReportClassification.class); + } + + /** + * Convert an instance of SmartOfferClassificationReportClassification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReportConditionsInner.java b/src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReportConditionsInner.java new file mode 100644 index 0000000..3ed5553 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SmartOfferClassificationReportConditionsInner.java @@ -0,0 +1,394 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.DeliveryMethodId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SmartOfferClassificationReportConditionsInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SmartOfferClassificationReportConditionsInner { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_FULFILLED = "fulfilled"; + @SerializedName(SERIALIZED_NAME_FULFILLED) + @javax.annotation.Nullable + private Boolean fulfilled; + + public static final String SERIALIZED_NAME_PASSED_DELIVERY_METHODS = "passedDeliveryMethods"; + @SerializedName(SERIALIZED_NAME_PASSED_DELIVERY_METHODS) + @javax.annotation.Nullable + private List passedDeliveryMethods = new ArrayList<>(); + + public static final String SERIALIZED_NAME_FAILED_DELIVERY_METHODS = "failedDeliveryMethods"; + @SerializedName(SERIALIZED_NAME_FAILED_DELIVERY_METHODS) + @javax.annotation.Nullable + private List failedDeliveryMethods = new ArrayList<>(); + + public SmartOfferClassificationReportConditionsInner() { + } + + public SmartOfferClassificationReportConditionsInner code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Technical condition name + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public SmartOfferClassificationReportConditionsInner name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Condition name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SmartOfferClassificationReportConditionsInner description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Brief condition description, might contain useful instructions to help making that particular condition pass + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + public SmartOfferClassificationReportConditionsInner fulfilled(@javax.annotation.Nullable Boolean fulfilled) { + this.fulfilled = fulfilled; + return this; + } + + /** + * Indicates whether this condition is met + * @return fulfilled + */ + @javax.annotation.Nullable + public Boolean getFulfilled() { + return fulfilled; + } + + public void setFulfilled(@javax.annotation.Nullable Boolean fulfilled) { + this.fulfilled = fulfilled; + } + + + public SmartOfferClassificationReportConditionsInner passedDeliveryMethods(@javax.annotation.Nullable List passedDeliveryMethods) { + this.passedDeliveryMethods = passedDeliveryMethods; + return this; + } + + public SmartOfferClassificationReportConditionsInner addPassedDeliveryMethodsItem(DeliveryMethodId passedDeliveryMethodsItem) { + if (this.passedDeliveryMethods == null) { + this.passedDeliveryMethods = new ArrayList<>(); + } + this.passedDeliveryMethods.add(passedDeliveryMethodsItem); + return this; + } + + /** + * Set of delivery methods that meet this condition. May be null if the condition does not apply to delivery methods. + * @return passedDeliveryMethods + */ + @javax.annotation.Nullable + public List getPassedDeliveryMethods() { + return passedDeliveryMethods; + } + + public void setPassedDeliveryMethods(@javax.annotation.Nullable List passedDeliveryMethods) { + this.passedDeliveryMethods = passedDeliveryMethods; + } + + + public SmartOfferClassificationReportConditionsInner failedDeliveryMethods(@javax.annotation.Nullable List failedDeliveryMethods) { + this.failedDeliveryMethods = failedDeliveryMethods; + return this; + } + + public SmartOfferClassificationReportConditionsInner addFailedDeliveryMethodsItem(DeliveryMethodId failedDeliveryMethodsItem) { + if (this.failedDeliveryMethods == null) { + this.failedDeliveryMethods = new ArrayList<>(); + } + this.failedDeliveryMethods.add(failedDeliveryMethodsItem); + return this; + } + + /** + * Set of delivery methods that fail to meet this condition. May be null if the condition does not apply to delivery methods. + * @return failedDeliveryMethods + */ + @javax.annotation.Nullable + public List getFailedDeliveryMethods() { + return failedDeliveryMethods; + } + + public void setFailedDeliveryMethods(@javax.annotation.Nullable List failedDeliveryMethods) { + this.failedDeliveryMethods = failedDeliveryMethods; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SmartOfferClassificationReportConditionsInner smartOfferClassificationReportConditionsInner = (SmartOfferClassificationReportConditionsInner) o; + return Objects.equals(this.code, smartOfferClassificationReportConditionsInner.code) && + Objects.equals(this.name, smartOfferClassificationReportConditionsInner.name) && + Objects.equals(this.description, smartOfferClassificationReportConditionsInner.description) && + Objects.equals(this.fulfilled, smartOfferClassificationReportConditionsInner.fulfilled) && + Objects.equals(this.passedDeliveryMethods, smartOfferClassificationReportConditionsInner.passedDeliveryMethods) && + Objects.equals(this.failedDeliveryMethods, smartOfferClassificationReportConditionsInner.failedDeliveryMethods); + } + + @Override + public int hashCode() { + return Objects.hash(code, name, description, fulfilled, passedDeliveryMethods, failedDeliveryMethods); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SmartOfferClassificationReportConditionsInner {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" fulfilled: ").append(toIndentedString(fulfilled)).append("\n"); + sb.append(" passedDeliveryMethods: ").append(toIndentedString(passedDeliveryMethods)).append("\n"); + sb.append(" failedDeliveryMethods: ").append(toIndentedString(failedDeliveryMethods)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("fulfilled"); + openapiFields.add("passedDeliveryMethods"); + openapiFields.add("failedDeliveryMethods"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SmartOfferClassificationReportConditionsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SmartOfferClassificationReportConditionsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SmartOfferClassificationReportConditionsInner is not found in the empty JSON string", SmartOfferClassificationReportConditionsInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SmartOfferClassificationReportConditionsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SmartOfferClassificationReportConditionsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (jsonObj.get("passedDeliveryMethods") != null && !jsonObj.get("passedDeliveryMethods").isJsonNull()) { + JsonArray jsonArraypassedDeliveryMethods = jsonObj.getAsJsonArray("passedDeliveryMethods"); + if (jsonArraypassedDeliveryMethods != null) { + // ensure the json data is an array + if (!jsonObj.get("passedDeliveryMethods").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `passedDeliveryMethods` to be an array in the JSON string but got `%s`", jsonObj.get("passedDeliveryMethods").toString())); + } + + // validate the optional field `passedDeliveryMethods` (array) + for (int i = 0; i < jsonArraypassedDeliveryMethods.size(); i++) { + DeliveryMethodId.validateJsonElement(jsonArraypassedDeliveryMethods.get(i)); + }; + } + } + if (jsonObj.get("failedDeliveryMethods") != null && !jsonObj.get("failedDeliveryMethods").isJsonNull()) { + JsonArray jsonArrayfailedDeliveryMethods = jsonObj.getAsJsonArray("failedDeliveryMethods"); + if (jsonArrayfailedDeliveryMethods != null) { + // ensure the json data is an array + if (!jsonObj.get("failedDeliveryMethods").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `failedDeliveryMethods` to be an array in the JSON string but got `%s`", jsonObj.get("failedDeliveryMethods").toString())); + } + + // validate the optional field `failedDeliveryMethods` (array) + for (int i = 0; i < jsonArrayfailedDeliveryMethods.size(); i++) { + DeliveryMethodId.validateJsonElement(jsonArrayfailedDeliveryMethods.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SmartOfferClassificationReportConditionsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SmartOfferClassificationReportConditionsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SmartOfferClassificationReportConditionsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SmartOfferClassificationReportConditionsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SmartOfferClassificationReportConditionsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SmartOfferClassificationReportConditionsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of SmartOfferClassificationReportConditionsInner + * @throws IOException if the JSON string is invalid with respect to SmartOfferClassificationReportConditionsInner + */ + public static SmartOfferClassificationReportConditionsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SmartOfferClassificationReportConditionsInner.class); + } + + /** + * Convert an instance of SmartOfferClassificationReportConditionsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReport.java b/src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReport.java new file mode 100644 index 0000000..93b9af3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReport.java @@ -0,0 +1,310 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.SmartDeliveryMethod; +import pl.wtx.allegro.api.client.model.SmartSellerClassificationReportClassification; +import pl.wtx.allegro.api.client.model.SmartSellerClassificationReportConditionsInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SmartSellerClassificationReport + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SmartSellerClassificationReport { + public static final String SERIALIZED_NAME_CLASSIFICATION = "classification"; + @SerializedName(SERIALIZED_NAME_CLASSIFICATION) + @javax.annotation.Nullable + private SmartSellerClassificationReportClassification classification; + + public static final String SERIALIZED_NAME_CONDITIONS = "conditions"; + @SerializedName(SERIALIZED_NAME_CONDITIONS) + @javax.annotation.Nullable + private List conditions = new ArrayList<>(); + + public static final String SERIALIZED_NAME_EXCLUDED_DELIVERY_METHODS = "excludedDeliveryMethods"; + @SerializedName(SERIALIZED_NAME_EXCLUDED_DELIVERY_METHODS) + @javax.annotation.Nullable + private List excludedDeliveryMethods = new ArrayList<>(); + + public SmartSellerClassificationReport() { + } + + public SmartSellerClassificationReport classification(@javax.annotation.Nullable SmartSellerClassificationReportClassification classification) { + this.classification = classification; + return this; + } + + /** + * Get classification + * @return classification + */ + @javax.annotation.Nullable + public SmartSellerClassificationReportClassification getClassification() { + return classification; + } + + public void setClassification(@javax.annotation.Nullable SmartSellerClassificationReportClassification classification) { + this.classification = classification; + } + + + public SmartSellerClassificationReport conditions(@javax.annotation.Nullable List conditions) { + this.conditions = conditions; + return this; + } + + public SmartSellerClassificationReport addConditionsItem(SmartSellerClassificationReportConditionsInner conditionsItem) { + if (this.conditions == null) { + this.conditions = new ArrayList<>(); + } + this.conditions.add(conditionsItem); + return this; + } + + /** + * Set of conditions to be met in order for user to be Smart! + * @return conditions + */ + @javax.annotation.Nullable + public List getConditions() { + return conditions; + } + + public void setConditions(@javax.annotation.Nullable List conditions) { + this.conditions = conditions; + } + + + public SmartSellerClassificationReport excludedDeliveryMethods(@javax.annotation.Nullable List excludedDeliveryMethods) { + this.excludedDeliveryMethods = excludedDeliveryMethods; + return this; + } + + public SmartSellerClassificationReport addExcludedDeliveryMethodsItem(SmartDeliveryMethod excludedDeliveryMethodsItem) { + if (this.excludedDeliveryMethods == null) { + this.excludedDeliveryMethods = new ArrayList<>(); + } + this.excludedDeliveryMethods.add(excludedDeliveryMethodsItem); + return this; + } + + /** + * Set of delivery methods that were excluded from Smart! classification on demand by seller + * @return excludedDeliveryMethods + */ + @javax.annotation.Nullable + public List getExcludedDeliveryMethods() { + return excludedDeliveryMethods; + } + + public void setExcludedDeliveryMethods(@javax.annotation.Nullable List excludedDeliveryMethods) { + this.excludedDeliveryMethods = excludedDeliveryMethods; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SmartSellerClassificationReport smartSellerClassificationReport = (SmartSellerClassificationReport) o; + return Objects.equals(this.classification, smartSellerClassificationReport.classification) && + Objects.equals(this.conditions, smartSellerClassificationReport.conditions) && + Objects.equals(this.excludedDeliveryMethods, smartSellerClassificationReport.excludedDeliveryMethods); + } + + @Override + public int hashCode() { + return Objects.hash(classification, conditions, excludedDeliveryMethods); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SmartSellerClassificationReport {\n"); + sb.append(" classification: ").append(toIndentedString(classification)).append("\n"); + sb.append(" conditions: ").append(toIndentedString(conditions)).append("\n"); + sb.append(" excludedDeliveryMethods: ").append(toIndentedString(excludedDeliveryMethods)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("classification"); + openapiFields.add("conditions"); + openapiFields.add("excludedDeliveryMethods"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SmartSellerClassificationReport + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SmartSellerClassificationReport.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SmartSellerClassificationReport is not found in the empty JSON string", SmartSellerClassificationReport.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SmartSellerClassificationReport.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SmartSellerClassificationReport` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `classification` + if (jsonObj.get("classification") != null && !jsonObj.get("classification").isJsonNull()) { + SmartSellerClassificationReportClassification.validateJsonElement(jsonObj.get("classification")); + } + if (jsonObj.get("conditions") != null && !jsonObj.get("conditions").isJsonNull()) { + JsonArray jsonArrayconditions = jsonObj.getAsJsonArray("conditions"); + if (jsonArrayconditions != null) { + // ensure the json data is an array + if (!jsonObj.get("conditions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `conditions` to be an array in the JSON string but got `%s`", jsonObj.get("conditions").toString())); + } + + // validate the optional field `conditions` (array) + for (int i = 0; i < jsonArrayconditions.size(); i++) { + SmartSellerClassificationReportConditionsInner.validateJsonElement(jsonArrayconditions.get(i)); + }; + } + } + if (jsonObj.get("excludedDeliveryMethods") != null && !jsonObj.get("excludedDeliveryMethods").isJsonNull()) { + JsonArray jsonArrayexcludedDeliveryMethods = jsonObj.getAsJsonArray("excludedDeliveryMethods"); + if (jsonArrayexcludedDeliveryMethods != null) { + // ensure the json data is an array + if (!jsonObj.get("excludedDeliveryMethods").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `excludedDeliveryMethods` to be an array in the JSON string but got `%s`", jsonObj.get("excludedDeliveryMethods").toString())); + } + + // validate the optional field `excludedDeliveryMethods` (array) + for (int i = 0; i < jsonArrayexcludedDeliveryMethods.size(); i++) { + SmartDeliveryMethod.validateJsonElement(jsonArrayexcludedDeliveryMethods.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SmartSellerClassificationReport.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SmartSellerClassificationReport' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SmartSellerClassificationReport.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SmartSellerClassificationReport value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SmartSellerClassificationReport read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SmartSellerClassificationReport given an JSON string + * + * @param jsonString JSON string + * @return An instance of SmartSellerClassificationReport + * @throws IOException if the JSON string is invalid with respect to SmartSellerClassificationReport + */ + public static SmartSellerClassificationReport fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SmartSellerClassificationReport.class); + } + + /** + * Convert an instance of SmartSellerClassificationReport to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReportClassification.java b/src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReportClassification.java new file mode 100644 index 0000000..b8805e1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReportClassification.java @@ -0,0 +1,231 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Seller Smart! eligibility status + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SmartSellerClassificationReportClassification { + public static final String SERIALIZED_NAME_FULFILLED = "fulfilled"; + @SerializedName(SERIALIZED_NAME_FULFILLED) + @javax.annotation.Nullable + private Boolean fulfilled; + + public static final String SERIALIZED_NAME_LAST_CHANGED = "lastChanged"; + @SerializedName(SERIALIZED_NAME_LAST_CHANGED) + @javax.annotation.Nullable + private OffsetDateTime lastChanged; + + public SmartSellerClassificationReportClassification() { + } + + public SmartSellerClassificationReportClassification fulfilled(@javax.annotation.Nullable Boolean fulfilled) { + this.fulfilled = fulfilled; + return this; + } + + /** + * Indicates whether that user is currently Smart! + * @return fulfilled + */ + @javax.annotation.Nullable + public Boolean getFulfilled() { + return fulfilled; + } + + public void setFulfilled(@javax.annotation.Nullable Boolean fulfilled) { + this.fulfilled = fulfilled; + } + + + public SmartSellerClassificationReportClassification lastChanged(@javax.annotation.Nullable OffsetDateTime lastChanged) { + this.lastChanged = lastChanged; + return this; + } + + /** + * Date of the most recent status change + * @return lastChanged + */ + @javax.annotation.Nullable + public OffsetDateTime getLastChanged() { + return lastChanged; + } + + public void setLastChanged(@javax.annotation.Nullable OffsetDateTime lastChanged) { + this.lastChanged = lastChanged; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SmartSellerClassificationReportClassification smartSellerClassificationReportClassification = (SmartSellerClassificationReportClassification) o; + return Objects.equals(this.fulfilled, smartSellerClassificationReportClassification.fulfilled) && + Objects.equals(this.lastChanged, smartSellerClassificationReportClassification.lastChanged); + } + + @Override + public int hashCode() { + return Objects.hash(fulfilled, lastChanged); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SmartSellerClassificationReportClassification {\n"); + sb.append(" fulfilled: ").append(toIndentedString(fulfilled)).append("\n"); + sb.append(" lastChanged: ").append(toIndentedString(lastChanged)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fulfilled"); + openapiFields.add("lastChanged"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SmartSellerClassificationReportClassification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SmartSellerClassificationReportClassification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SmartSellerClassificationReportClassification is not found in the empty JSON string", SmartSellerClassificationReportClassification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SmartSellerClassificationReportClassification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SmartSellerClassificationReportClassification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SmartSellerClassificationReportClassification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SmartSellerClassificationReportClassification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SmartSellerClassificationReportClassification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SmartSellerClassificationReportClassification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SmartSellerClassificationReportClassification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SmartSellerClassificationReportClassification given an JSON string + * + * @param jsonString JSON string + * @return An instance of SmartSellerClassificationReportClassification + * @throws IOException if the JSON string is invalid with respect to SmartSellerClassificationReportClassification + */ + public static SmartSellerClassificationReportClassification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SmartSellerClassificationReportClassification.class); + } + + /** + * Convert an instance of SmartSellerClassificationReportClassification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReportConditionsInner.java b/src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReportConditionsInner.java new file mode 100644 index 0000000..75ab8b7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SmartSellerClassificationReportConditionsInner.java @@ -0,0 +1,375 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SmartSellerClassificationReportConditionsInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SmartSellerClassificationReportConditionsInner { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private BigDecimal value; + + public static final String SERIALIZED_NAME_THRESHOLD = "threshold"; + @SerializedName(SERIALIZED_NAME_THRESHOLD) + @javax.annotation.Nullable + private BigDecimal threshold; + + public static final String SERIALIZED_NAME_FULFILLED = "fulfilled"; + @SerializedName(SERIALIZED_NAME_FULFILLED) + @javax.annotation.Nullable + private Boolean fulfilled; + + public static final String SERIALIZED_NAME_REQUIRED = "required"; + @SerializedName(SERIALIZED_NAME_REQUIRED) + @javax.annotation.Nullable + private Boolean required; + + public SmartSellerClassificationReportConditionsInner() { + } + + public SmartSellerClassificationReportConditionsInner code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Technical condition name + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public SmartSellerClassificationReportConditionsInner name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Condition name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SmartSellerClassificationReportConditionsInner description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Brief condition description, might contain useful instructions to help making that particular condition pass + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + public SmartSellerClassificationReportConditionsInner value(@javax.annotation.Nullable BigDecimal value) { + this.value = value; + return this; + } + + /** + * Value of related user attribute that this condition tests. Has to be greater that threshold if present. + * @return value + */ + @javax.annotation.Nullable + public BigDecimal getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable BigDecimal value) { + this.value = value; + } + + + public SmartSellerClassificationReportConditionsInner threshold(@javax.annotation.Nullable BigDecimal threshold) { + this.threshold = threshold; + return this; + } + + /** + * Minimum required `value` of related user attribute. + * @return threshold + */ + @javax.annotation.Nullable + public BigDecimal getThreshold() { + return threshold; + } + + public void setThreshold(@javax.annotation.Nullable BigDecimal threshold) { + this.threshold = threshold; + } + + + public SmartSellerClassificationReportConditionsInner fulfilled(@javax.annotation.Nullable Boolean fulfilled) { + this.fulfilled = fulfilled; + return this; + } + + /** + * Indicates whether this condition is met + * @return fulfilled + */ + @javax.annotation.Nullable + public Boolean getFulfilled() { + return fulfilled; + } + + public void setFulfilled(@javax.annotation.Nullable Boolean fulfilled) { + this.fulfilled = fulfilled; + } + + + public SmartSellerClassificationReportConditionsInner required(@javax.annotation.Nullable Boolean required) { + this.required = required; + return this; + } + + /** + * Indicates whether this condition is required to obtain Smart! status. Please note that certain conditions may be required (or not) based on result of checking other conditions. + * @return required + */ + @javax.annotation.Nullable + public Boolean getRequired() { + return required; + } + + public void setRequired(@javax.annotation.Nullable Boolean required) { + this.required = required; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SmartSellerClassificationReportConditionsInner smartSellerClassificationReportConditionsInner = (SmartSellerClassificationReportConditionsInner) o; + return Objects.equals(this.code, smartSellerClassificationReportConditionsInner.code) && + Objects.equals(this.name, smartSellerClassificationReportConditionsInner.name) && + Objects.equals(this.description, smartSellerClassificationReportConditionsInner.description) && + Objects.equals(this.value, smartSellerClassificationReportConditionsInner.value) && + Objects.equals(this.threshold, smartSellerClassificationReportConditionsInner.threshold) && + Objects.equals(this.fulfilled, smartSellerClassificationReportConditionsInner.fulfilled) && + Objects.equals(this.required, smartSellerClassificationReportConditionsInner.required); + } + + @Override + public int hashCode() { + return Objects.hash(code, name, description, value, threshold, fulfilled, required); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SmartSellerClassificationReportConditionsInner {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" threshold: ").append(toIndentedString(threshold)).append("\n"); + sb.append(" fulfilled: ").append(toIndentedString(fulfilled)).append("\n"); + sb.append(" required: ").append(toIndentedString(required)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("value"); + openapiFields.add("threshold"); + openapiFields.add("fulfilled"); + openapiFields.add("required"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SmartSellerClassificationReportConditionsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SmartSellerClassificationReportConditionsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SmartSellerClassificationReportConditionsInner is not found in the empty JSON string", SmartSellerClassificationReportConditionsInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SmartSellerClassificationReportConditionsInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SmartSellerClassificationReportConditionsInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SmartSellerClassificationReportConditionsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SmartSellerClassificationReportConditionsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SmartSellerClassificationReportConditionsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SmartSellerClassificationReportConditionsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SmartSellerClassificationReportConditionsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SmartSellerClassificationReportConditionsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of SmartSellerClassificationReportConditionsInner + * @throws IOException if the JSON string is invalid with respect to SmartSellerClassificationReportConditionsInner + */ + public static SmartSellerClassificationReportConditionsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SmartSellerClassificationReportConditionsInner.class); + } + + /** + * Convert an instance of SmartSellerClassificationReportConditionsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StandardizedDescription.java b/src/main/java/pl/wtx/allegro/api/client/model/StandardizedDescription.java new file mode 100644 index 0000000..6c9ca59 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StandardizedDescription.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.DescriptionSection; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The description section cannot have more than 40000 bytes in length. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StandardizedDescription { + public static final String SERIALIZED_NAME_SECTIONS = "sections"; + @SerializedName(SERIALIZED_NAME_SECTIONS) + @javax.annotation.Nullable + private List sections = new ArrayList<>(); + + public StandardizedDescription() { + } + + public StandardizedDescription sections(@javax.annotation.Nullable List sections) { + this.sections = sections; + return this; + } + + public StandardizedDescription addSectionsItem(DescriptionSection sectionsItem) { + if (this.sections == null) { + this.sections = new ArrayList<>(); + } + this.sections.add(sectionsItem); + return this; + } + + /** + * Get sections + * @return sections + */ + @javax.annotation.Nullable + public List getSections() { + return sections; + } + + public void setSections(@javax.annotation.Nullable List sections) { + this.sections = sections; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StandardizedDescription standardizedDescription = (StandardizedDescription) o; + return Objects.equals(this.sections, standardizedDescription.sections); + } + + @Override + public int hashCode() { + return Objects.hash(sections); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StandardizedDescription {\n"); + sb.append(" sections: ").append(toIndentedString(sections)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sections"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StandardizedDescription + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StandardizedDescription.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StandardizedDescription is not found in the empty JSON string", StandardizedDescription.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StandardizedDescription.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StandardizedDescription` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("sections") != null && !jsonObj.get("sections").isJsonNull()) { + JsonArray jsonArraysections = jsonObj.getAsJsonArray("sections"); + if (jsonArraysections != null) { + // ensure the json data is an array + if (!jsonObj.get("sections").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `sections` to be an array in the JSON string but got `%s`", jsonObj.get("sections").toString())); + } + + // validate the optional field `sections` (array) + for (int i = 0; i < jsonArraysections.size(); i++) { + DescriptionSection.validateJsonElement(jsonArraysections.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StandardizedDescription.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StandardizedDescription' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StandardizedDescription.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StandardizedDescription value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StandardizedDescription read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StandardizedDescription given an JSON string + * + * @param jsonString JSON string + * @return An instance of StandardizedDescription + * @throws IOException if the JSON string is invalid with respect to StandardizedDescription + */ + public static StandardizedDescription fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StandardizedDescription.class); + } + + /** + * Convert an instance of StandardizedDescription to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StartingPrice.java b/src/main/java/pl/wtx/allegro/api/client/model/StartingPrice.java new file mode 100644 index 0000000..e9e6227 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StartingPrice.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The starting price for offers in auction format. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StartingPrice { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public StartingPrice() { + } + + public StartingPrice amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public StartingPrice currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StartingPrice startingPrice = (StartingPrice) o; + return Objects.equals(this.amount, startingPrice.amount) && + Objects.equals(this.currency, startingPrice.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StartingPrice {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StartingPrice + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StartingPrice.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StartingPrice is not found in the empty JSON string", StartingPrice.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StartingPrice.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StartingPrice` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StartingPrice.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StartingPrice.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StartingPrice' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StartingPrice.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StartingPrice value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StartingPrice read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StartingPrice given an JSON string + * + * @param jsonString JSON string + * @return An instance of StartingPrice + * @throws IOException if the JSON string is invalid with respect to StartingPrice + */ + public static StartingPrice fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StartingPrice.class); + } + + /** + * Convert an instance of StartingPrice to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Stock.java b/src/main/java/pl/wtx/allegro/api/client/model/Stock.java new file mode 100644 index 0000000..54c024c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Stock.java @@ -0,0 +1,292 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Stock + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Stock { + public static final String SERIALIZED_NAME_AVAILABLE = "available"; + @SerializedName(SERIALIZED_NAME_AVAILABLE) + @javax.annotation.Nullable + private Integer available; + + /** + * Stock unit + */ + @JsonAdapter(UnitEnum.Adapter.class) + public enum UnitEnum { + UNIT("UNIT"), + + PAIR("PAIR"), + + SET("SET"); + + private String value; + + UnitEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static UnitEnum fromValue(String value) { + for (UnitEnum b : UnitEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final UnitEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public UnitEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return UnitEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + UnitEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private UnitEnum unit; + + public Stock() { + } + + public Stock available(@javax.annotation.Nullable Integer available) { + this.available = available; + return this; + } + + /** + * Quantity of this offer available for sale - how many times this offer can be sold. Offer can be activated only with stock being greater then 0. Setting this quantity to 0 for 'ACTIVE' or 'ACTIVATING' offer will trigger changing its status to 'ENDED'. + * minimum: 0 + * @return available + */ + @javax.annotation.Nullable + public Integer getAvailable() { + return available; + } + + public void setAvailable(@javax.annotation.Nullable Integer available) { + this.available = available; + } + + + public Stock unit(@javax.annotation.Nullable UnitEnum unit) { + this.unit = unit; + return this; + } + + /** + * Stock unit + * @return unit + */ + @javax.annotation.Nullable + public UnitEnum getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable UnitEnum unit) { + this.unit = unit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Stock stock = (Stock) o; + return Objects.equals(this.available, stock.available) && + Objects.equals(this.unit, stock.unit); + } + + @Override + public int hashCode() { + return Objects.hash(available, unit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Stock {\n"); + sb.append(" available: ").append(toIndentedString(available)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("available"); + openapiFields.add("unit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Stock + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Stock.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Stock is not found in the empty JSON string", Stock.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Stock.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Stock` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) && !jsonObj.get("unit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unit").toString())); + } + // validate the optional field `unit` + if (jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) { + UnitEnum.validateJsonElement(jsonObj.get("unit")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Stock.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Stock' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Stock.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Stock value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Stock read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Stock given an JSON string + * + * @param jsonString JSON string + * @return An instance of Stock + * @throws IOException if the JSON string is invalid with respect to Stock + */ + public static Stock fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Stock.class); + } + + /** + * Convert an instance of Stock to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StockProduct.java b/src/main/java/pl/wtx/allegro/api/client/model/StockProduct.java new file mode 100644 index 0000000..285118d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StockProduct.java @@ -0,0 +1,308 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The product. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StockProduct { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_GTINS = "gtins"; + @SerializedName(SERIALIZED_NAME_GTINS) + @javax.annotation.Nullable + private List gtins = new ArrayList<>(); + + public static final String SERIALIZED_NAME_IMAGE = "image"; + @SerializedName(SERIALIZED_NAME_IMAGE) + @javax.annotation.Nullable + private String image; + + public StockProduct() { + } + + public StockProduct id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The product identifier. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public StockProduct name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The product name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public StockProduct gtins(@javax.annotation.Nullable List gtins) { + this.gtins = gtins; + return this; + } + + public StockProduct addGtinsItem(String gtinsItem) { + if (this.gtins == null) { + this.gtins = new ArrayList<>(); + } + this.gtins.add(gtinsItem); + return this; + } + + /** + * List of product's GTIN numbers. + * @return gtins + */ + @javax.annotation.Nullable + public List getGtins() { + return gtins; + } + + public void setGtins(@javax.annotation.Nullable List gtins) { + this.gtins = gtins; + } + + + public StockProduct image(@javax.annotation.Nullable String image) { + this.image = image; + return this; + } + + /** + * The product image. + * @return image + */ + @javax.annotation.Nullable + public String getImage() { + return image; + } + + public void setImage(@javax.annotation.Nullable String image) { + this.image = image; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StockProduct stockProduct = (StockProduct) o; + return Objects.equals(this.id, stockProduct.id) && + Objects.equals(this.name, stockProduct.name) && + Objects.equals(this.gtins, stockProduct.gtins) && + Objects.equals(this.image, stockProduct.image); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, gtins, image); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StockProduct {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" gtins: ").append(toIndentedString(gtins)).append("\n"); + sb.append(" image: ").append(toIndentedString(image)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("gtins"); + openapiFields.add("image"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StockProduct + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StockProduct.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StockProduct is not found in the empty JSON string", StockProduct.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StockProduct.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StockProduct` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("gtins") != null && !jsonObj.get("gtins").isJsonNull() && !jsonObj.get("gtins").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `gtins` to be an array in the JSON string but got `%s`", jsonObj.get("gtins").toString())); + } + if ((jsonObj.get("image") != null && !jsonObj.get("image").isJsonNull()) && !jsonObj.get("image").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `image` to be a primitive type in the JSON string but got `%s`", jsonObj.get("image").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StockProduct.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StockProduct' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StockProduct.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StockProduct value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StockProduct read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StockProduct given an JSON string + * + * @param jsonString JSON string + * @return An instance of StockProduct + * @throws IOException if the JSON string is invalid with respect to StockProduct + */ + public static StockProduct fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StockProduct.class); + } + + /** + * Convert an instance of StockProduct to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StockProductItem.java b/src/main/java/pl/wtx/allegro/api/client/model/StockProductItem.java new file mode 100644 index 0000000..42e3617 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StockProductItem.java @@ -0,0 +1,366 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ReserveInfo; +import pl.wtx.allegro.api.client.model.StockProduct; +import pl.wtx.allegro.api.client.model.StockQuantity; +import pl.wtx.allegro.api.client.model.StockSellingStats; +import pl.wtx.allegro.api.client.model.StockStorageFee; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Groups together product and its quantity. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StockProductItem { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + @javax.annotation.Nullable + private StockProduct product; + + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nullable + private StockQuantity quantity; + + public static final String SERIALIZED_NAME_SELLING_STATS = "sellingStats"; + @SerializedName(SERIALIZED_NAME_SELLING_STATS) + @javax.annotation.Nullable + private StockSellingStats sellingStats; + + public static final String SERIALIZED_NAME_RESERVE = "reserve"; + @SerializedName(SERIALIZED_NAME_RESERVE) + @javax.annotation.Nullable + private ReserveInfo reserve; + + public static final String SERIALIZED_NAME_STORAGE_FEE = "storageFee"; + @SerializedName(SERIALIZED_NAME_STORAGE_FEE) + @javax.annotation.Nullable + private StockStorageFee storageFee; + + public static final String SERIALIZED_NAME_OFFER_ID = "offerId"; + @SerializedName(SERIALIZED_NAME_OFFER_ID) + @javax.annotation.Nullable + private String offerId; + + public StockProductItem() { + } + + public StockProductItem product(@javax.annotation.Nullable StockProduct product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public StockProduct getProduct() { + return product; + } + + public void setProduct(@javax.annotation.Nullable StockProduct product) { + this.product = product; + } + + + public StockProductItem quantity(@javax.annotation.Nullable StockQuantity quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nullable + public StockQuantity getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nullable StockQuantity quantity) { + this.quantity = quantity; + } + + + public StockProductItem sellingStats(@javax.annotation.Nullable StockSellingStats sellingStats) { + this.sellingStats = sellingStats; + return this; + } + + /** + * Get sellingStats + * @return sellingStats + */ + @javax.annotation.Nullable + public StockSellingStats getSellingStats() { + return sellingStats; + } + + public void setSellingStats(@javax.annotation.Nullable StockSellingStats sellingStats) { + this.sellingStats = sellingStats; + } + + + public StockProductItem reserve(@javax.annotation.Nullable ReserveInfo reserve) { + this.reserve = reserve; + return this; + } + + /** + * Get reserve + * @return reserve + */ + @javax.annotation.Nullable + public ReserveInfo getReserve() { + return reserve; + } + + public void setReserve(@javax.annotation.Nullable ReserveInfo reserve) { + this.reserve = reserve; + } + + + public StockProductItem storageFee(@javax.annotation.Nullable StockStorageFee storageFee) { + this.storageFee = storageFee; + return this; + } + + /** + * Get storageFee + * @return storageFee + */ + @javax.annotation.Nullable + public StockStorageFee getStorageFee() { + return storageFee; + } + + public void setStorageFee(@javax.annotation.Nullable StockStorageFee storageFee) { + this.storageFee = storageFee; + } + + + public StockProductItem offerId(@javax.annotation.Nullable String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Identifier of the offer currently attached to the product. + * @return offerId + */ + @javax.annotation.Nullable + public String getOfferId() { + return offerId; + } + + public void setOfferId(@javax.annotation.Nullable String offerId) { + this.offerId = offerId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StockProductItem stockProductItem = (StockProductItem) o; + return Objects.equals(this.product, stockProductItem.product) && + Objects.equals(this.quantity, stockProductItem.quantity) && + Objects.equals(this.sellingStats, stockProductItem.sellingStats) && + Objects.equals(this.reserve, stockProductItem.reserve) && + Objects.equals(this.storageFee, stockProductItem.storageFee) && + Objects.equals(this.offerId, stockProductItem.offerId); + } + + @Override + public int hashCode() { + return Objects.hash(product, quantity, sellingStats, reserve, storageFee, offerId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StockProductItem {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" sellingStats: ").append(toIndentedString(sellingStats)).append("\n"); + sb.append(" reserve: ").append(toIndentedString(reserve)).append("\n"); + sb.append(" storageFee: ").append(toIndentedString(storageFee)).append("\n"); + sb.append(" offerId: ").append(toIndentedString(offerId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("quantity"); + openapiFields.add("sellingStats"); + openapiFields.add("reserve"); + openapiFields.add("storageFee"); + openapiFields.add("offerId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StockProductItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StockProductItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StockProductItem is not found in the empty JSON string", StockProductItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StockProductItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StockProductItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + StockProduct.validateJsonElement(jsonObj.get("product")); + } + // validate the optional field `quantity` + if (jsonObj.get("quantity") != null && !jsonObj.get("quantity").isJsonNull()) { + StockQuantity.validateJsonElement(jsonObj.get("quantity")); + } + // validate the optional field `sellingStats` + if (jsonObj.get("sellingStats") != null && !jsonObj.get("sellingStats").isJsonNull()) { + StockSellingStats.validateJsonElement(jsonObj.get("sellingStats")); + } + // validate the optional field `reserve` + if (jsonObj.get("reserve") != null && !jsonObj.get("reserve").isJsonNull()) { + ReserveInfo.validateJsonElement(jsonObj.get("reserve")); + } + // validate the optional field `storageFee` + if (jsonObj.get("storageFee") != null && !jsonObj.get("storageFee").isJsonNull()) { + StockStorageFee.validateJsonElement(jsonObj.get("storageFee")); + } + if ((jsonObj.get("offerId") != null && !jsonObj.get("offerId").isJsonNull()) && !jsonObj.get("offerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `offerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("offerId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StockProductItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StockProductItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StockProductItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StockProductItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StockProductItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StockProductItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of StockProductItem + * @throws IOException if the JSON string is invalid with respect to StockProductItem + */ + public static StockProductItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StockProductItem.class); + } + + /** + * Convert an instance of StockProductItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StockProductList.java b/src/main/java/pl/wtx/allegro/api/client/model/StockProductList.java new file mode 100644 index 0000000..591532e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StockProductList.java @@ -0,0 +1,283 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.StockProductItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents the current stock for the seller. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StockProductList { + public static final String SERIALIZED_NAME_STOCK = "stock"; + @SerializedName(SERIALIZED_NAME_STOCK) + @javax.annotation.Nullable + private List stock = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private BigDecimal count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private BigDecimal totalCount; + + public StockProductList() { + } + + public StockProductList stock(@javax.annotation.Nullable List stock) { + this.stock = stock; + return this; + } + + public StockProductList addStockItem(StockProductItem stockItem) { + if (this.stock == null) { + this.stock = new ArrayList<>(); + } + this.stock.add(stockItem); + return this; + } + + /** + * List of products with their quantity. + * @return stock + */ + @javax.annotation.Nullable + public List getStock() { + return stock; + } + + public void setStock(@javax.annotation.Nullable List stock) { + this.stock = stock; + } + + + public StockProductList count(@javax.annotation.Nullable BigDecimal count) { + this.count = count; + return this; + } + + /** + * Number of returned products. + * @return count + */ + @javax.annotation.Nullable + public BigDecimal getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable BigDecimal count) { + this.count = count; + } + + + public StockProductList totalCount(@javax.annotation.Nullable BigDecimal totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of available products. + * @return totalCount + */ + @javax.annotation.Nullable + public BigDecimal getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable BigDecimal totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StockProductList stockProductList = (StockProductList) o; + return Objects.equals(this.stock, stockProductList.stock) && + Objects.equals(this.count, stockProductList.count) && + Objects.equals(this.totalCount, stockProductList.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(stock, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StockProductList {\n"); + sb.append(" stock: ").append(toIndentedString(stock)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("stock"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StockProductList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StockProductList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StockProductList is not found in the empty JSON string", StockProductList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StockProductList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StockProductList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("stock") != null && !jsonObj.get("stock").isJsonNull()) { + JsonArray jsonArraystock = jsonObj.getAsJsonArray("stock"); + if (jsonArraystock != null) { + // ensure the json data is an array + if (!jsonObj.get("stock").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `stock` to be an array in the JSON string but got `%s`", jsonObj.get("stock").toString())); + } + + // validate the optional field `stock` (array) + for (int i = 0; i < jsonArraystock.size(); i++) { + StockProductItem.validateJsonElement(jsonArraystock.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StockProductList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StockProductList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StockProductList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StockProductList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StockProductList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StockProductList given an JSON string + * + * @param jsonString JSON string + * @return An instance of StockProductList + * @throws IOException if the JSON string is invalid with respect to StockProductList + */ + public static StockProductList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StockProductList.class); + } + + /** + * Convert an instance of StockProductList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StockQuantity.java b/src/main/java/pl/wtx/allegro/api/client/model/StockQuantity.java new file mode 100644 index 0000000..854f19b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StockQuantity.java @@ -0,0 +1,285 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents stock quantity. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StockQuantity { + public static final String SERIALIZED_NAME_ON_OFFER = "onOffer"; + @SerializedName(SERIALIZED_NAME_ON_OFFER) + @javax.annotation.Nullable + private BigDecimal onOffer; + + public static final String SERIALIZED_NAME_AVAILABLE = "available"; + @SerializedName(SERIALIZED_NAME_AVAILABLE) + @javax.annotation.Nullable + private BigDecimal available; + + public static final String SERIALIZED_NAME_ON_ORDER = "onOrder"; + @SerializedName(SERIALIZED_NAME_ON_ORDER) + @javax.annotation.Nullable + private BigDecimal onOrder; + + public static final String SERIALIZED_NAME_ON_HOLD = "onHold"; + @SerializedName(SERIALIZED_NAME_ON_HOLD) + @javax.annotation.Nullable + private BigDecimal onHold; + + public StockQuantity() { + } + + public StockQuantity onOffer(@javax.annotation.Nullable BigDecimal onOffer) { + this.onOffer = onOffer; + return this; + } + + /** + * A number of items which are available on the current active offer for the product. + * @return onOffer + */ + @javax.annotation.Nullable + public BigDecimal getOnOffer() { + return onOffer; + } + + public void setOnOffer(@javax.annotation.Nullable BigDecimal onOffer) { + this.onOffer = onOffer; + } + + + public StockQuantity available(@javax.annotation.Nullable BigDecimal available) { + this.available = available; + return this; + } + + /** + * A number of items in a warehouse available for sale. The amount is taken from the current active offer, or in case there is no active offer, it shows the amount that will be available on offer after it will have been created. + * @return available + */ + @javax.annotation.Nullable + public BigDecimal getAvailable() { + return available; + } + + public void setAvailable(@javax.annotation.Nullable BigDecimal available) { + this.available = available; + } + + + public StockQuantity onOrder(@javax.annotation.Nullable BigDecimal onOrder) { + this.onOrder = onOrder; + return this; + } + + /** + * A number of items already bought but not shipped. These are items in unpaid and paid orders that waiting for courier pickup. + * @return onOrder + */ + @javax.annotation.Nullable + public BigDecimal getOnOrder() { + return onOrder; + } + + public void setOnOrder(@javax.annotation.Nullable BigDecimal onOrder) { + this.onOrder = onOrder; + } + + + public StockQuantity onHold(@javax.annotation.Nullable BigDecimal onHold) { + this.onHold = onHold; + return this; + } + + /** + * A number of items in a warehouse not available for sale (e.g. due to damage). + * @return onHold + */ + @javax.annotation.Nullable + public BigDecimal getOnHold() { + return onHold; + } + + public void setOnHold(@javax.annotation.Nullable BigDecimal onHold) { + this.onHold = onHold; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StockQuantity stockQuantity = (StockQuantity) o; + return Objects.equals(this.onOffer, stockQuantity.onOffer) && + Objects.equals(this.available, stockQuantity.available) && + Objects.equals(this.onOrder, stockQuantity.onOrder) && + Objects.equals(this.onHold, stockQuantity.onHold); + } + + @Override + public int hashCode() { + return Objects.hash(onOffer, available, onOrder, onHold); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StockQuantity {\n"); + sb.append(" onOffer: ").append(toIndentedString(onOffer)).append("\n"); + sb.append(" available: ").append(toIndentedString(available)).append("\n"); + sb.append(" onOrder: ").append(toIndentedString(onOrder)).append("\n"); + sb.append(" onHold: ").append(toIndentedString(onHold)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("onOffer"); + openapiFields.add("available"); + openapiFields.add("onOrder"); + openapiFields.add("onHold"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StockQuantity + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StockQuantity.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StockQuantity is not found in the empty JSON string", StockQuantity.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StockQuantity.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StockQuantity` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StockQuantity.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StockQuantity' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StockQuantity.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StockQuantity value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StockQuantity read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StockQuantity given an JSON string + * + * @param jsonString JSON string + * @return An instance of StockQuantity + * @throws IOException if the JSON string is invalid with respect to StockQuantity + */ + public static StockQuantity fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StockQuantity.class); + } + + /** + * Convert an instance of StockQuantity to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StockSellingStats.java b/src/main/java/pl/wtx/allegro/api/client/model/StockSellingStats.java new file mode 100644 index 0000000..c2a7153 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StockSellingStats.java @@ -0,0 +1,231 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents selling stats of given product in merchant's stock. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StockSellingStats { + public static final String SERIALIZED_NAME_LAST_WEEK_AVERAGE = "lastWeekAverage"; + @SerializedName(SERIALIZED_NAME_LAST_WEEK_AVERAGE) + @javax.annotation.Nullable + private BigDecimal lastWeekAverage; + + public static final String SERIALIZED_NAME_LAST_THIRTY_DAYS_SUM = "lastThirtyDaysSum"; + @SerializedName(SERIALIZED_NAME_LAST_THIRTY_DAYS_SUM) + @javax.annotation.Nullable + private BigDecimal lastThirtyDaysSum; + + public StockSellingStats() { + } + + public StockSellingStats lastWeekAverage(@javax.annotation.Nullable BigDecimal lastWeekAverage) { + this.lastWeekAverage = lastWeekAverage; + return this; + } + + /** + * Moving daily sales average calculated for last week (7 calendar days before current day), rounded to integer using \"half up\" logic. Doesn't include sales for current day. Note that this number is not stable and might change between subsequent requests due to e.g. cancellations of orders within the calculation period. + * @return lastWeekAverage + */ + @javax.annotation.Nullable + public BigDecimal getLastWeekAverage() { + return lastWeekAverage; + } + + public void setLastWeekAverage(@javax.annotation.Nullable BigDecimal lastWeekAverage) { + this.lastWeekAverage = lastWeekAverage; + } + + + public StockSellingStats lastThirtyDaysSum(@javax.annotation.Nullable BigDecimal lastThirtyDaysSum) { + this.lastThirtyDaysSum = lastThirtyDaysSum; + return this; + } + + /** + * Total sales for the last 30 calendar days. Doesn't include sales for current day. Note that this number is not stable and might change between subsequent requests due to e.g. cancellations of orders within the calculation period. + * @return lastThirtyDaysSum + */ + @javax.annotation.Nullable + public BigDecimal getLastThirtyDaysSum() { + return lastThirtyDaysSum; + } + + public void setLastThirtyDaysSum(@javax.annotation.Nullable BigDecimal lastThirtyDaysSum) { + this.lastThirtyDaysSum = lastThirtyDaysSum; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StockSellingStats stockSellingStats = (StockSellingStats) o; + return Objects.equals(this.lastWeekAverage, stockSellingStats.lastWeekAverage) && + Objects.equals(this.lastThirtyDaysSum, stockSellingStats.lastThirtyDaysSum); + } + + @Override + public int hashCode() { + return Objects.hash(lastWeekAverage, lastThirtyDaysSum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StockSellingStats {\n"); + sb.append(" lastWeekAverage: ").append(toIndentedString(lastWeekAverage)).append("\n"); + sb.append(" lastThirtyDaysSum: ").append(toIndentedString(lastThirtyDaysSum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("lastWeekAverage"); + openapiFields.add("lastThirtyDaysSum"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StockSellingStats + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StockSellingStats.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StockSellingStats is not found in the empty JSON string", StockSellingStats.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StockSellingStats.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StockSellingStats` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StockSellingStats.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StockSellingStats' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StockSellingStats.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StockSellingStats value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StockSellingStats read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StockSellingStats given an JSON string + * + * @param jsonString JSON string + * @return An instance of StockSellingStats + * @throws IOException if the JSON string is invalid with respect to StockSellingStats + */ + public static StockSellingStats fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StockSellingStats.class); + } + + /** + * Convert an instance of StockSellingStats to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StockStorageFee.java b/src/main/java/pl/wtx/allegro/api/client/model/StockStorageFee.java new file mode 100644 index 0000000..f3f88b4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StockStorageFee.java @@ -0,0 +1,328 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.StockStorageFeeDetails; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about storage fee for a given product in merchant's stock. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StockStorageFee { + /** + * Status of the storage fee. * NOT_APPLICABLE - fee for yesterday has not been charged and there are no available items of the product. * INCLUDED_IN_SERVICE_PRICE - fee for yesterday has not been charged and there are available items of the product. * CHARGED - the fee has been charged on seller's billing. * PREDICTION - prediction of upcoming fee, based on yesterday selling stats and quantity. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + NOT_APPLICABLE("NOT_APPLICABLE"), + + INCLUDED_IN_SERVICE_PRICE("INCLUDED_IN_SERVICE_PRICE"), + + CHARGED("CHARGED"), + + PREDICTION("PREDICTION"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_FEE_STATUS_AT = "feeStatusAt"; + @SerializedName(SERIALIZED_NAME_FEE_STATUS_AT) + @javax.annotation.Nullable + private String feeStatusAt; + + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable + private StockStorageFeeDetails details; + + public StockStorageFee() { + } + + public StockStorageFee status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Status of the storage fee. * NOT_APPLICABLE - fee for yesterday has not been charged and there are no available items of the product. * INCLUDED_IN_SERVICE_PRICE - fee for yesterday has not been charged and there are available items of the product. * CHARGED - the fee has been charged on seller's billing. * PREDICTION - prediction of upcoming fee, based on yesterday selling stats and quantity. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public StockStorageFee feeStatusAt(@javax.annotation.Nullable String feeStatusAt) { + this.feeStatusAt = feeStatusAt; + return this; + } + + /** + * Date when the fee was charged. Normally we return the data for the day before. However, due to asynchronous nature of fee update process, which are calculated overnight, it is possible to have some outdated entries when querying during fee recalculation process. This value allows to ensure that you work on the most recent data. + * @return feeStatusAt + */ + @javax.annotation.Nullable + public String getFeeStatusAt() { + return feeStatusAt; + } + + public void setFeeStatusAt(@javax.annotation.Nullable String feeStatusAt) { + this.feeStatusAt = feeStatusAt; + } + + + public StockStorageFee details(@javax.annotation.Nullable StockStorageFeeDetails details) { + this.details = details; + return this; + } + + /** + * Get details + * @return details + */ + @javax.annotation.Nullable + public StockStorageFeeDetails getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable StockStorageFeeDetails details) { + this.details = details; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StockStorageFee stockStorageFee = (StockStorageFee) o; + return Objects.equals(this.status, stockStorageFee.status) && + Objects.equals(this.feeStatusAt, stockStorageFee.feeStatusAt) && + Objects.equals(this.details, stockStorageFee.details); + } + + @Override + public int hashCode() { + return Objects.hash(status, feeStatusAt, details); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StockStorageFee {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" feeStatusAt: ").append(toIndentedString(feeStatusAt)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("feeStatusAt"); + openapiFields.add("details"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StockStorageFee + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StockStorageFee.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StockStorageFee is not found in the empty JSON string", StockStorageFee.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StockStorageFee.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StockStorageFee` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("feeStatusAt") != null && !jsonObj.get("feeStatusAt").isJsonNull()) && !jsonObj.get("feeStatusAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `feeStatusAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("feeStatusAt").toString())); + } + // validate the optional field `details` + if (jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) { + StockStorageFeeDetails.validateJsonElement(jsonObj.get("details")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StockStorageFee.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StockStorageFee' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StockStorageFee.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StockStorageFee value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StockStorageFee read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StockStorageFee given an JSON string + * + * @param jsonString JSON string + * @return An instance of StockStorageFee + * @throws IOException if the JSON string is invalid with respect to StockStorageFee + */ + public static StockStorageFee fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StockStorageFee.class); + } + + /** + * Convert an instance of StockStorageFee to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StockStorageFeeDetails.java b/src/main/java/pl/wtx/allegro/api/client/model/StockStorageFeeDetails.java new file mode 100644 index 0000000..63af2d3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StockStorageFeeDetails.java @@ -0,0 +1,291 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Details about charged storage fee. Only present in case of CHARGED status, null otherwise. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StockStorageFeeDetails { + public static final String SERIALIZED_NAME_FEE_PAYABLE_AT = "feePayableAt"; + @SerializedName(SERIALIZED_NAME_FEE_PAYABLE_AT) + @javax.annotation.Nullable + private String feePayableAt; + + public static final String SERIALIZED_NAME_CHARGED_ITEMS_QUANTITY = "chargedItemsQuantity"; + @SerializedName(SERIALIZED_NAME_CHARGED_ITEMS_QUANTITY) + @javax.annotation.Nullable + private BigDecimal chargedItemsQuantity; + + public static final String SERIALIZED_NAME_AMOUNT_GROSS = "amountGross"; + @SerializedName(SERIALIZED_NAME_AMOUNT_GROSS) + @javax.annotation.Nullable + private BigDecimal amountGross; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public StockStorageFeeDetails() { + } + + public StockStorageFeeDetails feePayableAt(@javax.annotation.Nullable String feePayableAt) { + this.feePayableAt = feePayableAt; + return this; + } + + /** + * Predicted date when the fee will be charged based on quantity and average sales. Only present in case of PREDICTION status, null otherwise. + * @return feePayableAt + */ + @javax.annotation.Nullable + public String getFeePayableAt() { + return feePayableAt; + } + + public void setFeePayableAt(@javax.annotation.Nullable String feePayableAt) { + this.feePayableAt = feePayableAt; + } + + + public StockStorageFeeDetails chargedItemsQuantity(@javax.annotation.Nullable BigDecimal chargedItemsQuantity) { + this.chargedItemsQuantity = chargedItemsQuantity; + return this; + } + + /** + * Number of items, for which storage fee was charged. For example seller might have 20 items in total, but only 3 of them are stored longer than free storage period, so the fee is applied only for them. + * @return chargedItemsQuantity + */ + @javax.annotation.Nullable + public BigDecimal getChargedItemsQuantity() { + return chargedItemsQuantity; + } + + public void setChargedItemsQuantity(@javax.annotation.Nullable BigDecimal chargedItemsQuantity) { + this.chargedItemsQuantity = chargedItemsQuantity; + } + + + public StockStorageFeeDetails amountGross(@javax.annotation.Nullable BigDecimal amountGross) { + this.amountGross = amountGross; + return this; + } + + /** + * Total gross amount of the charged fee. + * @return amountGross + */ + @javax.annotation.Nullable + public BigDecimal getAmountGross() { + return amountGross; + } + + public void setAmountGross(@javax.annotation.Nullable BigDecimal amountGross) { + this.amountGross = amountGross; + } + + + public StockStorageFeeDetails currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * Currency in which the fee was charged. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StockStorageFeeDetails stockStorageFeeDetails = (StockStorageFeeDetails) o; + return Objects.equals(this.feePayableAt, stockStorageFeeDetails.feePayableAt) && + Objects.equals(this.chargedItemsQuantity, stockStorageFeeDetails.chargedItemsQuantity) && + Objects.equals(this.amountGross, stockStorageFeeDetails.amountGross) && + Objects.equals(this.currency, stockStorageFeeDetails.currency); + } + + @Override + public int hashCode() { + return Objects.hash(feePayableAt, chargedItemsQuantity, amountGross, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StockStorageFeeDetails {\n"); + sb.append(" feePayableAt: ").append(toIndentedString(feePayableAt)).append("\n"); + sb.append(" chargedItemsQuantity: ").append(toIndentedString(chargedItemsQuantity)).append("\n"); + sb.append(" amountGross: ").append(toIndentedString(amountGross)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("feePayableAt"); + openapiFields.add("chargedItemsQuantity"); + openapiFields.add("amountGross"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StockStorageFeeDetails + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StockStorageFeeDetails.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StockStorageFeeDetails is not found in the empty JSON string", StockStorageFeeDetails.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StockStorageFeeDetails.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StockStorageFeeDetails` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("feePayableAt") != null && !jsonObj.get("feePayableAt").isJsonNull()) && !jsonObj.get("feePayableAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `feePayableAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("feePayableAt").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StockStorageFeeDetails.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StockStorageFeeDetails' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StockStorageFeeDetails.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StockStorageFeeDetails value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StockStorageFeeDetails read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StockStorageFeeDetails given an JSON string + * + * @param jsonString JSON string + * @return An instance of StockStorageFeeDetails + * @throws IOException if the JSON string is invalid with respect to StockStorageFeeDetails + */ + public static StockStorageFeeDetails fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StockStorageFeeDetails.class); + } + + /** + * Convert an instance of StockStorageFeeDetails to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StringCategoryParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/StringCategoryParameter.java new file mode 100644 index 0000000..c173a66 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StringCategoryParameter.java @@ -0,0 +1,257 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.CategoryParameter; +import pl.wtx.allegro.api.client.model.CategoryParameterDisplayConditions; +import pl.wtx.allegro.api.client.model.CategoryParameterOptions; +import pl.wtx.allegro.api.client.model.CategoryParameterRequirementConditions; +import pl.wtx.allegro.api.client.model.StringCategoryProductParameterAllOfRestrictions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * StringCategoryParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StringCategoryParameter extends CategoryParameter { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "string"; + + public static final String SERIALIZED_NAME_RESTRICTIONS = "restrictions"; + @SerializedName(SERIALIZED_NAME_RESTRICTIONS) + @javax.annotation.Nullable + private StringCategoryProductParameterAllOfRestrictions restrictions; + + public StringCategoryParameter() { + this.type = this.getClass().getSimpleName(); + } + + public StringCategoryParameter type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public StringCategoryParameter restrictions(@javax.annotation.Nullable StringCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + * Get restrictions + * @return restrictions + */ + @javax.annotation.Nullable + public StringCategoryProductParameterAllOfRestrictions getRestrictions() { + return restrictions; + } + + public void setRestrictions(@javax.annotation.Nullable StringCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StringCategoryParameter stringCategoryParameter = (StringCategoryParameter) o; + return Objects.equals(this.type, stringCategoryParameter.type) && + Objects.equals(this.restrictions, stringCategoryParameter.restrictions) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, restrictions, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StringCategoryParameter {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" restrictions: ").append(toIndentedString(restrictions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("required"); + openapiFields.add("requiredForProduct"); + openapiFields.add("requiredIf"); + openapiFields.add("displayedIf"); + openapiFields.add("unit"); + openapiFields.add("options"); + openapiFields.add("restrictions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StringCategoryParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StringCategoryParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StringCategoryParameter is not found in the empty JSON string", StringCategoryParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StringCategoryParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StringCategoryParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StringCategoryParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StringCategoryParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StringCategoryParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StringCategoryParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StringCategoryParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StringCategoryParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of StringCategoryParameter + * @throws IOException if the JSON string is invalid with respect to StringCategoryParameter + */ + public static StringCategoryParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StringCategoryParameter.class); + } + + /** + * Convert an instance of StringCategoryParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StringCategoryProductParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/StringCategoryProductParameter.java new file mode 100644 index 0000000..3071ad3 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StringCategoryProductParameter.java @@ -0,0 +1,254 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.CategoryParameterDisplayConditions; +import pl.wtx.allegro.api.client.model.CategoryParameterRequirementConditions; +import pl.wtx.allegro.api.client.model.CategoryProductParameter; +import pl.wtx.allegro.api.client.model.StringCategoryProductParameterAllOfRestrictions; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * StringCategoryProductParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StringCategoryProductParameter extends CategoryProductParameter { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "string"; + + public static final String SERIALIZED_NAME_RESTRICTIONS = "restrictions"; + @SerializedName(SERIALIZED_NAME_RESTRICTIONS) + @javax.annotation.Nullable + private StringCategoryProductParameterAllOfRestrictions restrictions; + + public StringCategoryProductParameter() { + this.type = this.getClass().getSimpleName(); + } + + public StringCategoryProductParameter type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public StringCategoryProductParameter restrictions(@javax.annotation.Nullable StringCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + * Get restrictions + * @return restrictions + */ + @javax.annotation.Nullable + public StringCategoryProductParameterAllOfRestrictions getRestrictions() { + return restrictions; + } + + public void setRestrictions(@javax.annotation.Nullable StringCategoryProductParameterAllOfRestrictions restrictions) { + this.restrictions = restrictions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StringCategoryProductParameter stringCategoryProductParameter = (StringCategoryProductParameter) o; + return Objects.equals(this.type, stringCategoryProductParameter.type) && + Objects.equals(this.restrictions, stringCategoryProductParameter.restrictions) && + super.equals(o); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, restrictions, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StringCategoryProductParameter {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" restrictions: ").append(toIndentedString(restrictions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("required"); + openapiFields.add("requiredIf"); + openapiFields.add("displayedIf"); + openapiFields.add("unit"); + openapiFields.add("restrictions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StringCategoryProductParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StringCategoryProductParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StringCategoryProductParameter is not found in the empty JSON string", StringCategoryProductParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StringCategoryProductParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StringCategoryProductParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StringCategoryProductParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StringCategoryProductParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StringCategoryProductParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StringCategoryProductParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StringCategoryProductParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StringCategoryProductParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of StringCategoryProductParameter + * @throws IOException if the JSON string is invalid with respect to StringCategoryProductParameter + */ + public static StringCategoryProductParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StringCategoryProductParameter.class); + } + + /** + * Convert an instance of StringCategoryProductParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/StringCategoryProductParameterAllOfRestrictions.java b/src/main/java/pl/wtx/allegro/api/client/model/StringCategoryProductParameterAllOfRestrictions.java new file mode 100644 index 0000000..dd10ba6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/StringCategoryProductParameterAllOfRestrictions.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The restrictions on values of this parameter. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class StringCategoryProductParameterAllOfRestrictions { + public static final String SERIALIZED_NAME_MIN_LENGTH = "minLength"; + @SerializedName(SERIALIZED_NAME_MIN_LENGTH) + @javax.annotation.Nullable + private Integer minLength; + + public static final String SERIALIZED_NAME_MAX_LENGTH = "maxLength"; + @SerializedName(SERIALIZED_NAME_MAX_LENGTH) + @javax.annotation.Nullable + private Integer maxLength; + + public static final String SERIALIZED_NAME_ALLOWED_NUMBER_OF_VALUES = "allowedNumberOfValues"; + @SerializedName(SERIALIZED_NAME_ALLOWED_NUMBER_OF_VALUES) + @javax.annotation.Nullable + private Integer allowedNumberOfValues; + + public StringCategoryProductParameterAllOfRestrictions() { + } + + public StringCategoryProductParameterAllOfRestrictions minLength(@javax.annotation.Nullable Integer minLength) { + this.minLength = minLength; + return this; + } + + /** + * The minimum length of the parameter value. + * minimum: 0 + * @return minLength + */ + @javax.annotation.Nullable + public Integer getMinLength() { + return minLength; + } + + public void setMinLength(@javax.annotation.Nullable Integer minLength) { + this.minLength = minLength; + } + + + public StringCategoryProductParameterAllOfRestrictions maxLength(@javax.annotation.Nullable Integer maxLength) { + this.maxLength = maxLength; + return this; + } + + /** + * The maximum length of the parameter value. + * minimum: 1 + * @return maxLength + */ + @javax.annotation.Nullable + public Integer getMaxLength() { + return maxLength; + } + + public void setMaxLength(@javax.annotation.Nullable Integer maxLength) { + this.maxLength = maxLength; + } + + + public StringCategoryProductParameterAllOfRestrictions allowedNumberOfValues(@javax.annotation.Nullable Integer allowedNumberOfValues) { + this.allowedNumberOfValues = allowedNumberOfValues; + return this; + } + + /** + * Indicates how many different values can be provided for this parameter. + * minimum: 0 + * @return allowedNumberOfValues + */ + @javax.annotation.Nullable + public Integer getAllowedNumberOfValues() { + return allowedNumberOfValues; + } + + public void setAllowedNumberOfValues(@javax.annotation.Nullable Integer allowedNumberOfValues) { + this.allowedNumberOfValues = allowedNumberOfValues; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StringCategoryProductParameterAllOfRestrictions stringCategoryProductParameterAllOfRestrictions = (StringCategoryProductParameterAllOfRestrictions) o; + return Objects.equals(this.minLength, stringCategoryProductParameterAllOfRestrictions.minLength) && + Objects.equals(this.maxLength, stringCategoryProductParameterAllOfRestrictions.maxLength) && + Objects.equals(this.allowedNumberOfValues, stringCategoryProductParameterAllOfRestrictions.allowedNumberOfValues); + } + + @Override + public int hashCode() { + return Objects.hash(minLength, maxLength, allowedNumberOfValues); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StringCategoryProductParameterAllOfRestrictions {\n"); + sb.append(" minLength: ").append(toIndentedString(minLength)).append("\n"); + sb.append(" maxLength: ").append(toIndentedString(maxLength)).append("\n"); + sb.append(" allowedNumberOfValues: ").append(toIndentedString(allowedNumberOfValues)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("minLength"); + openapiFields.add("maxLength"); + openapiFields.add("allowedNumberOfValues"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StringCategoryProductParameterAllOfRestrictions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StringCategoryProductParameterAllOfRestrictions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StringCategoryProductParameterAllOfRestrictions is not found in the empty JSON string", StringCategoryProductParameterAllOfRestrictions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StringCategoryProductParameterAllOfRestrictions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StringCategoryProductParameterAllOfRestrictions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StringCategoryProductParameterAllOfRestrictions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StringCategoryProductParameterAllOfRestrictions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StringCategoryProductParameterAllOfRestrictions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StringCategoryProductParameterAllOfRestrictions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StringCategoryProductParameterAllOfRestrictions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StringCategoryProductParameterAllOfRestrictions given an JSON string + * + * @param jsonString JSON string + * @return An instance of StringCategoryProductParameterAllOfRestrictions + * @throws IOException if the JSON string is invalid with respect to StringCategoryProductParameterAllOfRestrictions + */ + public static StringCategoryProductParameterAllOfRestrictions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StringCategoryProductParameterAllOfRestrictions.class); + } + + /** + * Convert an instance of StringCategoryProductParameterAllOfRestrictions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Subject.java b/src/main/java/pl/wtx/allegro/api/client/model/Subject.java new file mode 100644 index 0000000..70752ef --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Subject.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Subject of the dispute + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Subject { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public Subject() { + } + + public Subject name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Subject name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Subject subject = (Subject) o; + return Objects.equals(this.name, subject.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Subject {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Subject + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Subject.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Subject is not found in the empty JSON string", Subject.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Subject.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Subject` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Subject.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Subject' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Subject.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Subject value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Subject read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Subject given an JSON string + * + * @param jsonString JSON string + * @return An instance of Subject + * @throws IOException if the JSON string is invalid with respect to Subject + */ + public static Subject fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Subject.class); + } + + /** + * Convert an instance of Subject to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SubmitCommand.java b/src/main/java/pl/wtx/allegro/api/client/model/SubmitCommand.java new file mode 100644 index 0000000..b1ae74e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SubmitCommand.java @@ -0,0 +1,277 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.SubmitCommandInput; +import pl.wtx.allegro.api.client.model.SubmitCommandOutput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The submit command. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SubmitCommand { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_INPUT = "input"; + @SerializedName(SERIALIZED_NAME_INPUT) + @javax.annotation.Nonnull + private SubmitCommandInput input; + + public static final String SERIALIZED_NAME_OUTPUT = "output"; + @SerializedName(SERIALIZED_NAME_OUTPUT) + @javax.annotation.Nullable + private SubmitCommandOutput output; + + public SubmitCommand() { + } + + public SubmitCommand id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The identifier of command. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public SubmitCommand input(@javax.annotation.Nonnull SubmitCommandInput input) { + this.input = input; + return this; + } + + /** + * Get input + * @return input + */ + @javax.annotation.Nonnull + public SubmitCommandInput getInput() { + return input; + } + + public void setInput(@javax.annotation.Nonnull SubmitCommandInput input) { + this.input = input; + } + + + public SubmitCommand output(@javax.annotation.Nullable SubmitCommandOutput output) { + this.output = output; + return this; + } + + /** + * Get output + * @return output + */ + @javax.annotation.Nullable + public SubmitCommandOutput getOutput() { + return output; + } + + public void setOutput(@javax.annotation.Nullable SubmitCommandOutput output) { + this.output = output; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SubmitCommand submitCommand = (SubmitCommand) o; + return Objects.equals(this.id, submitCommand.id) && + Objects.equals(this.input, submitCommand.input) && + Objects.equals(this.output, submitCommand.output); + } + + @Override + public int hashCode() { + return Objects.hash(id, input, output); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubmitCommand {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("input"); + openapiFields.add("output"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("input"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SubmitCommand + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SubmitCommand.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SubmitCommand is not found in the empty JSON string", SubmitCommand.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SubmitCommand.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SubmitCommand` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SubmitCommand.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the required field `input` + SubmitCommandInput.validateJsonElement(jsonObj.get("input")); + // validate the optional field `output` + if (jsonObj.get("output") != null && !jsonObj.get("output").isJsonNull()) { + SubmitCommandOutput.validateJsonElement(jsonObj.get("output")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SubmitCommand.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SubmitCommand' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SubmitCommand.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SubmitCommand value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SubmitCommand read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SubmitCommand given an JSON string + * + * @param jsonString JSON string + * @return An instance of SubmitCommand + * @throws IOException if the JSON string is invalid with respect to SubmitCommand + */ + public static SubmitCommand fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SubmitCommand.class); + } + + /** + * Convert an instance of SubmitCommand to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SubmitCommandInput.java b/src/main/java/pl/wtx/allegro/api/client/model/SubmitCommandInput.java new file mode 100644 index 0000000..91ae879 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SubmitCommandInput.java @@ -0,0 +1,215 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents input of the Advance Ship Notice submit command. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SubmitCommandInput { + public static final String SERIALIZED_NAME_ADVANCE_SHIP_NOTICE_ID = "advanceShipNoticeId"; + @SerializedName(SERIALIZED_NAME_ADVANCE_SHIP_NOTICE_ID) + @javax.annotation.Nonnull + private UUID advanceShipNoticeId; + + public SubmitCommandInput() { + } + + public SubmitCommandInput advanceShipNoticeId(@javax.annotation.Nonnull UUID advanceShipNoticeId) { + this.advanceShipNoticeId = advanceShipNoticeId; + return this; + } + + /** + * The Advance Ship Notice identifier. + * @return advanceShipNoticeId + */ + @javax.annotation.Nonnull + public UUID getAdvanceShipNoticeId() { + return advanceShipNoticeId; + } + + public void setAdvanceShipNoticeId(@javax.annotation.Nonnull UUID advanceShipNoticeId) { + this.advanceShipNoticeId = advanceShipNoticeId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SubmitCommandInput submitCommandInput = (SubmitCommandInput) o; + return Objects.equals(this.advanceShipNoticeId, submitCommandInput.advanceShipNoticeId); + } + + @Override + public int hashCode() { + return Objects.hash(advanceShipNoticeId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubmitCommandInput {\n"); + sb.append(" advanceShipNoticeId: ").append(toIndentedString(advanceShipNoticeId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("advanceShipNoticeId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("advanceShipNoticeId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SubmitCommandInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SubmitCommandInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SubmitCommandInput is not found in the empty JSON string", SubmitCommandInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SubmitCommandInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SubmitCommandInput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SubmitCommandInput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("advanceShipNoticeId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `advanceShipNoticeId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("advanceShipNoticeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SubmitCommandInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SubmitCommandInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SubmitCommandInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SubmitCommandInput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SubmitCommandInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SubmitCommandInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of SubmitCommandInput + * @throws IOException if the JSON string is invalid with respect to SubmitCommandInput + */ + public static SubmitCommandInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SubmitCommandInput.class); + } + + /** + * Convert an instance of SubmitCommandInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SubmitCommandOutput.java b/src/main/java/pl/wtx/allegro/api/client/model/SubmitCommandOutput.java new file mode 100644 index 0000000..3bdd850 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SubmitCommandOutput.java @@ -0,0 +1,183 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents output of the Advance Ship Notice submit command. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SubmitCommandOutput { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + protected String status; + + public SubmitCommandOutput() { + this.status = this.getClass().getSimpleName(); + } + + public SubmitCommandOutput status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * The command status. + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SubmitCommandOutput submitCommandOutput = (SubmitCommandOutput) o; + return Objects.equals(this.status, submitCommandOutput.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubmitCommandOutput {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SubmitCommandOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SubmitCommandOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SubmitCommandOutput is not found in the empty JSON string", SubmitCommandOutput.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("status").getAsString(); + switch (discriminatorValue) { + case "FAILED": + SubmitFailedCommandOutput.validateJsonElement(jsonElement); + break; + case "RUNNING": + SubmitRunningCommandOutput.validateJsonElement(jsonElement); + break; + case "SUCCESSFUL": + SubmitSuccessfulCommandOutput.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `status` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of SubmitCommandOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of SubmitCommandOutput + * @throws IOException if the JSON string is invalid with respect to SubmitCommandOutput + */ + public static SubmitCommandOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SubmitCommandOutput.class); + } + + /** + * Convert an instance of SubmitCommandOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SubmitFailedCommandOutput.java b/src/main/java/pl/wtx/allegro/api/client/model/SubmitFailedCommandOutput.java new file mode 100644 index 0000000..fb9de90 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SubmitFailedCommandOutput.java @@ -0,0 +1,252 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Error; +import pl.wtx.allegro.api.client.model.SubmitCommandOutput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SubmitFailedCommandOutput + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SubmitFailedCommandOutput extends SubmitCommandOutput { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + protected String status = "FAILED"; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nonnull + private List errors = new ArrayList<>(); + + public SubmitFailedCommandOutput() { + this.status = this.getClass().getSimpleName(); + } + + public SubmitFailedCommandOutput status(@javax.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable String status) { + this.status = status; + } + + + public SubmitFailedCommandOutput errors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + return this; + } + + public SubmitFailedCommandOutput addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * The list of all the error objects explaining the error. + * @return errors + */ + @javax.annotation.Nonnull + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SubmitFailedCommandOutput submitFailedCommandOutput = (SubmitFailedCommandOutput) o; + return Objects.equals(this.status, submitFailedCommandOutput.status) && + Objects.equals(this.errors, submitFailedCommandOutput.errors) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(status, errors, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubmitFailedCommandOutput {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("errors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("errors"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SubmitFailedCommandOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SubmitFailedCommandOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SubmitFailedCommandOutput is not found in the empty JSON string", SubmitFailedCommandOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SubmitFailedCommandOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SubmitFailedCommandOutput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SubmitFailedCommandOutput.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SubmitFailedCommandOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SubmitFailedCommandOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SubmitFailedCommandOutput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SubmitFailedCommandOutput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SubmitFailedCommandOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SubmitFailedCommandOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of SubmitFailedCommandOutput + * @throws IOException if the JSON string is invalid with respect to SubmitFailedCommandOutput + */ + public static SubmitFailedCommandOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SubmitFailedCommandOutput.class); + } + + /** + * Convert an instance of SubmitFailedCommandOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SubmitRunningCommandOutput.java b/src/main/java/pl/wtx/allegro/api/client/model/SubmitRunningCommandOutput.java new file mode 100644 index 0000000..e2b116f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SubmitRunningCommandOutput.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.SubmitCommandOutput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SubmitRunningCommandOutput + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SubmitRunningCommandOutput extends SubmitCommandOutput { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + protected String status = "RUNNING"; + + public SubmitRunningCommandOutput() { + this.status = this.getClass().getSimpleName(); + } + + public SubmitRunningCommandOutput status(@javax.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable String status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SubmitRunningCommandOutput submitRunningCommandOutput = (SubmitRunningCommandOutput) o; + return Objects.equals(this.status, submitRunningCommandOutput.status) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(status, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubmitRunningCommandOutput {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SubmitRunningCommandOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SubmitRunningCommandOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SubmitRunningCommandOutput is not found in the empty JSON string", SubmitRunningCommandOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SubmitRunningCommandOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SubmitRunningCommandOutput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SubmitRunningCommandOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SubmitRunningCommandOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SubmitRunningCommandOutput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SubmitRunningCommandOutput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SubmitRunningCommandOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SubmitRunningCommandOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of SubmitRunningCommandOutput + * @throws IOException if the JSON string is invalid with respect to SubmitRunningCommandOutput + */ + public static SubmitRunningCommandOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SubmitRunningCommandOutput.class); + } + + /** + * Convert an instance of SubmitRunningCommandOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SubmitSuccessfulCommandOutput.java b/src/main/java/pl/wtx/allegro/api/client/model/SubmitSuccessfulCommandOutput.java new file mode 100644 index 0000000..f067678 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SubmitSuccessfulCommandOutput.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.SubmitCommandOutput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SubmitSuccessfulCommandOutput + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SubmitSuccessfulCommandOutput extends SubmitCommandOutput { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + protected String status = "SUCCESSFUL"; + + public SubmitSuccessfulCommandOutput() { + this.status = this.getClass().getSimpleName(); + } + + public SubmitSuccessfulCommandOutput status(@javax.annotation.Nullable String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable String status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SubmitSuccessfulCommandOutput submitSuccessfulCommandOutput = (SubmitSuccessfulCommandOutput) o; + return Objects.equals(this.status, submitSuccessfulCommandOutput.status) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(status, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubmitSuccessfulCommandOutput {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SubmitSuccessfulCommandOutput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SubmitSuccessfulCommandOutput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SubmitSuccessfulCommandOutput is not found in the empty JSON string", SubmitSuccessfulCommandOutput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SubmitSuccessfulCommandOutput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SubmitSuccessfulCommandOutput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SubmitSuccessfulCommandOutput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SubmitSuccessfulCommandOutput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SubmitSuccessfulCommandOutput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SubmitSuccessfulCommandOutput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SubmitSuccessfulCommandOutput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SubmitSuccessfulCommandOutput given an JSON string + * + * @param jsonString JSON string + * @return An instance of SubmitSuccessfulCommandOutput + * @throws IOException if the JSON string is invalid with respect to SubmitSuccessfulCommandOutput + */ + public static SubmitSuccessfulCommandOutput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SubmitSuccessfulCommandOutput.class); + } + + /** + * Convert an instance of SubmitSuccessfulCommandOutput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SupplierDto.java b/src/main/java/pl/wtx/allegro/api/client/model/SupplierDto.java new file mode 100644 index 0000000..7316fdc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SupplierDto.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Supplier id. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SupplierDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public SupplierDto() { + } + + public SupplierDto id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SupplierDto supplierDto = (SupplierDto) o; + return Objects.equals(this.id, supplierDto.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SupplierDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SupplierDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SupplierDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SupplierDto is not found in the empty JSON string", SupplierDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SupplierDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SupplierDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SupplierDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SupplierDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SupplierDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SupplierDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SupplierDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SupplierDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SupplierDto + * @throws IOException if the JSON string is invalid with respect to SupplierDto + */ + public static SupplierDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SupplierDto.class); + } + + /** + * Convert an instance of SupplierDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Surcharge.java b/src/main/java/pl/wtx/allegro/api/client/model/Surcharge.java new file mode 100644 index 0000000..e717f6c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Surcharge.java @@ -0,0 +1,215 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Surcharge. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Surcharge { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public Surcharge() { + } + + public Surcharge id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * The surcharge ID. + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Surcharge surcharge = (Surcharge) o; + return Objects.equals(this.id, surcharge.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Surcharge {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Surcharge + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Surcharge.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Surcharge is not found in the empty JSON string", Surcharge.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Surcharge.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Surcharge` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Surcharge.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Surcharge.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Surcharge' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Surcharge.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Surcharge value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Surcharge read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Surcharge given an JSON string + * + * @param jsonString JSON string + * @return An instance of Surcharge + * @throws IOException if the JSON string is invalid with respect to Surcharge + */ + public static Surcharge fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Surcharge.class); + } + + /** + * Convert an instance of Surcharge to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/SurchargeOperation.java b/src/main/java/pl/wtx/allegro/api/client/model/SurchargeOperation.java new file mode 100644 index 0000000..97dbde4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/SurchargeOperation.java @@ -0,0 +1,312 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.BaseOperation; +import pl.wtx.allegro.api.client.model.BuyerParticipant; +import pl.wtx.allegro.api.client.model.OperationPayment; +import pl.wtx.allegro.api.client.model.OperationValue; +import pl.wtx.allegro.api.client.model.Surcharge; +import pl.wtx.allegro.api.client.model.Wallet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * SurchargeOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class SurchargeOperation extends BaseOperation { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "SURCHARGE"; + + public static final String SERIALIZED_NAME_PAYMENT = "payment"; + @SerializedName(SERIALIZED_NAME_PAYMENT) + @javax.annotation.Nonnull + private OperationPayment payment; + + public static final String SERIALIZED_NAME_SURCHARGE = "surcharge"; + @SerializedName(SERIALIZED_NAME_SURCHARGE) + @javax.annotation.Nonnull + private Surcharge surcharge; + + public static final String SERIALIZED_NAME_PARTICIPANT = "participant"; + @SerializedName(SERIALIZED_NAME_PARTICIPANT) + @javax.annotation.Nonnull + private BuyerParticipant participant; + + public SurchargeOperation() { + this.type = this.getClass().getSimpleName(); + } + + public SurchargeOperation type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public SurchargeOperation payment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + return this; + } + + /** + * Get payment + * @return payment + */ + @javax.annotation.Nonnull + public OperationPayment getPayment() { + return payment; + } + + public void setPayment(@javax.annotation.Nonnull OperationPayment payment) { + this.payment = payment; + } + + + public SurchargeOperation surcharge(@javax.annotation.Nonnull Surcharge surcharge) { + this.surcharge = surcharge; + return this; + } + + /** + * Get surcharge + * @return surcharge + */ + @javax.annotation.Nonnull + public Surcharge getSurcharge() { + return surcharge; + } + + public void setSurcharge(@javax.annotation.Nonnull Surcharge surcharge) { + this.surcharge = surcharge; + } + + + public SurchargeOperation participant(@javax.annotation.Nonnull BuyerParticipant participant) { + this.participant = participant; + return this; + } + + /** + * Get participant + * @return participant + */ + @javax.annotation.Nonnull + public BuyerParticipant getParticipant() { + return participant; + } + + public void setParticipant(@javax.annotation.Nonnull BuyerParticipant participant) { + this.participant = participant; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SurchargeOperation surchargeOperation = (SurchargeOperation) o; + return Objects.equals(this.type, surchargeOperation.type) && + Objects.equals(this.payment, surchargeOperation.payment) && + Objects.equals(this.surcharge, surchargeOperation.surcharge) && + Objects.equals(this.participant, surchargeOperation.participant) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, payment, surcharge, participant, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SurchargeOperation {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" payment: ").append(toIndentedString(payment)).append("\n"); + sb.append(" surcharge: ").append(toIndentedString(surcharge)).append("\n"); + sb.append(" participant: ").append(toIndentedString(participant)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("group"); + openapiFields.add("wallet"); + openapiFields.add("value"); + openapiFields.add("occurredAt"); + openapiFields.add("marketplaceId"); + openapiFields.add("payment"); + openapiFields.add("surcharge"); + openapiFields.add("participant"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("payment"); + openapiRequiredFields.add("surcharge"); + openapiRequiredFields.add("participant"); + openapiRequiredFields.add("group"); + openapiRequiredFields.add("wallet"); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("occurredAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SurchargeOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SurchargeOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SurchargeOperation is not found in the empty JSON string", SurchargeOperation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SurchargeOperation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SurchargeOperation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SurchargeOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SurchargeOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SurchargeOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SurchargeOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SurchargeOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SurchargeOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SurchargeOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of SurchargeOperation + * @throws IOException if the JSON string is invalid with respect to SurchargeOperation + */ + public static SurchargeOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SurchargeOperation.class); + } + + /** + * Convert an instance of SurchargeOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TagId.java b/src/main/java/pl/wtx/allegro/api/client/model/TagId.java new file mode 100644 index 0000000..ab2fac8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TagId.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TagId + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TagId { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public TagId() { + } + + public TagId id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagId tagId = (TagId) o; + return Objects.equals(this.id, tagId.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagId {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TagId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TagId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TagId is not found in the empty JSON string", TagId.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TagId.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TagId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TagId.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TagId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TagId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TagId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TagId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TagId read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TagId given an JSON string + * + * @param jsonString JSON string + * @return An instance of TagId + * @throws IOException if the JSON string is invalid with respect to TagId + */ + public static TagId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TagId.class); + } + + /** + * Convert an instance of TagId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TagIdsRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/TagIdsRequest.java new file mode 100644 index 0000000..6abc024 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TagIdsRequest.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.TagId; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TagIdsRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TagIdsRequest { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nonnull + private List tags = new ArrayList<>(); + + public TagIdsRequest() { + } + + public TagIdsRequest tags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + return this; + } + + public TagIdsRequest addTagsItem(TagId tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nonnull + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagIdsRequest tagIdsRequest = (TagIdsRequest) o; + return Objects.equals(this.tags, tagIdsRequest.tags); + } + + @Override + public int hashCode() { + return Objects.hash(tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagIdsRequest {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("tags"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TagIdsRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TagIdsRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TagIdsRequest is not found in the empty JSON string", TagIdsRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TagIdsRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TagIdsRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TagIdsRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + // validate the required field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + TagId.validateJsonElement(jsonArraytags.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TagIdsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TagIdsRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TagIdsRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TagIdsRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TagIdsRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TagIdsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of TagIdsRequest + * @throws IOException if the JSON string is invalid with respect to TagIdsRequest + */ + public static TagIdsRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TagIdsRequest.class); + } + + /** + * Convert an instance of TagIdsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TagListResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/TagListResponse.java new file mode 100644 index 0000000..72afb21 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TagListResponse.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.TagResponse; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TagListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TagListResponse { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nonnull + private List tags = new ArrayList<>(); + + public TagListResponse() { + } + + public TagListResponse tags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + return this; + } + + public TagListResponse addTagsItem(TagResponse tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nonnull + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagListResponse tagListResponse = (TagListResponse) o; + return Objects.equals(this.tags, tagListResponse.tags); + } + + @Override + public int hashCode() { + return Objects.hash(tags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagListResponse {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("tags"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TagListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TagListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TagListResponse is not found in the empty JSON string", TagListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TagListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TagListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TagListResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + // validate the required field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + TagResponse.validateJsonElement(jsonArraytags.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TagListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TagListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TagListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TagListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TagListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TagListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of TagListResponse + * @throws IOException if the JSON string is invalid with respect to TagListResponse + */ + public static TagListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TagListResponse.class); + } + + /** + * Convert an instance of TagListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TagRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/TagRequest.java new file mode 100644 index 0000000..5add2c4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TagRequest.java @@ -0,0 +1,241 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TagRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TagRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_HIDDEN = "hidden"; + @SerializedName(SERIALIZED_NAME_HIDDEN) + @javax.annotation.Nullable + private Boolean hidden; + + public TagRequest() { + } + + public TagRequest name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public TagRequest hidden(@javax.annotation.Nullable Boolean hidden) { + this.hidden = hidden; + return this; + } + + /** + * Get hidden + * @return hidden + */ + @javax.annotation.Nullable + public Boolean getHidden() { + return hidden; + } + + public void setHidden(@javax.annotation.Nullable Boolean hidden) { + this.hidden = hidden; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagRequest tagRequest = (TagRequest) o; + return Objects.equals(this.name, tagRequest.name) && + Objects.equals(this.hidden, tagRequest.hidden); + } + + @Override + public int hashCode() { + return Objects.hash(name, hidden); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" hidden: ").append(toIndentedString(hidden)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("hidden"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TagRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TagRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TagRequest is not found in the empty JSON string", TagRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TagRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TagRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TagRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TagRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TagRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TagRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TagRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TagRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TagRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of TagRequest + * @throws IOException if the JSON string is invalid with respect to TagRequest + */ + public static TagRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TagRequest.class); + } + + /** + * Convert an instance of TagRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TagResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/TagResponse.java new file mode 100644 index 0000000..5f878c4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TagResponse.java @@ -0,0 +1,273 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TagResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TagResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_HIDDEN = "hidden"; + @SerializedName(SERIALIZED_NAME_HIDDEN) + @javax.annotation.Nonnull + private Boolean hidden; + + public TagResponse() { + } + + public TagResponse id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public TagResponse name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public TagResponse hidden(@javax.annotation.Nonnull Boolean hidden) { + this.hidden = hidden; + return this; + } + + /** + * Get hidden + * @return hidden + */ + @javax.annotation.Nonnull + public Boolean getHidden() { + return hidden; + } + + public void setHidden(@javax.annotation.Nonnull Boolean hidden) { + this.hidden = hidden; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TagResponse tagResponse = (TagResponse) o; + return Objects.equals(this.id, tagResponse.id) && + Objects.equals(this.name, tagResponse.name) && + Objects.equals(this.hidden, tagResponse.hidden); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, hidden); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" hidden: ").append(toIndentedString(hidden)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("hidden"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("hidden"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TagResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TagResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TagResponse is not found in the empty JSON string", TagResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TagResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TagResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TagResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TagResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TagResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TagResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TagResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TagResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TagResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of TagResponse + * @throws IOException if the JSON string is invalid with respect to TagResponse + */ + public static TagResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TagResponse.class); + } + + /** + * Convert an instance of TagResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TaskCount.java b/src/main/java/pl/wtx/allegro/api/client/model/TaskCount.java new file mode 100644 index 0000000..411f8d6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TaskCount.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Offers updates summary + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TaskCount { + public static final String SERIALIZED_NAME_FAILED = "failed"; + @SerializedName(SERIALIZED_NAME_FAILED) + @javax.annotation.Nullable + private Integer failed; + + public static final String SERIALIZED_NAME_SUCCESS = "success"; + @SerializedName(SERIALIZED_NAME_SUCCESS) + @javax.annotation.Nullable + private Integer success; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + @javax.annotation.Nullable + private Integer total; + + public TaskCount() { + } + + public TaskCount failed(@javax.annotation.Nullable Integer failed) { + this.failed = failed; + return this; + } + + /** + * Current number of failed offers updates + * minimum: 0 + * @return failed + */ + @javax.annotation.Nullable + public Integer getFailed() { + return failed; + } + + public void setFailed(@javax.annotation.Nullable Integer failed) { + this.failed = failed; + } + + + public TaskCount success(@javax.annotation.Nullable Integer success) { + this.success = success; + return this; + } + + /** + * Current number of success offers updates + * minimum: 0 + * @return success + */ + @javax.annotation.Nullable + public Integer getSuccess() { + return success; + } + + public void setSuccess(@javax.annotation.Nullable Integer success) { + this.success = success; + } + + + public TaskCount total(@javax.annotation.Nullable Integer total) { + this.total = total; + return this; + } + + /** + * Total number of scheduled offers updates + * minimum: 0 + * @return total + */ + @javax.annotation.Nullable + public Integer getTotal() { + return total; + } + + public void setTotal(@javax.annotation.Nullable Integer total) { + this.total = total; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TaskCount taskCount = (TaskCount) o; + return Objects.equals(this.failed, taskCount.failed) && + Objects.equals(this.success, taskCount.success) && + Objects.equals(this.total, taskCount.total); + } + + @Override + public int hashCode() { + return Objects.hash(failed, success, total); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TaskCount {\n"); + sb.append(" failed: ").append(toIndentedString(failed)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("failed"); + openapiFields.add("success"); + openapiFields.add("total"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TaskCount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TaskCount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TaskCount is not found in the empty JSON string", TaskCount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TaskCount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TaskCount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TaskCount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TaskCount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TaskCount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TaskCount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TaskCount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TaskCount given an JSON string + * + * @param jsonString JSON string + * @return An instance of TaskCount + * @throws IOException if the JSON string is invalid with respect to TaskCount + */ + public static TaskCount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TaskCount.class); + } + + /** + * Convert an instance of TaskCount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TaskReport.java b/src/main/java/pl/wtx/allegro/api/client/model/TaskReport.java new file mode 100644 index 0000000..a5ea877 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TaskReport.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CommandTask; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contains list of task results + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TaskReport { + public static final String SERIALIZED_NAME_TASKS = "tasks"; + @SerializedName(SERIALIZED_NAME_TASKS) + @javax.annotation.Nullable + private List tasks = new ArrayList<>(); + + public TaskReport() { + } + + public TaskReport tasks(@javax.annotation.Nullable List tasks) { + this.tasks = tasks; + return this; + } + + public TaskReport addTasksItem(CommandTask tasksItem) { + if (this.tasks == null) { + this.tasks = new ArrayList<>(); + } + this.tasks.add(tasksItem); + return this; + } + + /** + * List of task results + * @return tasks + */ + @javax.annotation.Nullable + public List getTasks() { + return tasks; + } + + public void setTasks(@javax.annotation.Nullable List tasks) { + this.tasks = tasks; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TaskReport taskReport = (TaskReport) o; + return Objects.equals(this.tasks, taskReport.tasks); + } + + @Override + public int hashCode() { + return Objects.hash(tasks); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TaskReport {\n"); + sb.append(" tasks: ").append(toIndentedString(tasks)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tasks"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TaskReport + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TaskReport.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TaskReport is not found in the empty JSON string", TaskReport.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TaskReport.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TaskReport` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("tasks") != null && !jsonObj.get("tasks").isJsonNull()) { + JsonArray jsonArraytasks = jsonObj.getAsJsonArray("tasks"); + if (jsonArraytasks != null) { + // ensure the json data is an array + if (!jsonObj.get("tasks").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tasks` to be an array in the JSON string but got `%s`", jsonObj.get("tasks").toString())); + } + + // validate the optional field `tasks` (array) + for (int i = 0; i < jsonArraytasks.size(); i++) { + CommandTask.validateJsonElement(jsonArraytasks.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TaskReport.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TaskReport' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TaskReport.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TaskReport value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TaskReport read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TaskReport given an JSON string + * + * @param jsonString JSON string + * @return An instance of TaskReport + * @throws IOException if the JSON string is invalid with respect to TaskReport + */ + public static TaskReport fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TaskReport.class); + } + + /** + * Convert an instance of TaskReport to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Tax.java b/src/main/java/pl/wtx/allegro/api/client/model/Tax.java new file mode 100644 index 0000000..6f19c99 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Tax.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * VAT tax rate. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Tax { + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + @javax.annotation.Nullable + private String percentage; + + public Tax() { + } + + public Tax percentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + return this; + } + + /** + * The buy now tax rate, Format 0.00. The tax is linked to the default country that corresponds to the base marketplace of this offer. + * @return percentage + */ + @javax.annotation.Nullable + public String getPercentage() { + return percentage; + } + + public void setPercentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tax tax = (Tax) o; + return Objects.equals(this.percentage, tax.percentage); + } + + @Override + public int hashCode() { + return Objects.hash(percentage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tax {\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("percentage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tax + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tax.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Tax is not found in the empty JSON string", Tax.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Tax.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Tax` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("percentage") != null && !jsonObj.get("percentage").isJsonNull()) && !jsonObj.get("percentage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `percentage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("percentage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tax.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tax' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tax.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tax value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Tax read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tax given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tax + * @throws IOException if the JSON string is invalid with respect to Tax + */ + public static Tax fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tax.class); + } + + /** + * Convert an instance of Tax to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TaxExemption.java b/src/main/java/pl/wtx/allegro/api/client/model/TaxExemption.java new file mode 100644 index 0000000..339559f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TaxExemption.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TaxExemption + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TaxExemption { + public static final String SERIALIZED_NAME_LABEL = "label"; + @SerializedName(SERIALIZED_NAME_LABEL) + @javax.annotation.Nullable + private String label; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public TaxExemption() { + } + + public TaxExemption label(@javax.annotation.Nullable String label) { + this.label = label; + return this; + } + + /** + * Displayable exemption label. + * @return label + */ + @javax.annotation.Nullable + public String getLabel() { + return label; + } + + public void setLabel(@javax.annotation.Nullable String label) { + this.label = label; + } + + + public TaxExemption value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Value of exemption. + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TaxExemption taxExemption = (TaxExemption) o; + return Objects.equals(this.label, taxExemption.label) && + Objects.equals(this.value, taxExemption.value); + } + + @Override + public int hashCode() { + return Objects.hash(label, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TaxExemption {\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TaxExemption + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TaxExemption.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TaxExemption is not found in the empty JSON string", TaxExemption.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TaxExemption.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TaxExemption` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("label") != null && !jsonObj.get("label").isJsonNull()) && !jsonObj.get("label").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `label` to be a primitive type in the JSON string but got `%s`", jsonObj.get("label").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TaxExemption.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TaxExemption' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TaxExemption.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TaxExemption value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TaxExemption read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TaxExemption given an JSON string + * + * @param jsonString JSON string + * @return An instance of TaxExemption + * @throws IOException if the JSON string is invalid with respect to TaxExemption + */ + public static TaxExemption fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TaxExemption.class); + } + + /** + * Convert an instance of TaxExemption to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TaxIdRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/TaxIdRequest.java new file mode 100644 index 0000000..b4e217a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TaxIdRequest.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TaxIdRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TaxIdRequest { + public static final String SERIALIZED_NAME_TAX_ID = "taxId"; + @SerializedName(SERIALIZED_NAME_TAX_ID) + @javax.annotation.Nullable + private String taxId; + + public TaxIdRequest() { + } + + public TaxIdRequest taxId(@javax.annotation.Nullable String taxId) { + this.taxId = taxId; + return this; + } + + /** + * User's tax identification number. + * @return taxId + */ + @javax.annotation.Nullable + public String getTaxId() { + return taxId; + } + + public void setTaxId(@javax.annotation.Nullable String taxId) { + this.taxId = taxId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TaxIdRequest taxIdRequest = (TaxIdRequest) o; + return Objects.equals(this.taxId, taxIdRequest.taxId); + } + + @Override + public int hashCode() { + return Objects.hash(taxId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TaxIdRequest {\n"); + sb.append(" taxId: ").append(toIndentedString(taxId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("taxId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TaxIdRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TaxIdRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TaxIdRequest is not found in the empty JSON string", TaxIdRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TaxIdRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TaxIdRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("taxId") != null && !jsonObj.get("taxId").isJsonNull()) && !jsonObj.get("taxId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `taxId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TaxIdRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TaxIdRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TaxIdRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TaxIdRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TaxIdRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TaxIdRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of TaxIdRequest + * @throws IOException if the JSON string is invalid with respect to TaxIdRequest + */ + public static TaxIdRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TaxIdRequest.class); + } + + /** + * Convert an instance of TaxIdRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TaxIdResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/TaxIdResponse.java new file mode 100644 index 0000000..8b17b53 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TaxIdResponse.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TaxIdResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TaxIdResponse { + public static final String SERIALIZED_NAME_TAX_ID = "taxId"; + @SerializedName(SERIALIZED_NAME_TAX_ID) + @javax.annotation.Nullable + private String taxId; + + public static final String SERIALIZED_NAME_VERIFICATION_STATUS = "verificationStatus"; + @SerializedName(SERIALIZED_NAME_VERIFICATION_STATUS) + @javax.annotation.Nullable + private String verificationStatus; + + public TaxIdResponse() { + } + + public TaxIdResponse taxId(@javax.annotation.Nullable String taxId) { + this.taxId = taxId; + return this; + } + + /** + * User's tax identification number. + * @return taxId + */ + @javax.annotation.Nullable + public String getTaxId() { + return taxId; + } + + public void setTaxId(@javax.annotation.Nullable String taxId) { + this.taxId = taxId; + } + + + public TaxIdResponse verificationStatus(@javax.annotation.Nullable String verificationStatus) { + this.verificationStatus = verificationStatus; + return this; + } + + /** + * Tax identification number verification status. Only the ACCEPTED status allows you to send products to the Allegro Warehouse. + * @return verificationStatus + */ + @javax.annotation.Nullable + public String getVerificationStatus() { + return verificationStatus; + } + + public void setVerificationStatus(@javax.annotation.Nullable String verificationStatus) { + this.verificationStatus = verificationStatus; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TaxIdResponse taxIdResponse = (TaxIdResponse) o; + return Objects.equals(this.taxId, taxIdResponse.taxId) && + Objects.equals(this.verificationStatus, taxIdResponse.verificationStatus); + } + + @Override + public int hashCode() { + return Objects.hash(taxId, verificationStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TaxIdResponse {\n"); + sb.append(" taxId: ").append(toIndentedString(taxId)).append("\n"); + sb.append(" verificationStatus: ").append(toIndentedString(verificationStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("taxId"); + openapiFields.add("verificationStatus"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TaxIdResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TaxIdResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TaxIdResponse is not found in the empty JSON string", TaxIdResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TaxIdResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TaxIdResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("taxId") != null && !jsonObj.get("taxId").isJsonNull()) && !jsonObj.get("taxId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `taxId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxId").toString())); + } + if ((jsonObj.get("verificationStatus") != null && !jsonObj.get("verificationStatus").isJsonNull()) && !jsonObj.get("verificationStatus").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `verificationStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("verificationStatus").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TaxIdResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TaxIdResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TaxIdResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TaxIdResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TaxIdResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TaxIdResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of TaxIdResponse + * @throws IOException if the JSON string is invalid with respect to TaxIdResponse + */ + public static TaxIdResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TaxIdResponse.class); + } + + /** + * Convert an instance of TaxIdResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TaxRate.java b/src/main/java/pl/wtx/allegro/api/client/model/TaxRate.java new file mode 100644 index 0000000..e12e052 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TaxRate.java @@ -0,0 +1,258 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.TaxRateValue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TaxRate + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TaxRate { + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public TaxRate() { + } + + public TaxRate countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * A country code for which given VAT setting is defined. + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + public TaxRate values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public TaxRate addValuesItem(TaxRateValue valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Values of tax rates for given country code. + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TaxRate taxRate = (TaxRate) o; + return Objects.equals(this.countryCode, taxRate.countryCode) && + Objects.equals(this.values, taxRate.values); + } + + @Override + public int hashCode() { + return Objects.hash(countryCode, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TaxRate {\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("countryCode"); + openapiFields.add("values"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TaxRate + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TaxRate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TaxRate is not found in the empty JSON string", TaxRate.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TaxRate.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TaxRate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("countryCode") != null && !jsonObj.get("countryCode").isJsonNull()) && !jsonObj.get("countryCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `countryCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("countryCode").toString())); + } + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull()) { + JsonArray jsonArrayvalues = jsonObj.getAsJsonArray("values"); + if (jsonArrayvalues != null) { + // ensure the json data is an array + if (!jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + + // validate the optional field `values` (array) + for (int i = 0; i < jsonArrayvalues.size(); i++) { + TaxRateValue.validateJsonElement(jsonArrayvalues.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TaxRate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TaxRate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TaxRate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TaxRate value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TaxRate read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TaxRate given an JSON string + * + * @param jsonString JSON string + * @return An instance of TaxRate + * @throws IOException if the JSON string is invalid with respect to TaxRate + */ + public static TaxRate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TaxRate.class); + } + + /** + * Convert an instance of TaxRate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TaxRateValue.java b/src/main/java/pl/wtx/allegro/api/client/model/TaxRateValue.java new file mode 100644 index 0000000..6753090 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TaxRateValue.java @@ -0,0 +1,263 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TaxRateValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TaxRateValue { + public static final String SERIALIZED_NAME_LABEL = "label"; + @SerializedName(SERIALIZED_NAME_LABEL) + @javax.annotation.Nullable + private String label; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_EXEMPTION_REQUIRED = "exemptionRequired"; + @SerializedName(SERIALIZED_NAME_EXEMPTION_REQUIRED) + @javax.annotation.Nullable + private Boolean exemptionRequired; + + public TaxRateValue() { + } + + public TaxRateValue label(@javax.annotation.Nullable String label) { + this.label = label; + return this; + } + + /** + * Displayable tax rate label. + * @return label + */ + @javax.annotation.Nullable + public String getLabel() { + return label; + } + + public void setLabel(@javax.annotation.Nullable String label) { + this.label = label; + } + + + public TaxRateValue value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * A numeric value of VAT tax rate. In case of \"OUT_OF_SCOPE_OF_VAT\" it is set to 0. + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public TaxRateValue exemptionRequired(@javax.annotation.Nullable Boolean exemptionRequired) { + this.exemptionRequired = exemptionRequired; + return this; + } + + /** + * Exemption field must be filled out if true, otherwise is optional. + * @return exemptionRequired + */ + @javax.annotation.Nullable + public Boolean getExemptionRequired() { + return exemptionRequired; + } + + public void setExemptionRequired(@javax.annotation.Nullable Boolean exemptionRequired) { + this.exemptionRequired = exemptionRequired; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TaxRateValue taxRateValue = (TaxRateValue) o; + return Objects.equals(this.label, taxRateValue.label) && + Objects.equals(this.value, taxRateValue.value) && + Objects.equals(this.exemptionRequired, taxRateValue.exemptionRequired); + } + + @Override + public int hashCode() { + return Objects.hash(label, value, exemptionRequired); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TaxRateValue {\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" exemptionRequired: ").append(toIndentedString(exemptionRequired)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("value"); + openapiFields.add("exemptionRequired"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TaxRateValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TaxRateValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TaxRateValue is not found in the empty JSON string", TaxRateValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TaxRateValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TaxRateValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("label") != null && !jsonObj.get("label").isJsonNull()) && !jsonObj.get("label").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `label` to be a primitive type in the JSON string but got `%s`", jsonObj.get("label").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TaxRateValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TaxRateValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TaxRateValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TaxRateValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TaxRateValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TaxRateValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of TaxRateValue + * @throws IOException if the JSON string is invalid with respect to TaxRateValue + */ + public static TaxRateValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TaxRateValue.class); + } + + /** + * Convert an instance of TaxRateValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TaxSubject.java b/src/main/java/pl/wtx/allegro/api/client/model/TaxSubject.java new file mode 100644 index 0000000..64b230a --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TaxSubject.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TaxSubject + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TaxSubject { + public static final String SERIALIZED_NAME_LABEL = "label"; + @SerializedName(SERIALIZED_NAME_LABEL) + @javax.annotation.Nullable + private String label; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public TaxSubject() { + } + + public TaxSubject label(@javax.annotation.Nullable String label) { + this.label = label; + return this; + } + + /** + * Displayable tax subject label. + * @return label + */ + @javax.annotation.Nullable + public String getLabel() { + return label; + } + + public void setLabel(@javax.annotation.Nullable String label) { + this.label = label; + } + + + public TaxSubject value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Value of subject. + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TaxSubject taxSubject = (TaxSubject) o; + return Objects.equals(this.label, taxSubject.label) && + Objects.equals(this.value, taxSubject.value); + } + + @Override + public int hashCode() { + return Objects.hash(label, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TaxSubject {\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TaxSubject + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TaxSubject.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TaxSubject is not found in the empty JSON string", TaxSubject.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TaxSubject.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TaxSubject` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("label") != null && !jsonObj.get("label").isJsonNull()) && !jsonObj.get("label").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `label` to be a primitive type in the JSON string but got `%s`", jsonObj.get("label").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TaxSubject.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TaxSubject' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TaxSubject.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TaxSubject value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TaxSubject read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TaxSubject given an JSON string + * + * @param jsonString JSON string + * @return An instance of TaxSubject + * @throws IOException if the JSON string is invalid with respect to TaxSubject + */ + public static TaxSubject fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TaxSubject.class); + } + + /** + * Convert an instance of TaxSubject to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TecdocSpecification.java b/src/main/java/pl/wtx/allegro/api/client/model/TecdocSpecification.java new file mode 100644 index 0000000..5ceeb9f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TecdocSpecification.java @@ -0,0 +1,266 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.TecdocSpecificationItem; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Contains additional information describing products from automotive categories. Technical specification is created based on TecDoc database and can only be used while creating offer with assigned product to it. <a href=\"../../tutorials/jak-jednym-requestem-wystawic-oferte-powiazana-z-produktem-D7Kj9gw4xFA\" target=\"_blank\">Read more</a>. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TecdocSpecification { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nullable + private List items = new ArrayList<>(); + + public TecdocSpecification() { + } + + public TecdocSpecification id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Identifier of technical specification. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public TecdocSpecification items(@javax.annotation.Nullable List items) { + this.items = items; + return this; + } + + public TecdocSpecification addItemsItem(TecdocSpecificationItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Text representation of the technical specification. Provided for informational purposes only - ignored when creating (Post) or updating (Put) compatibility list in the offer. + * @return items + */ + @javax.annotation.Nullable + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nullable List items) { + this.items = items; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TecdocSpecification tecdocSpecification = (TecdocSpecification) o; + return Objects.equals(this.id, tecdocSpecification.id) && + Objects.equals(this.items, tecdocSpecification.items); + } + + @Override + public int hashCode() { + return Objects.hash(id, items); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TecdocSpecification {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TecdocSpecification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TecdocSpecification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TecdocSpecification is not found in the empty JSON string", TecdocSpecification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TecdocSpecification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TecdocSpecification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TecdocSpecification.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + if (jsonArrayitems != null) { + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + // validate the optional field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + TecdocSpecificationItem.validateJsonElement(jsonArrayitems.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TecdocSpecification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TecdocSpecification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TecdocSpecification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TecdocSpecification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TecdocSpecification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TecdocSpecification given an JSON string + * + * @param jsonString JSON string + * @return An instance of TecdocSpecification + * @throws IOException if the JSON string is invalid with respect to TecdocSpecification + */ + public static TecdocSpecification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TecdocSpecification.class); + } + + /** + * Convert an instance of TecdocSpecification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TecdocSpecificationItem.java b/src/main/java/pl/wtx/allegro/api/client/model/TecdocSpecificationItem.java new file mode 100644 index 0000000..f7c3e74 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TecdocSpecificationItem.java @@ -0,0 +1,247 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TecdocSpecificationItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TecdocSpecificationItem { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values = new ArrayList<>(); + + public TecdocSpecificationItem() { + } + + public TecdocSpecificationItem name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Technical specification property name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public TecdocSpecificationItem values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public TecdocSpecificationItem addValuesItem(String valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * Technical specification property values. + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TecdocSpecificationItem tecdocSpecificationItem = (TecdocSpecificationItem) o; + return Objects.equals(this.name, tecdocSpecificationItem.name) && + Objects.equals(this.values, tecdocSpecificationItem.values); + } + + @Override + public int hashCode() { + return Objects.hash(name, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TecdocSpecificationItem {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("values"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TecdocSpecificationItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TecdocSpecificationItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TecdocSpecificationItem is not found in the empty JSON string", TecdocSpecificationItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TecdocSpecificationItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TecdocSpecificationItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TecdocSpecificationItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TecdocSpecificationItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TecdocSpecificationItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TecdocSpecificationItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TecdocSpecificationItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TecdocSpecificationItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of TecdocSpecificationItem + * @throws IOException if the JSON string is invalid with respect to TecdocSpecificationItem + */ + public static TecdocSpecificationItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TecdocSpecificationItem.class); + } + + /** + * Convert an instance of TecdocSpecificationItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ThirdParty.java b/src/main/java/pl/wtx/allegro/api/client/model/ThirdParty.java new file mode 100644 index 0000000..a6fe81e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ThirdParty.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents shipping details from third party. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ThirdParty { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ORDER_NUMBER = "orderNumber"; + @SerializedName(SERIALIZED_NAME_ORDER_NUMBER) + @javax.annotation.Nullable + private String orderNumber; + + public ThirdParty() { + } + + public ThirdParty name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Third party name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ThirdParty orderNumber(@javax.annotation.Nullable String orderNumber) { + this.orderNumber = orderNumber; + return this; + } + + /** + * Third party order number. + * @return orderNumber + */ + @javax.annotation.Nullable + public String getOrderNumber() { + return orderNumber; + } + + public void setOrderNumber(@javax.annotation.Nullable String orderNumber) { + this.orderNumber = orderNumber; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ThirdParty thirdParty = (ThirdParty) o; + return Objects.equals(this.name, thirdParty.name) && + Objects.equals(this.orderNumber, thirdParty.orderNumber); + } + + @Override + public int hashCode() { + return Objects.hash(name, orderNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ThirdParty {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" orderNumber: ").append(toIndentedString(orderNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("orderNumber"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ThirdParty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ThirdParty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ThirdParty is not found in the empty JSON string", ThirdParty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ThirdParty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ThirdParty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("orderNumber") != null && !jsonObj.get("orderNumber").isJsonNull()) && !jsonObj.get("orderNumber").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `orderNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orderNumber").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ThirdParty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ThirdParty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ThirdParty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ThirdParty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ThirdParty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ThirdParty given an JSON string + * + * @param jsonString JSON string + * @return An instance of ThirdParty + * @throws IOException if the JSON string is invalid with respect to ThirdParty + */ + public static ThirdParty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ThirdParty.class); + } + + /** + * Convert an instance of ThirdParty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ThirdPartyDeliveryShipping.java b/src/main/java/pl/wtx/allegro/api/client/model/ThirdPartyDeliveryShipping.java new file mode 100644 index 0000000..c42f290 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ThirdPartyDeliveryShipping.java @@ -0,0 +1,289 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Shipping; +import pl.wtx.allegro.api.client.model.ThirdParty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ThirdPartyDeliveryShipping + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ThirdPartyDeliveryShipping extends Shipping { + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + @javax.annotation.Nullable + protected String method = "THIRD_PARTY_DELIVERY"; + + public static final String SERIALIZED_NAME_THIRD_PARTY = "thirdParty"; + @SerializedName(SERIALIZED_NAME_THIRD_PARTY) + @javax.annotation.Nullable + private ThirdParty thirdParty; + + public static final String SERIALIZED_NAME_ESTIMATED_TIME_OF_ARRIVAL = "estimatedTimeOfArrival"; + @SerializedName(SERIALIZED_NAME_ESTIMATED_TIME_OF_ARRIVAL) + @javax.annotation.Nullable + private OffsetDateTime estimatedTimeOfArrival; + + public static final String SERIALIZED_NAME_COUNTRY_CODE = "countryCode"; + @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) + @javax.annotation.Nullable + private String countryCode; + + public ThirdPartyDeliveryShipping() { + this.method = this.getClass().getSimpleName(); + } + + public ThirdPartyDeliveryShipping method(@javax.annotation.Nullable String method) { + this.method = method; + return this; + } + + /** + * Get method + * @return method + */ + @javax.annotation.Nullable + public String getMethod() { + return method; + } + + public void setMethod(@javax.annotation.Nullable String method) { + this.method = method; + } + + + public ThirdPartyDeliveryShipping thirdParty(@javax.annotation.Nullable ThirdParty thirdParty) { + this.thirdParty = thirdParty; + return this; + } + + /** + * Get thirdParty + * @return thirdParty + */ + @javax.annotation.Nullable + public ThirdParty getThirdParty() { + return thirdParty; + } + + public void setThirdParty(@javax.annotation.Nullable ThirdParty thirdParty) { + this.thirdParty = thirdParty; + } + + + public ThirdPartyDeliveryShipping estimatedTimeOfArrival(@javax.annotation.Nullable OffsetDateTime estimatedTimeOfArrival) { + this.estimatedTimeOfArrival = estimatedTimeOfArrival; + return this; + } + + /** + * The estimated date and time of Advance Ship Notice arrival in the warehouse. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601). + * @return estimatedTimeOfArrival + */ + @javax.annotation.Nullable + public OffsetDateTime getEstimatedTimeOfArrival() { + return estimatedTimeOfArrival; + } + + public void setEstimatedTimeOfArrival(@javax.annotation.Nullable OffsetDateTime estimatedTimeOfArrival) { + this.estimatedTimeOfArrival = estimatedTimeOfArrival; + } + + + public ThirdPartyDeliveryShipping countryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Country code in ISO 3166-1 alpha-2 format (two-letter code), which means the country from which Advance Ship Notice is sent. + * @return countryCode + */ + @javax.annotation.Nullable + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(@javax.annotation.Nullable String countryCode) { + this.countryCode = countryCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ThirdPartyDeliveryShipping thirdPartyDeliveryShipping = (ThirdPartyDeliveryShipping) o; + return Objects.equals(this.method, thirdPartyDeliveryShipping.method) && + Objects.equals(this.thirdParty, thirdPartyDeliveryShipping.thirdParty) && + Objects.equals(this.estimatedTimeOfArrival, thirdPartyDeliveryShipping.estimatedTimeOfArrival) && + Objects.equals(this.countryCode, thirdPartyDeliveryShipping.countryCode) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(method, thirdParty, estimatedTimeOfArrival, countryCode, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ThirdPartyDeliveryShipping {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" thirdParty: ").append(toIndentedString(thirdParty)).append("\n"); + sb.append(" estimatedTimeOfArrival: ").append(toIndentedString(estimatedTimeOfArrival)).append("\n"); + sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("method"); + openapiFields.add("thirdParty"); + openapiFields.add("estimatedTimeOfArrival"); + openapiFields.add("countryCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ThirdPartyDeliveryShipping + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ThirdPartyDeliveryShipping.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ThirdPartyDeliveryShipping is not found in the empty JSON string", ThirdPartyDeliveryShipping.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ThirdPartyDeliveryShipping.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ThirdPartyDeliveryShipping` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ThirdPartyDeliveryShipping.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ThirdPartyDeliveryShipping' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ThirdPartyDeliveryShipping.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ThirdPartyDeliveryShipping value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ThirdPartyDeliveryShipping read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ThirdPartyDeliveryShipping given an JSON string + * + * @param jsonString JSON string + * @return An instance of ThirdPartyDeliveryShipping + * @throws IOException if the JSON string is invalid with respect to ThirdPartyDeliveryShipping + */ + public static ThirdPartyDeliveryShipping fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ThirdPartyDeliveryShipping.class); + } + + /** + * Convert an instance of ThirdPartyDeliveryShipping to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Thread.java b/src/main/java/pl/wtx/allegro/api/client/model/Thread.java new file mode 100644 index 0000000..8aabdd4 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Thread.java @@ -0,0 +1,314 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.Interlocutor; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Thread + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Thread { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_READ = "read"; + @SerializedName(SERIALIZED_NAME_READ) + @javax.annotation.Nonnull + private Boolean read; + + public static final String SERIALIZED_NAME_LAST_MESSAGE_DATE_TIME = "lastMessageDateTime"; + @SerializedName(SERIALIZED_NAME_LAST_MESSAGE_DATE_TIME) + @javax.annotation.Nullable + private OffsetDateTime lastMessageDateTime; + + public static final String SERIALIZED_NAME_INTERLOCUTOR = "interlocutor"; + @SerializedName(SERIALIZED_NAME_INTERLOCUTOR) + @javax.annotation.Nullable + private Interlocutor interlocutor; + + public Thread() { + } + + public Thread id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public Thread read(@javax.annotation.Nonnull Boolean read) { + this.read = read; + return this; + } + + /** + * Get read + * @return read + */ + @javax.annotation.Nonnull + public Boolean getRead() { + return read; + } + + public void setRead(@javax.annotation.Nonnull Boolean read) { + this.read = read; + } + + + public Thread lastMessageDateTime(@javax.annotation.Nullable OffsetDateTime lastMessageDateTime) { + this.lastMessageDateTime = lastMessageDateTime; + return this; + } + + /** + * Get lastMessageDateTime + * @return lastMessageDateTime + */ + @javax.annotation.Nullable + public OffsetDateTime getLastMessageDateTime() { + return lastMessageDateTime; + } + + public void setLastMessageDateTime(@javax.annotation.Nullable OffsetDateTime lastMessageDateTime) { + this.lastMessageDateTime = lastMessageDateTime; + } + + + public Thread interlocutor(@javax.annotation.Nullable Interlocutor interlocutor) { + this.interlocutor = interlocutor; + return this; + } + + /** + * Get interlocutor + * @return interlocutor + */ + @javax.annotation.Nullable + public Interlocutor getInterlocutor() { + return interlocutor; + } + + public void setInterlocutor(@javax.annotation.Nullable Interlocutor interlocutor) { + this.interlocutor = interlocutor; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Thread thread = (Thread) o; + return Objects.equals(this.id, thread.id) && + Objects.equals(this.read, thread.read) && + Objects.equals(this.lastMessageDateTime, thread.lastMessageDateTime) && + Objects.equals(this.interlocutor, thread.interlocutor); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, read, lastMessageDateTime, interlocutor); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Thread {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" read: ").append(toIndentedString(read)).append("\n"); + sb.append(" lastMessageDateTime: ").append(toIndentedString(lastMessageDateTime)).append("\n"); + sb.append(" interlocutor: ").append(toIndentedString(interlocutor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("read"); + openapiFields.add("lastMessageDateTime"); + openapiFields.add("interlocutor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("read"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Thread + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Thread.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Thread is not found in the empty JSON string", Thread.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Thread.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Thread` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Thread.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `interlocutor` + if (jsonObj.get("interlocutor") != null && !jsonObj.get("interlocutor").isJsonNull()) { + Interlocutor.validateJsonElement(jsonObj.get("interlocutor")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Thread.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Thread' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Thread.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Thread value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Thread read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Thread given an JSON string + * + * @param jsonString JSON string + * @return An instance of Thread + * @throws IOException if the JSON string is invalid with respect to Thread + */ + public static Thread fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Thread.class); + } + + /** + * Convert an instance of Thread to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ThreadId.java b/src/main/java/pl/wtx/allegro/api/client/model/ThreadId.java new file mode 100644 index 0000000..ca15321 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ThreadId.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ThreadId + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ThreadId { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public ThreadId() { + } + + public ThreadId id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ThreadId threadId = (ThreadId) o; + return Objects.equals(this.id, threadId.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ThreadId {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ThreadId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ThreadId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ThreadId is not found in the empty JSON string", ThreadId.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ThreadId.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ThreadId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ThreadId.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ThreadId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ThreadId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ThreadId.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ThreadId value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ThreadId read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ThreadId given an JSON string + * + * @param jsonString JSON string + * @return An instance of ThreadId + * @throws IOException if the JSON string is invalid with respect to ThreadId + */ + public static ThreadId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ThreadId.class); + } + + /** + * Convert an instance of ThreadId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ThreadReadFlag.java b/src/main/java/pl/wtx/allegro/api/client/model/ThreadReadFlag.java new file mode 100644 index 0000000..fccd6ff --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ThreadReadFlag.java @@ -0,0 +1,211 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ThreadReadFlag + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ThreadReadFlag { + public static final String SERIALIZED_NAME_READ = "read"; + @SerializedName(SERIALIZED_NAME_READ) + @javax.annotation.Nonnull + private Boolean read; + + public ThreadReadFlag() { + } + + public ThreadReadFlag read(@javax.annotation.Nonnull Boolean read) { + this.read = read; + return this; + } + + /** + * Get read + * @return read + */ + @javax.annotation.Nonnull + public Boolean getRead() { + return read; + } + + public void setRead(@javax.annotation.Nonnull Boolean read) { + this.read = read; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ThreadReadFlag threadReadFlag = (ThreadReadFlag) o; + return Objects.equals(this.read, threadReadFlag.read); + } + + @Override + public int hashCode() { + return Objects.hash(read); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ThreadReadFlag {\n"); + sb.append(" read: ").append(toIndentedString(read)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("read"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("read"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ThreadReadFlag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ThreadReadFlag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ThreadReadFlag is not found in the empty JSON string", ThreadReadFlag.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ThreadReadFlag.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ThreadReadFlag` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ThreadReadFlag.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ThreadReadFlag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ThreadReadFlag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ThreadReadFlag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ThreadReadFlag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ThreadReadFlag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ThreadReadFlag given an JSON string + * + * @param jsonString JSON string + * @return An instance of ThreadReadFlag + * @throws IOException if the JSON string is invalid with respect to ThreadReadFlag + */ + public static ThreadReadFlag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ThreadReadFlag.class); + } + + /** + * Convert an instance of ThreadReadFlag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ThreadsList.java b/src/main/java/pl/wtx/allegro/api/client/model/ThreadsList.java new file mode 100644 index 0000000..6a25d43 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ThreadsList.java @@ -0,0 +1,290 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.Thread; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ThreadsList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ThreadsList { + public static final String SERIALIZED_NAME_THREADS = "threads"; + @SerializedName(SERIALIZED_NAME_THREADS) + @javax.annotation.Nonnull + private List threads = new ArrayList<>(); + + public static final String SERIALIZED_NAME_OFFSET = "offset"; + @SerializedName(SERIALIZED_NAME_OFFSET) + @javax.annotation.Nonnull + private Integer offset; + + public static final String SERIALIZED_NAME_LIMIT = "limit"; + @SerializedName(SERIALIZED_NAME_LIMIT) + @javax.annotation.Nonnull + private Integer limit; + + public ThreadsList() { + } + + public ThreadsList threads(@javax.annotation.Nonnull List threads) { + this.threads = threads; + return this; + } + + public ThreadsList addThreadsItem(Thread threadsItem) { + if (this.threads == null) { + this.threads = new ArrayList<>(); + } + this.threads.add(threadsItem); + return this; + } + + /** + * Get threads + * @return threads + */ + @javax.annotation.Nonnull + public List getThreads() { + return threads; + } + + public void setThreads(@javax.annotation.Nonnull List threads) { + this.threads = threads; + } + + + public ThreadsList offset(@javax.annotation.Nonnull Integer offset) { + this.offset = offset; + return this; + } + + /** + * Get offset + * minimum: 0 + * @return offset + */ + @javax.annotation.Nonnull + public Integer getOffset() { + return offset; + } + + public void setOffset(@javax.annotation.Nonnull Integer offset) { + this.offset = offset; + } + + + public ThreadsList limit(@javax.annotation.Nonnull Integer limit) { + this.limit = limit; + return this; + } + + /** + * Get limit + * minimum: 0 + * @return limit + */ + @javax.annotation.Nonnull + public Integer getLimit() { + return limit; + } + + public void setLimit(@javax.annotation.Nonnull Integer limit) { + this.limit = limit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ThreadsList threadsList = (ThreadsList) o; + return Objects.equals(this.threads, threadsList.threads) && + Objects.equals(this.offset, threadsList.offset) && + Objects.equals(this.limit, threadsList.limit); + } + + @Override + public int hashCode() { + return Objects.hash(threads, offset, limit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ThreadsList {\n"); + sb.append(" threads: ").append(toIndentedString(threads)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("threads"); + openapiFields.add("offset"); + openapiFields.add("limit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("threads"); + openapiRequiredFields.add("offset"); + openapiRequiredFields.add("limit"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ThreadsList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ThreadsList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ThreadsList is not found in the empty JSON string", ThreadsList.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ThreadsList.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ThreadsList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ThreadsList.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("threads").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `threads` to be an array in the JSON string but got `%s`", jsonObj.get("threads").toString())); + } + + JsonArray jsonArraythreads = jsonObj.getAsJsonArray("threads"); + // validate the required field `threads` (array) + for (int i = 0; i < jsonArraythreads.size(); i++) { + Thread.validateJsonElement(jsonArraythreads.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ThreadsList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ThreadsList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ThreadsList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ThreadsList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ThreadsList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ThreadsList given an JSON string + * + * @param jsonString JSON string + * @return An instance of ThreadsList + * @throws IOException if the JSON string is invalid with respect to ThreadsList + */ + public static ThreadsList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ThreadsList.class); + } + + /** + * Convert an instance of ThreadsList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TrustedContent.java b/src/main/java/pl/wtx/allegro/api/client/model/TrustedContent.java new file mode 100644 index 0000000..94c700d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TrustedContent.java @@ -0,0 +1,227 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Each path will point to a specific field in the product object, indicating that given product part data originates directly from the manufacturer, its representative, or a trusted source. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TrustedContent { + public static final String SERIALIZED_NAME_PATHS = "paths"; + @SerializedName(SERIALIZED_NAME_PATHS) + @javax.annotation.Nonnull + private List paths = new ArrayList<>(); + + public TrustedContent() { + } + + public TrustedContent paths(@javax.annotation.Nonnull List paths) { + this.paths = paths; + return this; + } + + public TrustedContent addPathsItem(String pathsItem) { + if (this.paths == null) { + this.paths = new ArrayList<>(); + } + this.paths.add(pathsItem); + return this; + } + + /** + * Get paths + * @return paths + */ + @javax.annotation.Nonnull + public List getPaths() { + return paths; + } + + public void setPaths(@javax.annotation.Nonnull List paths) { + this.paths = paths; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TrustedContent trustedContent = (TrustedContent) o; + return Objects.equals(this.paths, trustedContent.paths); + } + + @Override + public int hashCode() { + return Objects.hash(paths); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TrustedContent {\n"); + sb.append(" paths: ").append(toIndentedString(paths)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("paths"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("paths"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TrustedContent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TrustedContent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TrustedContent is not found in the empty JSON string", TrustedContent.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TrustedContent.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TrustedContent` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TrustedContent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("paths") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("paths").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `paths` to be an array in the JSON string but got `%s`", jsonObj.get("paths").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TrustedContent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TrustedContent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TrustedContent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TrustedContent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TrustedContent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TrustedContent given an JSON string + * + * @param jsonString JSON string + * @return An instance of TrustedContent + * @throws IOException if the JSON string is invalid with respect to TrustedContent + */ + public static TrustedContent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TrustedContent.class); + } + + /** + * Convert an instance of TrustedContent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountDefinitionDto.java b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountDefinitionDto.java new file mode 100644 index 0000000..002afbf --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountDefinitionDto.java @@ -0,0 +1,404 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.TurnoverDiscountThresholdDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Turnover discount definition. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TurnoverDiscountDefinitionDto { + public static final String SERIALIZED_NAME_CUMULATING_FROM_DATE = "cumulatingFromDate"; + @SerializedName(SERIALIZED_NAME_CUMULATING_FROM_DATE) + @javax.annotation.Nullable + private LocalDate cumulatingFromDate; + + public static final String SERIALIZED_NAME_CUMULATING_TO_DATE = "cumulatingToDate"; + @SerializedName(SERIALIZED_NAME_CUMULATING_TO_DATE) + @javax.annotation.Nullable + private LocalDate cumulatingToDate; + + public static final String SERIALIZED_NAME_SPENDING_FROM_DATE = "spendingFromDate"; + @SerializedName(SERIALIZED_NAME_SPENDING_FROM_DATE) + @javax.annotation.Nullable + private LocalDate spendingFromDate; + + public static final String SERIALIZED_NAME_SPENDING_TO_DATE = "spendingToDate"; + @SerializedName(SERIALIZED_NAME_SPENDING_TO_DATE) + @javax.annotation.Nullable + private LocalDate spendingToDate; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_THRESHOLDS = "thresholds"; + @SerializedName(SERIALIZED_NAME_THRESHOLDS) + @javax.annotation.Nullable + private List thresholds = new ArrayList<>(); + + public TurnoverDiscountDefinitionDto() { + } + + public TurnoverDiscountDefinitionDto cumulatingFromDate(@javax.annotation.Nullable LocalDate cumulatingFromDate) { + this.cumulatingFromDate = cumulatingFromDate; + return this; + } + + /** + * First day of cumulating turnover against definition. + * @return cumulatingFromDate + */ + @javax.annotation.Nullable + public LocalDate getCumulatingFromDate() { + return cumulatingFromDate; + } + + public void setCumulatingFromDate(@javax.annotation.Nullable LocalDate cumulatingFromDate) { + this.cumulatingFromDate = cumulatingFromDate; + } + + + public TurnoverDiscountDefinitionDto cumulatingToDate(@javax.annotation.Nullable LocalDate cumulatingToDate) { + this.cumulatingToDate = cumulatingToDate; + return this; + } + + /** + * First day when cumulating turnover against definition is no longer happening. If empty - cumulating turnover will be continued indefinitely. + * @return cumulatingToDate + */ + @javax.annotation.Nullable + public LocalDate getCumulatingToDate() { + return cumulatingToDate; + } + + public void setCumulatingToDate(@javax.annotation.Nullable LocalDate cumulatingToDate) { + this.cumulatingToDate = cumulatingToDate; + } + + + public TurnoverDiscountDefinitionDto spendingFromDate(@javax.annotation.Nullable LocalDate spendingFromDate) { + this.spendingFromDate = spendingFromDate; + return this; + } + + /** + * First day of applying discount from this definition based on cumulated turnover. + * @return spendingFromDate + */ + @javax.annotation.Nullable + public LocalDate getSpendingFromDate() { + return spendingFromDate; + } + + public void setSpendingFromDate(@javax.annotation.Nullable LocalDate spendingFromDate) { + this.spendingFromDate = spendingFromDate; + } + + + public TurnoverDiscountDefinitionDto spendingToDate(@javax.annotation.Nullable LocalDate spendingToDate) { + this.spendingToDate = spendingToDate; + return this; + } + + /** + * First day when applying discount from definition is no longer happening. If empty - applying discount will be continued indefinitely. + * @return spendingToDate + */ + @javax.annotation.Nullable + public LocalDate getSpendingToDate() { + return spendingToDate; + } + + public void setSpendingToDate(@javax.annotation.Nullable LocalDate spendingToDate) { + this.spendingToDate = spendingToDate; + } + + + public TurnoverDiscountDefinitionDto createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation date of the definition. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public TurnoverDiscountDefinitionDto updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Last update date of the definition. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public TurnoverDiscountDefinitionDto thresholds(@javax.annotation.Nullable List thresholds) { + this.thresholds = thresholds; + return this; + } + + public TurnoverDiscountDefinitionDto addThresholdsItem(TurnoverDiscountThresholdDto thresholdsItem) { + if (this.thresholds == null) { + this.thresholds = new ArrayList<>(); + } + this.thresholds.add(thresholdsItem); + return this; + } + + /** + * Turnover discount thresholds. + * @return thresholds + */ + @javax.annotation.Nullable + public List getThresholds() { + return thresholds; + } + + public void setThresholds(@javax.annotation.Nullable List thresholds) { + this.thresholds = thresholds; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TurnoverDiscountDefinitionDto turnoverDiscountDefinitionDto = (TurnoverDiscountDefinitionDto) o; + return Objects.equals(this.cumulatingFromDate, turnoverDiscountDefinitionDto.cumulatingFromDate) && + Objects.equals(this.cumulatingToDate, turnoverDiscountDefinitionDto.cumulatingToDate) && + Objects.equals(this.spendingFromDate, turnoverDiscountDefinitionDto.spendingFromDate) && + Objects.equals(this.spendingToDate, turnoverDiscountDefinitionDto.spendingToDate) && + Objects.equals(this.createdAt, turnoverDiscountDefinitionDto.createdAt) && + Objects.equals(this.updatedAt, turnoverDiscountDefinitionDto.updatedAt) && + Objects.equals(this.thresholds, turnoverDiscountDefinitionDto.thresholds); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(cumulatingFromDate, cumulatingToDate, spendingFromDate, spendingToDate, createdAt, updatedAt, thresholds); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TurnoverDiscountDefinitionDto {\n"); + sb.append(" cumulatingFromDate: ").append(toIndentedString(cumulatingFromDate)).append("\n"); + sb.append(" cumulatingToDate: ").append(toIndentedString(cumulatingToDate)).append("\n"); + sb.append(" spendingFromDate: ").append(toIndentedString(spendingFromDate)).append("\n"); + sb.append(" spendingToDate: ").append(toIndentedString(spendingToDate)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" thresholds: ").append(toIndentedString(thresholds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("cumulatingFromDate"); + openapiFields.add("cumulatingToDate"); + openapiFields.add("spendingFromDate"); + openapiFields.add("spendingToDate"); + openapiFields.add("createdAt"); + openapiFields.add("updatedAt"); + openapiFields.add("thresholds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TurnoverDiscountDefinitionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TurnoverDiscountDefinitionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TurnoverDiscountDefinitionDto is not found in the empty JSON string", TurnoverDiscountDefinitionDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TurnoverDiscountDefinitionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TurnoverDiscountDefinitionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("thresholds") != null && !jsonObj.get("thresholds").isJsonNull()) { + JsonArray jsonArraythresholds = jsonObj.getAsJsonArray("thresholds"); + if (jsonArraythresholds != null) { + // ensure the json data is an array + if (!jsonObj.get("thresholds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `thresholds` to be an array in the JSON string but got `%s`", jsonObj.get("thresholds").toString())); + } + + // validate the optional field `thresholds` (array) + for (int i = 0; i < jsonArraythresholds.size(); i++) { + TurnoverDiscountThresholdDto.validateJsonElement(jsonArraythresholds.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TurnoverDiscountDefinitionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TurnoverDiscountDefinitionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TurnoverDiscountDefinitionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TurnoverDiscountDefinitionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TurnoverDiscountDefinitionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TurnoverDiscountDefinitionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TurnoverDiscountDefinitionDto + * @throws IOException if the JSON string is invalid with respect to TurnoverDiscountDefinitionDto + */ + public static TurnoverDiscountDefinitionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TurnoverDiscountDefinitionDto.class); + } + + /** + * Convert an instance of TurnoverDiscountDefinitionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountDto.java b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountDto.java new file mode 100644 index 0000000..dcfd2b9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountDto.java @@ -0,0 +1,346 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.TurnoverDiscountDefinitionDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Turnover discount for a marketplace. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TurnoverDiscountDto { + public static final String SERIALIZED_NAME_MARKETPLACE_ID = "marketplaceId"; + @SerializedName(SERIALIZED_NAME_MARKETPLACE_ID) + @javax.annotation.Nullable + private String marketplaceId; + + /** + * Turnover discount status. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + ACTIVATING("ACTIVATING"), + + ACTIVE("ACTIVE"), + + DEACTIVATING("DEACTIVATING"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_DEFINITIONS = "definitions"; + @SerializedName(SERIALIZED_NAME_DEFINITIONS) + @javax.annotation.Nullable + private List definitions = new ArrayList<>(); + + public TurnoverDiscountDto() { + } + + public TurnoverDiscountDto marketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + return this; + } + + /** + * Marketplace ID. + * @return marketplaceId + */ + @javax.annotation.Nullable + public String getMarketplaceId() { + return marketplaceId; + } + + public void setMarketplaceId(@javax.annotation.Nullable String marketplaceId) { + this.marketplaceId = marketplaceId; + } + + + public TurnoverDiscountDto status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Turnover discount status. + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public TurnoverDiscountDto definitions(@javax.annotation.Nullable List definitions) { + this.definitions = definitions; + return this; + } + + public TurnoverDiscountDto addDefinitionsItem(TurnoverDiscountDefinitionDto definitionsItem) { + if (this.definitions == null) { + this.definitions = new ArrayList<>(); + } + this.definitions.add(definitionsItem); + return this; + } + + /** + * Definitions currently active or active in the future. + * @return definitions + */ + @javax.annotation.Nullable + public List getDefinitions() { + return definitions; + } + + public void setDefinitions(@javax.annotation.Nullable List definitions) { + this.definitions = definitions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TurnoverDiscountDto turnoverDiscountDto = (TurnoverDiscountDto) o; + return Objects.equals(this.marketplaceId, turnoverDiscountDto.marketplaceId) && + Objects.equals(this.status, turnoverDiscountDto.status) && + Objects.equals(this.definitions, turnoverDiscountDto.definitions); + } + + @Override + public int hashCode() { + return Objects.hash(marketplaceId, status, definitions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TurnoverDiscountDto {\n"); + sb.append(" marketplaceId: ").append(toIndentedString(marketplaceId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" definitions: ").append(toIndentedString(definitions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("marketplaceId"); + openapiFields.add("status"); + openapiFields.add("definitions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TurnoverDiscountDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TurnoverDiscountDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TurnoverDiscountDto is not found in the empty JSON string", TurnoverDiscountDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TurnoverDiscountDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TurnoverDiscountDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("marketplaceId") != null && !jsonObj.get("marketplaceId").isJsonNull()) && !jsonObj.get("marketplaceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `marketplaceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("marketplaceId").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if (jsonObj.get("definitions") != null && !jsonObj.get("definitions").isJsonNull()) { + JsonArray jsonArraydefinitions = jsonObj.getAsJsonArray("definitions"); + if (jsonArraydefinitions != null) { + // ensure the json data is an array + if (!jsonObj.get("definitions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `definitions` to be an array in the JSON string but got `%s`", jsonObj.get("definitions").toString())); + } + + // validate the optional field `definitions` (array) + for (int i = 0; i < jsonArraydefinitions.size(); i++) { + TurnoverDiscountDefinitionDto.validateJsonElement(jsonArraydefinitions.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TurnoverDiscountDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TurnoverDiscountDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TurnoverDiscountDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TurnoverDiscountDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TurnoverDiscountDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TurnoverDiscountDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TurnoverDiscountDto + * @throws IOException if the JSON string is invalid with respect to TurnoverDiscountDto + */ + public static TurnoverDiscountDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TurnoverDiscountDto.class); + } + + /** + * Convert an instance of TurnoverDiscountDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountRequest.java new file mode 100644 index 0000000..147a5db --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountRequest.java @@ -0,0 +1,228 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.TurnoverDiscountThresholdDto; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * TurnoverDiscountRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TurnoverDiscountRequest { + public static final String SERIALIZED_NAME_THRESHOLDS = "thresholds"; + @SerializedName(SERIALIZED_NAME_THRESHOLDS) + @javax.annotation.Nullable + private List thresholds = new ArrayList<>(); + + public TurnoverDiscountRequest() { + } + + public TurnoverDiscountRequest thresholds(@javax.annotation.Nullable List thresholds) { + this.thresholds = thresholds; + return this; + } + + public TurnoverDiscountRequest addThresholdsItem(TurnoverDiscountThresholdDto thresholdsItem) { + if (this.thresholds == null) { + this.thresholds = new ArrayList<>(); + } + this.thresholds.add(thresholdsItem); + return this; + } + + /** + * List of thresholds to apply to cumulated turnover. + * @return thresholds + */ + @javax.annotation.Nullable + public List getThresholds() { + return thresholds; + } + + public void setThresholds(@javax.annotation.Nullable List thresholds) { + this.thresholds = thresholds; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TurnoverDiscountRequest turnoverDiscountRequest = (TurnoverDiscountRequest) o; + return Objects.equals(this.thresholds, turnoverDiscountRequest.thresholds); + } + + @Override + public int hashCode() { + return Objects.hash(thresholds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TurnoverDiscountRequest {\n"); + sb.append(" thresholds: ").append(toIndentedString(thresholds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("thresholds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TurnoverDiscountRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TurnoverDiscountRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TurnoverDiscountRequest is not found in the empty JSON string", TurnoverDiscountRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TurnoverDiscountRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TurnoverDiscountRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("thresholds") != null && !jsonObj.get("thresholds").isJsonNull()) { + JsonArray jsonArraythresholds = jsonObj.getAsJsonArray("thresholds"); + if (jsonArraythresholds != null) { + // ensure the json data is an array + if (!jsonObj.get("thresholds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `thresholds` to be an array in the JSON string but got `%s`", jsonObj.get("thresholds").toString())); + } + + // validate the optional field `thresholds` (array) + for (int i = 0; i < jsonArraythresholds.size(); i++) { + TurnoverDiscountThresholdDto.validateJsonElement(jsonArraythresholds.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TurnoverDiscountRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TurnoverDiscountRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TurnoverDiscountRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TurnoverDiscountRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TurnoverDiscountRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TurnoverDiscountRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of TurnoverDiscountRequest + * @throws IOException if the JSON string is invalid with respect to TurnoverDiscountRequest + */ + public static TurnoverDiscountRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TurnoverDiscountRequest.class); + } + + /** + * Convert an instance of TurnoverDiscountRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDto.java b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDto.java new file mode 100644 index 0000000..3430bf1 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDto.java @@ -0,0 +1,240 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.TurnoverDiscountThresholdDtoDiscount; +import pl.wtx.allegro.api.client.model.TurnoverDiscountThresholdDtoMinimumTurnover; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Turnover discount threshold. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TurnoverDiscountThresholdDto { + public static final String SERIALIZED_NAME_MINIMUM_TURNOVER = "minimumTurnover"; + @SerializedName(SERIALIZED_NAME_MINIMUM_TURNOVER) + @javax.annotation.Nullable + private TurnoverDiscountThresholdDtoMinimumTurnover minimumTurnover; + + public static final String SERIALIZED_NAME_DISCOUNT = "discount"; + @SerializedName(SERIALIZED_NAME_DISCOUNT) + @javax.annotation.Nullable + private TurnoverDiscountThresholdDtoDiscount discount; + + public TurnoverDiscountThresholdDto() { + } + + public TurnoverDiscountThresholdDto minimumTurnover(@javax.annotation.Nullable TurnoverDiscountThresholdDtoMinimumTurnover minimumTurnover) { + this.minimumTurnover = minimumTurnover; + return this; + } + + /** + * Get minimumTurnover + * @return minimumTurnover + */ + @javax.annotation.Nullable + public TurnoverDiscountThresholdDtoMinimumTurnover getMinimumTurnover() { + return minimumTurnover; + } + + public void setMinimumTurnover(@javax.annotation.Nullable TurnoverDiscountThresholdDtoMinimumTurnover minimumTurnover) { + this.minimumTurnover = minimumTurnover; + } + + + public TurnoverDiscountThresholdDto discount(@javax.annotation.Nullable TurnoverDiscountThresholdDtoDiscount discount) { + this.discount = discount; + return this; + } + + /** + * Get discount + * @return discount + */ + @javax.annotation.Nullable + public TurnoverDiscountThresholdDtoDiscount getDiscount() { + return discount; + } + + public void setDiscount(@javax.annotation.Nullable TurnoverDiscountThresholdDtoDiscount discount) { + this.discount = discount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TurnoverDiscountThresholdDto turnoverDiscountThresholdDto = (TurnoverDiscountThresholdDto) o; + return Objects.equals(this.minimumTurnover, turnoverDiscountThresholdDto.minimumTurnover) && + Objects.equals(this.discount, turnoverDiscountThresholdDto.discount); + } + + @Override + public int hashCode() { + return Objects.hash(minimumTurnover, discount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TurnoverDiscountThresholdDto {\n"); + sb.append(" minimumTurnover: ").append(toIndentedString(minimumTurnover)).append("\n"); + sb.append(" discount: ").append(toIndentedString(discount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("minimumTurnover"); + openapiFields.add("discount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TurnoverDiscountThresholdDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TurnoverDiscountThresholdDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TurnoverDiscountThresholdDto is not found in the empty JSON string", TurnoverDiscountThresholdDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TurnoverDiscountThresholdDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TurnoverDiscountThresholdDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `minimumTurnover` + if (jsonObj.get("minimumTurnover") != null && !jsonObj.get("minimumTurnover").isJsonNull()) { + TurnoverDiscountThresholdDtoMinimumTurnover.validateJsonElement(jsonObj.get("minimumTurnover")); + } + // validate the optional field `discount` + if (jsonObj.get("discount") != null && !jsonObj.get("discount").isJsonNull()) { + TurnoverDiscountThresholdDtoDiscount.validateJsonElement(jsonObj.get("discount")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TurnoverDiscountThresholdDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TurnoverDiscountThresholdDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TurnoverDiscountThresholdDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TurnoverDiscountThresholdDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TurnoverDiscountThresholdDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TurnoverDiscountThresholdDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TurnoverDiscountThresholdDto + * @throws IOException if the JSON string is invalid with respect to TurnoverDiscountThresholdDto + */ + public static TurnoverDiscountThresholdDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TurnoverDiscountThresholdDto.class); + } + + /** + * Convert an instance of TurnoverDiscountThresholdDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDtoDiscount.java b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDtoDiscount.java new file mode 100644 index 0000000..a9d7563 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDtoDiscount.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Discount obtained by user after reaching turnover threshold. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TurnoverDiscountThresholdDtoDiscount { + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + @javax.annotation.Nullable + private String percentage; + + public TurnoverDiscountThresholdDtoDiscount() { + } + + public TurnoverDiscountThresholdDtoDiscount percentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + return this; + } + + /** + * Discount percentage value. The fractional part must be absent or equal to 0. + * @return percentage + */ + @javax.annotation.Nullable + public String getPercentage() { + return percentage; + } + + public void setPercentage(@javax.annotation.Nullable String percentage) { + this.percentage = percentage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TurnoverDiscountThresholdDtoDiscount turnoverDiscountThresholdDtoDiscount = (TurnoverDiscountThresholdDtoDiscount) o; + return Objects.equals(this.percentage, turnoverDiscountThresholdDtoDiscount.percentage); + } + + @Override + public int hashCode() { + return Objects.hash(percentage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TurnoverDiscountThresholdDtoDiscount {\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("percentage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TurnoverDiscountThresholdDtoDiscount + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TurnoverDiscountThresholdDtoDiscount.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TurnoverDiscountThresholdDtoDiscount is not found in the empty JSON string", TurnoverDiscountThresholdDtoDiscount.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TurnoverDiscountThresholdDtoDiscount.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TurnoverDiscountThresholdDtoDiscount` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("percentage") != null && !jsonObj.get("percentage").isJsonNull()) && !jsonObj.get("percentage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `percentage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("percentage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TurnoverDiscountThresholdDtoDiscount.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TurnoverDiscountThresholdDtoDiscount' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TurnoverDiscountThresholdDtoDiscount.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TurnoverDiscountThresholdDtoDiscount value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TurnoverDiscountThresholdDtoDiscount read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TurnoverDiscountThresholdDtoDiscount given an JSON string + * + * @param jsonString JSON string + * @return An instance of TurnoverDiscountThresholdDtoDiscount + * @throws IOException if the JSON string is invalid with respect to TurnoverDiscountThresholdDtoDiscount + */ + public static TurnoverDiscountThresholdDtoDiscount fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TurnoverDiscountThresholdDtoDiscount.class); + } + + /** + * Convert an instance of TurnoverDiscountThresholdDtoDiscount to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDtoMinimumTurnover.java b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDtoMinimumTurnover.java new file mode 100644 index 0000000..80ed0fc --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/TurnoverDiscountThresholdDtoMinimumTurnover.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The minimum turnover that the buyer is required to accumulate in order to receive a discount for the next month. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class TurnoverDiscountThresholdDtoMinimumTurnover { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nullable + private String currency; + + public TurnoverDiscountThresholdDtoMinimumTurnover() { + } + + public TurnoverDiscountThresholdDtoMinimumTurnover amount(@javax.annotation.Nullable String amount) { + this.amount = amount; + return this; + } + + /** + * Amount of the minimal turnover. The fractional part must be absent or equal to 0. + * @return amount + */ + @javax.annotation.Nullable + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable String amount) { + this.amount = amount; + } + + + public TurnoverDiscountThresholdDtoMinimumTurnover currency(@javax.annotation.Nullable String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). Must meet the base currency for the marketplace. + * @return currency + */ + @javax.annotation.Nullable + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nullable String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TurnoverDiscountThresholdDtoMinimumTurnover turnoverDiscountThresholdDtoMinimumTurnover = (TurnoverDiscountThresholdDtoMinimumTurnover) o; + return Objects.equals(this.amount, turnoverDiscountThresholdDtoMinimumTurnover.amount) && + Objects.equals(this.currency, turnoverDiscountThresholdDtoMinimumTurnover.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TurnoverDiscountThresholdDtoMinimumTurnover {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TurnoverDiscountThresholdDtoMinimumTurnover + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TurnoverDiscountThresholdDtoMinimumTurnover.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TurnoverDiscountThresholdDtoMinimumTurnover is not found in the empty JSON string", TurnoverDiscountThresholdDtoMinimumTurnover.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TurnoverDiscountThresholdDtoMinimumTurnover.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TurnoverDiscountThresholdDtoMinimumTurnover` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("amount") != null && !jsonObj.get("amount").isJsonNull()) && !jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if ((jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonNull()) && !jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TurnoverDiscountThresholdDtoMinimumTurnover.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TurnoverDiscountThresholdDtoMinimumTurnover' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TurnoverDiscountThresholdDtoMinimumTurnover.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TurnoverDiscountThresholdDtoMinimumTurnover value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TurnoverDiscountThresholdDtoMinimumTurnover read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TurnoverDiscountThresholdDtoMinimumTurnover given an JSON string + * + * @param jsonString JSON string + * @return An instance of TurnoverDiscountThresholdDtoMinimumTurnover + * @throws IOException if the JSON string is invalid with respect to TurnoverDiscountThresholdDtoMinimumTurnover + */ + public static TurnoverDiscountThresholdDtoMinimumTurnover fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TurnoverDiscountThresholdDtoMinimumTurnover.class); + } + + /** + * Convert an instance of TurnoverDiscountThresholdDtoMinimumTurnover to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponse.java new file mode 100644 index 0000000..9812efb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponse.java @@ -0,0 +1,284 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.UnfilledParametersResponseOffersInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UnfilledParametersResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UnfilledParametersResponse { + public static final String SERIALIZED_NAME_OFFERS = "offers"; + @SerializedName(SERIALIZED_NAME_OFFERS) + @javax.annotation.Nullable + private List offers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + @javax.annotation.Nullable + private Integer totalCount; + + public UnfilledParametersResponse() { + } + + public UnfilledParametersResponse offers(@javax.annotation.Nullable List offers) { + this.offers = offers; + return this; + } + + public UnfilledParametersResponse addOffersItem(UnfilledParametersResponseOffersInner offersItem) { + if (this.offers == null) { + this.offers = new ArrayList<>(); + } + this.offers.add(offersItem); + return this; + } + + /** + * List of offers unfilled parameters. + * @return offers + */ + @javax.annotation.Nullable + public List getOffers() { + return offers; + } + + public void setOffers(@javax.annotation.Nullable List offers) { + this.offers = offers; + } + + + public UnfilledParametersResponse count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Number of returned elements. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public UnfilledParametersResponse totalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Total number of available elements. + * minimum: 0 + * @return totalCount + */ + @javax.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { + this.totalCount = totalCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnfilledParametersResponse unfilledParametersResponse = (UnfilledParametersResponse) o; + return Objects.equals(this.offers, unfilledParametersResponse.offers) && + Objects.equals(this.count, unfilledParametersResponse.count) && + Objects.equals(this.totalCount, unfilledParametersResponse.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(offers, count, totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnfilledParametersResponse {\n"); + sb.append(" offers: ").append(toIndentedString(offers)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offers"); + openapiFields.add("count"); + openapiFields.add("totalCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnfilledParametersResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnfilledParametersResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnfilledParametersResponse is not found in the empty JSON string", UnfilledParametersResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnfilledParametersResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnfilledParametersResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("offers") != null && !jsonObj.get("offers").isJsonNull()) { + JsonArray jsonArrayoffers = jsonObj.getAsJsonArray("offers"); + if (jsonArrayoffers != null) { + // ensure the json data is an array + if (!jsonObj.get("offers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offers` to be an array in the JSON string but got `%s`", jsonObj.get("offers").toString())); + } + + // validate the optional field `offers` (array) + for (int i = 0; i < jsonArrayoffers.size(); i++) { + UnfilledParametersResponseOffersInner.validateJsonElement(jsonArrayoffers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnfilledParametersResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnfilledParametersResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnfilledParametersResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnfilledParametersResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnfilledParametersResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnfilledParametersResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnfilledParametersResponse + * @throws IOException if the JSON string is invalid with respect to UnfilledParametersResponse + */ + public static UnfilledParametersResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnfilledParametersResponse.class); + } + + /** + * Convert an instance of UnfilledParametersResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInner.java b/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInner.java new file mode 100644 index 0000000..e49f093 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInner.java @@ -0,0 +1,290 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.UnfilledParametersResponseOffersInnerCategory; +import pl.wtx.allegro.api.client.model.UnfilledParametersResponseOffersInnerParametersInner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UnfilledParametersResponseOffersInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UnfilledParametersResponseOffersInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + @javax.annotation.Nullable + private UnfilledParametersResponseOffersInnerCategory category; + + public UnfilledParametersResponseOffersInner() { + } + + public UnfilledParametersResponseOffersInner id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Identifier of the offer. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public UnfilledParametersResponseOffersInner parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public UnfilledParametersResponseOffersInner addParametersItem(UnfilledParametersResponseOffersInnerParametersInner parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * List of unfilled parameters. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public UnfilledParametersResponseOffersInner category(@javax.annotation.Nullable UnfilledParametersResponseOffersInnerCategory category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + */ + @javax.annotation.Nullable + public UnfilledParametersResponseOffersInnerCategory getCategory() { + return category; + } + + public void setCategory(@javax.annotation.Nullable UnfilledParametersResponseOffersInnerCategory category) { + this.category = category; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnfilledParametersResponseOffersInner unfilledParametersResponseOffersInner = (UnfilledParametersResponseOffersInner) o; + return Objects.equals(this.id, unfilledParametersResponseOffersInner.id) && + Objects.equals(this.parameters, unfilledParametersResponseOffersInner.parameters) && + Objects.equals(this.category, unfilledParametersResponseOffersInner.category); + } + + @Override + public int hashCode() { + return Objects.hash(id, parameters, category); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnfilledParametersResponseOffersInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("parameters"); + openapiFields.add("category"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnfilledParametersResponseOffersInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnfilledParametersResponseOffersInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnfilledParametersResponseOffersInner is not found in the empty JSON string", UnfilledParametersResponseOffersInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnfilledParametersResponseOffersInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnfilledParametersResponseOffersInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + UnfilledParametersResponseOffersInnerParametersInner.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + // validate the optional field `category` + if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { + UnfilledParametersResponseOffersInnerCategory.validateJsonElement(jsonObj.get("category")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnfilledParametersResponseOffersInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnfilledParametersResponseOffersInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnfilledParametersResponseOffersInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnfilledParametersResponseOffersInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnfilledParametersResponseOffersInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnfilledParametersResponseOffersInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnfilledParametersResponseOffersInner + * @throws IOException if the JSON string is invalid with respect to UnfilledParametersResponseOffersInner + */ + public static UnfilledParametersResponseOffersInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnfilledParametersResponseOffersInner.class); + } + + /** + * Convert an instance of UnfilledParametersResponseOffersInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInnerCategory.java b/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInnerCategory.java new file mode 100644 index 0000000..204dce2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInnerCategory.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Category of offer with unfilled parameters + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UnfilledParametersResponseOffersInnerCategory { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public UnfilledParametersResponseOffersInnerCategory() { + } + + public UnfilledParametersResponseOffersInnerCategory id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Category identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnfilledParametersResponseOffersInnerCategory unfilledParametersResponseOffersInnerCategory = (UnfilledParametersResponseOffersInnerCategory) o; + return Objects.equals(this.id, unfilledParametersResponseOffersInnerCategory.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnfilledParametersResponseOffersInnerCategory {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnfilledParametersResponseOffersInnerCategory + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnfilledParametersResponseOffersInnerCategory.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnfilledParametersResponseOffersInnerCategory is not found in the empty JSON string", UnfilledParametersResponseOffersInnerCategory.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnfilledParametersResponseOffersInnerCategory.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnfilledParametersResponseOffersInnerCategory` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnfilledParametersResponseOffersInnerCategory.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnfilledParametersResponseOffersInnerCategory' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnfilledParametersResponseOffersInnerCategory.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnfilledParametersResponseOffersInnerCategory value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnfilledParametersResponseOffersInnerCategory read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnfilledParametersResponseOffersInnerCategory given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnfilledParametersResponseOffersInnerCategory + * @throws IOException if the JSON string is invalid with respect to UnfilledParametersResponseOffersInnerCategory + */ + public static UnfilledParametersResponseOffersInnerCategory fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnfilledParametersResponseOffersInnerCategory.class); + } + + /** + * Convert an instance of UnfilledParametersResponseOffersInnerCategory to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInnerParametersInner.java b/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInnerParametersInner.java new file mode 100644 index 0000000..1034d38 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UnfilledParametersResponseOffersInnerParametersInner.java @@ -0,0 +1,206 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UnfilledParametersResponseOffersInnerParametersInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UnfilledParametersResponseOffersInnerParametersInner { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public UnfilledParametersResponseOffersInnerParametersInner() { + } + + public UnfilledParametersResponseOffersInnerParametersInner id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Parameter identifier. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnfilledParametersResponseOffersInnerParametersInner unfilledParametersResponseOffersInnerParametersInner = (UnfilledParametersResponseOffersInnerParametersInner) o; + return Objects.equals(this.id, unfilledParametersResponseOffersInnerParametersInner.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnfilledParametersResponseOffersInnerParametersInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnfilledParametersResponseOffersInnerParametersInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnfilledParametersResponseOffersInnerParametersInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UnfilledParametersResponseOffersInnerParametersInner is not found in the empty JSON string", UnfilledParametersResponseOffersInnerParametersInner.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnfilledParametersResponseOffersInnerParametersInner.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UnfilledParametersResponseOffersInnerParametersInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnfilledParametersResponseOffersInnerParametersInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnfilledParametersResponseOffersInnerParametersInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnfilledParametersResponseOffersInnerParametersInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnfilledParametersResponseOffersInnerParametersInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnfilledParametersResponseOffersInnerParametersInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnfilledParametersResponseOffersInnerParametersInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnfilledParametersResponseOffersInnerParametersInner + * @throws IOException if the JSON string is invalid with respect to UnfilledParametersResponseOffersInnerParametersInner + */ + public static UnfilledParametersResponseOffersInnerParametersInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnfilledParametersResponseOffersInnerParametersInner.class); + } + + /** + * Convert an instance of UnfilledParametersResponseOffersInnerParametersInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UpdateOfferBundleDiscountDTO.java b/src/main/java/pl/wtx/allegro/api/client/model/UpdateOfferBundleDiscountDTO.java new file mode 100644 index 0000000..f69ecb9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UpdateOfferBundleDiscountDTO.java @@ -0,0 +1,240 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import pl.wtx.allegro.api.client.model.BundleDiscountDTO; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UpdateOfferBundleDiscountDTO + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UpdateOfferBundleDiscountDTO { + public static final String SERIALIZED_NAME_DISCOUNTS = "discounts"; + @SerializedName(SERIALIZED_NAME_DISCOUNTS) + @javax.annotation.Nullable + private List discounts; + + public UpdateOfferBundleDiscountDTO() { + } + + public UpdateOfferBundleDiscountDTO discounts(@javax.annotation.Nullable List discounts) { + this.discounts = discounts; + return this; + } + + public UpdateOfferBundleDiscountDTO addDiscountsItem(BundleDiscountDTO discountsItem) { + if (this.discounts == null) { + this.discounts = new ArrayList<>(); + } + this.discounts.add(discountsItem); + return this; + } + + /** + * Discounts on marketplaces. Can be null or empty if bundle shouldn't have discount on any marketplace. + * @return discounts + */ + @javax.annotation.Nullable + public List getDiscounts() { + return discounts; + } + + public void setDiscounts(@javax.annotation.Nullable List discounts) { + this.discounts = discounts; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateOfferBundleDiscountDTO updateOfferBundleDiscountDTO = (UpdateOfferBundleDiscountDTO) o; + return Objects.equals(this.discounts, updateOfferBundleDiscountDTO.discounts); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(discounts); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateOfferBundleDiscountDTO {\n"); + sb.append(" discounts: ").append(toIndentedString(discounts)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("discounts"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateOfferBundleDiscountDTO + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateOfferBundleDiscountDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateOfferBundleDiscountDTO is not found in the empty JSON string", UpdateOfferBundleDiscountDTO.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateOfferBundleDiscountDTO.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateOfferBundleDiscountDTO` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("discounts") != null && !jsonObj.get("discounts").isJsonNull()) { + JsonArray jsonArraydiscounts = jsonObj.getAsJsonArray("discounts"); + if (jsonArraydiscounts != null) { + // ensure the json data is an array + if (!jsonObj.get("discounts").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `discounts` to be an array in the JSON string but got `%s`", jsonObj.get("discounts").toString())); + } + + // validate the optional field `discounts` (array) + for (int i = 0; i < jsonArraydiscounts.size(); i++) { + BundleDiscountDTO.validateJsonElement(jsonArraydiscounts.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateOfferBundleDiscountDTO.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateOfferBundleDiscountDTO' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateOfferBundleDiscountDTO.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateOfferBundleDiscountDTO value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateOfferBundleDiscountDTO read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateOfferBundleDiscountDTO given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateOfferBundleDiscountDTO + * @throws IOException if the JSON string is invalid with respect to UpdateOfferBundleDiscountDTO + */ + public static UpdateOfferBundleDiscountDTO fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateOfferBundleDiscountDTO.class); + } + + /** + * Convert an instance of UpdateOfferBundleDiscountDTO to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UpdateResponsiblePersonRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/UpdateResponsiblePersonRequest.java new file mode 100644 index 0000000..fd62e53 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UpdateResponsiblePersonRequest.java @@ -0,0 +1,269 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.ResponsiblePersonResponsePersonalData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UpdateResponsiblePersonRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UpdateResponsiblePersonRequest { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PERSONAL_DATA = "personalData"; + @SerializedName(SERIALIZED_NAME_PERSONAL_DATA) + @javax.annotation.Nullable + private ResponsiblePersonResponsePersonalData personalData; + + public UpdateResponsiblePersonRequest() { + } + + public UpdateResponsiblePersonRequest id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * Responsible person ID. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public UpdateResponsiblePersonRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Internal name of responsible person in dictionary (visible only to you). Can't start or end with whitespace. Can't contain whitespaces other than space. Can't contain multiple spaces in a row. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public UpdateResponsiblePersonRequest personalData(@javax.annotation.Nullable ResponsiblePersonResponsePersonalData personalData) { + this.personalData = personalData; + return this; + } + + /** + * Get personalData + * @return personalData + */ + @javax.annotation.Nullable + public ResponsiblePersonResponsePersonalData getPersonalData() { + return personalData; + } + + public void setPersonalData(@javax.annotation.Nullable ResponsiblePersonResponsePersonalData personalData) { + this.personalData = personalData; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateResponsiblePersonRequest updateResponsiblePersonRequest = (UpdateResponsiblePersonRequest) o; + return Objects.equals(this.id, updateResponsiblePersonRequest.id) && + Objects.equals(this.name, updateResponsiblePersonRequest.name) && + Objects.equals(this.personalData, updateResponsiblePersonRequest.personalData); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, personalData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateResponsiblePersonRequest {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" personalData: ").append(toIndentedString(personalData)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("personalData"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateResponsiblePersonRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateResponsiblePersonRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateResponsiblePersonRequest is not found in the empty JSON string", UpdateResponsiblePersonRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateResponsiblePersonRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateResponsiblePersonRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `personalData` + if (jsonObj.get("personalData") != null && !jsonObj.get("personalData").isJsonNull()) { + ResponsiblePersonResponsePersonalData.validateJsonElement(jsonObj.get("personalData")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateResponsiblePersonRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateResponsiblePersonRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateResponsiblePersonRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateResponsiblePersonRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateResponsiblePersonRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateResponsiblePersonRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateResponsiblePersonRequest + * @throws IOException if the JSON string is invalid with respect to UpdateResponsiblePersonRequest + */ + public static UpdateResponsiblePersonRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateResponsiblePersonRequest.class); + } + + /** + * Convert an instance of UpdateResponsiblePersonRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UpdateResponsibleProducerRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/UpdateResponsibleProducerRequest.java new file mode 100644 index 0000000..bcbb818 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UpdateResponsibleProducerRequest.java @@ -0,0 +1,269 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.ResponsibleProducerResponseProducerData; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UpdateResponsibleProducerRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UpdateResponsibleProducerRequest { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_PRODUCER_DATA = "producerData"; + @SerializedName(SERIALIZED_NAME_PRODUCER_DATA) + @javax.annotation.Nullable + private ResponsibleProducerResponseProducerData producerData; + + public UpdateResponsibleProducerRequest() { + } + + public UpdateResponsibleProducerRequest id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * Responsible producer ID. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public UpdateResponsibleProducerRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Internal name of responsible producer in dictionary (visible only to you). Can't start or end with whitespace. Can't contain whitespaces other than space. Can't contain multiple spaces in a row. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public UpdateResponsibleProducerRequest producerData(@javax.annotation.Nullable ResponsibleProducerResponseProducerData producerData) { + this.producerData = producerData; + return this; + } + + /** + * Get producerData + * @return producerData + */ + @javax.annotation.Nullable + public ResponsibleProducerResponseProducerData getProducerData() { + return producerData; + } + + public void setProducerData(@javax.annotation.Nullable ResponsibleProducerResponseProducerData producerData) { + this.producerData = producerData; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateResponsibleProducerRequest updateResponsibleProducerRequest = (UpdateResponsibleProducerRequest) o; + return Objects.equals(this.id, updateResponsibleProducerRequest.id) && + Objects.equals(this.name, updateResponsibleProducerRequest.name) && + Objects.equals(this.producerData, updateResponsibleProducerRequest.producerData); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, producerData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateResponsibleProducerRequest {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" producerData: ").append(toIndentedString(producerData)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("producerData"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateResponsibleProducerRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateResponsibleProducerRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateResponsibleProducerRequest is not found in the empty JSON string", UpdateResponsibleProducerRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateResponsibleProducerRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateResponsibleProducerRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `producerData` + if (jsonObj.get("producerData") != null && !jsonObj.get("producerData").isJsonNull()) { + ResponsibleProducerResponseProducerData.validateJsonElement(jsonObj.get("producerData")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateResponsibleProducerRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateResponsibleProducerRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateResponsibleProducerRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateResponsibleProducerRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateResponsibleProducerRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateResponsibleProducerRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateResponsibleProducerRequest + * @throws IOException if the JSON string is invalid with respect to UpdateResponsibleProducerRequest + */ + public static UpdateResponsibleProducerRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateResponsibleProducerRequest.class); + } + + /** + * Convert an instance of UpdateResponsibleProducerRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedAdvanceShipNoticeRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedAdvanceShipNoticeRequest.java new file mode 100644 index 0000000..e6429ce --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedAdvanceShipNoticeRequest.java @@ -0,0 +1,292 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ProductItem; +import pl.wtx.allegro.api.client.model.UpdateSubmittedHandlingUnitInput; +import pl.wtx.allegro.api.client.model.UpdateSubmittedShippingInput; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UpdateSubmittedAdvanceShipNoticeRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UpdateSubmittedAdvanceShipNoticeRequest { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nullable + private List items = new ArrayList<>(); + + public static final String SERIALIZED_NAME_HANDLING_UNIT = "handlingUnit"; + @SerializedName(SERIALIZED_NAME_HANDLING_UNIT) + @javax.annotation.Nullable + private UpdateSubmittedHandlingUnitInput handlingUnit; + + public static final String SERIALIZED_NAME_SHIPPING = "shipping"; + @SerializedName(SERIALIZED_NAME_SHIPPING) + @javax.annotation.Nullable + private UpdateSubmittedShippingInput shipping; + + public UpdateSubmittedAdvanceShipNoticeRequest() { + } + + public UpdateSubmittedAdvanceShipNoticeRequest items(@javax.annotation.Nullable List items) { + this.items = items; + return this; + } + + public UpdateSubmittedAdvanceShipNoticeRequest addItemsItem(ProductItem itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of product items. + * @return items + */ + @javax.annotation.Nullable + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nullable List items) { + this.items = items; + } + + + public UpdateSubmittedAdvanceShipNoticeRequest handlingUnit(@javax.annotation.Nullable UpdateSubmittedHandlingUnitInput handlingUnit) { + this.handlingUnit = handlingUnit; + return this; + } + + /** + * Get handlingUnit + * @return handlingUnit + */ + @javax.annotation.Nullable + public UpdateSubmittedHandlingUnitInput getHandlingUnit() { + return handlingUnit; + } + + public void setHandlingUnit(@javax.annotation.Nullable UpdateSubmittedHandlingUnitInput handlingUnit) { + this.handlingUnit = handlingUnit; + } + + + public UpdateSubmittedAdvanceShipNoticeRequest shipping(@javax.annotation.Nullable UpdateSubmittedShippingInput shipping) { + this.shipping = shipping; + return this; + } + + /** + * Get shipping + * @return shipping + */ + @javax.annotation.Nullable + public UpdateSubmittedShippingInput getShipping() { + return shipping; + } + + public void setShipping(@javax.annotation.Nullable UpdateSubmittedShippingInput shipping) { + this.shipping = shipping; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSubmittedAdvanceShipNoticeRequest updateSubmittedAdvanceShipNoticeRequest = (UpdateSubmittedAdvanceShipNoticeRequest) o; + return Objects.equals(this.items, updateSubmittedAdvanceShipNoticeRequest.items) && + Objects.equals(this.handlingUnit, updateSubmittedAdvanceShipNoticeRequest.handlingUnit) && + Objects.equals(this.shipping, updateSubmittedAdvanceShipNoticeRequest.shipping); + } + + @Override + public int hashCode() { + return Objects.hash(items, handlingUnit, shipping); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSubmittedAdvanceShipNoticeRequest {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" handlingUnit: ").append(toIndentedString(handlingUnit)).append("\n"); + sb.append(" shipping: ").append(toIndentedString(shipping)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("items"); + openapiFields.add("handlingUnit"); + openapiFields.add("shipping"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSubmittedAdvanceShipNoticeRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSubmittedAdvanceShipNoticeRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSubmittedAdvanceShipNoticeRequest is not found in the empty JSON string", UpdateSubmittedAdvanceShipNoticeRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSubmittedAdvanceShipNoticeRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSubmittedAdvanceShipNoticeRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + if (jsonArrayitems != null) { + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + // validate the optional field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + ProductItem.validateJsonElement(jsonArrayitems.get(i)); + }; + } + } + // validate the optional field `handlingUnit` + if (jsonObj.get("handlingUnit") != null && !jsonObj.get("handlingUnit").isJsonNull()) { + UpdateSubmittedHandlingUnitInput.validateJsonElement(jsonObj.get("handlingUnit")); + } + // validate the optional field `shipping` + if (jsonObj.get("shipping") != null && !jsonObj.get("shipping").isJsonNull()) { + UpdateSubmittedShippingInput.validateJsonElement(jsonObj.get("shipping")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSubmittedAdvanceShipNoticeRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSubmittedAdvanceShipNoticeRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSubmittedAdvanceShipNoticeRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSubmittedAdvanceShipNoticeRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSubmittedAdvanceShipNoticeRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSubmittedAdvanceShipNoticeRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSubmittedAdvanceShipNoticeRequest + * @throws IOException if the JSON string is invalid with respect to UpdateSubmittedAdvanceShipNoticeRequest + */ + public static UpdateSubmittedAdvanceShipNoticeRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSubmittedAdvanceShipNoticeRequest.class); + } + + /** + * Convert an instance of UpdateSubmittedAdvanceShipNoticeRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedHandlingUnitInput.java b/src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedHandlingUnitInput.java new file mode 100644 index 0000000..bb6899b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedHandlingUnitInput.java @@ -0,0 +1,204 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents information about handling unit. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UpdateSubmittedHandlingUnitInput { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nullable + private BigDecimal amount; + + public UpdateSubmittedHandlingUnitInput() { + } + + public UpdateSubmittedHandlingUnitInput amount(@javax.annotation.Nullable BigDecimal amount) { + this.amount = amount; + return this; + } + + /** + * Number of handling units. Depending on the selected handling unit type, it's the number of boxes, pallets or packages placed in the container to be dispatched. + * @return amount + */ + @javax.annotation.Nullable + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nullable BigDecimal amount) { + this.amount = amount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSubmittedHandlingUnitInput updateSubmittedHandlingUnitInput = (UpdateSubmittedHandlingUnitInput) o; + return Objects.equals(this.amount, updateSubmittedHandlingUnitInput.amount); + } + + @Override + public int hashCode() { + return Objects.hash(amount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSubmittedHandlingUnitInput {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSubmittedHandlingUnitInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSubmittedHandlingUnitInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSubmittedHandlingUnitInput is not found in the empty JSON string", UpdateSubmittedHandlingUnitInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSubmittedHandlingUnitInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSubmittedHandlingUnitInput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSubmittedHandlingUnitInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSubmittedHandlingUnitInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSubmittedHandlingUnitInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSubmittedHandlingUnitInput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSubmittedHandlingUnitInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSubmittedHandlingUnitInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSubmittedHandlingUnitInput + * @throws IOException if the JSON string is invalid with respect to UpdateSubmittedHandlingUnitInput + */ + public static UpdateSubmittedHandlingUnitInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSubmittedHandlingUnitInput.class); + } + + /** + * Convert an instance of UpdateSubmittedHandlingUnitInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedShippingInput.java b/src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedShippingInput.java new file mode 100644 index 0000000..8da7565 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UpdateSubmittedShippingInput.java @@ -0,0 +1,298 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Courier; +import pl.wtx.allegro.api.client.model.ThirdParty; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Represents information about package shipment. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UpdateSubmittedShippingInput { + public static final String SERIALIZED_NAME_ESTIMATED_TIME_OF_ARRIVAL = "estimatedTimeOfArrival"; + @SerializedName(SERIALIZED_NAME_ESTIMATED_TIME_OF_ARRIVAL) + @javax.annotation.Nullable + private OffsetDateTime estimatedTimeOfArrival; + + public static final String SERIALIZED_NAME_TRUCK_LICENCE_PLATE = "truckLicencePlate"; + @SerializedName(SERIALIZED_NAME_TRUCK_LICENCE_PLATE) + @javax.annotation.Nullable + private String truckLicencePlate; + + public static final String SERIALIZED_NAME_COURIER = "courier"; + @SerializedName(SERIALIZED_NAME_COURIER) + @javax.annotation.Nullable + private Courier courier; + + public static final String SERIALIZED_NAME_THIRD_PARTY = "thirdParty"; + @SerializedName(SERIALIZED_NAME_THIRD_PARTY) + @javax.annotation.Nullable + private ThirdParty thirdParty; + + public UpdateSubmittedShippingInput() { + } + + public UpdateSubmittedShippingInput estimatedTimeOfArrival(@javax.annotation.Nullable OffsetDateTime estimatedTimeOfArrival) { + this.estimatedTimeOfArrival = estimatedTimeOfArrival; + return this; + } + + /** + * The estimated date and time of Advance Ship Notice arrival in the warehouse. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601). + * @return estimatedTimeOfArrival + */ + @javax.annotation.Nullable + public OffsetDateTime getEstimatedTimeOfArrival() { + return estimatedTimeOfArrival; + } + + public void setEstimatedTimeOfArrival(@javax.annotation.Nullable OffsetDateTime estimatedTimeOfArrival) { + this.estimatedTimeOfArrival = estimatedTimeOfArrival; + } + + + public UpdateSubmittedShippingInput truckLicencePlate(@javax.annotation.Nullable String truckLicencePlate) { + this.truckLicencePlate = truckLicencePlate; + return this; + } + + /** + * Vehicle licence plate number. + * @return truckLicencePlate + */ + @javax.annotation.Nullable + public String getTruckLicencePlate() { + return truckLicencePlate; + } + + public void setTruckLicencePlate(@javax.annotation.Nullable String truckLicencePlate) { + this.truckLicencePlate = truckLicencePlate; + } + + + public UpdateSubmittedShippingInput courier(@javax.annotation.Nullable Courier courier) { + this.courier = courier; + return this; + } + + /** + * Get courier + * @return courier + */ + @javax.annotation.Nullable + public Courier getCourier() { + return courier; + } + + public void setCourier(@javax.annotation.Nullable Courier courier) { + this.courier = courier; + } + + + public UpdateSubmittedShippingInput thirdParty(@javax.annotation.Nullable ThirdParty thirdParty) { + this.thirdParty = thirdParty; + return this; + } + + /** + * Get thirdParty + * @return thirdParty + */ + @javax.annotation.Nullable + public ThirdParty getThirdParty() { + return thirdParty; + } + + public void setThirdParty(@javax.annotation.Nullable ThirdParty thirdParty) { + this.thirdParty = thirdParty; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSubmittedShippingInput updateSubmittedShippingInput = (UpdateSubmittedShippingInput) o; + return Objects.equals(this.estimatedTimeOfArrival, updateSubmittedShippingInput.estimatedTimeOfArrival) && + Objects.equals(this.truckLicencePlate, updateSubmittedShippingInput.truckLicencePlate) && + Objects.equals(this.courier, updateSubmittedShippingInput.courier) && + Objects.equals(this.thirdParty, updateSubmittedShippingInput.thirdParty); + } + + @Override + public int hashCode() { + return Objects.hash(estimatedTimeOfArrival, truckLicencePlate, courier, thirdParty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSubmittedShippingInput {\n"); + sb.append(" estimatedTimeOfArrival: ").append(toIndentedString(estimatedTimeOfArrival)).append("\n"); + sb.append(" truckLicencePlate: ").append(toIndentedString(truckLicencePlate)).append("\n"); + sb.append(" courier: ").append(toIndentedString(courier)).append("\n"); + sb.append(" thirdParty: ").append(toIndentedString(thirdParty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("estimatedTimeOfArrival"); + openapiFields.add("truckLicencePlate"); + openapiFields.add("courier"); + openapiFields.add("thirdParty"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSubmittedShippingInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSubmittedShippingInput.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSubmittedShippingInput is not found in the empty JSON string", UpdateSubmittedShippingInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSubmittedShippingInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSubmittedShippingInput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("truckLicencePlate") != null && !jsonObj.get("truckLicencePlate").isJsonNull()) && !jsonObj.get("truckLicencePlate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `truckLicencePlate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("truckLicencePlate").toString())); + } + // validate the optional field `courier` + if (jsonObj.get("courier") != null && !jsonObj.get("courier").isJsonNull()) { + Courier.validateJsonElement(jsonObj.get("courier")); + } + // validate the optional field `thirdParty` + if (jsonObj.get("thirdParty") != null && !jsonObj.get("thirdParty").isJsonNull()) { + ThirdParty.validateJsonElement(jsonObj.get("thirdParty")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSubmittedShippingInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSubmittedShippingInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSubmittedShippingInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSubmittedShippingInput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSubmittedShippingInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSubmittedShippingInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSubmittedShippingInput + * @throws IOException if the JSON string is invalid with respect to UpdateSubmittedShippingInput + */ + public static UpdateSubmittedShippingInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSubmittedShippingInput.class); + } + + /** + * Convert an instance of UpdateSubmittedShippingInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/User.java b/src/main/java/pl/wtx/allegro/api/client/model/User.java new file mode 100644 index 0000000..9c6997d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/User.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * User + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class User { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_LOGIN = "login"; + @SerializedName(SERIALIZED_NAME_LOGIN) + @javax.annotation.Nonnull + private String login; + + public User() { + } + + public User id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Buyer id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public User login(@javax.annotation.Nonnull String login) { + this.login = login; + return this; + } + + /** + * Buyer's login + * @return login + */ + @javax.annotation.Nonnull + public String getLogin() { + return login; + } + + public void setLogin(@javax.annotation.Nonnull String login) { + this.login = login; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.login, user.login); + } + + @Override + public int hashCode() { + return Objects.hash(id, login); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" login: ").append(toIndentedString(login)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("login"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("login"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!User.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `User` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : User.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("login").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `login` to be a primitive type in the JSON string but got `%s`", jsonObj.get("login").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of User given an JSON string + * + * @param jsonString JSON string + * @return An instance of User + * @throws IOException if the JSON string is invalid with respect to User + */ + public static User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, User.class); + } + + /** + * Convert an instance of User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserCampaignEligibility.java b/src/main/java/pl/wtx/allegro/api/client/model/UserCampaignEligibility.java new file mode 100644 index 0000000..cccb762 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserCampaignEligibility.java @@ -0,0 +1,260 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.CampaignRefusalReason; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Summary of user eligibility for participation in the campaign. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserCampaignEligibility { + public static final String SERIALIZED_NAME_ELIGIBLE = "eligible"; + @SerializedName(SERIALIZED_NAME_ELIGIBLE) + @javax.annotation.Nonnull + private Boolean eligible; + + public static final String SERIALIZED_NAME_REFUSAL_REASONS = "refusalReasons"; + @SerializedName(SERIALIZED_NAME_REFUSAL_REASONS) + @javax.annotation.Nonnull + private List refusalReasons = new ArrayList<>(); + + public UserCampaignEligibility() { + } + + public UserCampaignEligibility eligible(@javax.annotation.Nonnull Boolean eligible) { + this.eligible = eligible; + return this; + } + + /** + * Information whether user is eligible to participate in this campaign. + * @return eligible + */ + @javax.annotation.Nonnull + public Boolean getEligible() { + return eligible; + } + + public void setEligible(@javax.annotation.Nonnull Boolean eligible) { + this.eligible = eligible; + } + + + public UserCampaignEligibility refusalReasons(@javax.annotation.Nonnull List refusalReasons) { + this.refusalReasons = refusalReasons; + return this; + } + + public UserCampaignEligibility addRefusalReasonsItem(CampaignRefusalReason refusalReasonsItem) { + if (this.refusalReasons == null) { + this.refusalReasons = new ArrayList<>(); + } + this.refusalReasons.add(refusalReasonsItem); + return this; + } + + /** + * Information why user is not able to participate in the campaign. + * @return refusalReasons + */ + @javax.annotation.Nonnull + public List getRefusalReasons() { + return refusalReasons; + } + + public void setRefusalReasons(@javax.annotation.Nonnull List refusalReasons) { + this.refusalReasons = refusalReasons; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserCampaignEligibility userCampaignEligibility = (UserCampaignEligibility) o; + return Objects.equals(this.eligible, userCampaignEligibility.eligible) && + Objects.equals(this.refusalReasons, userCampaignEligibility.refusalReasons); + } + + @Override + public int hashCode() { + return Objects.hash(eligible, refusalReasons); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserCampaignEligibility {\n"); + sb.append(" eligible: ").append(toIndentedString(eligible)).append("\n"); + sb.append(" refusalReasons: ").append(toIndentedString(refusalReasons)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eligible"); + openapiFields.add("refusalReasons"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("eligible"); + openapiRequiredFields.add("refusalReasons"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserCampaignEligibility + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserCampaignEligibility.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserCampaignEligibility is not found in the empty JSON string", UserCampaignEligibility.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserCampaignEligibility.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserCampaignEligibility` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserCampaignEligibility.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("refusalReasons").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `refusalReasons` to be an array in the JSON string but got `%s`", jsonObj.get("refusalReasons").toString())); + } + + JsonArray jsonArrayrefusalReasons = jsonObj.getAsJsonArray("refusalReasons"); + // validate the required field `refusalReasons` (array) + for (int i = 0; i < jsonArrayrefusalReasons.size(); i++) { + CampaignRefusalReason.validateJsonElement(jsonArrayrefusalReasons.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserCampaignEligibility.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserCampaignEligibility' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserCampaignEligibility.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserCampaignEligibility value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserCampaignEligibility read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserCampaignEligibility given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserCampaignEligibility + * @throws IOException if the JSON string is invalid with respect to UserCampaignEligibility + */ + public static UserCampaignEligibility fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserCampaignEligibility.class); + } + + /** + * Convert an instance of UserCampaignEligibility to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRating.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRating.java new file mode 100644 index 0000000..fe58629 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRating.java @@ -0,0 +1,579 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.Answer; +import pl.wtx.allegro.api.client.model.Order; +import pl.wtx.allegro.api.client.model.Rates; +import pl.wtx.allegro.api.client.model.Removal; +import pl.wtx.allegro.api.client.model.User; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UserRating + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRating { + public static final String SERIALIZED_NAME_ANSWER = "answer"; + @SerializedName(SERIALIZED_NAME_ANSWER) + @javax.annotation.Nullable + private Answer answer; + + public static final String SERIALIZED_NAME_BUYER = "buyer"; + @SerializedName(SERIALIZED_NAME_BUYER) + @javax.annotation.Nonnull + private User buyer; + + public static final String SERIALIZED_NAME_COMMENT = "comment"; + @SerializedName(SERIALIZED_NAME_COMMENT) + @javax.annotation.Nullable + private String comment; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private String createdAt; + + public static final String SERIALIZED_NAME_EDITED_AT = "editedAt"; + @SerializedName(SERIALIZED_NAME_EDITED_AT) + @javax.annotation.Nullable + private String editedAt; + + public static final String SERIALIZED_NAME_EXCLUDED_FROM_AVERAGE_RATES = "excludedFromAverageRates"; + @SerializedName(SERIALIZED_NAME_EXCLUDED_FROM_AVERAGE_RATES) + @javax.annotation.Nullable + private Boolean excludedFromAverageRates; + + public static final String SERIALIZED_NAME_EXCLUDED_FROM_AVERAGE_RATES_REASON = "excludedFromAverageRatesReason"; + @SerializedName(SERIALIZED_NAME_EXCLUDED_FROM_AVERAGE_RATES_REASON) + @javax.annotation.Nullable + private String excludedFromAverageRatesReason; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_LAST_CHANGED_AT = "lastChangedAt"; + @SerializedName(SERIALIZED_NAME_LAST_CHANGED_AT) + @javax.annotation.Nullable + private String lastChangedAt; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + @javax.annotation.Nullable + private Order order; + + public static final String SERIALIZED_NAME_RATES = "rates"; + @SerializedName(SERIALIZED_NAME_RATES) + @javax.annotation.Nullable + private Rates rates; + + public static final String SERIALIZED_NAME_RECOMMENDED = "recommended"; + @SerializedName(SERIALIZED_NAME_RECOMMENDED) + @javax.annotation.Nonnull + private Boolean recommended; + + public static final String SERIALIZED_NAME_REMOVAL = "removal"; + @SerializedName(SERIALIZED_NAME_REMOVAL) + @javax.annotation.Nullable + private Removal removal; + + public UserRating() { + } + + public UserRating answer(@javax.annotation.Nullable Answer answer) { + this.answer = answer; + return this; + } + + /** + * Get answer + * @return answer + */ + @javax.annotation.Nullable + public Answer getAnswer() { + return answer; + } + + public void setAnswer(@javax.annotation.Nullable Answer answer) { + this.answer = answer; + } + + + public UserRating buyer(@javax.annotation.Nonnull User buyer) { + this.buyer = buyer; + return this; + } + + /** + * Get buyer + * @return buyer + */ + @javax.annotation.Nonnull + public User getBuyer() { + return buyer; + } + + public void setBuyer(@javax.annotation.Nonnull User buyer) { + this.buyer = buyer; + } + + + public UserRating comment(@javax.annotation.Nullable String comment) { + this.comment = comment; + return this; + } + + /** + * Buyer's text comment + * @return comment + */ + @javax.annotation.Nullable + public String getComment() { + return comment; + } + + public void setComment(@javax.annotation.Nullable String comment) { + this.comment = comment; + } + + + public UserRating createdAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation datetime in ISO 8601 format + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + } + + + public UserRating editedAt(@javax.annotation.Nullable String editedAt) { + this.editedAt = editedAt; + return this; + } + + /** + * Edition datetime in ISO 8601 format + * @return editedAt + */ + @javax.annotation.Nullable + public String getEditedAt() { + return editedAt; + } + + public void setEditedAt(@javax.annotation.Nullable String editedAt) { + this.editedAt = editedAt; + } + + + public UserRating excludedFromAverageRates(@javax.annotation.Nullable Boolean excludedFromAverageRates) { + this.excludedFromAverageRates = excludedFromAverageRates; + return this; + } + + /** + * If true this rating was not included in calculating average user rates + * @return excludedFromAverageRates + */ + @javax.annotation.Nullable + public Boolean getExcludedFromAverageRates() { + return excludedFromAverageRates; + } + + public void setExcludedFromAverageRates(@javax.annotation.Nullable Boolean excludedFromAverageRates) { + this.excludedFromAverageRates = excludedFromAverageRates; + } + + + public UserRating excludedFromAverageRatesReason(@javax.annotation.Nullable String excludedFromAverageRatesReason) { + this.excludedFromAverageRatesReason = excludedFromAverageRatesReason; + return this; + } + + /** + * The reason why the rating was excluded from calculating average user rates. The message is translated based on the value of the \"Accept-Language\" header and exists only when the rating was excluded. + * @return excludedFromAverageRatesReason + */ + @javax.annotation.Nullable + public String getExcludedFromAverageRatesReason() { + return excludedFromAverageRatesReason; + } + + public void setExcludedFromAverageRatesReason(@javax.annotation.Nullable String excludedFromAverageRatesReason) { + this.excludedFromAverageRatesReason = excludedFromAverageRatesReason; + } + + + public UserRating id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Rating id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public UserRating lastChangedAt(@javax.annotation.Nullable String lastChangedAt) { + this.lastChangedAt = lastChangedAt; + return this; + } + + /** + * Last change (creation or latest edition) datetime in ISO 8601 format + * @return lastChangedAt + */ + @javax.annotation.Nullable + public String getLastChangedAt() { + return lastChangedAt; + } + + public void setLastChangedAt(@javax.annotation.Nullable String lastChangedAt) { + this.lastChangedAt = lastChangedAt; + } + + + public UserRating order(@javax.annotation.Nullable Order order) { + this.order = order; + return this; + } + + /** + * Get order + * @return order + */ + @javax.annotation.Nullable + public Order getOrder() { + return order; + } + + public void setOrder(@javax.annotation.Nullable Order order) { + this.order = order; + } + + + public UserRating rates(@javax.annotation.Nullable Rates rates) { + this.rates = rates; + return this; + } + + /** + * Get rates + * @return rates + */ + @javax.annotation.Nullable + public Rates getRates() { + return rates; + } + + public void setRates(@javax.annotation.Nullable Rates rates) { + this.rates = rates; + } + + + public UserRating recommended(@javax.annotation.Nonnull Boolean recommended) { + this.recommended = recommended; + return this; + } + + /** + * Whether buyer recommends the order + * @return recommended + */ + @javax.annotation.Nonnull + public Boolean getRecommended() { + return recommended; + } + + public void setRecommended(@javax.annotation.Nonnull Boolean recommended) { + this.recommended = recommended; + } + + + public UserRating removal(@javax.annotation.Nullable Removal removal) { + this.removal = removal; + return this; + } + + /** + * Get removal + * @return removal + */ + @javax.annotation.Nullable + public Removal getRemoval() { + return removal; + } + + public void setRemoval(@javax.annotation.Nullable Removal removal) { + this.removal = removal; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRating userRating = (UserRating) o; + return Objects.equals(this.answer, userRating.answer) && + Objects.equals(this.buyer, userRating.buyer) && + Objects.equals(this.comment, userRating.comment) && + Objects.equals(this.createdAt, userRating.createdAt) && + Objects.equals(this.editedAt, userRating.editedAt) && + Objects.equals(this.excludedFromAverageRates, userRating.excludedFromAverageRates) && + Objects.equals(this.excludedFromAverageRatesReason, userRating.excludedFromAverageRatesReason) && + Objects.equals(this.id, userRating.id) && + Objects.equals(this.lastChangedAt, userRating.lastChangedAt) && + Objects.equals(this.order, userRating.order) && + Objects.equals(this.rates, userRating.rates) && + Objects.equals(this.recommended, userRating.recommended) && + Objects.equals(this.removal, userRating.removal); + } + + @Override + public int hashCode() { + return Objects.hash(answer, buyer, comment, createdAt, editedAt, excludedFromAverageRates, excludedFromAverageRatesReason, id, lastChangedAt, order, rates, recommended, removal); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRating {\n"); + sb.append(" answer: ").append(toIndentedString(answer)).append("\n"); + sb.append(" buyer: ").append(toIndentedString(buyer)).append("\n"); + sb.append(" comment: ").append(toIndentedString(comment)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" editedAt: ").append(toIndentedString(editedAt)).append("\n"); + sb.append(" excludedFromAverageRates: ").append(toIndentedString(excludedFromAverageRates)).append("\n"); + sb.append(" excludedFromAverageRatesReason: ").append(toIndentedString(excludedFromAverageRatesReason)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" lastChangedAt: ").append(toIndentedString(lastChangedAt)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" rates: ").append(toIndentedString(rates)).append("\n"); + sb.append(" recommended: ").append(toIndentedString(recommended)).append("\n"); + sb.append(" removal: ").append(toIndentedString(removal)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("answer"); + openapiFields.add("buyer"); + openapiFields.add("comment"); + openapiFields.add("createdAt"); + openapiFields.add("editedAt"); + openapiFields.add("excludedFromAverageRates"); + openapiFields.add("excludedFromAverageRatesReason"); + openapiFields.add("id"); + openapiFields.add("lastChangedAt"); + openapiFields.add("order"); + openapiFields.add("rates"); + openapiFields.add("recommended"); + openapiFields.add("removal"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("buyer"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("recommended"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRating + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRating.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRating is not found in the empty JSON string", UserRating.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRating.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRating` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRating.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `answer` + if (jsonObj.get("answer") != null && !jsonObj.get("answer").isJsonNull()) { + Answer.validateJsonElement(jsonObj.get("answer")); + } + // validate the required field `buyer` + User.validateJsonElement(jsonObj.get("buyer")); + if ((jsonObj.get("comment") != null && !jsonObj.get("comment").isJsonNull()) && !jsonObj.get("comment").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `comment` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comment").toString())); + } + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); + } + if ((jsonObj.get("editedAt") != null && !jsonObj.get("editedAt").isJsonNull()) && !jsonObj.get("editedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `editedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("editedAt").toString())); + } + if ((jsonObj.get("excludedFromAverageRatesReason") != null && !jsonObj.get("excludedFromAverageRatesReason").isJsonNull()) && !jsonObj.get("excludedFromAverageRatesReason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `excludedFromAverageRatesReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("excludedFromAverageRatesReason").toString())); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("lastChangedAt") != null && !jsonObj.get("lastChangedAt").isJsonNull()) && !jsonObj.get("lastChangedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastChangedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastChangedAt").toString())); + } + // validate the optional field `order` + if (jsonObj.get("order") != null && !jsonObj.get("order").isJsonNull()) { + Order.validateJsonElement(jsonObj.get("order")); + } + // validate the optional field `rates` + if (jsonObj.get("rates") != null && !jsonObj.get("rates").isJsonNull()) { + Rates.validateJsonElement(jsonObj.get("rates")); + } + // validate the optional field `removal` + if (jsonObj.get("removal") != null && !jsonObj.get("removal").isJsonNull()) { + Removal.validateJsonElement(jsonObj.get("removal")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRating.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRating' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRating.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRating value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRating read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRating given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRating + * @throws IOException if the JSON string is invalid with respect to UserRating + */ + public static UserRating fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRating.class); + } + + /** + * Convert an instance of UserRating to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingAnswerRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingAnswerRequest.java new file mode 100644 index 0000000..c734a63 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingAnswerRequest.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Answer for user's rating. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingAnswerRequest { + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nonnull + private String message; + + public UserRatingAnswerRequest() { + } + + public UserRatingAnswerRequest message(@javax.annotation.Nonnull String message) { + this.message = message; + return this; + } + + /** + * Answer message. + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nonnull String message) { + this.message = message; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingAnswerRequest userRatingAnswerRequest = (UserRatingAnswerRequest) o; + return Objects.equals(this.message, userRatingAnswerRequest.message); + } + + @Override + public int hashCode() { + return Objects.hash(message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingAnswerRequest {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("message"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingAnswerRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingAnswerRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingAnswerRequest is not found in the empty JSON string", UserRatingAnswerRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingAnswerRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingAnswerRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingAnswerRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingAnswerRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingAnswerRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingAnswerRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingAnswerRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingAnswerRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingAnswerRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingAnswerRequest + * @throws IOException if the JSON string is invalid with respect to UserRatingAnswerRequest + */ + public static UserRatingAnswerRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingAnswerRequest.class); + } + + /** + * Convert an instance of UserRatingAnswerRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingListResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingListResponse.java new file mode 100644 index 0000000..a841818 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingListResponse.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.UserRating; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UserRatingListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingListResponse { + public static final String SERIALIZED_NAME_RATINGS = "ratings"; + @SerializedName(SERIALIZED_NAME_RATINGS) + @javax.annotation.Nonnull + private List ratings = new ArrayList<>(); + + public UserRatingListResponse() { + } + + public UserRatingListResponse ratings(@javax.annotation.Nonnull List ratings) { + this.ratings = ratings; + return this; + } + + public UserRatingListResponse addRatingsItem(UserRating ratingsItem) { + if (this.ratings == null) { + this.ratings = new ArrayList<>(); + } + this.ratings.add(ratingsItem); + return this; + } + + /** + * List of ratings that match requested filter. Empty when no rating matched. + * @return ratings + */ + @javax.annotation.Nonnull + public List getRatings() { + return ratings; + } + + public void setRatings(@javax.annotation.Nonnull List ratings) { + this.ratings = ratings; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingListResponse userRatingListResponse = (UserRatingListResponse) o; + return Objects.equals(this.ratings, userRatingListResponse.ratings); + } + + @Override + public int hashCode() { + return Objects.hash(ratings); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingListResponse {\n"); + sb.append(" ratings: ").append(toIndentedString(ratings)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("ratings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("ratings"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingListResponse is not found in the empty JSON string", UserRatingListResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingListResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingListResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingListResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("ratings").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ratings` to be an array in the JSON string but got `%s`", jsonObj.get("ratings").toString())); + } + + JsonArray jsonArrayratings = jsonObj.getAsJsonArray("ratings"); + // validate the required field `ratings` (array) + for (int i = 0; i < jsonArrayratings.size(); i++) { + UserRating.validateJsonElement(jsonArrayratings.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingListResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingListResponse + * @throws IOException if the JSON string is invalid with respect to UserRatingListResponse + */ + public static UserRatingListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingListResponse.class); + } + + /** + * Convert an instance of UserRatingListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingListResponseVBeta1.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingListResponseVBeta1.java new file mode 100644 index 0000000..7994b22 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingListResponseVBeta1.java @@ -0,0 +1,232 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.UserRatingVBeta1; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UserRatingListResponseVBeta1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingListResponseVBeta1 { + public static final String SERIALIZED_NAME_RATINGS = "ratings"; + @SerializedName(SERIALIZED_NAME_RATINGS) + @javax.annotation.Nonnull + private List ratings = new ArrayList<>(); + + public UserRatingListResponseVBeta1() { + } + + public UserRatingListResponseVBeta1 ratings(@javax.annotation.Nonnull List ratings) { + this.ratings = ratings; + return this; + } + + public UserRatingListResponseVBeta1 addRatingsItem(UserRatingVBeta1 ratingsItem) { + if (this.ratings == null) { + this.ratings = new ArrayList<>(); + } + this.ratings.add(ratingsItem); + return this; + } + + /** + * List of ratings that match requested filter. Empty when no rating matched. + * @return ratings + */ + @javax.annotation.Nonnull + public List getRatings() { + return ratings; + } + + public void setRatings(@javax.annotation.Nonnull List ratings) { + this.ratings = ratings; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingListResponseVBeta1 userRatingListResponseVBeta1 = (UserRatingListResponseVBeta1) o; + return Objects.equals(this.ratings, userRatingListResponseVBeta1.ratings); + } + + @Override + public int hashCode() { + return Objects.hash(ratings); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingListResponseVBeta1 {\n"); + sb.append(" ratings: ").append(toIndentedString(ratings)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("ratings"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("ratings"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingListResponseVBeta1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingListResponseVBeta1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingListResponseVBeta1 is not found in the empty JSON string", UserRatingListResponseVBeta1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingListResponseVBeta1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingListResponseVBeta1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingListResponseVBeta1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("ratings").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ratings` to be an array in the JSON string but got `%s`", jsonObj.get("ratings").toString())); + } + + JsonArray jsonArrayratings = jsonObj.getAsJsonArray("ratings"); + // validate the required field `ratings` (array) + for (int i = 0; i < jsonArrayratings.size(); i++) { + UserRatingVBeta1.validateJsonElement(jsonArrayratings.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingListResponseVBeta1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingListResponseVBeta1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingListResponseVBeta1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingListResponseVBeta1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingListResponseVBeta1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingListResponseVBeta1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingListResponseVBeta1 + * @throws IOException if the JSON string is invalid with respect to UserRatingListResponseVBeta1 + */ + public static UserRatingListResponseVBeta1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingListResponseVBeta1.class); + } + + /** + * Convert an instance of UserRatingListResponseVBeta1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingRemovalRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingRemovalRequest.java new file mode 100644 index 0000000..137ebf9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingRemovalRequest.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.UserRatingRemovalRequestRequest; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UserRatingRemovalRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingRemovalRequest { + public static final String SERIALIZED_NAME_REQUEST = "request"; + @SerializedName(SERIALIZED_NAME_REQUEST) + @javax.annotation.Nonnull + private UserRatingRemovalRequestRequest request; + + public UserRatingRemovalRequest() { + } + + public UserRatingRemovalRequest request(@javax.annotation.Nonnull UserRatingRemovalRequestRequest request) { + this.request = request; + return this; + } + + /** + * Get request + * @return request + */ + @javax.annotation.Nonnull + public UserRatingRemovalRequestRequest getRequest() { + return request; + } + + public void setRequest(@javax.annotation.Nonnull UserRatingRemovalRequestRequest request) { + this.request = request; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingRemovalRequest userRatingRemovalRequest = (UserRatingRemovalRequest) o; + return Objects.equals(this.request, userRatingRemovalRequest.request); + } + + @Override + public int hashCode() { + return Objects.hash(request); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingRemovalRequest {\n"); + sb.append(" request: ").append(toIndentedString(request)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("request"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("request"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingRemovalRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingRemovalRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingRemovalRequest is not found in the empty JSON string", UserRatingRemovalRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingRemovalRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingRemovalRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingRemovalRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `request` + UserRatingRemovalRequestRequest.validateJsonElement(jsonObj.get("request")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingRemovalRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingRemovalRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingRemovalRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingRemovalRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingRemovalRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingRemovalRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingRemovalRequest + * @throws IOException if the JSON string is invalid with respect to UserRatingRemovalRequest + */ + public static UserRatingRemovalRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingRemovalRequest.class); + } + + /** + * Convert an instance of UserRatingRemovalRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingRemovalRequestRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingRemovalRequestRequest.java new file mode 100644 index 0000000..8b60418 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingRemovalRequestRequest.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UserRatingRemovalRequestRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingRemovalRequestRequest { + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nonnull + private String message; + + public UserRatingRemovalRequestRequest() { + } + + public UserRatingRemovalRequestRequest message(@javax.annotation.Nonnull String message) { + this.message = message; + return this; + } + + /** + * Message containing explanation for removing rating. + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nonnull String message) { + this.message = message; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingRemovalRequestRequest userRatingRemovalRequestRequest = (UserRatingRemovalRequestRequest) o; + return Objects.equals(this.message, userRatingRemovalRequestRequest.message); + } + + @Override + public int hashCode() { + return Objects.hash(message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingRemovalRequestRequest {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("message"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingRemovalRequestRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingRemovalRequestRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingRemovalRequestRequest is not found in the empty JSON string", UserRatingRemovalRequestRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingRemovalRequestRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingRemovalRequestRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingRemovalRequestRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingRemovalRequestRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingRemovalRequestRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingRemovalRequestRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingRemovalRequestRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingRemovalRequestRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingRemovalRequestRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingRemovalRequestRequest + * @throws IOException if the JSON string is invalid with respect to UserRatingRemovalRequestRequest + */ + public static UserRatingRemovalRequestRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingRemovalRequestRequest.class); + } + + /** + * Convert an instance of UserRatingRemovalRequestRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponse.java new file mode 100644 index 0000000..4167192 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponse.java @@ -0,0 +1,308 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.AverageRates; +import pl.wtx.allegro.api.client.model.UserRatingSummaryResponseNotRecommended; +import pl.wtx.allegro.api.client.model.UserRatingSummaryResponseRecommended; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UserRatingSummaryResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingSummaryResponse { + public static final String SERIALIZED_NAME_AVERAGE_RATES = "averageRates"; + @SerializedName(SERIALIZED_NAME_AVERAGE_RATES) + @javax.annotation.Nullable + private AverageRates averageRates; + + public static final String SERIALIZED_NAME_NOT_RECOMMENDED = "notRecommended"; + @SerializedName(SERIALIZED_NAME_NOT_RECOMMENDED) + @javax.annotation.Nonnull + private UserRatingSummaryResponseNotRecommended notRecommended; + + public static final String SERIALIZED_NAME_RECOMMENDED = "recommended"; + @SerializedName(SERIALIZED_NAME_RECOMMENDED) + @javax.annotation.Nonnull + private UserRatingSummaryResponseRecommended recommended; + + public static final String SERIALIZED_NAME_RECOMMENDED_PERCENTAGE = "recommendedPercentage"; + @SerializedName(SERIALIZED_NAME_RECOMMENDED_PERCENTAGE) + @javax.annotation.Nonnull + private String recommendedPercentage; + + public UserRatingSummaryResponse() { + } + + public UserRatingSummaryResponse averageRates(@javax.annotation.Nullable AverageRates averageRates) { + this.averageRates = averageRates; + return this; + } + + /** + * Get averageRates + * @return averageRates + */ + @javax.annotation.Nullable + public AverageRates getAverageRates() { + return averageRates; + } + + public void setAverageRates(@javax.annotation.Nullable AverageRates averageRates) { + this.averageRates = averageRates; + } + + + public UserRatingSummaryResponse notRecommended(@javax.annotation.Nonnull UserRatingSummaryResponseNotRecommended notRecommended) { + this.notRecommended = notRecommended; + return this; + } + + /** + * Get notRecommended + * @return notRecommended + */ + @javax.annotation.Nonnull + public UserRatingSummaryResponseNotRecommended getNotRecommended() { + return notRecommended; + } + + public void setNotRecommended(@javax.annotation.Nonnull UserRatingSummaryResponseNotRecommended notRecommended) { + this.notRecommended = notRecommended; + } + + + public UserRatingSummaryResponse recommended(@javax.annotation.Nonnull UserRatingSummaryResponseRecommended recommended) { + this.recommended = recommended; + return this; + } + + /** + * Get recommended + * @return recommended + */ + @javax.annotation.Nonnull + public UserRatingSummaryResponseRecommended getRecommended() { + return recommended; + } + + public void setRecommended(@javax.annotation.Nonnull UserRatingSummaryResponseRecommended recommended) { + this.recommended = recommended; + } + + + public UserRatingSummaryResponse recommendedPercentage(@javax.annotation.Nonnull String recommendedPercentage) { + this.recommendedPercentage = recommendedPercentage; + return this; + } + + /** + * Percentage of unique buyers recommending the seller. + * @return recommendedPercentage + */ + @javax.annotation.Nonnull + public String getRecommendedPercentage() { + return recommendedPercentage; + } + + public void setRecommendedPercentage(@javax.annotation.Nonnull String recommendedPercentage) { + this.recommendedPercentage = recommendedPercentage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingSummaryResponse userRatingSummaryResponse = (UserRatingSummaryResponse) o; + return Objects.equals(this.averageRates, userRatingSummaryResponse.averageRates) && + Objects.equals(this.notRecommended, userRatingSummaryResponse.notRecommended) && + Objects.equals(this.recommended, userRatingSummaryResponse.recommended) && + Objects.equals(this.recommendedPercentage, userRatingSummaryResponse.recommendedPercentage); + } + + @Override + public int hashCode() { + return Objects.hash(averageRates, notRecommended, recommended, recommendedPercentage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingSummaryResponse {\n"); + sb.append(" averageRates: ").append(toIndentedString(averageRates)).append("\n"); + sb.append(" notRecommended: ").append(toIndentedString(notRecommended)).append("\n"); + sb.append(" recommended: ").append(toIndentedString(recommended)).append("\n"); + sb.append(" recommendedPercentage: ").append(toIndentedString(recommendedPercentage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("averageRates"); + openapiFields.add("notRecommended"); + openapiFields.add("recommended"); + openapiFields.add("recommendedPercentage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("notRecommended"); + openapiRequiredFields.add("recommended"); + openapiRequiredFields.add("recommendedPercentage"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingSummaryResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingSummaryResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingSummaryResponse is not found in the empty JSON string", UserRatingSummaryResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingSummaryResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingSummaryResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingSummaryResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `averageRates` + if (jsonObj.get("averageRates") != null && !jsonObj.get("averageRates").isJsonNull()) { + AverageRates.validateJsonElement(jsonObj.get("averageRates")); + } + // validate the required field `notRecommended` + UserRatingSummaryResponseNotRecommended.validateJsonElement(jsonObj.get("notRecommended")); + // validate the required field `recommended` + UserRatingSummaryResponseRecommended.validateJsonElement(jsonObj.get("recommended")); + if (!jsonObj.get("recommendedPercentage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `recommendedPercentage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("recommendedPercentage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingSummaryResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingSummaryResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingSummaryResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingSummaryResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingSummaryResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingSummaryResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingSummaryResponse + * @throws IOException if the JSON string is invalid with respect to UserRatingSummaryResponse + */ + public static UserRatingSummaryResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingSummaryResponse.class); + } + + /** + * Convert an instance of UserRatingSummaryResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseNotRecommended.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseNotRecommended.java new file mode 100644 index 0000000..8cd9dfb --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseNotRecommended.java @@ -0,0 +1,241 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Summary of data concerning users that do not recommend the seller. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingSummaryResponseNotRecommended { + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + @javax.annotation.Nonnull + private Long total; + + public static final String SERIALIZED_NAME_UNIQUE = "unique"; + @SerializedName(SERIALIZED_NAME_UNIQUE) + @javax.annotation.Nonnull + private Long unique; + + public UserRatingSummaryResponseNotRecommended() { + } + + public UserRatingSummaryResponseNotRecommended total(@javax.annotation.Nonnull Long total) { + this.total = total; + return this; + } + + /** + * Total number of negative feedbacks received. + * minimum: 0 + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(@javax.annotation.Nonnull Long total) { + this.total = total; + } + + + public UserRatingSummaryResponseNotRecommended unique(@javax.annotation.Nonnull Long unique) { + this.unique = unique; + return this; + } + + /** + * Number of unique users. + * minimum: 0 + * @return unique + */ + @javax.annotation.Nonnull + public Long getUnique() { + return unique; + } + + public void setUnique(@javax.annotation.Nonnull Long unique) { + this.unique = unique; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingSummaryResponseNotRecommended userRatingSummaryResponseNotRecommended = (UserRatingSummaryResponseNotRecommended) o; + return Objects.equals(this.total, userRatingSummaryResponseNotRecommended.total) && + Objects.equals(this.unique, userRatingSummaryResponseNotRecommended.unique); + } + + @Override + public int hashCode() { + return Objects.hash(total, unique); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingSummaryResponseNotRecommended {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" unique: ").append(toIndentedString(unique)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("total"); + openapiFields.add("unique"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("unique"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingSummaryResponseNotRecommended + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingSummaryResponseNotRecommended.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingSummaryResponseNotRecommended is not found in the empty JSON string", UserRatingSummaryResponseNotRecommended.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingSummaryResponseNotRecommended.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingSummaryResponseNotRecommended` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingSummaryResponseNotRecommended.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingSummaryResponseNotRecommended.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingSummaryResponseNotRecommended' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingSummaryResponseNotRecommended.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingSummaryResponseNotRecommended value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingSummaryResponseNotRecommended read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingSummaryResponseNotRecommended given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingSummaryResponseNotRecommended + * @throws IOException if the JSON string is invalid with respect to UserRatingSummaryResponseNotRecommended + */ + public static UserRatingSummaryResponseNotRecommended fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingSummaryResponseNotRecommended.class); + } + + /** + * Convert an instance of UserRatingSummaryResponseNotRecommended to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseRecommended.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseRecommended.java new file mode 100644 index 0000000..f07fc7b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseRecommended.java @@ -0,0 +1,241 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Summary of data concerning users that recommend the seller. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingSummaryResponseRecommended { + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + @javax.annotation.Nonnull + private Long total; + + public static final String SERIALIZED_NAME_UNIQUE = "unique"; + @SerializedName(SERIALIZED_NAME_UNIQUE) + @javax.annotation.Nonnull + private Long unique; + + public UserRatingSummaryResponseRecommended() { + } + + public UserRatingSummaryResponseRecommended total(@javax.annotation.Nonnull Long total) { + this.total = total; + return this; + } + + /** + * Total number of positive feedbacks received. + * minimum: 0 + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(@javax.annotation.Nonnull Long total) { + this.total = total; + } + + + public UserRatingSummaryResponseRecommended unique(@javax.annotation.Nonnull Long unique) { + this.unique = unique; + return this; + } + + /** + * Number of unique users. + * minimum: 0 + * @return unique + */ + @javax.annotation.Nonnull + public Long getUnique() { + return unique; + } + + public void setUnique(@javax.annotation.Nonnull Long unique) { + this.unique = unique; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingSummaryResponseRecommended userRatingSummaryResponseRecommended = (UserRatingSummaryResponseRecommended) o; + return Objects.equals(this.total, userRatingSummaryResponseRecommended.total) && + Objects.equals(this.unique, userRatingSummaryResponseRecommended.unique); + } + + @Override + public int hashCode() { + return Objects.hash(total, unique); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingSummaryResponseRecommended {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" unique: ").append(toIndentedString(unique)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("total"); + openapiFields.add("unique"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("unique"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingSummaryResponseRecommended + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingSummaryResponseRecommended.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingSummaryResponseRecommended is not found in the empty JSON string", UserRatingSummaryResponseRecommended.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingSummaryResponseRecommended.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingSummaryResponseRecommended` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingSummaryResponseRecommended.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingSummaryResponseRecommended.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingSummaryResponseRecommended' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingSummaryResponseRecommended.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingSummaryResponseRecommended value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingSummaryResponseRecommended read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingSummaryResponseRecommended given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingSummaryResponseRecommended + * @throws IOException if the JSON string is invalid with respect to UserRatingSummaryResponseRecommended + */ + public static UserRatingSummaryResponseRecommended fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingSummaryResponseRecommended.class); + } + + /** + * Convert an instance of UserRatingSummaryResponseRecommended to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2.java new file mode 100644 index 0000000..dd93287 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2.java @@ -0,0 +1,340 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2NotRecommended; +import pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2Recommended; +import pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2Statistics; +import pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2User; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UserRatingSummaryResponseV2 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingSummaryResponseV2 { + public static final String SERIALIZED_NAME_RECOMMENDED = "recommended"; + @SerializedName(SERIALIZED_NAME_RECOMMENDED) + @javax.annotation.Nullable + private UserRatingSummaryResponseV2Recommended recommended; + + public static final String SERIALIZED_NAME_NOT_RECOMMENDED = "notRecommended"; + @SerializedName(SERIALIZED_NAME_NOT_RECOMMENDED) + @javax.annotation.Nullable + private UserRatingSummaryResponseV2NotRecommended notRecommended; + + public static final String SERIALIZED_NAME_RECOMMENDED_PERCENTAGE = "recommendedPercentage"; + @SerializedName(SERIALIZED_NAME_RECOMMENDED_PERCENTAGE) + @javax.annotation.Nullable + private String recommendedPercentage; + + public static final String SERIALIZED_NAME_STATISTICS = "statistics"; + @SerializedName(SERIALIZED_NAME_STATISTICS) + @javax.annotation.Nullable + private UserRatingSummaryResponseV2Statistics statistics; + + public static final String SERIALIZED_NAME_USER = "user"; + @SerializedName(SERIALIZED_NAME_USER) + @javax.annotation.Nonnull + private UserRatingSummaryResponseV2User user; + + public UserRatingSummaryResponseV2() { + } + + public UserRatingSummaryResponseV2 recommended(@javax.annotation.Nullable UserRatingSummaryResponseV2Recommended recommended) { + this.recommended = recommended; + return this; + } + + /** + * Get recommended + * @return recommended + */ + @javax.annotation.Nullable + public UserRatingSummaryResponseV2Recommended getRecommended() { + return recommended; + } + + public void setRecommended(@javax.annotation.Nullable UserRatingSummaryResponseV2Recommended recommended) { + this.recommended = recommended; + } + + + public UserRatingSummaryResponseV2 notRecommended(@javax.annotation.Nullable UserRatingSummaryResponseV2NotRecommended notRecommended) { + this.notRecommended = notRecommended; + return this; + } + + /** + * Get notRecommended + * @return notRecommended + */ + @javax.annotation.Nullable + public UserRatingSummaryResponseV2NotRecommended getNotRecommended() { + return notRecommended; + } + + public void setNotRecommended(@javax.annotation.Nullable UserRatingSummaryResponseV2NotRecommended notRecommended) { + this.notRecommended = notRecommended; + } + + + public UserRatingSummaryResponseV2 recommendedPercentage(@javax.annotation.Nullable String recommendedPercentage) { + this.recommendedPercentage = recommendedPercentage; + return this; + } + + /** + * Percentage of unique buyers recommending the seller. + * @return recommendedPercentage + */ + @javax.annotation.Nullable + public String getRecommendedPercentage() { + return recommendedPercentage; + } + + public void setRecommendedPercentage(@javax.annotation.Nullable String recommendedPercentage) { + this.recommendedPercentage = recommendedPercentage; + } + + + public UserRatingSummaryResponseV2 statistics(@javax.annotation.Nullable UserRatingSummaryResponseV2Statistics statistics) { + this.statistics = statistics; + return this; + } + + /** + * Get statistics + * @return statistics + */ + @javax.annotation.Nullable + public UserRatingSummaryResponseV2Statistics getStatistics() { + return statistics; + } + + public void setStatistics(@javax.annotation.Nullable UserRatingSummaryResponseV2Statistics statistics) { + this.statistics = statistics; + } + + + public UserRatingSummaryResponseV2 user(@javax.annotation.Nonnull UserRatingSummaryResponseV2User user) { + this.user = user; + return this; + } + + /** + * Get user + * @return user + */ + @javax.annotation.Nonnull + public UserRatingSummaryResponseV2User getUser() { + return user; + } + + public void setUser(@javax.annotation.Nonnull UserRatingSummaryResponseV2User user) { + this.user = user; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingSummaryResponseV2 userRatingSummaryResponseV2 = (UserRatingSummaryResponseV2) o; + return Objects.equals(this.recommended, userRatingSummaryResponseV2.recommended) && + Objects.equals(this.notRecommended, userRatingSummaryResponseV2.notRecommended) && + Objects.equals(this.recommendedPercentage, userRatingSummaryResponseV2.recommendedPercentage) && + Objects.equals(this.statistics, userRatingSummaryResponseV2.statistics) && + Objects.equals(this.user, userRatingSummaryResponseV2.user); + } + + @Override + public int hashCode() { + return Objects.hash(recommended, notRecommended, recommendedPercentage, statistics, user); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingSummaryResponseV2 {\n"); + sb.append(" recommended: ").append(toIndentedString(recommended)).append("\n"); + sb.append(" notRecommended: ").append(toIndentedString(notRecommended)).append("\n"); + sb.append(" recommendedPercentage: ").append(toIndentedString(recommendedPercentage)).append("\n"); + sb.append(" statistics: ").append(toIndentedString(statistics)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("recommended"); + openapiFields.add("notRecommended"); + openapiFields.add("recommendedPercentage"); + openapiFields.add("statistics"); + openapiFields.add("user"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("user"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingSummaryResponseV2 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingSummaryResponseV2.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingSummaryResponseV2 is not found in the empty JSON string", UserRatingSummaryResponseV2.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingSummaryResponseV2.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingSummaryResponseV2` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingSummaryResponseV2.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `recommended` + if (jsonObj.get("recommended") != null && !jsonObj.get("recommended").isJsonNull()) { + UserRatingSummaryResponseV2Recommended.validateJsonElement(jsonObj.get("recommended")); + } + // validate the optional field `notRecommended` + if (jsonObj.get("notRecommended") != null && !jsonObj.get("notRecommended").isJsonNull()) { + UserRatingSummaryResponseV2NotRecommended.validateJsonElement(jsonObj.get("notRecommended")); + } + if ((jsonObj.get("recommendedPercentage") != null && !jsonObj.get("recommendedPercentage").isJsonNull()) && !jsonObj.get("recommendedPercentage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `recommendedPercentage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("recommendedPercentage").toString())); + } + // validate the optional field `statistics` + if (jsonObj.get("statistics") != null && !jsonObj.get("statistics").isJsonNull()) { + UserRatingSummaryResponseV2Statistics.validateJsonElement(jsonObj.get("statistics")); + } + // validate the required field `user` + UserRatingSummaryResponseV2User.validateJsonElement(jsonObj.get("user")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingSummaryResponseV2.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingSummaryResponseV2' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingSummaryResponseV2.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingSummaryResponseV2 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingSummaryResponseV2 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingSummaryResponseV2 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingSummaryResponseV2 + * @throws IOException if the JSON string is invalid with respect to UserRatingSummaryResponseV2 + */ + public static UserRatingSummaryResponseV2 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingSummaryResponseV2.class); + } + + /** + * Convert an instance of UserRatingSummaryResponseV2 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2NotRecommended.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2NotRecommended.java new file mode 100644 index 0000000..38c8e9c --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2NotRecommended.java @@ -0,0 +1,241 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Summary of data concerning users that do not recommend the seller. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingSummaryResponseV2NotRecommended { + public static final String SERIALIZED_NAME_UNIQUE = "unique"; + @SerializedName(SERIALIZED_NAME_UNIQUE) + @javax.annotation.Nonnull + private Long unique; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + @javax.annotation.Nonnull + private Long total; + + public UserRatingSummaryResponseV2NotRecommended() { + } + + public UserRatingSummaryResponseV2NotRecommended unique(@javax.annotation.Nonnull Long unique) { + this.unique = unique; + return this; + } + + /** + * Number of not recommending unique users. + * minimum: 0 + * @return unique + */ + @javax.annotation.Nonnull + public Long getUnique() { + return unique; + } + + public void setUnique(@javax.annotation.Nonnull Long unique) { + this.unique = unique; + } + + + public UserRatingSummaryResponseV2NotRecommended total(@javax.annotation.Nonnull Long total) { + this.total = total; + return this; + } + + /** + * Total number of negative feedbacks received. + * minimum: 0 + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(@javax.annotation.Nonnull Long total) { + this.total = total; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingSummaryResponseV2NotRecommended userRatingSummaryResponseV2NotRecommended = (UserRatingSummaryResponseV2NotRecommended) o; + return Objects.equals(this.unique, userRatingSummaryResponseV2NotRecommended.unique) && + Objects.equals(this.total, userRatingSummaryResponseV2NotRecommended.total); + } + + @Override + public int hashCode() { + return Objects.hash(unique, total); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingSummaryResponseV2NotRecommended {\n"); + sb.append(" unique: ").append(toIndentedString(unique)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("unique"); + openapiFields.add("total"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("unique"); + openapiRequiredFields.add("total"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingSummaryResponseV2NotRecommended + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingSummaryResponseV2NotRecommended.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingSummaryResponseV2NotRecommended is not found in the empty JSON string", UserRatingSummaryResponseV2NotRecommended.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingSummaryResponseV2NotRecommended.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingSummaryResponseV2NotRecommended` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingSummaryResponseV2NotRecommended.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingSummaryResponseV2NotRecommended.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingSummaryResponseV2NotRecommended' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingSummaryResponseV2NotRecommended.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingSummaryResponseV2NotRecommended value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingSummaryResponseV2NotRecommended read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingSummaryResponseV2NotRecommended given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingSummaryResponseV2NotRecommended + * @throws IOException if the JSON string is invalid with respect to UserRatingSummaryResponseV2NotRecommended + */ + public static UserRatingSummaryResponseV2NotRecommended fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingSummaryResponseV2NotRecommended.class); + } + + /** + * Convert an instance of UserRatingSummaryResponseV2NotRecommended to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2Recommended.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2Recommended.java new file mode 100644 index 0000000..918af24 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2Recommended.java @@ -0,0 +1,241 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Summary of data concerning users that recommend the seller. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingSummaryResponseV2Recommended { + public static final String SERIALIZED_NAME_UNIQUE = "unique"; + @SerializedName(SERIALIZED_NAME_UNIQUE) + @javax.annotation.Nonnull + private Long unique; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + @javax.annotation.Nonnull + private Long total; + + public UserRatingSummaryResponseV2Recommended() { + } + + public UserRatingSummaryResponseV2Recommended unique(@javax.annotation.Nonnull Long unique) { + this.unique = unique; + return this; + } + + /** + * Number of recommending unique users. + * minimum: 0 + * @return unique + */ + @javax.annotation.Nonnull + public Long getUnique() { + return unique; + } + + public void setUnique(@javax.annotation.Nonnull Long unique) { + this.unique = unique; + } + + + public UserRatingSummaryResponseV2Recommended total(@javax.annotation.Nonnull Long total) { + this.total = total; + return this; + } + + /** + * Total number of positive feedbacks received. + * minimum: 0 + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(@javax.annotation.Nonnull Long total) { + this.total = total; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingSummaryResponseV2Recommended userRatingSummaryResponseV2Recommended = (UserRatingSummaryResponseV2Recommended) o; + return Objects.equals(this.unique, userRatingSummaryResponseV2Recommended.unique) && + Objects.equals(this.total, userRatingSummaryResponseV2Recommended.total); + } + + @Override + public int hashCode() { + return Objects.hash(unique, total); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingSummaryResponseV2Recommended {\n"); + sb.append(" unique: ").append(toIndentedString(unique)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("unique"); + openapiFields.add("total"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("unique"); + openapiRequiredFields.add("total"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingSummaryResponseV2Recommended + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingSummaryResponseV2Recommended.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingSummaryResponseV2Recommended is not found in the empty JSON string", UserRatingSummaryResponseV2Recommended.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingSummaryResponseV2Recommended.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingSummaryResponseV2Recommended` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingSummaryResponseV2Recommended.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingSummaryResponseV2Recommended.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingSummaryResponseV2Recommended' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingSummaryResponseV2Recommended.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingSummaryResponseV2Recommended value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingSummaryResponseV2Recommended read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingSummaryResponseV2Recommended given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingSummaryResponseV2Recommended + * @throws IOException if the JSON string is invalid with respect to UserRatingSummaryResponseV2Recommended + */ + public static UserRatingSummaryResponseV2Recommended fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingSummaryResponseV2Recommended.class); + } + + /** + * Convert an instance of UserRatingSummaryResponseV2Recommended to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2Statistics.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2Statistics.java new file mode 100644 index 0000000..59c607f --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2Statistics.java @@ -0,0 +1,276 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2StatisticsExcluded; +import pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2StatisticsReceived; +import pl.wtx.allegro.api.client.model.UserRatingSummaryResponseV2StatisticsRemoved; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Summary of ratings statistics. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingSummaryResponseV2Statistics { + public static final String SERIALIZED_NAME_RECEIVED = "received"; + @SerializedName(SERIALIZED_NAME_RECEIVED) + @javax.annotation.Nonnull + private UserRatingSummaryResponseV2StatisticsReceived received; + + public static final String SERIALIZED_NAME_EXCLUDED = "excluded"; + @SerializedName(SERIALIZED_NAME_EXCLUDED) + @javax.annotation.Nonnull + private UserRatingSummaryResponseV2StatisticsExcluded excluded; + + public static final String SERIALIZED_NAME_REMOVED = "removed"; + @SerializedName(SERIALIZED_NAME_REMOVED) + @javax.annotation.Nonnull + private UserRatingSummaryResponseV2StatisticsRemoved removed; + + public UserRatingSummaryResponseV2Statistics() { + } + + public UserRatingSummaryResponseV2Statistics received(@javax.annotation.Nonnull UserRatingSummaryResponseV2StatisticsReceived received) { + this.received = received; + return this; + } + + /** + * Get received + * @return received + */ + @javax.annotation.Nonnull + public UserRatingSummaryResponseV2StatisticsReceived getReceived() { + return received; + } + + public void setReceived(@javax.annotation.Nonnull UserRatingSummaryResponseV2StatisticsReceived received) { + this.received = received; + } + + + public UserRatingSummaryResponseV2Statistics excluded(@javax.annotation.Nonnull UserRatingSummaryResponseV2StatisticsExcluded excluded) { + this.excluded = excluded; + return this; + } + + /** + * Get excluded + * @return excluded + */ + @javax.annotation.Nonnull + public UserRatingSummaryResponseV2StatisticsExcluded getExcluded() { + return excluded; + } + + public void setExcluded(@javax.annotation.Nonnull UserRatingSummaryResponseV2StatisticsExcluded excluded) { + this.excluded = excluded; + } + + + public UserRatingSummaryResponseV2Statistics removed(@javax.annotation.Nonnull UserRatingSummaryResponseV2StatisticsRemoved removed) { + this.removed = removed; + return this; + } + + /** + * Get removed + * @return removed + */ + @javax.annotation.Nonnull + public UserRatingSummaryResponseV2StatisticsRemoved getRemoved() { + return removed; + } + + public void setRemoved(@javax.annotation.Nonnull UserRatingSummaryResponseV2StatisticsRemoved removed) { + this.removed = removed; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingSummaryResponseV2Statistics userRatingSummaryResponseV2Statistics = (UserRatingSummaryResponseV2Statistics) o; + return Objects.equals(this.received, userRatingSummaryResponseV2Statistics.received) && + Objects.equals(this.excluded, userRatingSummaryResponseV2Statistics.excluded) && + Objects.equals(this.removed, userRatingSummaryResponseV2Statistics.removed); + } + + @Override + public int hashCode() { + return Objects.hash(received, excluded, removed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingSummaryResponseV2Statistics {\n"); + sb.append(" received: ").append(toIndentedString(received)).append("\n"); + sb.append(" excluded: ").append(toIndentedString(excluded)).append("\n"); + sb.append(" removed: ").append(toIndentedString(removed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("received"); + openapiFields.add("excluded"); + openapiFields.add("removed"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("received"); + openapiRequiredFields.add("excluded"); + openapiRequiredFields.add("removed"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingSummaryResponseV2Statistics + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingSummaryResponseV2Statistics.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingSummaryResponseV2Statistics is not found in the empty JSON string", UserRatingSummaryResponseV2Statistics.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingSummaryResponseV2Statistics.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingSummaryResponseV2Statistics` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingSummaryResponseV2Statistics.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `received` + UserRatingSummaryResponseV2StatisticsReceived.validateJsonElement(jsonObj.get("received")); + // validate the required field `excluded` + UserRatingSummaryResponseV2StatisticsExcluded.validateJsonElement(jsonObj.get("excluded")); + // validate the required field `removed` + UserRatingSummaryResponseV2StatisticsRemoved.validateJsonElement(jsonObj.get("removed")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingSummaryResponseV2Statistics.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingSummaryResponseV2Statistics' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingSummaryResponseV2Statistics.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingSummaryResponseV2Statistics value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingSummaryResponseV2Statistics read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingSummaryResponseV2Statistics given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingSummaryResponseV2Statistics + * @throws IOException if the JSON string is invalid with respect to UserRatingSummaryResponseV2Statistics + */ + public static UserRatingSummaryResponseV2Statistics fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingSummaryResponseV2Statistics.class); + } + + /** + * Convert an instance of UserRatingSummaryResponseV2Statistics to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsExcluded.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsExcluded.java new file mode 100644 index 0000000..8757484 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsExcluded.java @@ -0,0 +1,212 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Summary of excluded ratings. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingSummaryResponseV2StatisticsExcluded { + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + @javax.annotation.Nonnull + private Long total; + + public UserRatingSummaryResponseV2StatisticsExcluded() { + } + + public UserRatingSummaryResponseV2StatisticsExcluded total(@javax.annotation.Nonnull Long total) { + this.total = total; + return this; + } + + /** + * Total number of excluded ratings. + * minimum: 0 + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(@javax.annotation.Nonnull Long total) { + this.total = total; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingSummaryResponseV2StatisticsExcluded userRatingSummaryResponseV2StatisticsExcluded = (UserRatingSummaryResponseV2StatisticsExcluded) o; + return Objects.equals(this.total, userRatingSummaryResponseV2StatisticsExcluded.total); + } + + @Override + public int hashCode() { + return Objects.hash(total); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingSummaryResponseV2StatisticsExcluded {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("total"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("total"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingSummaryResponseV2StatisticsExcluded + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingSummaryResponseV2StatisticsExcluded.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingSummaryResponseV2StatisticsExcluded is not found in the empty JSON string", UserRatingSummaryResponseV2StatisticsExcluded.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingSummaryResponseV2StatisticsExcluded.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingSummaryResponseV2StatisticsExcluded` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingSummaryResponseV2StatisticsExcluded.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingSummaryResponseV2StatisticsExcluded.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingSummaryResponseV2StatisticsExcluded' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingSummaryResponseV2StatisticsExcluded.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingSummaryResponseV2StatisticsExcluded value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingSummaryResponseV2StatisticsExcluded read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingSummaryResponseV2StatisticsExcluded given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingSummaryResponseV2StatisticsExcluded + * @throws IOException if the JSON string is invalid with respect to UserRatingSummaryResponseV2StatisticsExcluded + */ + public static UserRatingSummaryResponseV2StatisticsExcluded fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingSummaryResponseV2StatisticsExcluded.class); + } + + /** + * Convert an instance of UserRatingSummaryResponseV2StatisticsExcluded to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsReceived.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsReceived.java new file mode 100644 index 0000000..9e59b89 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsReceived.java @@ -0,0 +1,212 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Summary of received ratings. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingSummaryResponseV2StatisticsReceived { + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + @javax.annotation.Nonnull + private Long total; + + public UserRatingSummaryResponseV2StatisticsReceived() { + } + + public UserRatingSummaryResponseV2StatisticsReceived total(@javax.annotation.Nonnull Long total) { + this.total = total; + return this; + } + + /** + * Total number of received ratings. + * minimum: 0 + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(@javax.annotation.Nonnull Long total) { + this.total = total; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingSummaryResponseV2StatisticsReceived userRatingSummaryResponseV2StatisticsReceived = (UserRatingSummaryResponseV2StatisticsReceived) o; + return Objects.equals(this.total, userRatingSummaryResponseV2StatisticsReceived.total); + } + + @Override + public int hashCode() { + return Objects.hash(total); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingSummaryResponseV2StatisticsReceived {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("total"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("total"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingSummaryResponseV2StatisticsReceived + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingSummaryResponseV2StatisticsReceived.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingSummaryResponseV2StatisticsReceived is not found in the empty JSON string", UserRatingSummaryResponseV2StatisticsReceived.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingSummaryResponseV2StatisticsReceived.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingSummaryResponseV2StatisticsReceived` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingSummaryResponseV2StatisticsReceived.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingSummaryResponseV2StatisticsReceived.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingSummaryResponseV2StatisticsReceived' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingSummaryResponseV2StatisticsReceived.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingSummaryResponseV2StatisticsReceived value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingSummaryResponseV2StatisticsReceived read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingSummaryResponseV2StatisticsReceived given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingSummaryResponseV2StatisticsReceived + * @throws IOException if the JSON string is invalid with respect to UserRatingSummaryResponseV2StatisticsReceived + */ + public static UserRatingSummaryResponseV2StatisticsReceived fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingSummaryResponseV2StatisticsReceived.class); + } + + /** + * Convert an instance of UserRatingSummaryResponseV2StatisticsReceived to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsRemoved.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsRemoved.java new file mode 100644 index 0000000..01ba5e2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2StatisticsRemoved.java @@ -0,0 +1,299 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Summary of removed ratings. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingSummaryResponseV2StatisticsRemoved { + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + @javax.annotation.Nonnull + private Long total; + + public static final String SERIALIZED_NAME_BY_ADMIN = "byAdmin"; + @SerializedName(SERIALIZED_NAME_BY_ADMIN) + @javax.annotation.Nonnull + private Long byAdmin; + + public static final String SERIALIZED_NAME_BY_BUYER = "byBuyer"; + @SerializedName(SERIALIZED_NAME_BY_BUYER) + @javax.annotation.Nonnull + private Long byBuyer; + + public static final String SERIALIZED_NAME_BY_BUYER_DUE_TO_COMPENSATION = "byBuyerDueToCompensation"; + @SerializedName(SERIALIZED_NAME_BY_BUYER_DUE_TO_COMPENSATION) + @javax.annotation.Nonnull + private Long byBuyerDueToCompensation; + + public UserRatingSummaryResponseV2StatisticsRemoved() { + } + + public UserRatingSummaryResponseV2StatisticsRemoved total(@javax.annotation.Nonnull Long total) { + this.total = total; + return this; + } + + /** + * Total number of removed ratings. + * minimum: 0 + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(@javax.annotation.Nonnull Long total) { + this.total = total; + } + + + public UserRatingSummaryResponseV2StatisticsRemoved byAdmin(@javax.annotation.Nonnull Long byAdmin) { + this.byAdmin = byAdmin; + return this; + } + + /** + * Number of ratings removed by admin. + * minimum: 0 + * @return byAdmin + */ + @javax.annotation.Nonnull + public Long getByAdmin() { + return byAdmin; + } + + public void setByAdmin(@javax.annotation.Nonnull Long byAdmin) { + this.byAdmin = byAdmin; + } + + + public UserRatingSummaryResponseV2StatisticsRemoved byBuyer(@javax.annotation.Nonnull Long byBuyer) { + this.byBuyer = byBuyer; + return this; + } + + /** + * Number of ratings removed by buyer. + * minimum: 0 + * @return byBuyer + */ + @javax.annotation.Nonnull + public Long getByBuyer() { + return byBuyer; + } + + public void setByBuyer(@javax.annotation.Nonnull Long byBuyer) { + this.byBuyer = byBuyer; + } + + + public UserRatingSummaryResponseV2StatisticsRemoved byBuyerDueToCompensation(@javax.annotation.Nonnull Long byBuyerDueToCompensation) { + this.byBuyerDueToCompensation = byBuyerDueToCompensation; + return this; + } + + /** + * Number of ratings removed by buyer due to compensation. + * minimum: 0 + * @return byBuyerDueToCompensation + */ + @javax.annotation.Nonnull + public Long getByBuyerDueToCompensation() { + return byBuyerDueToCompensation; + } + + public void setByBuyerDueToCompensation(@javax.annotation.Nonnull Long byBuyerDueToCompensation) { + this.byBuyerDueToCompensation = byBuyerDueToCompensation; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingSummaryResponseV2StatisticsRemoved userRatingSummaryResponseV2StatisticsRemoved = (UserRatingSummaryResponseV2StatisticsRemoved) o; + return Objects.equals(this.total, userRatingSummaryResponseV2StatisticsRemoved.total) && + Objects.equals(this.byAdmin, userRatingSummaryResponseV2StatisticsRemoved.byAdmin) && + Objects.equals(this.byBuyer, userRatingSummaryResponseV2StatisticsRemoved.byBuyer) && + Objects.equals(this.byBuyerDueToCompensation, userRatingSummaryResponseV2StatisticsRemoved.byBuyerDueToCompensation); + } + + @Override + public int hashCode() { + return Objects.hash(total, byAdmin, byBuyer, byBuyerDueToCompensation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingSummaryResponseV2StatisticsRemoved {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" byAdmin: ").append(toIndentedString(byAdmin)).append("\n"); + sb.append(" byBuyer: ").append(toIndentedString(byBuyer)).append("\n"); + sb.append(" byBuyerDueToCompensation: ").append(toIndentedString(byBuyerDueToCompensation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("total"); + openapiFields.add("byAdmin"); + openapiFields.add("byBuyer"); + openapiFields.add("byBuyerDueToCompensation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("byAdmin"); + openapiRequiredFields.add("byBuyer"); + openapiRequiredFields.add("byBuyerDueToCompensation"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingSummaryResponseV2StatisticsRemoved + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingSummaryResponseV2StatisticsRemoved.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingSummaryResponseV2StatisticsRemoved is not found in the empty JSON string", UserRatingSummaryResponseV2StatisticsRemoved.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingSummaryResponseV2StatisticsRemoved.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingSummaryResponseV2StatisticsRemoved` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingSummaryResponseV2StatisticsRemoved.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingSummaryResponseV2StatisticsRemoved.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingSummaryResponseV2StatisticsRemoved' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingSummaryResponseV2StatisticsRemoved.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingSummaryResponseV2StatisticsRemoved value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingSummaryResponseV2StatisticsRemoved read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingSummaryResponseV2StatisticsRemoved given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingSummaryResponseV2StatisticsRemoved + * @throws IOException if the JSON string is invalid with respect to UserRatingSummaryResponseV2StatisticsRemoved + */ + public static UserRatingSummaryResponseV2StatisticsRemoved fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingSummaryResponseV2StatisticsRemoved.class); + } + + /** + * Convert an instance of UserRatingSummaryResponseV2StatisticsRemoved to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2User.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2User.java new file mode 100644 index 0000000..c0d81af --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingSummaryResponseV2User.java @@ -0,0 +1,241 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Information about the user. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingSummaryResponseV2User { + public static final String SERIALIZED_NAME_NUMBER_OF_PRODUCTS_SOLD_WITHIN30_DAYS = "numberOfProductsSoldWithin30Days"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_PRODUCTS_SOLD_WITHIN30_DAYS) + @javax.annotation.Nonnull + private Long numberOfProductsSoldWithin30Days; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private LocalDate createdAt; + + public UserRatingSummaryResponseV2User() { + } + + public UserRatingSummaryResponseV2User numberOfProductsSoldWithin30Days(@javax.annotation.Nonnull Long numberOfProductsSoldWithin30Days) { + this.numberOfProductsSoldWithin30Days = numberOfProductsSoldWithin30Days; + return this; + } + + /** + * Number of products sold by the user within the last 30 days. + * minimum: 0 + * @return numberOfProductsSoldWithin30Days + */ + @javax.annotation.Nonnull + public Long getNumberOfProductsSoldWithin30Days() { + return numberOfProductsSoldWithin30Days; + } + + public void setNumberOfProductsSoldWithin30Days(@javax.annotation.Nonnull Long numberOfProductsSoldWithin30Days) { + this.numberOfProductsSoldWithin30Days = numberOfProductsSoldWithin30Days; + } + + + public UserRatingSummaryResponseV2User createdAt(@javax.annotation.Nonnull LocalDate createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The date when the user account was created. + * @return createdAt + */ + @javax.annotation.Nonnull + public LocalDate getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull LocalDate createdAt) { + this.createdAt = createdAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingSummaryResponseV2User userRatingSummaryResponseV2User = (UserRatingSummaryResponseV2User) o; + return Objects.equals(this.numberOfProductsSoldWithin30Days, userRatingSummaryResponseV2User.numberOfProductsSoldWithin30Days) && + Objects.equals(this.createdAt, userRatingSummaryResponseV2User.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(numberOfProductsSoldWithin30Days, createdAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingSummaryResponseV2User {\n"); + sb.append(" numberOfProductsSoldWithin30Days: ").append(toIndentedString(numberOfProductsSoldWithin30Days)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("numberOfProductsSoldWithin30Days"); + openapiFields.add("createdAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("numberOfProductsSoldWithin30Days"); + openapiRequiredFields.add("createdAt"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingSummaryResponseV2User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingSummaryResponseV2User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingSummaryResponseV2User is not found in the empty JSON string", UserRatingSummaryResponseV2User.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingSummaryResponseV2User.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingSummaryResponseV2User` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingSummaryResponseV2User.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingSummaryResponseV2User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingSummaryResponseV2User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingSummaryResponseV2User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingSummaryResponseV2User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingSummaryResponseV2User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingSummaryResponseV2User given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingSummaryResponseV2User + * @throws IOException if the JSON string is invalid with respect to UserRatingSummaryResponseV2User + */ + public static UserRatingSummaryResponseV2User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingSummaryResponseV2User.class); + } + + /** + * Convert an instance of UserRatingSummaryResponseV2User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/UserRatingVBeta1.java b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingVBeta1.java new file mode 100644 index 0000000..506dfdd --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/UserRatingVBeta1.java @@ -0,0 +1,575 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.AnswerVBeta1; +import pl.wtx.allegro.api.client.model.CommentVBeta1; +import pl.wtx.allegro.api.client.model.Exclusion; +import pl.wtx.allegro.api.client.model.Justification; +import pl.wtx.allegro.api.client.model.Order; +import pl.wtx.allegro.api.client.model.Removal; +import pl.wtx.allegro.api.client.model.User; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * UserRatingVBeta1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class UserRatingVBeta1 { + public static final String SERIALIZED_NAME_ANSWER = "answer"; + @SerializedName(SERIALIZED_NAME_ANSWER) + @javax.annotation.Nullable + private AnswerVBeta1 answer; + + public static final String SERIALIZED_NAME_BUYER = "buyer"; + @SerializedName(SERIALIZED_NAME_BUYER) + @javax.annotation.Nonnull + private User buyer; + + public static final String SERIALIZED_NAME_COMMENT = "comment"; + @SerializedName(SERIALIZED_NAME_COMMENT) + @javax.annotation.Nullable + private CommentVBeta1 comment; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private String createdAt; + + public static final String SERIALIZED_NAME_EDITED_AT = "editedAt"; + @SerializedName(SERIALIZED_NAME_EDITED_AT) + @javax.annotation.Nullable + private String editedAt; + + public static final String SERIALIZED_NAME_EXCLUSION = "exclusion"; + @SerializedName(SERIALIZED_NAME_EXCLUSION) + @javax.annotation.Nullable + private Exclusion exclusion; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_JUSTIFICATIONS = "justifications"; + @SerializedName(SERIALIZED_NAME_JUSTIFICATIONS) + @javax.annotation.Nullable + private List justifications = new ArrayList<>(); + + public static final String SERIALIZED_NAME_LAST_CHANGED_AT = "lastChangedAt"; + @SerializedName(SERIALIZED_NAME_LAST_CHANGED_AT) + @javax.annotation.Nullable + private String lastChangedAt; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + @javax.annotation.Nonnull + private Order order; + + public static final String SERIALIZED_NAME_RECOMMENDED = "recommended"; + @SerializedName(SERIALIZED_NAME_RECOMMENDED) + @javax.annotation.Nonnull + private Boolean recommended; + + public static final String SERIALIZED_NAME_REMOVAL = "removal"; + @SerializedName(SERIALIZED_NAME_REMOVAL) + @javax.annotation.Nullable + private Removal removal; + + public UserRatingVBeta1() { + } + + public UserRatingVBeta1 answer(@javax.annotation.Nullable AnswerVBeta1 answer) { + this.answer = answer; + return this; + } + + /** + * Get answer + * @return answer + */ + @javax.annotation.Nullable + public AnswerVBeta1 getAnswer() { + return answer; + } + + public void setAnswer(@javax.annotation.Nullable AnswerVBeta1 answer) { + this.answer = answer; + } + + + public UserRatingVBeta1 buyer(@javax.annotation.Nonnull User buyer) { + this.buyer = buyer; + return this; + } + + /** + * Get buyer + * @return buyer + */ + @javax.annotation.Nonnull + public User getBuyer() { + return buyer; + } + + public void setBuyer(@javax.annotation.Nonnull User buyer) { + this.buyer = buyer; + } + + + public UserRatingVBeta1 comment(@javax.annotation.Nullable CommentVBeta1 comment) { + this.comment = comment; + return this; + } + + /** + * Get comment + * @return comment + */ + @javax.annotation.Nullable + public CommentVBeta1 getComment() { + return comment; + } + + public void setComment(@javax.annotation.Nullable CommentVBeta1 comment) { + this.comment = comment; + } + + + public UserRatingVBeta1 createdAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation datetime in ISO 8601 format + * @return createdAt + */ + @javax.annotation.Nonnull + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull String createdAt) { + this.createdAt = createdAt; + } + + + public UserRatingVBeta1 editedAt(@javax.annotation.Nullable String editedAt) { + this.editedAt = editedAt; + return this; + } + + /** + * Edition datetime in ISO 8601 format + * @return editedAt + */ + @javax.annotation.Nullable + public String getEditedAt() { + return editedAt; + } + + public void setEditedAt(@javax.annotation.Nullable String editedAt) { + this.editedAt = editedAt; + } + + + public UserRatingVBeta1 exclusion(@javax.annotation.Nullable Exclusion exclusion) { + this.exclusion = exclusion; + return this; + } + + /** + * Get exclusion + * @return exclusion + */ + @javax.annotation.Nullable + public Exclusion getExclusion() { + return exclusion; + } + + public void setExclusion(@javax.annotation.Nullable Exclusion exclusion) { + this.exclusion = exclusion; + } + + + public UserRatingVBeta1 id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Rating id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public UserRatingVBeta1 justifications(@javax.annotation.Nullable List justifications) { + this.justifications = justifications; + return this; + } + + public UserRatingVBeta1 addJustificationsItem(Justification justificationsItem) { + if (this.justifications == null) { + this.justifications = new ArrayList<>(); + } + this.justifications.add(justificationsItem); + return this; + } + + /** + * List of the justifications chosen by the buyer while creating rating + * @return justifications + */ + @javax.annotation.Nullable + public List getJustifications() { + return justifications; + } + + public void setJustifications(@javax.annotation.Nullable List justifications) { + this.justifications = justifications; + } + + + public UserRatingVBeta1 lastChangedAt(@javax.annotation.Nullable String lastChangedAt) { + this.lastChangedAt = lastChangedAt; + return this; + } + + /** + * Last change (creation or latest edition) datetime in ISO 8601 format + * @return lastChangedAt + */ + @javax.annotation.Nullable + public String getLastChangedAt() { + return lastChangedAt; + } + + public void setLastChangedAt(@javax.annotation.Nullable String lastChangedAt) { + this.lastChangedAt = lastChangedAt; + } + + + public UserRatingVBeta1 order(@javax.annotation.Nonnull Order order) { + this.order = order; + return this; + } + + /** + * Get order + * @return order + */ + @javax.annotation.Nonnull + public Order getOrder() { + return order; + } + + public void setOrder(@javax.annotation.Nonnull Order order) { + this.order = order; + } + + + public UserRatingVBeta1 recommended(@javax.annotation.Nonnull Boolean recommended) { + this.recommended = recommended; + return this; + } + + /** + * Whether buyer recommends the order + * @return recommended + */ + @javax.annotation.Nonnull + public Boolean getRecommended() { + return recommended; + } + + public void setRecommended(@javax.annotation.Nonnull Boolean recommended) { + this.recommended = recommended; + } + + + public UserRatingVBeta1 removal(@javax.annotation.Nullable Removal removal) { + this.removal = removal; + return this; + } + + /** + * Get removal + * @return removal + */ + @javax.annotation.Nullable + public Removal getRemoval() { + return removal; + } + + public void setRemoval(@javax.annotation.Nullable Removal removal) { + this.removal = removal; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserRatingVBeta1 userRatingVBeta1 = (UserRatingVBeta1) o; + return Objects.equals(this.answer, userRatingVBeta1.answer) && + Objects.equals(this.buyer, userRatingVBeta1.buyer) && + Objects.equals(this.comment, userRatingVBeta1.comment) && + Objects.equals(this.createdAt, userRatingVBeta1.createdAt) && + Objects.equals(this.editedAt, userRatingVBeta1.editedAt) && + Objects.equals(this.exclusion, userRatingVBeta1.exclusion) && + Objects.equals(this.id, userRatingVBeta1.id) && + Objects.equals(this.justifications, userRatingVBeta1.justifications) && + Objects.equals(this.lastChangedAt, userRatingVBeta1.lastChangedAt) && + Objects.equals(this.order, userRatingVBeta1.order) && + Objects.equals(this.recommended, userRatingVBeta1.recommended) && + Objects.equals(this.removal, userRatingVBeta1.removal); + } + + @Override + public int hashCode() { + return Objects.hash(answer, buyer, comment, createdAt, editedAt, exclusion, id, justifications, lastChangedAt, order, recommended, removal); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserRatingVBeta1 {\n"); + sb.append(" answer: ").append(toIndentedString(answer)).append("\n"); + sb.append(" buyer: ").append(toIndentedString(buyer)).append("\n"); + sb.append(" comment: ").append(toIndentedString(comment)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" editedAt: ").append(toIndentedString(editedAt)).append("\n"); + sb.append(" exclusion: ").append(toIndentedString(exclusion)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" justifications: ").append(toIndentedString(justifications)).append("\n"); + sb.append(" lastChangedAt: ").append(toIndentedString(lastChangedAt)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" recommended: ").append(toIndentedString(recommended)).append("\n"); + sb.append(" removal: ").append(toIndentedString(removal)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("answer"); + openapiFields.add("buyer"); + openapiFields.add("comment"); + openapiFields.add("createdAt"); + openapiFields.add("editedAt"); + openapiFields.add("exclusion"); + openapiFields.add("id"); + openapiFields.add("justifications"); + openapiFields.add("lastChangedAt"); + openapiFields.add("order"); + openapiFields.add("recommended"); + openapiFields.add("removal"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("buyer"); + openapiRequiredFields.add("createdAt"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("order"); + openapiRequiredFields.add("recommended"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserRatingVBeta1 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserRatingVBeta1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserRatingVBeta1 is not found in the empty JSON string", UserRatingVBeta1.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserRatingVBeta1.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserRatingVBeta1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserRatingVBeta1.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `answer` + if (jsonObj.get("answer") != null && !jsonObj.get("answer").isJsonNull()) { + AnswerVBeta1.validateJsonElement(jsonObj.get("answer")); + } + // validate the required field `buyer` + User.validateJsonElement(jsonObj.get("buyer")); + // validate the optional field `comment` + if (jsonObj.get("comment") != null && !jsonObj.get("comment").isJsonNull()) { + CommentVBeta1.validateJsonElement(jsonObj.get("comment")); + } + if (!jsonObj.get("createdAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdAt").toString())); + } + if ((jsonObj.get("editedAt") != null && !jsonObj.get("editedAt").isJsonNull()) && !jsonObj.get("editedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `editedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("editedAt").toString())); + } + // validate the optional field `exclusion` + if (jsonObj.get("exclusion") != null && !jsonObj.get("exclusion").isJsonNull()) { + Exclusion.validateJsonElement(jsonObj.get("exclusion")); + } + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (jsonObj.get("justifications") != null && !jsonObj.get("justifications").isJsonNull()) { + JsonArray jsonArrayjustifications = jsonObj.getAsJsonArray("justifications"); + if (jsonArrayjustifications != null) { + // ensure the json data is an array + if (!jsonObj.get("justifications").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `justifications` to be an array in the JSON string but got `%s`", jsonObj.get("justifications").toString())); + } + + // validate the optional field `justifications` (array) + for (int i = 0; i < jsonArrayjustifications.size(); i++) { + Justification.validateJsonElement(jsonArrayjustifications.get(i)); + }; + } + } + if ((jsonObj.get("lastChangedAt") != null && !jsonObj.get("lastChangedAt").isJsonNull()) && !jsonObj.get("lastChangedAt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastChangedAt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastChangedAt").toString())); + } + // validate the required field `order` + Order.validateJsonElement(jsonObj.get("order")); + // validate the optional field `removal` + if (jsonObj.get("removal") != null && !jsonObj.get("removal").isJsonNull()) { + Removal.validateJsonElement(jsonObj.get("removal")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserRatingVBeta1.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserRatingVBeta1' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserRatingVBeta1.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserRatingVBeta1 value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserRatingVBeta1 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UserRatingVBeta1 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserRatingVBeta1 + * @throws IOException if the JSON string is invalid with respect to UserRatingVBeta1 + */ + public static UserRatingVBeta1 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserRatingVBeta1.class); + } + + /** + * Convert an instance of UserRatingVBeta1 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Validation.java b/src/main/java/pl/wtx/allegro/api/client/model/Validation.java new file mode 100644 index 0000000..2f12a52 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Validation.java @@ -0,0 +1,310 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.ValidationError; +import pl.wtx.allegro.api.client.model.ValidationWarning; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Validation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Validation { + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nonnull + private List errors = new ArrayList<>(); + + public static final String SERIALIZED_NAME_WARNINGS = "warnings"; + @SerializedName(SERIALIZED_NAME_WARNINGS) + @javax.annotation.Nullable + private List warnings = new ArrayList<>(); + + public static final String SERIALIZED_NAME_VALIDATED_AT = "validatedAt"; + @SerializedName(SERIALIZED_NAME_VALIDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime validatedAt; + + public Validation() { + } + + public Validation errors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + return this; + } + + public Validation addErrorsItem(ValidationError errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @javax.annotation.Nonnull + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + } + + + public Validation warnings(@javax.annotation.Nullable List warnings) { + this.warnings = warnings; + return this; + } + + public Validation addWarningsItem(ValidationWarning warningsItem) { + if (this.warnings == null) { + this.warnings = new ArrayList<>(); + } + this.warnings.add(warningsItem); + return this; + } + + /** + * Get warnings + * @return warnings + */ + @javax.annotation.Nullable + public List getWarnings() { + return warnings; + } + + public void setWarnings(@javax.annotation.Nullable List warnings) { + this.warnings = warnings; + } + + + public Validation validatedAt(@javax.annotation.Nullable OffsetDateTime validatedAt) { + this.validatedAt = validatedAt; + return this; + } + + /** + * Get validatedAt + * @return validatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getValidatedAt() { + return validatedAt; + } + + public void setValidatedAt(@javax.annotation.Nullable OffsetDateTime validatedAt) { + this.validatedAt = validatedAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Validation validation = (Validation) o; + return Objects.equals(this.errors, validation.errors) && + Objects.equals(this.warnings, validation.warnings) && + Objects.equals(this.validatedAt, validation.validatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(errors, warnings, validatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Validation {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" warnings: ").append(toIndentedString(warnings)).append("\n"); + sb.append(" validatedAt: ").append(toIndentedString(validatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("errors"); + openapiFields.add("warnings"); + openapiFields.add("validatedAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("errors"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Validation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Validation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Validation is not found in the empty JSON string", Validation.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Validation.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Validation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Validation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + // validate the required field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + ValidationError.validateJsonElement(jsonArrayerrors.get(i)); + }; + if (jsonObj.get("warnings") != null && !jsonObj.get("warnings").isJsonNull()) { + JsonArray jsonArraywarnings = jsonObj.getAsJsonArray("warnings"); + if (jsonArraywarnings != null) { + // ensure the json data is an array + if (!jsonObj.get("warnings").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `warnings` to be an array in the JSON string but got `%s`", jsonObj.get("warnings").toString())); + } + + // validate the optional field `warnings` (array) + for (int i = 0; i < jsonArraywarnings.size(); i++) { + ValidationWarning.validateJsonElement(jsonArraywarnings.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Validation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Validation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Validation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Validation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Validation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Validation given an JSON string + * + * @param jsonString JSON string + * @return An instance of Validation + * @throws IOException if the JSON string is invalid with respect to Validation + */ + public static Validation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Validation.class); + } + + /** + * Convert an instance of Validation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ValidationError.java b/src/main/java/pl/wtx/allegro/api/client/model/ValidationError.java new file mode 100644 index 0000000..4e82973 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ValidationError.java @@ -0,0 +1,375 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ValidationError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ValidationError { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable + private String details; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private String path; + + public static final String SERIALIZED_NAME_USER_MESSAGE = "userMessage"; + @SerializedName(SERIALIZED_NAME_USER_MESSAGE) + @javax.annotation.Nullable + private String userMessage; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); + + public ValidationError() { + } + + public ValidationError code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public ValidationError details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * Get details + * @return details + */ + @javax.annotation.Nullable + public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + + public ValidationError message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + public ValidationError path(@javax.annotation.Nullable String path) { + this.path = path; + return this; + } + + /** + * Get path + * @return path + */ + @javax.annotation.Nullable + public String getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable String path) { + this.path = path; + } + + + public ValidationError userMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + return this; + } + + /** + * Get userMessage + * @return userMessage + */ + @javax.annotation.Nullable + public String getUserMessage() { + return userMessage; + } + + public void setUserMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + } + + + public ValidationError metadata(@javax.annotation.Nullable Map metadata) { + this.metadata = metadata; + return this; + } + + public ValidationError putMetadataItem(String key, String metadataItem) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.put(key, metadataItem); + return this; + } + + /** + * Additional technical properties of this error. Set of possible keys depends on the specific error. + * @return metadata + */ + @javax.annotation.Nullable + public Map getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable Map metadata) { + this.metadata = metadata; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ValidationError validationError = (ValidationError) o; + return Objects.equals(this.code, validationError.code) && + Objects.equals(this.details, validationError.details) && + Objects.equals(this.message, validationError.message) && + Objects.equals(this.path, validationError.path) && + Objects.equals(this.userMessage, validationError.userMessage) && + Objects.equals(this.metadata, validationError.metadata); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(code, details, message, path, userMessage, metadata); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ValidationError {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" userMessage: ").append(toIndentedString(userMessage)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("details"); + openapiFields.add("message"); + openapiFields.add("path"); + openapiFields.add("userMessage"); + openapiFields.add("metadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ValidationError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ValidationError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ValidationError is not found in the empty JSON string", ValidationError.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ValidationError.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ValidationError` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be a primitive type in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) && !jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + if ((jsonObj.get("userMessage") != null && !jsonObj.get("userMessage").isJsonNull()) && !jsonObj.get("userMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ValidationError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ValidationError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ValidationError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ValidationError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ValidationError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ValidationError given an JSON string + * + * @param jsonString JSON string + * @return An instance of ValidationError + * @throws IOException if the JSON string is invalid with respect to ValidationError + */ + public static ValidationError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ValidationError.class); + } + + /** + * Convert an instance of ValidationError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/ValidationWarning.java b/src/main/java/pl/wtx/allegro/api/client/model/ValidationWarning.java new file mode 100644 index 0000000..fc79dfe --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/ValidationWarning.java @@ -0,0 +1,375 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * ValidationWarning + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class ValidationWarning { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nullable + private String code; + + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable + private String details; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nullable + private String message; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + @javax.annotation.Nullable + private String path; + + public static final String SERIALIZED_NAME_USER_MESSAGE = "userMessage"; + @SerializedName(SERIALIZED_NAME_USER_MESSAGE) + @javax.annotation.Nullable + private String userMessage; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable + private Map metadata = new HashMap<>(); + + public ValidationWarning() { + } + + public ValidationWarning code(@javax.annotation.Nullable String code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + */ + @javax.annotation.Nullable + public String getCode() { + return code; + } + + public void setCode(@javax.annotation.Nullable String code) { + this.code = code; + } + + + public ValidationWarning details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * Get details + * @return details + */ + @javax.annotation.Nullable + public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + + public ValidationWarning message(@javax.annotation.Nullable String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nullable String message) { + this.message = message; + } + + + public ValidationWarning path(@javax.annotation.Nullable String path) { + this.path = path; + return this; + } + + /** + * Get path + * @return path + */ + @javax.annotation.Nullable + public String getPath() { + return path; + } + + public void setPath(@javax.annotation.Nullable String path) { + this.path = path; + } + + + public ValidationWarning userMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + return this; + } + + /** + * Get userMessage + * @return userMessage + */ + @javax.annotation.Nullable + public String getUserMessage() { + return userMessage; + } + + public void setUserMessage(@javax.annotation.Nullable String userMessage) { + this.userMessage = userMessage; + } + + + public ValidationWarning metadata(@javax.annotation.Nullable Map metadata) { + this.metadata = metadata; + return this; + } + + public ValidationWarning putMetadataItem(String key, String metadataItem) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.put(key, metadataItem); + return this; + } + + /** + * Additional technical properties of this error. Set of possible keys depends on the specific error. + * @return metadata + */ + @javax.annotation.Nullable + public Map getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable Map metadata) { + this.metadata = metadata; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ValidationWarning validationWarning = (ValidationWarning) o; + return Objects.equals(this.code, validationWarning.code) && + Objects.equals(this.details, validationWarning.details) && + Objects.equals(this.message, validationWarning.message) && + Objects.equals(this.path, validationWarning.path) && + Objects.equals(this.userMessage, validationWarning.userMessage) && + Objects.equals(this.metadata, validationWarning.metadata); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(code, details, message, path, userMessage, metadata); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ValidationWarning {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" userMessage: ").append(toIndentedString(userMessage)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("details"); + openapiFields.add("message"); + openapiFields.add("path"); + openapiFields.add("userMessage"); + openapiFields.add("metadata"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ValidationWarning + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ValidationWarning.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ValidationWarning is not found in the empty JSON string", ValidationWarning.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ValidationWarning.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ValidationWarning` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + if ((jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be a primitive type in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("path") != null && !jsonObj.get("path").isJsonNull()) && !jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + if ((jsonObj.get("userMessage") != null && !jsonObj.get("userMessage").isJsonNull()) && !jsonObj.get("userMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userMessage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ValidationWarning.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ValidationWarning' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ValidationWarning.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ValidationWarning value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ValidationWarning read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ValidationWarning given an JSON string + * + * @param jsonString JSON string + * @return An instance of ValidationWarning + * @throws IOException if the JSON string is invalid with respect to ValidationWarning + */ + public static ValidationWarning fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ValidationWarning.class); + } + + /** + * Convert an instance of ValidationWarning to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/VariantSet.java b/src/main/java/pl/wtx/allegro/api/client/model/VariantSet.java new file mode 100644 index 0000000..c4a6860 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/VariantSet.java @@ -0,0 +1,310 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.VariantSetOffer; +import pl.wtx.allegro.api.client.model.VariantSetParameter; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * VariantSet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class VariantSet { + public static final String SERIALIZED_NAME_OFFERS = "offers"; + @SerializedName(SERIALIZED_NAME_OFFERS) + @javax.annotation.Nonnull + private List offers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nonnull + private List parameters = new ArrayList<>(); + + public VariantSet() { + } + + public VariantSet offers(@javax.annotation.Nonnull List offers) { + this.offers = offers; + return this; + } + + public VariantSet addOffersItem(VariantSetOffer offersItem) { + if (this.offers == null) { + this.offers = new ArrayList<>(); + } + this.offers.add(offersItem); + return this; + } + + /** + * Get offers + * @return offers + */ + @javax.annotation.Nonnull + public List getOffers() { + return offers; + } + + public void setOffers(@javax.annotation.Nonnull List offers) { + this.offers = offers; + } + + + public VariantSet name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public VariantSet parameters(@javax.annotation.Nonnull List parameters) { + this.parameters = parameters; + return this; + } + + public VariantSet addParametersItem(VariantSetParameter parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Get parameters + * @return parameters + */ + @javax.annotation.Nonnull + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nonnull List parameters) { + this.parameters = parameters; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VariantSet variantSet = (VariantSet) o; + return Objects.equals(this.offers, variantSet.offers) && + Objects.equals(this.name, variantSet.name) && + Objects.equals(this.parameters, variantSet.parameters); + } + + @Override + public int hashCode() { + return Objects.hash(offers, name, parameters); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VariantSet {\n"); + sb.append(" offers: ").append(toIndentedString(offers)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offers"); + openapiFields.add("name"); + openapiFields.add("parameters"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offers"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("parameters"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VariantSet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VariantSet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VariantSet is not found in the empty JSON string", VariantSet.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!VariantSet.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `VariantSet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VariantSet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("offers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offers` to be an array in the JSON string but got `%s`", jsonObj.get("offers").toString())); + } + + JsonArray jsonArrayoffers = jsonObj.getAsJsonArray("offers"); + // validate the required field `offers` (array) + for (int i = 0; i < jsonArrayoffers.size(); i++) { + VariantSetOffer.validateJsonElement(jsonArrayoffers.get(i)); + }; + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + // validate the required field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + VariantSetParameter.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VariantSet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VariantSet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VariantSet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VariantSet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VariantSet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VariantSet given an JSON string + * + * @param jsonString JSON string + * @return An instance of VariantSet + * @throws IOException if the JSON string is invalid with respect to VariantSet + */ + public static VariantSet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VariantSet.class); + } + + /** + * Convert an instance of VariantSet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/VariantSetOffer.java b/src/main/java/pl/wtx/allegro/api/client/model/VariantSetOffer.java new file mode 100644 index 0000000..294fea6 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/VariantSetOffer.java @@ -0,0 +1,244 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * VariantSetOffer + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class VariantSetOffer { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public static final String SERIALIZED_NAME_COLOR_PATTERN = "colorPattern"; + @SerializedName(SERIALIZED_NAME_COLOR_PATTERN) + @javax.annotation.Nullable + private String colorPattern; + + public VariantSetOffer() { + } + + public VariantSetOffer id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + public VariantSetOffer colorPattern(@javax.annotation.Nullable String colorPattern) { + this.colorPattern = colorPattern; + return this; + } + + /** + * Label that allows to group variants via image. All variants having the same image should have identical identifier in this field. + * @return colorPattern + */ + @javax.annotation.Nullable + public String getColorPattern() { + return colorPattern; + } + + public void setColorPattern(@javax.annotation.Nullable String colorPattern) { + this.colorPattern = colorPattern; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VariantSetOffer variantSetOffer = (VariantSetOffer) o; + return Objects.equals(this.id, variantSetOffer.id) && + Objects.equals(this.colorPattern, variantSetOffer.colorPattern); + } + + @Override + public int hashCode() { + return Objects.hash(id, colorPattern); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VariantSetOffer {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" colorPattern: ").append(toIndentedString(colorPattern)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("colorPattern"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VariantSetOffer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VariantSetOffer.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VariantSetOffer is not found in the empty JSON string", VariantSetOffer.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!VariantSetOffer.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `VariantSetOffer` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VariantSetOffer.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("colorPattern") != null && !jsonObj.get("colorPattern").isJsonNull()) && !jsonObj.get("colorPattern").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `colorPattern` to be a primitive type in the JSON string but got `%s`", jsonObj.get("colorPattern").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VariantSetOffer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VariantSetOffer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VariantSetOffer.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VariantSetOffer value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VariantSetOffer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VariantSetOffer given an JSON string + * + * @param jsonString JSON string + * @return An instance of VariantSetOffer + * @throws IOException if the JSON string is invalid with respect to VariantSetOffer + */ + public static VariantSetOffer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VariantSetOffer.class); + } + + /** + * Convert an instance of VariantSetOffer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/VariantSetParameter.java b/src/main/java/pl/wtx/allegro/api/client/model/VariantSetParameter.java new file mode 100644 index 0000000..677e93b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/VariantSetParameter.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * VariantSetParameter + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class VariantSetParameter { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private String id; + + public VariantSetParameter() { + } + + public VariantSetParameter id(@javax.annotation.Nonnull String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VariantSetParameter variantSetParameter = (VariantSetParameter) o; + return Objects.equals(this.id, variantSetParameter.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VariantSetParameter {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VariantSetParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VariantSetParameter.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VariantSetParameter is not found in the empty JSON string", VariantSetParameter.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!VariantSetParameter.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `VariantSetParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VariantSetParameter.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VariantSetParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VariantSetParameter' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VariantSetParameter.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VariantSetParameter value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VariantSetParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VariantSetParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of VariantSetParameter + * @throws IOException if the JSON string is invalid with respect to VariantSetParameter + */ + public static VariantSetParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VariantSetParameter.class); + } + + /** + * Convert an instance of VariantSetParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/VariantSetResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/VariantSetResponse.java new file mode 100644 index 0000000..dd1bbab --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/VariantSetResponse.java @@ -0,0 +1,340 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.VariantSetOffer; +import pl.wtx.allegro.api.client.model.VariantSetParameter; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * VariantSetResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class VariantSetResponse { + public static final String SERIALIZED_NAME_OFFERS = "offers"; + @SerializedName(SERIALIZED_NAME_OFFERS) + @javax.annotation.Nonnull + private List offers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nonnull + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public VariantSetResponse() { + } + + public VariantSetResponse offers(@javax.annotation.Nonnull List offers) { + this.offers = offers; + return this; + } + + public VariantSetResponse addOffersItem(VariantSetOffer offersItem) { + if (this.offers == null) { + this.offers = new ArrayList<>(); + } + this.offers.add(offersItem); + return this; + } + + /** + * Get offers + * @return offers + */ + @javax.annotation.Nonnull + public List getOffers() { + return offers; + } + + public void setOffers(@javax.annotation.Nonnull List offers) { + this.offers = offers; + } + + + public VariantSetResponse name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public VariantSetResponse parameters(@javax.annotation.Nonnull List parameters) { + this.parameters = parameters; + return this; + } + + public VariantSetResponse addParametersItem(VariantSetParameter parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Get parameters + * @return parameters + */ + @javax.annotation.Nonnull + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nonnull List parameters) { + this.parameters = parameters; + } + + + public VariantSetResponse id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VariantSetResponse variantSetResponse = (VariantSetResponse) o; + return Objects.equals(this.offers, variantSetResponse.offers) && + Objects.equals(this.name, variantSetResponse.name) && + Objects.equals(this.parameters, variantSetResponse.parameters) && + Objects.equals(this.id, variantSetResponse.id); + } + + @Override + public int hashCode() { + return Objects.hash(offers, name, parameters, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VariantSetResponse {\n"); + sb.append(" offers: ").append(toIndentedString(offers)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("offers"); + openapiFields.add("name"); + openapiFields.add("parameters"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("offers"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("parameters"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VariantSetResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VariantSetResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VariantSetResponse is not found in the empty JSON string", VariantSetResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!VariantSetResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `VariantSetResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VariantSetResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("offers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offers` to be an array in the JSON string but got `%s`", jsonObj.get("offers").toString())); + } + + JsonArray jsonArrayoffers = jsonObj.getAsJsonArray("offers"); + // validate the required field `offers` (array) + for (int i = 0; i < jsonArrayoffers.size(); i++) { + VariantSetOffer.validateJsonElement(jsonArrayoffers.get(i)); + }; + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + // validate the required field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + VariantSetParameter.validateJsonElement(jsonArrayparameters.get(i)); + }; + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VariantSetResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VariantSetResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VariantSetResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VariantSetResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VariantSetResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VariantSetResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of VariantSetResponse + * @throws IOException if the JSON string is invalid with respect to VariantSetResponse + */ + public static VariantSetResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VariantSetResponse.class); + } + + /** + * Convert an instance of VariantSetResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/VariantSets.java b/src/main/java/pl/wtx/allegro/api/client/model/VariantSets.java new file mode 100644 index 0000000..b682e63 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/VariantSets.java @@ -0,0 +1,256 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.VariantSetsVariantSet; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * VariantSets + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class VariantSets { + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_OFFER_VARIANTS = "offerVariants"; + @SerializedName(SERIALIZED_NAME_OFFER_VARIANTS) + @javax.annotation.Nullable + private List offerVariants = new ArrayList<>(); + + public VariantSets() { + } + + public VariantSets count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Total number of variant sets matching the query. + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public VariantSets offerVariants(@javax.annotation.Nullable List offerVariants) { + this.offerVariants = offerVariants; + return this; + } + + public VariantSets addOfferVariantsItem(VariantSetsVariantSet offerVariantsItem) { + if (this.offerVariants == null) { + this.offerVariants = new ArrayList<>(); + } + this.offerVariants.add(offerVariantsItem); + return this; + } + + /** + * Get offerVariants + * @return offerVariants + */ + @javax.annotation.Nullable + public List getOfferVariants() { + return offerVariants; + } + + public void setOfferVariants(@javax.annotation.Nullable List offerVariants) { + this.offerVariants = offerVariants; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VariantSets variantSets = (VariantSets) o; + return Objects.equals(this.count, variantSets.count) && + Objects.equals(this.offerVariants, variantSets.offerVariants); + } + + @Override + public int hashCode() { + return Objects.hash(count, offerVariants); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VariantSets {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" offerVariants: ").append(toIndentedString(offerVariants)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("count"); + openapiFields.add("offerVariants"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VariantSets + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VariantSets.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VariantSets is not found in the empty JSON string", VariantSets.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!VariantSets.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `VariantSets` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("offerVariants") != null && !jsonObj.get("offerVariants").isJsonNull()) { + JsonArray jsonArrayofferVariants = jsonObj.getAsJsonArray("offerVariants"); + if (jsonArrayofferVariants != null) { + // ensure the json data is an array + if (!jsonObj.get("offerVariants").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `offerVariants` to be an array in the JSON string but got `%s`", jsonObj.get("offerVariants").toString())); + } + + // validate the optional field `offerVariants` (array) + for (int i = 0; i < jsonArrayofferVariants.size(); i++) { + VariantSetsVariantSet.validateJsonElement(jsonArrayofferVariants.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VariantSets.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VariantSets' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VariantSets.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VariantSets value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VariantSets read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VariantSets given an JSON string + * + * @param jsonString JSON string + * @return An instance of VariantSets + * @throws IOException if the JSON string is invalid with respect to VariantSets + */ + public static VariantSets fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VariantSets.class); + } + + /** + * Convert an instance of VariantSets to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/VariantSetsVariantSet.java b/src/main/java/pl/wtx/allegro/api/client/model/VariantSetsVariantSet.java new file mode 100644 index 0000000..3a12c69 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/VariantSetsVariantSet.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * VariantSetsVariantSet + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class VariantSetsVariantSet { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public VariantSetsVariantSet() { + } + + public VariantSetsVariantSet id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Variant set id. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public VariantSetsVariantSet name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Variant set name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VariantSetsVariantSet variantSetsVariantSet = (VariantSetsVariantSet) o; + return Objects.equals(this.id, variantSetsVariantSet.id) && + Objects.equals(this.name, variantSetsVariantSet.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VariantSetsVariantSet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VariantSetsVariantSet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VariantSetsVariantSet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VariantSetsVariantSet is not found in the empty JSON string", VariantSetsVariantSet.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!VariantSetsVariantSet.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `VariantSetsVariantSet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VariantSetsVariantSet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VariantSetsVariantSet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VariantSetsVariantSet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VariantSetsVariantSet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VariantSetsVariantSet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VariantSetsVariantSet given an JSON string + * + * @param jsonString JSON string + * @return An instance of VariantSetsVariantSet + * @throws IOException if the JSON string is invalid with respect to VariantSetsVariantSet + */ + public static VariantSetsVariantSet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VariantSetsVariantSet.class); + } + + /** + * Convert an instance of VariantSetsVariantSet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/VisibilityTimePolicy.java b/src/main/java/pl/wtx/allegro/api/client/model/VisibilityTimePolicy.java new file mode 100644 index 0000000..31f1058 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/VisibilityTimePolicy.java @@ -0,0 +1,334 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * Time period when the campaign is visible in <a href=\"https://allegro.pl/moje-allegro/sprzedaz/moje-oferty\" target=\"_blank\">My Allegro</a> and <a href=\"https://ms.allegro.pl/seller-offers/\" target=\"_blank\">Sales Manager (Menedżer sprzedaży)</a> (it is not equal to the time period when badges are displayed on the list of offers or on the offer page). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class VisibilityTimePolicy { + /** + * Gets or Sets type + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + ALWAYS("ALWAYS"), + + SINCE("SINCE"), + + WITHIN("WITHIN"), + + UNTIL("UNTIL"), + + NEVER("NEVER"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + @javax.annotation.Nullable + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + @javax.annotation.Nullable + private String to; + + public VisibilityTimePolicy() { + } + + public VisibilityTimePolicy type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public VisibilityTimePolicy from(@javax.annotation.Nullable String from) { + this.from = from; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return from + */ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + public void setFrom(@javax.annotation.Nullable String from) { + this.from = from; + } + + + public VisibilityTimePolicy to(@javax.annotation.Nullable String to) { + this.to = to; + return this; + } + + /** + * Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601). + * @return to + */ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + public void setTo(@javax.annotation.Nullable String to) { + this.to = to; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VisibilityTimePolicy visibilityTimePolicy = (VisibilityTimePolicy) o; + return Objects.equals(this.type, visibilityTimePolicy.type) && + Objects.equals(this.from, visibilityTimePolicy.from) && + Objects.equals(this.to, visibilityTimePolicy.to); + } + + @Override + public int hashCode() { + return Objects.hash(type, from, to); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VisibilityTimePolicy {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("from"); + openapiFields.add("to"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VisibilityTimePolicy + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VisibilityTimePolicy.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VisibilityTimePolicy is not found in the empty JSON string", VisibilityTimePolicy.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!VisibilityTimePolicy.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `VisibilityTimePolicy` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VisibilityTimePolicy.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VisibilityTimePolicy.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VisibilityTimePolicy' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VisibilityTimePolicy.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VisibilityTimePolicy value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public VisibilityTimePolicy read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VisibilityTimePolicy given an JSON string + * + * @param jsonString JSON string + * @return An instance of VisibilityTimePolicy + * @throws IOException if the JSON string is invalid with respect to VisibilityTimePolicy + */ + public static VisibilityTimePolicy fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VisibilityTimePolicy.class); + } + + /** + * Convert an instance of VisibilityTimePolicy to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Wallet.java b/src/main/java/pl/wtx/allegro/api/client/model/Wallet.java new file mode 100644 index 0000000..0a4c334 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Wallet.java @@ -0,0 +1,390 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.WalletBalance; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The state of the wallet after the operation. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Wallet { + /** + * The payment operator. + */ + @JsonAdapter(PaymentOperatorEnum.Adapter.class) + public enum PaymentOperatorEnum { + PAYU("PAYU"), + + P24("P24"), + + AF("AF"), + + AF_PAYU("AF_PAYU"), + + AF_P24("AF_P24"); + + private String value; + + PaymentOperatorEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PaymentOperatorEnum fromValue(String value) { + for (PaymentOperatorEnum b : PaymentOperatorEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PaymentOperatorEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PaymentOperatorEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PaymentOperatorEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + PaymentOperatorEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_PAYMENT_OPERATOR = "paymentOperator"; + @SerializedName(SERIALIZED_NAME_PAYMENT_OPERATOR) + @javax.annotation.Nonnull + private PaymentOperatorEnum paymentOperator; + + /** + * The type of the wallet. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + AVAILABLE("AVAILABLE"), + + WAITING("WAITING"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String SERIALIZED_NAME_BALANCE = "balance"; + @SerializedName(SERIALIZED_NAME_BALANCE) + @javax.annotation.Nonnull + private WalletBalance balance; + + public Wallet() { + } + + public Wallet paymentOperator(@javax.annotation.Nonnull PaymentOperatorEnum paymentOperator) { + this.paymentOperator = paymentOperator; + return this; + } + + /** + * The payment operator. + * @return paymentOperator + */ + @javax.annotation.Nonnull + public PaymentOperatorEnum getPaymentOperator() { + return paymentOperator; + } + + public void setPaymentOperator(@javax.annotation.Nonnull PaymentOperatorEnum paymentOperator) { + this.paymentOperator = paymentOperator; + } + + + public Wallet type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * The type of the wallet. + * @return type + */ + @javax.annotation.Nonnull + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public Wallet balance(@javax.annotation.Nonnull WalletBalance balance) { + this.balance = balance; + return this; + } + + /** + * Get balance + * @return balance + */ + @javax.annotation.Nonnull + public WalletBalance getBalance() { + return balance; + } + + public void setBalance(@javax.annotation.Nonnull WalletBalance balance) { + this.balance = balance; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Wallet wallet = (Wallet) o; + return Objects.equals(this.paymentOperator, wallet.paymentOperator) && + Objects.equals(this.type, wallet.type) && + Objects.equals(this.balance, wallet.balance); + } + + @Override + public int hashCode() { + return Objects.hash(paymentOperator, type, balance); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Wallet {\n"); + sb.append(" paymentOperator: ").append(toIndentedString(paymentOperator)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" balance: ").append(toIndentedString(balance)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("paymentOperator"); + openapiFields.add("type"); + openapiFields.add("balance"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("paymentOperator"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("balance"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Wallet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Wallet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Wallet is not found in the empty JSON string", Wallet.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Wallet.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Wallet` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Wallet.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("paymentOperator").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `paymentOperator` to be a primitive type in the JSON string but got `%s`", jsonObj.get("paymentOperator").toString())); + } + // validate the required field `paymentOperator` + PaymentOperatorEnum.validateJsonElement(jsonObj.get("paymentOperator")); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the required field `type` + TypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `balance` + WalletBalance.validateJsonElement(jsonObj.get("balance")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Wallet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Wallet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Wallet.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Wallet value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Wallet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Wallet given an JSON string + * + * @param jsonString JSON string + * @return An instance of Wallet + * @throws IOException if the JSON string is invalid with respect to Wallet + */ + public static Wallet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Wallet.class); + } + + /** + * Convert an instance of Wallet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WalletBalance.java b/src/main/java/pl/wtx/allegro/api/client/model/WalletBalance.java new file mode 100644 index 0000000..f21702b --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WalletBalance.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The wallet balance after the operation. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WalletBalance { + public static final String SERIALIZED_NAME_AMOUNT = "amount"; + @SerializedName(SERIALIZED_NAME_AMOUNT) + @javax.annotation.Nonnull + private String amount; + + public static final String SERIALIZED_NAME_CURRENCY = "currency"; + @SerializedName(SERIALIZED_NAME_CURRENCY) + @javax.annotation.Nonnull + private String currency; + + public WalletBalance() { + } + + public WalletBalance amount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + return this; + } + + /** + * The amount provided in a string format to avoid rounding errors. + * @return amount + */ + @javax.annotation.Nonnull + public String getAmount() { + return amount; + } + + public void setAmount(@javax.annotation.Nonnull String amount) { + this.amount = amount; + } + + + public WalletBalance currency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + return this; + } + + /** + * The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + * @return currency + */ + @javax.annotation.Nonnull + public String getCurrency() { + return currency; + } + + public void setCurrency(@javax.annotation.Nonnull String currency) { + this.currency = currency; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WalletBalance walletBalance = (WalletBalance) o; + return Objects.equals(this.amount, walletBalance.amount) && + Objects.equals(this.currency, walletBalance.currency); + } + + @Override + public int hashCode() { + return Objects.hash(amount, currency); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WalletBalance {\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("amount"); + openapiFields.add("currency"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("amount"); + openapiRequiredFields.add("currency"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WalletBalance + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WalletBalance.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WalletBalance is not found in the empty JSON string", WalletBalance.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WalletBalance.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WalletBalance` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WalletBalance.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("amount").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `amount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("amount").toString())); + } + if (!jsonObj.get("currency").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WalletBalance.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WalletBalance' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WalletBalance.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WalletBalance value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WalletBalance read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WalletBalance given an JSON string + * + * @param jsonString JSON string + * @return An instance of WalletBalance + * @throws IOException if the JSON string is invalid with respect to WalletBalance + */ + public static WalletBalance fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WalletBalance.class); + } + + /** + * Convert an instance of WalletBalance to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WarrantiesListWarrantyBasic.java b/src/main/java/pl/wtx/allegro/api/client/model/WarrantiesListWarrantyBasic.java new file mode 100644 index 0000000..7228c7d --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WarrantiesListWarrantyBasic.java @@ -0,0 +1,256 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.WarrantyBasic; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WarrantiesListWarrantyBasic + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WarrantiesListWarrantyBasic { + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_WARRANTIES = "warranties"; + @SerializedName(SERIALIZED_NAME_WARRANTIES) + @javax.annotation.Nullable + private List warranties = new ArrayList<>(); + + public WarrantiesListWarrantyBasic() { + } + + public WarrantiesListWarrantyBasic count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * minimum: 0 + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public WarrantiesListWarrantyBasic warranties(@javax.annotation.Nullable List warranties) { + this.warranties = warranties; + return this; + } + + public WarrantiesListWarrantyBasic addWarrantiesItem(WarrantyBasic warrantiesItem) { + if (this.warranties == null) { + this.warranties = new ArrayList<>(); + } + this.warranties.add(warrantiesItem); + return this; + } + + /** + * Get warranties + * @return warranties + */ + @javax.annotation.Nullable + public List getWarranties() { + return warranties; + } + + public void setWarranties(@javax.annotation.Nullable List warranties) { + this.warranties = warranties; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WarrantiesListWarrantyBasic warrantiesListWarrantyBasic = (WarrantiesListWarrantyBasic) o; + return Objects.equals(this.count, warrantiesListWarrantyBasic.count) && + Objects.equals(this.warranties, warrantiesListWarrantyBasic.warranties); + } + + @Override + public int hashCode() { + return Objects.hash(count, warranties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarrantiesListWarrantyBasic {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" warranties: ").append(toIndentedString(warranties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("count"); + openapiFields.add("warranties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WarrantiesListWarrantyBasic + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarrantiesListWarrantyBasic.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WarrantiesListWarrantyBasic is not found in the empty JSON string", WarrantiesListWarrantyBasic.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WarrantiesListWarrantyBasic.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarrantiesListWarrantyBasic` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("warranties") != null && !jsonObj.get("warranties").isJsonNull()) { + JsonArray jsonArraywarranties = jsonObj.getAsJsonArray("warranties"); + if (jsonArraywarranties != null) { + // ensure the json data is an array + if (!jsonObj.get("warranties").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `warranties` to be an array in the JSON string but got `%s`", jsonObj.get("warranties").toString())); + } + + // validate the optional field `warranties` (array) + for (int i = 0; i < jsonArraywarranties.size(); i++) { + WarrantyBasic.validateJsonElement(jsonArraywarranties.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WarrantiesListWarrantyBasic.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarrantiesListWarrantyBasic' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WarrantiesListWarrantyBasic.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WarrantiesListWarrantyBasic value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WarrantiesListWarrantyBasic read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WarrantiesListWarrantyBasic given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarrantiesListWarrantyBasic + * @throws IOException if the JSON string is invalid with respect to WarrantiesListWarrantyBasic + */ + public static WarrantiesListWarrantyBasic fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarrantiesListWarrantyBasic.class); + } + + /** + * Convert an instance of WarrantiesListWarrantyBasic to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/Warranty.java b/src/main/java/pl/wtx/allegro/api/client/model/Warranty.java new file mode 100644 index 0000000..0104bf0 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/Warranty.java @@ -0,0 +1,207 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * The warranty information. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class Warranty { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public Warranty() { + } + + public Warranty id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the warranty definition. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Warranty warranty = (Warranty) o; + return Objects.equals(this.id, warranty.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Warranty {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Warranty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Warranty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Warranty is not found in the empty JSON string", Warranty.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Warranty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Warranty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Warranty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Warranty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Warranty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Warranty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Warranty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Warranty given an JSON string + * + * @param jsonString JSON string + * @return An instance of Warranty + * @throws IOException if the JSON string is invalid with respect to Warranty + */ + public static Warranty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Warranty.class); + } + + /** + * Convert an instance of Warranty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WarrantyAttachment.java b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyAttachment.java new file mode 100644 index 0000000..b69eb60 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyAttachment.java @@ -0,0 +1,237 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WarrantyAttachment + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WarrantyAttachment { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public WarrantyAttachment() { + } + + public WarrantyAttachment id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The Id of the attachment received in a response from *POST /afters-sales-service-conditions/attachments* + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public WarrantyAttachment name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Attachment file name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WarrantyAttachment warrantyAttachment = (WarrantyAttachment) o; + return Objects.equals(this.id, warrantyAttachment.id) && + Objects.equals(this.name, warrantyAttachment.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarrantyAttachment {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WarrantyAttachment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarrantyAttachment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WarrantyAttachment is not found in the empty JSON string", WarrantyAttachment.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WarrantyAttachment.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarrantyAttachment` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WarrantyAttachment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarrantyAttachment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WarrantyAttachment.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WarrantyAttachment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WarrantyAttachment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WarrantyAttachment given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarrantyAttachment + * @throws IOException if the JSON string is invalid with respect to WarrantyAttachment + */ + public static WarrantyAttachment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarrantyAttachment.class); + } + + /** + * Convert an instance of WarrantyAttachment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WarrantyBasic.java b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyBasic.java new file mode 100644 index 0000000..394b1b8 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyBasic.java @@ -0,0 +1,236 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WarrantyBasic + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WarrantyBasic { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public WarrantyBasic() { + } + + public WarrantyBasic id(@javax.annotation.Nullable String id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + + public WarrantyBasic name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WarrantyBasic warrantyBasic = (WarrantyBasic) o; + return Objects.equals(this.id, warrantyBasic.id) && + Objects.equals(this.name, warrantyBasic.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarrantyBasic {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WarrantyBasic + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarrantyBasic.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WarrantyBasic is not found in the empty JSON string", WarrantyBasic.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WarrantyBasic.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarrantyBasic` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WarrantyBasic.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarrantyBasic' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WarrantyBasic.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WarrantyBasic value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WarrantyBasic read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WarrantyBasic given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarrantyBasic + * @throws IOException if the JSON string is invalid with respect to WarrantyBasic + */ + public static WarrantyBasic fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarrantyBasic.class); + } + + /** + * Convert an instance of WarrantyBasic to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WarrantyPeriod.java b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyPeriod.java new file mode 100644 index 0000000..72f7c76 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyPeriod.java @@ -0,0 +1,233 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WarrantyPeriod + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WarrantyPeriod { + public static final String SERIALIZED_NAME_PERIOD = "period"; + @SerializedName(SERIALIZED_NAME_PERIOD) + @javax.annotation.Nullable + private String period; + + public static final String SERIALIZED_NAME_LIFETIME = "lifetime"; + @SerializedName(SERIALIZED_NAME_LIFETIME) + @javax.annotation.Nullable + private Boolean lifetime; + + public WarrantyPeriod() { + } + + public WarrantyPeriod period(@javax.annotation.Nullable String period) { + this.period = period; + return this; + } + + /** + * Period in ISO 8601 format. + * @return period + */ + @javax.annotation.Nullable + public String getPeriod() { + return period; + } + + public void setPeriod(@javax.annotation.Nullable String period) { + this.period = period; + } + + + public WarrantyPeriod lifetime(@javax.annotation.Nullable Boolean lifetime) { + this.lifetime = lifetime; + return this; + } + + /** + * Indices if it is lifetime warranty. + * @return lifetime + */ + @javax.annotation.Nullable + public Boolean getLifetime() { + return lifetime; + } + + public void setLifetime(@javax.annotation.Nullable Boolean lifetime) { + this.lifetime = lifetime; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WarrantyPeriod warrantyPeriod = (WarrantyPeriod) o; + return Objects.equals(this.period, warrantyPeriod.period) && + Objects.equals(this.lifetime, warrantyPeriod.lifetime); + } + + @Override + public int hashCode() { + return Objects.hash(period, lifetime); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarrantyPeriod {\n"); + sb.append(" period: ").append(toIndentedString(period)).append("\n"); + sb.append(" lifetime: ").append(toIndentedString(lifetime)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("period"); + openapiFields.add("lifetime"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WarrantyPeriod + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarrantyPeriod.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WarrantyPeriod is not found in the empty JSON string", WarrantyPeriod.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WarrantyPeriod.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarrantyPeriod` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("period") != null && !jsonObj.get("period").isJsonNull()) && !jsonObj.get("period").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `period` to be a primitive type in the JSON string but got `%s`", jsonObj.get("period").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WarrantyPeriod.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarrantyPeriod' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WarrantyPeriod.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WarrantyPeriod value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WarrantyPeriod read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WarrantyPeriod given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarrantyPeriod + * @throws IOException if the JSON string is invalid with respect to WarrantyPeriod + */ + public static WarrantyPeriod fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarrantyPeriod.class); + } + + /** + * Convert an instance of WarrantyPeriod to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WarrantyRequest.java b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyRequest.java new file mode 100644 index 0000000..ba66d90 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyRequest.java @@ -0,0 +1,363 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.WarrantyAttachment; +import pl.wtx.allegro.api.client.model.WarrantyPeriod; +import pl.wtx.allegro.api.client.model.WarrantyType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WarrantyRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WarrantyRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private WarrantyType type; + + public static final String SERIALIZED_NAME_INDIVIDUAL = "individual"; + @SerializedName(SERIALIZED_NAME_INDIVIDUAL) + @javax.annotation.Nullable + private WarrantyPeriod individual; + + public static final String SERIALIZED_NAME_CORPORATE = "corporate"; + @SerializedName(SERIALIZED_NAME_CORPORATE) + @javax.annotation.Nullable + private WarrantyPeriod corporate; + + public static final String SERIALIZED_NAME_ATTACHMENT = "attachment"; + @SerializedName(SERIALIZED_NAME_ATTACHMENT) + @javax.annotation.Nullable + private WarrantyAttachment attachment; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public WarrantyRequest() { + } + + public WarrantyRequest name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Warranty name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public WarrantyRequest type(@javax.annotation.Nullable WarrantyType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public WarrantyType getType() { + return type; + } + + public void setType(@javax.annotation.Nullable WarrantyType type) { + this.type = type; + } + + + public WarrantyRequest individual(@javax.annotation.Nullable WarrantyPeriod individual) { + this.individual = individual; + return this; + } + + /** + * Get individual + * @return individual + */ + @javax.annotation.Nullable + public WarrantyPeriod getIndividual() { + return individual; + } + + public void setIndividual(@javax.annotation.Nullable WarrantyPeriod individual) { + this.individual = individual; + } + + + public WarrantyRequest corporate(@javax.annotation.Nullable WarrantyPeriod corporate) { + this.corporate = corporate; + return this; + } + + /** + * Get corporate + * @return corporate + */ + @javax.annotation.Nullable + public WarrantyPeriod getCorporate() { + return corporate; + } + + public void setCorporate(@javax.annotation.Nullable WarrantyPeriod corporate) { + this.corporate = corporate; + } + + + public WarrantyRequest attachment(@javax.annotation.Nullable WarrantyAttachment attachment) { + this.attachment = attachment; + return this; + } + + /** + * Get attachment + * @return attachment + */ + @javax.annotation.Nullable + public WarrantyAttachment getAttachment() { + return attachment; + } + + public void setAttachment(@javax.annotation.Nullable WarrantyAttachment attachment) { + this.attachment = attachment; + } + + + public WarrantyRequest description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Warranty description. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WarrantyRequest warrantyRequest = (WarrantyRequest) o; + return Objects.equals(this.name, warrantyRequest.name) && + Objects.equals(this.type, warrantyRequest.type) && + Objects.equals(this.individual, warrantyRequest.individual) && + Objects.equals(this.corporate, warrantyRequest.corporate) && + Objects.equals(this.attachment, warrantyRequest.attachment) && + Objects.equals(this.description, warrantyRequest.description); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, individual, corporate, attachment, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarrantyRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" individual: ").append(toIndentedString(individual)).append("\n"); + sb.append(" corporate: ").append(toIndentedString(corporate)).append("\n"); + sb.append(" attachment: ").append(toIndentedString(attachment)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("individual"); + openapiFields.add("corporate"); + openapiFields.add("attachment"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WarrantyRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarrantyRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WarrantyRequest is not found in the empty JSON string", WarrantyRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WarrantyRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarrantyRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + WarrantyType.validateJsonElement(jsonObj.get("type")); + } + // validate the optional field `individual` + if (jsonObj.get("individual") != null && !jsonObj.get("individual").isJsonNull()) { + WarrantyPeriod.validateJsonElement(jsonObj.get("individual")); + } + // validate the optional field `corporate` + if (jsonObj.get("corporate") != null && !jsonObj.get("corporate").isJsonNull()) { + WarrantyPeriod.validateJsonElement(jsonObj.get("corporate")); + } + // validate the optional field `attachment` + if (jsonObj.get("attachment") != null && !jsonObj.get("attachment").isJsonNull()) { + WarrantyAttachment.validateJsonElement(jsonObj.get("attachment")); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WarrantyRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarrantyRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WarrantyRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WarrantyRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WarrantyRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WarrantyRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarrantyRequest + * @throws IOException if the JSON string is invalid with respect to WarrantyRequest + */ + public static WarrantyRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarrantyRequest.class); + } + + /** + * Convert an instance of WarrantyRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WarrantyResponse.java b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyResponse.java new file mode 100644 index 0000000..363855e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyResponse.java @@ -0,0 +1,426 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import pl.wtx.allegro.api.client.model.AfterSalesServicesAttachment; +import pl.wtx.allegro.api.client.model.Seller; +import pl.wtx.allegro.api.client.model.WarrantyPeriod; +import pl.wtx.allegro.api.client.model.WarrantyType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WarrantyResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WarrantyResponse { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private UUID id; + + public static final String SERIALIZED_NAME_SELLER = "seller"; + @SerializedName(SERIALIZED_NAME_SELLER) + @javax.annotation.Nullable + private Seller seller; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private WarrantyType type; + + public static final String SERIALIZED_NAME_INDIVIDUAL = "individual"; + @SerializedName(SERIALIZED_NAME_INDIVIDUAL) + @javax.annotation.Nullable + private WarrantyPeriod individual; + + public static final String SERIALIZED_NAME_CORPORATE = "corporate"; + @SerializedName(SERIALIZED_NAME_CORPORATE) + @javax.annotation.Nullable + private WarrantyPeriod corporate; + + public static final String SERIALIZED_NAME_ATTACHMENT = "attachment"; + @SerializedName(SERIALIZED_NAME_ATTACHMENT) + @javax.annotation.Nullable + private AfterSalesServicesAttachment attachment; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public WarrantyResponse() { + } + + public WarrantyResponse id(@javax.annotation.Nullable UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the warranty definition. + * @return id + */ + @javax.annotation.Nullable + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nullable UUID id) { + this.id = id; + } + + + public WarrantyResponse seller(@javax.annotation.Nullable Seller seller) { + this.seller = seller; + return this; + } + + /** + * Get seller + * @return seller + */ + @javax.annotation.Nullable + public Seller getSeller() { + return seller; + } + + public void setSeller(@javax.annotation.Nullable Seller seller) { + this.seller = seller; + } + + + public WarrantyResponse name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Warranty name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public WarrantyResponse type(@javax.annotation.Nullable WarrantyType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public WarrantyType getType() { + return type; + } + + public void setType(@javax.annotation.Nullable WarrantyType type) { + this.type = type; + } + + + public WarrantyResponse individual(@javax.annotation.Nullable WarrantyPeriod individual) { + this.individual = individual; + return this; + } + + /** + * Get individual + * @return individual + */ + @javax.annotation.Nullable + public WarrantyPeriod getIndividual() { + return individual; + } + + public void setIndividual(@javax.annotation.Nullable WarrantyPeriod individual) { + this.individual = individual; + } + + + public WarrantyResponse corporate(@javax.annotation.Nullable WarrantyPeriod corporate) { + this.corporate = corporate; + return this; + } + + /** + * Get corporate + * @return corporate + */ + @javax.annotation.Nullable + public WarrantyPeriod getCorporate() { + return corporate; + } + + public void setCorporate(@javax.annotation.Nullable WarrantyPeriod corporate) { + this.corporate = corporate; + } + + + public WarrantyResponse attachment(@javax.annotation.Nullable AfterSalesServicesAttachment attachment) { + this.attachment = attachment; + return this; + } + + /** + * Get attachment + * @return attachment + */ + @javax.annotation.Nullable + public AfterSalesServicesAttachment getAttachment() { + return attachment; + } + + public void setAttachment(@javax.annotation.Nullable AfterSalesServicesAttachment attachment) { + this.attachment = attachment; + } + + + public WarrantyResponse description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Warranty description. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WarrantyResponse warrantyResponse = (WarrantyResponse) o; + return Objects.equals(this.id, warrantyResponse.id) && + Objects.equals(this.seller, warrantyResponse.seller) && + Objects.equals(this.name, warrantyResponse.name) && + Objects.equals(this.type, warrantyResponse.type) && + Objects.equals(this.individual, warrantyResponse.individual) && + Objects.equals(this.corporate, warrantyResponse.corporate) && + Objects.equals(this.attachment, warrantyResponse.attachment) && + Objects.equals(this.description, warrantyResponse.description); + } + + @Override + public int hashCode() { + return Objects.hash(id, seller, name, type, individual, corporate, attachment, description); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarrantyResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" seller: ").append(toIndentedString(seller)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" individual: ").append(toIndentedString(individual)).append("\n"); + sb.append(" corporate: ").append(toIndentedString(corporate)).append("\n"); + sb.append(" attachment: ").append(toIndentedString(attachment)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("seller"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("individual"); + openapiFields.add("corporate"); + openapiFields.add("attachment"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WarrantyResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarrantyResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WarrantyResponse is not found in the empty JSON string", WarrantyResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WarrantyResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WarrantyResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + // validate the optional field `seller` + if (jsonObj.get("seller") != null && !jsonObj.get("seller").isJsonNull()) { + Seller.validateJsonElement(jsonObj.get("seller")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + WarrantyType.validateJsonElement(jsonObj.get("type")); + } + // validate the optional field `individual` + if (jsonObj.get("individual") != null && !jsonObj.get("individual").isJsonNull()) { + WarrantyPeriod.validateJsonElement(jsonObj.get("individual")); + } + // validate the optional field `corporate` + if (jsonObj.get("corporate") != null && !jsonObj.get("corporate").isJsonNull()) { + WarrantyPeriod.validateJsonElement(jsonObj.get("corporate")); + } + // validate the optional field `attachment` + if (jsonObj.get("attachment") != null && !jsonObj.get("attachment").isJsonNull()) { + AfterSalesServicesAttachment.validateJsonElement(jsonObj.get("attachment")); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WarrantyResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarrantyResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WarrantyResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WarrantyResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WarrantyResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WarrantyResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarrantyResponse + * @throws IOException if the JSON string is invalid with respect to WarrantyResponse + */ + public static WarrantyResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarrantyResponse.class); + } + + /** + * Convert an instance of WarrantyResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WarrantyType.java b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyType.java new file mode 100644 index 0000000..faab2ec --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WarrantyType.java @@ -0,0 +1,78 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Defines who is warrantor. + */ +@JsonAdapter(WarrantyType.Adapter.class) +public enum WarrantyType { + + MANUFACTURER("MANUFACTURER"), + + SELLER("SELLER"); + + private String value; + + WarrantyType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static WarrantyType fromValue(String value) { + for (WarrantyType b : WarrantyType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final WarrantyType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public WarrantyType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return WarrantyType.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + WarrantyType.fromValue(value); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WeightValue.java b/src/main/java/pl/wtx/allegro/api/client/model/WeightValue.java new file mode 100644 index 0000000..bb283b7 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WeightValue.java @@ -0,0 +1,295 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WeightValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WeightValue { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private BigDecimal value; + + /** + * Weight unit. Currently only `KILOGRAMS` is accepted. + */ + @JsonAdapter(UnitEnum.Adapter.class) + public enum UnitEnum { + KILOGRAMS("KILOGRAMS"); + + private String value; + + UnitEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static UnitEnum fromValue(String value) { + for (UnitEnum b : UnitEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final UnitEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public UnitEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return UnitEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + UnitEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_UNIT = "unit"; + @SerializedName(SERIALIZED_NAME_UNIT) + @javax.annotation.Nullable + private UnitEnum unit; + + public WeightValue() { + } + + public WeightValue value(@javax.annotation.Nonnull BigDecimal value) { + this.value = value; + return this; + } + + /** + * Weight value, provided in a string format to avoid rounding errors. + * @return value + */ + @javax.annotation.Nonnull + public BigDecimal getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull BigDecimal value) { + this.value = value; + } + + + public WeightValue unit(@javax.annotation.Nullable UnitEnum unit) { + this.unit = unit; + return this; + } + + /** + * Weight unit. Currently only `KILOGRAMS` is accepted. + * @return unit + */ + @javax.annotation.Nullable + public UnitEnum getUnit() { + return unit; + } + + public void setUnit(@javax.annotation.Nullable UnitEnum unit) { + this.unit = unit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WeightValue weightValue = (WeightValue) o; + return Objects.equals(this.value, weightValue.value) && + Objects.equals(this.unit, weightValue.unit); + } + + @Override + public int hashCode() { + return Objects.hash(value, unit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WeightValue {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" unit: ").append(toIndentedString(unit)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + openapiFields.add("unit"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("value"); + openapiRequiredFields.add("unit"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WeightValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WeightValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WeightValue is not found in the empty JSON string", WeightValue.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WeightValue.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WeightValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WeightValue.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("unit") != null && !jsonObj.get("unit").isJsonNull()) && !jsonObj.get("unit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unit").toString())); + } + // validate the required field `unit` + UnitEnum.validateJsonElement(jsonObj.get("unit")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WeightValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WeightValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WeightValue.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WeightValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WeightValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WeightValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of WeightValue + * @throws IOException if the JSON string is invalid with respect to WeightValue + */ + public static WeightValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WeightValue.class); + } + + /** + * Convert an instance of WeightValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecification.java b/src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecification.java new file mode 100644 index 0000000..94abaa2 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecification.java @@ -0,0 +1,280 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.BenefitSpecification; +import pl.wtx.allegro.api.client.model.WholesalePriceListBenefitSpecificationAllOfThresholds; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WholesalePriceListBenefitSpecification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WholesalePriceListBenefitSpecification extends BenefitSpecification { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + protected String type = "WHOLESALE_PRICE_LIST"; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_THRESHOLDS = "thresholds"; + @SerializedName(SERIALIZED_NAME_THRESHOLDS) + @javax.annotation.Nonnull + private List thresholds = new ArrayList<>(); + + public WholesalePriceListBenefitSpecification() { + this.type = this.getClass().getSimpleName(); + } + + public WholesalePriceListBenefitSpecification type(@javax.annotation.Nullable String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nullable String type) { + this.type = type; + } + + + public WholesalePriceListBenefitSpecification name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Price list name (visible to you only). + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public WholesalePriceListBenefitSpecification thresholds(@javax.annotation.Nonnull List thresholds) { + this.thresholds = thresholds; + return this; + } + + public WholesalePriceListBenefitSpecification addThresholdsItem(WholesalePriceListBenefitSpecificationAllOfThresholds thresholdsItem) { + if (this.thresholds == null) { + this.thresholds = new ArrayList<>(); + } + this.thresholds.add(thresholdsItem); + return this; + } + + /** + * List of discount thresholds. A threshold with a higher quantity.lowerBound than another must also have a higher discount.percentage. + * @return thresholds + */ + @javax.annotation.Nonnull + public List getThresholds() { + return thresholds; + } + + public void setThresholds(@javax.annotation.Nonnull List thresholds) { + this.thresholds = thresholds; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WholesalePriceListBenefitSpecification wholesalePriceListBenefitSpecification = (WholesalePriceListBenefitSpecification) o; + return Objects.equals(this.type, wholesalePriceListBenefitSpecification.type) && + Objects.equals(this.name, wholesalePriceListBenefitSpecification.name) && + Objects.equals(this.thresholds, wholesalePriceListBenefitSpecification.thresholds) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, name, thresholds, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WholesalePriceListBenefitSpecification {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" thresholds: ").append(toIndentedString(thresholds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("name"); + openapiFields.add("thresholds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("thresholds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WholesalePriceListBenefitSpecification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WholesalePriceListBenefitSpecification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WholesalePriceListBenefitSpecification is not found in the empty JSON string", WholesalePriceListBenefitSpecification.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WholesalePriceListBenefitSpecification.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WholesalePriceListBenefitSpecification` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WholesalePriceListBenefitSpecification.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WholesalePriceListBenefitSpecification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WholesalePriceListBenefitSpecification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WholesalePriceListBenefitSpecification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WholesalePriceListBenefitSpecification value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WholesalePriceListBenefitSpecification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WholesalePriceListBenefitSpecification given an JSON string + * + * @param jsonString JSON string + * @return An instance of WholesalePriceListBenefitSpecification + * @throws IOException if the JSON string is invalid with respect to WholesalePriceListBenefitSpecification + */ + public static WholesalePriceListBenefitSpecification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WholesalePriceListBenefitSpecification.class); + } + + /** + * Convert an instance of WholesalePriceListBenefitSpecification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecificationAllOfQuantity.java b/src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecificationAllOfQuantity.java new file mode 100644 index 0000000..2e7db66 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecificationAllOfQuantity.java @@ -0,0 +1,214 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WholesalePriceListBenefitSpecificationAllOfQuantity + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WholesalePriceListBenefitSpecificationAllOfQuantity { + public static final String SERIALIZED_NAME_LOWER_BOUND = "lowerBound"; + @SerializedName(SERIALIZED_NAME_LOWER_BOUND) + @javax.annotation.Nonnull + private BigDecimal lowerBound; + + public WholesalePriceListBenefitSpecificationAllOfQuantity() { + } + + public WholesalePriceListBenefitSpecificationAllOfQuantity lowerBound(@javax.annotation.Nonnull BigDecimal lowerBound) { + this.lowerBound = lowerBound; + return this; + } + + /** + * Minimum number of units of an offer for which the threshold is applicable. + * minimum: 2 + * maximum: 100000 + * @return lowerBound + */ + @javax.annotation.Nonnull + public BigDecimal getLowerBound() { + return lowerBound; + } + + public void setLowerBound(@javax.annotation.Nonnull BigDecimal lowerBound) { + this.lowerBound = lowerBound; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WholesalePriceListBenefitSpecificationAllOfQuantity wholesalePriceListBenefitSpecificationAllOfQuantity = (WholesalePriceListBenefitSpecificationAllOfQuantity) o; + return Objects.equals(this.lowerBound, wholesalePriceListBenefitSpecificationAllOfQuantity.lowerBound); + } + + @Override + public int hashCode() { + return Objects.hash(lowerBound); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WholesalePriceListBenefitSpecificationAllOfQuantity {\n"); + sb.append(" lowerBound: ").append(toIndentedString(lowerBound)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("lowerBound"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("lowerBound"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WholesalePriceListBenefitSpecificationAllOfQuantity + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WholesalePriceListBenefitSpecificationAllOfQuantity.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WholesalePriceListBenefitSpecificationAllOfQuantity is not found in the empty JSON string", WholesalePriceListBenefitSpecificationAllOfQuantity.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WholesalePriceListBenefitSpecificationAllOfQuantity.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WholesalePriceListBenefitSpecificationAllOfQuantity` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WholesalePriceListBenefitSpecificationAllOfQuantity.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WholesalePriceListBenefitSpecificationAllOfQuantity.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WholesalePriceListBenefitSpecificationAllOfQuantity' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WholesalePriceListBenefitSpecificationAllOfQuantity.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WholesalePriceListBenefitSpecificationAllOfQuantity value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WholesalePriceListBenefitSpecificationAllOfQuantity read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WholesalePriceListBenefitSpecificationAllOfQuantity given an JSON string + * + * @param jsonString JSON string + * @return An instance of WholesalePriceListBenefitSpecificationAllOfQuantity + * @throws IOException if the JSON string is invalid with respect to WholesalePriceListBenefitSpecificationAllOfQuantity + */ + public static WholesalePriceListBenefitSpecificationAllOfQuantity fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WholesalePriceListBenefitSpecificationAllOfQuantity.class); + } + + /** + * Convert an instance of WholesalePriceListBenefitSpecificationAllOfQuantity to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecificationAllOfThresholds.java b/src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecificationAllOfThresholds.java new file mode 100644 index 0000000..597dc8e --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WholesalePriceListBenefitSpecificationAllOfThresholds.java @@ -0,0 +1,245 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.LargeOrderDiscountBenefitSpecificationAllOfDiscount; +import pl.wtx.allegro.api.client.model.WholesalePriceListBenefitSpecificationAllOfQuantity; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WholesalePriceListBenefitSpecificationAllOfThresholds + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WholesalePriceListBenefitSpecificationAllOfThresholds { + public static final String SERIALIZED_NAME_QUANTITY = "quantity"; + @SerializedName(SERIALIZED_NAME_QUANTITY) + @javax.annotation.Nonnull + private WholesalePriceListBenefitSpecificationAllOfQuantity quantity; + + public static final String SERIALIZED_NAME_DISCOUNT = "discount"; + @SerializedName(SERIALIZED_NAME_DISCOUNT) + @javax.annotation.Nonnull + private LargeOrderDiscountBenefitSpecificationAllOfDiscount discount; + + public WholesalePriceListBenefitSpecificationAllOfThresholds() { + } + + public WholesalePriceListBenefitSpecificationAllOfThresholds quantity(@javax.annotation.Nonnull WholesalePriceListBenefitSpecificationAllOfQuantity quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + */ + @javax.annotation.Nonnull + public WholesalePriceListBenefitSpecificationAllOfQuantity getQuantity() { + return quantity; + } + + public void setQuantity(@javax.annotation.Nonnull WholesalePriceListBenefitSpecificationAllOfQuantity quantity) { + this.quantity = quantity; + } + + + public WholesalePriceListBenefitSpecificationAllOfThresholds discount(@javax.annotation.Nonnull LargeOrderDiscountBenefitSpecificationAllOfDiscount discount) { + this.discount = discount; + return this; + } + + /** + * Get discount + * @return discount + */ + @javax.annotation.Nonnull + public LargeOrderDiscountBenefitSpecificationAllOfDiscount getDiscount() { + return discount; + } + + public void setDiscount(@javax.annotation.Nonnull LargeOrderDiscountBenefitSpecificationAllOfDiscount discount) { + this.discount = discount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WholesalePriceListBenefitSpecificationAllOfThresholds wholesalePriceListBenefitSpecificationAllOfThresholds = (WholesalePriceListBenefitSpecificationAllOfThresholds) o; + return Objects.equals(this.quantity, wholesalePriceListBenefitSpecificationAllOfThresholds.quantity) && + Objects.equals(this.discount, wholesalePriceListBenefitSpecificationAllOfThresholds.discount); + } + + @Override + public int hashCode() { + return Objects.hash(quantity, discount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WholesalePriceListBenefitSpecificationAllOfThresholds {\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" discount: ").append(toIndentedString(discount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("quantity"); + openapiFields.add("discount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("quantity"); + openapiRequiredFields.add("discount"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WholesalePriceListBenefitSpecificationAllOfThresholds + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WholesalePriceListBenefitSpecificationAllOfThresholds.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WholesalePriceListBenefitSpecificationAllOfThresholds is not found in the empty JSON string", WholesalePriceListBenefitSpecificationAllOfThresholds.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WholesalePriceListBenefitSpecificationAllOfThresholds.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WholesalePriceListBenefitSpecificationAllOfThresholds` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WholesalePriceListBenefitSpecificationAllOfThresholds.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `quantity` + WholesalePriceListBenefitSpecificationAllOfQuantity.validateJsonElement(jsonObj.get("quantity")); + // validate the required field `discount` + LargeOrderDiscountBenefitSpecificationAllOfDiscount.validateJsonElement(jsonObj.get("discount")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WholesalePriceListBenefitSpecificationAllOfThresholds.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WholesalePriceListBenefitSpecificationAllOfThresholds' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WholesalePriceListBenefitSpecificationAllOfThresholds.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WholesalePriceListBenefitSpecificationAllOfThresholds value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WholesalePriceListBenefitSpecificationAllOfThresholds read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WholesalePriceListBenefitSpecificationAllOfThresholds given an JSON string + * + * @param jsonString JSON string + * @return An instance of WholesalePriceListBenefitSpecificationAllOfThresholds + * @throws IOException if the JSON string is invalid with respect to WholesalePriceListBenefitSpecificationAllOfThresholds + */ + public static WholesalePriceListBenefitSpecificationAllOfThresholds fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WholesalePriceListBenefitSpecificationAllOfThresholds.class); + } + + /** + * Convert an instance of WholesalePriceListBenefitSpecificationAllOfThresholds to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WrapperTypeForPreviewConditions.java b/src/main/java/pl/wtx/allegro/api/client/model/WrapperTypeForPreviewConditions.java new file mode 100644 index 0000000..770d235 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WrapperTypeForPreviewConditions.java @@ -0,0 +1,235 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import pl.wtx.allegro.api.client.model.ParametersForPreviewPrice; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WrapperTypeForPreviewConditions + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WrapperTypeForPreviewConditions { + public static final String SERIALIZED_NAME_INCLUDE_QUOTING_BUNDLES = "includeQuotingBundles"; + @SerializedName(SERIALIZED_NAME_INCLUDE_QUOTING_BUNDLES) + @javax.annotation.Nullable + private Boolean includeQuotingBundles; + + public static final String SERIALIZED_NAME_OFFER = "offer"; + @SerializedName(SERIALIZED_NAME_OFFER) + @javax.annotation.Nullable + private ParametersForPreviewPrice offer; + + public WrapperTypeForPreviewConditions() { + } + + public WrapperTypeForPreviewConditions includeQuotingBundles(@javax.annotation.Nullable Boolean includeQuotingBundles) { + this.includeQuotingBundles = includeQuotingBundles; + return this; + } + + /** + * Include in calculation user's active bundles which allow to publish for free offer or use for free promotion options. + * @return includeQuotingBundles + */ + @javax.annotation.Nullable + public Boolean getIncludeQuotingBundles() { + return includeQuotingBundles; + } + + public void setIncludeQuotingBundles(@javax.annotation.Nullable Boolean includeQuotingBundles) { + this.includeQuotingBundles = includeQuotingBundles; + } + + + public WrapperTypeForPreviewConditions offer(@javax.annotation.Nullable ParametersForPreviewPrice offer) { + this.offer = offer; + return this; + } + + /** + * Get offer + * @return offer + */ + @javax.annotation.Nullable + public ParametersForPreviewPrice getOffer() { + return offer; + } + + public void setOffer(@javax.annotation.Nullable ParametersForPreviewPrice offer) { + this.offer = offer; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WrapperTypeForPreviewConditions wrapperTypeForPreviewConditions = (WrapperTypeForPreviewConditions) o; + return Objects.equals(this.includeQuotingBundles, wrapperTypeForPreviewConditions.includeQuotingBundles) && + Objects.equals(this.offer, wrapperTypeForPreviewConditions.offer); + } + + @Override + public int hashCode() { + return Objects.hash(includeQuotingBundles, offer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WrapperTypeForPreviewConditions {\n"); + sb.append(" includeQuotingBundles: ").append(toIndentedString(includeQuotingBundles)).append("\n"); + sb.append(" offer: ").append(toIndentedString(offer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("includeQuotingBundles"); + openapiFields.add("offer"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WrapperTypeForPreviewConditions + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WrapperTypeForPreviewConditions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WrapperTypeForPreviewConditions is not found in the empty JSON string", WrapperTypeForPreviewConditions.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WrapperTypeForPreviewConditions.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WrapperTypeForPreviewConditions` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `offer` + if (jsonObj.get("offer") != null && !jsonObj.get("offer").isJsonNull()) { + ParametersForPreviewPrice.validateJsonElement(jsonObj.get("offer")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WrapperTypeForPreviewConditions.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WrapperTypeForPreviewConditions' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WrapperTypeForPreviewConditions.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WrapperTypeForPreviewConditions value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WrapperTypeForPreviewConditions read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WrapperTypeForPreviewConditions given an JSON string + * + * @param jsonString JSON string + * @return An instance of WrapperTypeForPreviewConditions + * @throws IOException if the JSON string is invalid with respect to WrapperTypeForPreviewConditions + */ + public static WrapperTypeForPreviewConditions fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WrapperTypeForPreviewConditions.class); + } + + /** + * Convert an instance of WrapperTypeForPreviewConditions to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/pl/wtx/allegro/api/client/model/WrapsListingAndCommissionsFees.java b/src/main/java/pl/wtx/allegro/api/client/model/WrapsListingAndCommissionsFees.java new file mode 100644 index 0000000..24629a9 --- /dev/null +++ b/src/main/java/pl/wtx/allegro/api/client/model/WrapsListingAndCommissionsFees.java @@ -0,0 +1,279 @@ +/* + * Allegro REST API + * https://developer.allegro.pl/about Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman. + * + * The version of the OpenAPI document: latest + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package pl.wtx.allegro.api.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import pl.wtx.allegro.api.client.model.DescribesListingFee; +import pl.wtx.allegro.api.client.model.DescribesSuccessCommissionFee; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import pl.wtx.allegro.api.client.invoker.JSON; + +/** + * WrapsListingAndCommissionsFees + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0") +public class WrapsListingAndCommissionsFees { + public static final String SERIALIZED_NAME_COMMISSIONS = "commissions"; + @SerializedName(SERIALIZED_NAME_COMMISSIONS) + @javax.annotation.Nonnull + private List commissions = new ArrayList<>(); + + public static final String SERIALIZED_NAME_QUOTES = "quotes"; + @SerializedName(SERIALIZED_NAME_QUOTES) + @javax.annotation.Nonnull + private List quotes = new ArrayList<>(); + + public WrapsListingAndCommissionsFees() { + } + + public WrapsListingAndCommissionsFees commissions(@javax.annotation.Nonnull List commissions) { + this.commissions = commissions; + return this; + } + + public WrapsListingAndCommissionsFees addCommissionsItem(DescribesSuccessCommissionFee commissionsItem) { + if (this.commissions == null) { + this.commissions = new ArrayList<>(); + } + this.commissions.add(commissionsItem); + return this; + } + + /** + * Get commissions + * @return commissions + */ + @javax.annotation.Nonnull + public List getCommissions() { + return commissions; + } + + public void setCommissions(@javax.annotation.Nonnull List commissions) { + this.commissions = commissions; + } + + + public WrapsListingAndCommissionsFees quotes(@javax.annotation.Nonnull List quotes) { + this.quotes = quotes; + return this; + } + + public WrapsListingAndCommissionsFees addQuotesItem(DescribesListingFee quotesItem) { + if (this.quotes == null) { + this.quotes = new ArrayList<>(); + } + this.quotes.add(quotesItem); + return this; + } + + /** + * Get quotes + * @return quotes + */ + @javax.annotation.Nonnull + public List getQuotes() { + return quotes; + } + + public void setQuotes(@javax.annotation.Nonnull List quotes) { + this.quotes = quotes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WrapsListingAndCommissionsFees wrapsListingAndCommissionsFees = (WrapsListingAndCommissionsFees) o; + return Objects.equals(this.commissions, wrapsListingAndCommissionsFees.commissions) && + Objects.equals(this.quotes, wrapsListingAndCommissionsFees.quotes); + } + + @Override + public int hashCode() { + return Objects.hash(commissions, quotes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WrapsListingAndCommissionsFees {\n"); + sb.append(" commissions: ").append(toIndentedString(commissions)).append("\n"); + sb.append(" quotes: ").append(toIndentedString(quotes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("commissions"); + openapiFields.add("quotes"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("commissions"); + openapiRequiredFields.add("quotes"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WrapsListingAndCommissionsFees + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WrapsListingAndCommissionsFees.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WrapsListingAndCommissionsFees is not found in the empty JSON string", WrapsListingAndCommissionsFees.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WrapsListingAndCommissionsFees.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WrapsListingAndCommissionsFees` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WrapsListingAndCommissionsFees.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("commissions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `commissions` to be an array in the JSON string but got `%s`", jsonObj.get("commissions").toString())); + } + + JsonArray jsonArraycommissions = jsonObj.getAsJsonArray("commissions"); + // validate the required field `commissions` (array) + for (int i = 0; i < jsonArraycommissions.size(); i++) { + DescribesSuccessCommissionFee.validateJsonElement(jsonArraycommissions.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("quotes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `quotes` to be an array in the JSON string but got `%s`", jsonObj.get("quotes").toString())); + } + + JsonArray jsonArrayquotes = jsonObj.getAsJsonArray("quotes"); + // validate the required field `quotes` (array) + for (int i = 0; i < jsonArrayquotes.size(); i++) { + DescribesListingFee.validateJsonElement(jsonArrayquotes.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WrapsListingAndCommissionsFees.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WrapsListingAndCommissionsFees' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WrapsListingAndCommissionsFees.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WrapsListingAndCommissionsFees value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WrapsListingAndCommissionsFees read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WrapsListingAndCommissionsFees given an JSON string + * + * @param jsonString JSON string + * @return An instance of WrapsListingAndCommissionsFees + * @throws IOException if the JSON string is invalid with respect to WrapsListingAndCommissionsFees + */ + public static WrapsListingAndCommissionsFees fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WrapsListingAndCommissionsFees.class); + } + + /** + * Convert an instance of WrapsListingAndCommissionsFees to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/resources/openapi.yaml b/src/main/resources/openapi.yaml new file mode 100644 index 0000000..bfe39c8 --- /dev/null +++ b/src/main/resources/openapi.yaml @@ -0,0 +1,32266 @@ +openapi: 3.0.0 +servers: + - url: https://api.{environment} + variables: + environment: + default: allegro.pl + enum: + - allegro.pl # Production server + - allegro.pl.allegrosandbox.pl # Sandbox server +info: + description: + 'https://developer.allegro.pl/about + + + Documentation is generated from [this OpenAPI 3.0 specification file](https://developer.allegro.pl/swagger.yaml). + + To start working with our API, you can also check our [official Allegro REST API public collection](https://www.postman.com/allegro-rest-api/allegro-rest-api/collection/4puh6ls/allegro-rest-api) in Postman.' + version: 'latest' + title: Allegro REST API + termsOfService: 'https://developer.allegro.pl/rules/' + contact: + name: "API Support" + url: 'https://github.com/allegro/allegro-api/issues' + +tags: + - name: Information about marketplaces + - name: Information about user + - name: User's offer information + - name: Offer management + - name: Categories and parameters + - name: Images and attachments + - name: Products + - name: Batch offer modification + - name: Automatic pricing + - name: Offer variants + - name: Offer tags + description: >- + Tags are only available to sellers registered on allegro.pl and can only be assigned to offers with base marketplace `allegro-pl`. + - name: Tax settings + - name: Compatibility List + - name: Rebates and promotions + - name: Offer bundles + - name: Badge campaigns + - name: Allegro Prices + - name: AlleDiscount + - name: Offer rating + - name: Classifieds + - name: Pricing + - name: Order management + - name: Payments + - name: Disputes + - name: Shipment management + - name: Customer returns + - name: Commission refunds + - name: After sale services + - name: Delivery + - name: Additional services + - name: Additional services translations + - name: Size tables + - name: Points of service + - name: Contacts + - name: Message Center + - name: Billing + - name: Auctions and Bidding + - name: Charity + - name: Public user information + - name: Public offer information + - name: Offer translations + - name: Advance Ship Notices + - name: Fulfillment Stock + - name: Fulfillment Parcels + - name: Fulfillment Products + - name: Fulfillment Removal + - name: Tax Identification Number + - name: Responsible persons + - name: Responsible producers + +x-tagGroups: + - name: Offer + tags: + - User's offer information + - Offer management + - Offer translations + - Categories and parameters + - Images and attachments + - Products + - Batch offer modification + - Automatic pricing + - Offer variants + - Offer tags + - Tax settings + - Compatibility List + - Rebates and promotions + - Offer bundles + - Badge campaigns + - Allegro Prices + - AlleDiscount + - Offer rating + - Classifieds + - Pricing + - name: Orders + tags: + - Order management + - Payments + - Disputes + - Shipment management + - Customer returns + - Commission refunds + - name: Sale settings + tags: + - After sale services + - Delivery + - Additional services + - Additional services translations + - Size tables + - Points of service + - Contacts + - Responsible persons + - Responsible producers + - name: One Fulfillment + tags: + - Advance Ship Notices + - Fulfillment Stock + - Fulfillment Parcels + - Fulfillment Products + - Fulfillment Removal + - Tax Identification Number + - name: Others + tags: + - Information about user + - Information about marketplaces + - Message Center + - Billing + - Auctions and Bidding + - Charity + - Public user information + - Public offer information + +security: + - bearer-token-for-user: [] + +paths: + /sale/product-offers: + post: + tags: + - Offer management + summary: "Create offer based on product" + description: >- + Use this resource to create offer based on product. Read more: PL / EN. + Note that requests may be limited. + operationId: createProductOffers + parameters: + - name: Accept-Language + in: header + required: false + description: Expected language of messages. + example: pl-PL + schema: + type: string + format: BCP-47 language code + enum: + - en-US + - pl-PL + - uk-UA + - sk-SK + - cs-CZ + - hu-HU + responses: + '201': + description: Offer created successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SaleProductOfferResponseV1' + '202': + description: The product-offer creation request has been accepted for processing, but the processing has not been completed. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SaleProductOfferResponseV1' + headers: + Location: + schema: + type: string + description: The location URI points to a resource that will display the status of the asynchronous processing. + Retry-after: + schema: + type: integer + minimum: 0 + description: An estimate time of when you should poll the location uri to get the status of the asynchronous processing. + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden - not allowed to access. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/vnd.allegro.public.v1+json: + schema: + type: object + properties: + errors: + allOf: + #language=html + - description: >- +

The list of all the error objects explaining the error.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Error metadata fields
Error codeMetadata keyDescription
PARAMETER_MISMATCHproductIdID of an existing product that was matched to your request, but has parameter differences
MultipleProductsFoundExceptionfoundProductsIdsIDs of existing products that were matched to provided product id (GTIN or MPN).
CATEGORY_MISMATCHrequestedCategoryNameName of the requested category in the offer
requestedCategoryIdID of the requested category in the offer
existingCategoryNameName of the existing category in the product
existingCategoryIdID of the existing category in the product
DefaultImpliedWarrantyNotFoundExceptiondefaultNameName to be selected if none provided
InvalidDictionaryParameterdictionaryValueRequested invalid value
parameterIdParameter ID in which the value does not exist
parameterNameParameter name
AdditionalServicesGroupNotFoundExceptionrequestedNameRequested name
DictionaryParameterIdsAndValuesNotMatchparameterIdParameter ID in which number of requested values and ids don't match
parameterNameParameter name
GallerySizeExceptiongallerySizeLimitMax number of images in this request
UnsupportedLanguageExceptionavailableLocalesComma-separated list of supported locales
UploadImageRequestTimeoutExceptionimageUrlRequested image URL
NotUniqueSizeTableExceptionrequestedNameRequested name which was not found in your settings
DictionaryParameterValueNotFoundparameterNameParameter name to which requested value was not matched
requestedDictionaryValueRequested value
CompatibilityListCategoryNotSupportedExceptionrequestedNameRequested compatibility list name
BaseMarketplaceInAdditionalMarketplacesExceptionbaseMarketplaceCode of the base marketplace which should not have been sent
ContactNotFoundExceptionrequestedNameRequested contact name
DictionaryParameterValueNotUniqueparameterNameParameter name related to the error
requestedDictionaryValueRepeated dictionary value
DictionaryParameterIdNotFoundparameterIdParameter id related to the error
parameterNameParameter name related to the error
WarrantyNotUniqueExceptionrequestedNameRequested warranty name that is repeated in your configuration
UnsupportedAdditionalMarketplaceExceptionsupportedAdditionalMarketplacesCode of requested marketplace that is not supported
ProductNotFoundExceptionproductIdRequested product id which was not found
CATEGORY_NOT_EXISTScategoryIdRequested category id which was not found
FundraisingCampaignNotFoundExceptionrequestedNameRequested campaign name which was not found
WholesalePriceListNotFoundExceptionrequestedNameRequested price-list which was not found
ImpliedWarrantyNotFoundExceptiondefaultNameDefault name which would match automatically
requestedNameRequested name of implied warranty which was not found
NotUniqueWholesalePriceListExceptionwholesalePriceListRequested name of price list which is repeated in your configuration
FundraisingCampaignNotUniqueExceptionrequestedNameRequested name of campaign which is repeated in your configuration
ParameterNameNotFoundExceptioncategoryIdCategory id related to the error
parameterNameRequested parameter name which was not found
ReturnPolicyNotFoundExceptiondefaultNameDefault name which would match automatically
requestedNameRequested name of policy which was not found
UnknownProductOfferPartExceptionrequestedPartRequested offer part which was is not supported
validPartsValid parts of the product offer
ParameterNameNotUniqueExceptioncategoryIdCategory id related to the error
parameterNameRequested parameter name which is not unique
SizeTableNotFoundExceptionrequestedNameRequested size table name which was not found
NotUniqueAdditionalServicesGroupExceptionrequestedNameRequested name of additional services group which is repeated in your configuration
ShippingRatesNotFoundExceptiondefaultNameDefault name which would match automatically
requestedNameRequested name of shipping rates which was not found
IncompleteParameterDefinitionparameterIdParameter id related to the error
CompatibilityListUnsupportedItemsTypeExceptioncategoryIdCategory id related to the error
requestedItemTypeRequested item type which is not supported
INVALID_CATEGORY_IDcategoryIdRequested category id which is not valid
ReturnPolicyNotUniqueExceptionrequestedNameRequested name of return policy which is repeated in your configuration
ParameterIdNotFoundExceptioncategoryIdCategory id related to the error
parameterIdRequested parameter id which was not found
WarrantyNotFoundExceptionrequestedNameRequested name of warranty which was not found
DefaultReturnPolicyNotFoundExceptiondefaultNameDefault name which would match automatically
CompatibilityListUnknownItemsTypeExceptionrequestedNameRequested type of the item which is not supported
ContactNotUniqueExceptionrequestedNameRequested name of contact which is repeated in your configuration
OfferNotFoundExceptionofferIdRequested offer id which was not found
UserNotFoundExceptionuserIdRequested user id which was not found
DefaultShippingRatesNotFoundExceptiondefaultNameDefault name which would match automatically
NonUniqueShippingRatesExceptionrequestedNameRequested name of shipping rates which is repeated in your configuration
ParameterCategoryExceptionparameterIdParameter id related to the error
parameterNameParameter name related to the error
requestedParameterTypeRequested parameter type which is not valid
PublicationTasksNotFoundExceptioncommandIdRequested command id which was not found
TransactionTaxSettingsNotFoundExceptionrequestedTaxCountryRequested tax country which was not found
requestedTaxExemptionRequested tax exemption which was not found
requestedTaxRateRequested tax rate which was not found
requestedTaxSubjectRequested tax subject which was not found
taxSettingsIdTax settings id related to the error
ImpliedWarrantyNotUniqueExceptionrequestedNameRequested name of implied warranty which is repeated in your configuration
+ - $ref: '#/components/schemas/Errors' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SaleProductOfferRequestV1' + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + '/sale/product-offers/{offerId}': + patch: + tags: + - Offer management + summary: "Edit an offer" + description: >- + Use this resource to edit offer. Read more: PL / EN. + Note that requests may be limited. + operationId: editProductOffers + parameters: + - name: offerId + in: path + description: The offer identifier. + required: true + schema: + type: string + - name: Accept-Language + in: header + required: false + description: Expected language of messages. + example: pl-PL + schema: + type: string + format: BCP-47 language code + enum: + - en-US + - pl-PL + - uk-UA + - sk-SK + - cs-CZ + - hu-HU + responses: + '200': + description: Offer edited successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SaleProductOfferResponseV1' + '202': + description: The request to edit product-offer has been accepted for processing, but the processing has not been completed. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SaleProductOfferResponseV1' + headers: + Location: + schema: + type: string + description: The location URI points to a resource that will display the status of the asynchronous processing. + Retry-after: + schema: + type: integer + minimum: 0 + description: An estimate time in seconds of when you should poll the location uri to get the status of the asynchronous processing. + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden - not allowed to access. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Not Found. Offer not found. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '409': + description: Conflict. The current state of the offer does not allow to perform the request (e.g. The previous edition of the offer is still being processed). + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/vnd.allegro.public.v1+json: + schema: + type: object + properties: + errors: + allOf: + #language=html + - description: >- +

The list of all the error objects explaining the error.

+ + + + + + + + + + + + + + + + + + + + + + +
Error metadata fields
Error codeMetadata keyDescription
PARAMETER_MISMATCHproductIdID of an existing product that was matched to your request, but has parameter differences
MultipleProductsFoundExceptionfoundProductsIdsIDs of existing products that were matched to provided product id (GTIN or MPN).
+ - $ref: '#/components/schemas/Errors' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SaleProductOfferPatchRequestV1' + required: true + get: + tags: + - User's offer information + summary: 'Get all data of the particular product-offer' + description: + 'Use this resource to retrieve all data of the particular product-offer. Read more: PL / EN.' + operationId: getProductOffer + parameters: + - name: offerId + in: path + description: Offer identifier. + required: true + schema: + type: string + responses: + '200': + description: Offer returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SaleProductOfferResponseV1' + '400': + description: Invalid offer ID format + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + '/sale/product-offers/{offerId}/parts': + get: + tags: + - User's offer information + summary: 'Get selected data of the particular product-offer' + description: >- + Use this resource to retrieve selected data of the particular product-offer. + The model and functionality is a subset of the full product offer get endpoint + (`GET /sale/product-offers/{offerId}`), but it is faster and more reliable. + operationId: getPartialProductOffer + parameters: + - name: offerId + in: path + description: Offer identifier. + required: true + schema: + type: string + - name: include + in: query + required: true + description: >- + Selection of parts intended to retrieve. Multiple parts can be specified at the same time. + schema: + type: array + items: + type: string + enum: + - stock + - price + - name: Accept-Language + in: header + required: false + description: Expected language of messages. + example: pl-PL + schema: + type: string + format: BCP-47 language code + enum: + - en-US + - pl-PL + - uk-UA + - sk-SK + - cs-CZ + - hu-HU + responses: + '200': + description: Offer returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SalePartialProductOfferResponse' + '400': + description: Invalid offer ID format or unsupported part name + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized - access to this resource requires authorization + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '403': + description: Access to offer is forbidden for this account + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Offer not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + '/sale/product-offers/{offerId}/operations/{operationId}': + get: + tags: + - Offer management + summary: 'Check the processing status of a POST or PATCH request' + description: + 'The URI for the resource given by Location header of POST /sale/product-offers and PATCH /sale/product-offers/{offerId}. + Use this resource to check processing status of a POST or PATCH request. Read more: PL / EN.' + operationId: getProductOfferProcessingStatus + parameters: + - name: offerId + in: path + description: Offer identifier. + required: true + schema: + type: string + - name: operationId + in: path + description: Operation identifier provided in location header of POST or PATCH request. + required: true + schema: + type: string + - name: Accept-Language + in: header + required: false + description: Expected language of messages. + example: pl-PL + schema: + type: string + format: BCP-47 language code + enum: + - en-US + - pl-PL + - uk-UA + - sk-SK + - cs-CZ + - hu-HU + responses: + '202': + description: The request processing has not been completed. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SaleProductOfferStatusResponse' + '303': + description: 'The processing of product-offer has been completed. The Location header provide information about the location of processed resource.' + '400': + description: Syntactically incorrect request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offers: + get: + tags: + - User's offer information + summary: "Get seller's offers" + description: >- + Use this resource to get the list of the seller's offers. You can use different query parameters to filter the list. Read more: PL / EN. + operationId: searchOffersUsingGET + parameters: + - name: offer.id + in: query + description: Offer ID. + required: false + schema: + type: array + items: + example: "16885969603" + type: string + - name: name + in: query + description: The text to search in the offer title. + example: "iPhone 15" + required: false + schema: + type: string + - name: sellingMode.price.amount.gte + in: query + description: >- + The lower threshold of price. + + + If additionally a `publication.marketplace` is provided, searches using the price on the given marketplace. + required: false + schema: + type: number + minimum: 0 + example: 9.99 + - name: sellingMode.price.amount.lte + in: query + description: >- + The upper threshold of price. + + + If additionally a `publication.marketplace` is provided, searches using the price on the given marketplace. + required: false + schema: + type: number + minimum: 1 + example: 125.99 + - name: sellingMode.priceAutomation.rule.id + in: query + description: >- + The ID of price automation rule. Returns offers with given price automation rule ID. + + + If additionally a `publication.marketplace` is provided, searches using the price automation rule on the given marketplace. + example: "66950bc04a57a95dfad0891d" + required: false + schema: + type: string + - name: sellingMode.priceAutomation.rule.id.empty + in: query + description: >- + Allows to filter offers by existence of price automation rule ID. + Passing 'false' will return offers with any price automation rule, passing 'true' will return offers without any price automation rules. + + + If additionally a `publication.marketplace` is provided, searches using the price automation rule on the given marketplace. + example: false + required: false + schema: + type: boolean + - name: publication.status + in: query + description: >- + The publication status of the offer. Passing more than one value will search for offers with any of the given statuses. By default all statuses are included. + Example: `publication.status=INACTIVE&publication.status=ACTIVE` - returns offers with status `INACTIVE` or `ACTIVE`. + required: false + schema: + type: array + items: + type: string + example: "INACTIVE" + enum: + - INACTIVE + - ACTIVE + - ACTIVATING + - ENDED + - name: publication.marketplace + in: query + required: false + description: >- + Either the base marketplace or an additional marketplace of the offer. + + + When passing the parameter `publication.marketplace`, searches for offers with the given marketplace as either its base marketplace or one of its additional marketplaces. + When the parameter is omitted, searches for offers with all marketplaces. + + + In addition to searching, passing the parameter also influences the functionality of other query parameter by searching and sorting by data (e.g. price) on the given marketplace. + schema: + $ref: '#/components/schemas/MarketplaceId' + - name: sellingMode.format + in: query + required: false + description: >- + The offer's selling format. Passing more than one value will search for offers with any of the given formats. By default all formats are included. + Example: `sellingMode.format=BUY_NOW&sellingMode.format=ADVERTISEMENT` - returns offers with with format `BUY_NOW` or `ADVERTISEMENT`. + schema: + type: array + items: + type: string + example: "BUY_NOW" + enum: + - BUY_NOW + - ADVERTISEMENT + - AUCTION + - name: external.id + in: query + description: >- + The ID from the client's external system. Passing more than one value will search for offers with any of the given IDs. By default no ID is included. + Example: `external.id=1233&external.id=1234` - returns offers with ID `1233` or `1234`. Single ID length shouldn't exceed 100 characters. + required: false + schema: + type: array + maxItems: 100 + items: + type: string + maxLength: 100 + example: "EXTERNAL_ID_122" + - name: delivery.shippingRates.id + in: query + description: >- + The ID of shipping rates. Returns offers with given shipping rates ID. + example: "2991e29e-5fbc-46f5-963a-65c326ba65c2" + schema: + type: string + format: uuid + - name: delivery.shippingRates.id.empty + in: query + description: Allows to filter offers by existence of shipping rates ID. + example: false + schema: + type: boolean + - name: sort + in: query + description: >- + The results' sorting order. No prefix in the value means ascending order. `-` prefix means descending order. + If you don't provide the sort parameter, the list is sorted by offer creation time, descending. + + + If additionally a `publication.marketplace` is provided, sorts by price and `stock.sold` using the data on the given marketplace. + example: "sellingMode.price.amount" + required: false + schema: + type: string + enum: + - sellingMode.price.amount + - -sellingMode.price.amount + - stock.sold + - -stock.sold + - stock.available + - -stock.available + - name: limit + in: query + required: false + description: >- + The maximum number of offers returned in the response. + example: 100 + schema: + type: integer + format: int32 + minimum: 1 + maximum: 1000 + default: 20 + - name: offset + in: query + required: false + description: Index of the first returned offer from all search results. Maximum sum of offset and limit is 10 000 000. + example: 101 + schema: + type: integer + format: int32 + minimum: 0 + maximum: 9999999 + - name: category.id + in: query + description: The identifier of the category, where you want to search for offers. + example: "20285" + required: false + schema: + type: string + - name: product.id.empty + in: query + description: Allows to filter offers by existence of product ID. + example: true + required: false + schema: + type: boolean + - name: productizationRequired + in: query + description: Allows to search for offers from categories where productization is required. + example: true + required: false + schema: + type: boolean + - name: b2b.buyableOnlyByBusiness + in: query + description: Allows to search for offers buyable only by businesses. + example: false + required: false + schema: + type: boolean + - name: fundraisingCampaign.id + in: query + description: ID of the charity fundraising campaign that benefits from this offer. + example: "e2307b4f-6903-4be6-85e6-19e8ea303760" + schema: + type: string + format: uuid + - name: fundraisingCampaign.id.empty + in: query + description: Allows to search for charity or commercial offers. + example: false + schema: + type: boolean + - name: afterSalesServices.returnPolicy.id + in: query + description: The ID of return policy. Returns offers with given return policy ID. + schema: + type: string + format: uuid + responses: + '200': + description: The list of offers returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OffersSearchResultDto' + '400': + description: The request query parameters are invalid. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '403': + description: The user has no rights to query offers or provided token is invalid. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offers/{offerId}: + delete: + tags: + - Offer management + summary: 'Delete a draft offer' + description: + 'Use this resource to delete a draft offer. Read more: PL / EN.' + operationId: deleteOfferUsingDELETE + parameters: + - name: offerId + in: path + description: Offer identifier. + required: true + schema: + type: string + responses: + '204': + description: No content + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + '/offers/{offerId}/change-price-commands/{commandId}': + put: + tags: + - Offer management + summary: 'Modify the Buy Now price in an offer' + description: + 'Use this resource to change the Buy Now price in a single offer. Read more: PL / EN.' + operationId: createChangePriceCommandUsingPUT + parameters: + - name: offerId + in: path + description: The offer identifier. + required: true + schema: + type: string + - name: commandId + in: path + description: The unique command id generated by you. + required: true + schema: + type: string + format: uuid + responses: + '200': + description: The command was created successfully and is queued for processing. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ChangePrice' + default: + description: >- + An immediate error response is returned whether the command input data is not valid or there is an internal + problem with our systems. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ChangePriceWithoutOutput' + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offers/{offerId}/translations: + get: + tags: + - Offer translations + summary: Get offer translations + description: 'Get offer translation for given language or all present. Read more: PL / EN.' + operationId: getOfferTranslationUsingGET + parameters: + - name: language + in: query + description: Language for translation to retrieve. If not provided, all translations as well as base content for offer will be returned. + required: false + schema: + type: string + format: BCP-47 language code + example: 'en-US' + - name: offerId + in: path + description: Offer identifier. + required: true + schema: + type: string + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + responses: + '200': + description: The list of offer translations returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferTranslations' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + /sale/offers/{offerId}/translations/{language}: + patch: + tags: + - Offer translations + summary: Update offer translation + description: 'Update manual translation for offer. Read more: PL / EN.' + operationId: updateOfferTranslationUsingPATCH + parameters: + - name: language + in: path + description: Language of the provided translation. + required: true + schema: + type: string + format: BCP-47 language code + example: 'en-US' + - name: offerId + in: path + description: Offer identifier. + required: true + schema: + type: string + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ManualTranslationUpdateRequest' + description: Request with manual translation for offer, must contain at least one translated offer element (title, description or safety information). + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + responses: + '200': + description: Update successful + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + delete: + tags: + - Offer translations + summary: Delete offer translation + description: 'Delete single element or entire manual translation. Read more: PL / EN.' + operationId: deleteManualTranslationUsingDELETE + parameters: + - name: language + in: path + description: Language of the translation to delete. + required: true + schema: + type: string + format: BCP-47 language code + example: 'en-US' + - name: offerId + in: path + description: Offer identifier. + required: true + schema: + type: string + - name: element + in: query + description: Offer element for which translation should be deleted. If not provided, translations for all elements will be deleted. + example: "title" + required: false + schema: + type: string + enum: + - title + - description + - safety_information + - name: products.id + in: query + description: ProductId for which safety information translation should be deleted. If not provided, safety information translations for all products in offer will be deleted. + example: "0e810d4a-bbee-495c-8979-866bb06d3904" + required: false + schema: + type: string + format: uuid + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + responses: + '200': + description: Delete successful + '204': + description: No Content + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + /sale/classified-seller-stats: + get: + tags: + - Classifieds + summary: "Get the seller's advertisements daily statistics" + description: >- + This endpoint returns daily statistics collected for a list of advertisements in a given date range for logged user. Read more: PL / EN. + operationId: classifiedSellerOfferStatsGET + parameters: + - name: date.gte + in: query + description: >- + The maximum date and time from which the events will be fetched in ISO 8601 format. + The value should be less than the current date time. + The difference between date.gte and date.lte should be less than 3 months. + example: "2020-11-13T12:45:20.818Z" + required: false + schema: + type: string + format: date-time + - name: date.lte + in: query + description: >- + The minimum date and time from which the events will be fetched in ISO 8601 format. + The value should be less than the current date time and greater than date.lte. + The difference between date.gte and date.lte should be less than 3 months. + example: "2020-11-13T12:45:20.818Z" + required: false + schema: + type: string + format: date-time + responses: + '200': + description: Returns offer's statistics list + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SellerOfferStatsResponseDto' + '400': + description: Syntactically incorrect request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '422': + description: Unprocessable Entity + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/classified-offers-stats: + get: + tags: + - Classifieds + summary: "Get the advertisements daily statistics" + description: >- + This endpoint returns daily statistics collected for a list of advertisements in a given date range. Read more: PL / EN. + operationId: classifiedOffersStatsGET + parameters: + - name: offer.id + in: query + description: 'List of offer Ids, maximum 50 values.' + required: true + allowEmptyValue: false + explode: true + schema: + type: array + items: + type: string + example: "12394529345" + - name: date.gte + in: query + description: >- + The maximum date and time from which the events will be fetched in ISO 8601 format. + The value should be less than the current date time. + The difference between date.gte and date.lte should be less than 3 months. + example: "2020-11-13T12:45:20.818Z" + required: false + schema: + type: string + format: date-time + - name: date.lte + in: query + description: >- + The minimum date and time from which the events will be fetched in ISO 8601 format. + The value should be less than the current date time and greater than date.lte. + The difference between date.gte and date.lte should be less than 3 months. + example: "2020-11-13T12:45:20.818Z" + required: false + schema: + type: string + format: date-time + responses: + '200': + description: Returns offer's statistics list + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferStatsResponseDto' + '400': + description: Syntactically incorrect request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '422': + description: Unprocessable Entity + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offer-publication-commands/{commandId}: + put: + tags: + - Offer management + summary: 'Batch offer publish / unpublish' + description: + 'Use this resource to modify multiple offers publication at once. Read more: PL / EN. + This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute.' + operationId: changePublicationStatusUsingPUT + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + responses: + '201': + description: Command was registered + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GeneralReport' + '400': + description: Semantically incorrect request or provided conditions not correct + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '409': + description: Command id was already used + '422': + description: Unprocessable Entity + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PublicationChangeCommandDto' + description: publicationChangeCommandDto + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + get: + tags: + - Offer management + summary: "Publish command summary" + description: + 'Use this resource to retrieve information about the offer listing statuses. You will receive a summary with + a number of correctly listed offers and errors. Read more: PL / EN. + This resource is rate limited to retrieving information about 270 000 offer changes per minute.' + operationId: getPublicationReportUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + responses: + '200': + description: Report was generated and successfully returned + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GeneralReport' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Command not found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offer-publication-commands/{commandId}/tasks: + get: + tags: + - Offer management + summary: 'Publish command detailed report' + description: + 'Use this resource to retrieve information about the offer statuses on the site (Defaults: limit = 100, + offset = 0). Read more: PL / EN. + This resource is rate limited to retrieving information about 270 000 offer changes per minute.' + operationId: getPublicationTasksUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + - name: limit + in: query + description: The limit of elements in the response. + example: 200 + required: false + schema: + type: integer + format: int32 + default: 100 + minimum: 1 + maximum: 1000 + - name: offset + in: query + description: The offset of elements in the response. + example: 201 + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + maximum: 999 + responses: + '200': + description: Task status successfully returned + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TaskReport' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Command not found + '422': + description: Unprocessable Entity + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offer-classifieds-packages/{offerId}: + get: + tags: + - Classifieds + summary: Get classified packages assigned to an offer + description: + 'Use this resource to retrieve classified packages currently assigned to an offer. Read more: PL / EN.' + operationId: getClassifiedPackagesUsingGET + parameters: + - name: offerId + in: path + description: Offer ID. + required: true + schema: + type: string + responses: + '200': + description: Packages returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ClassifiedResponse' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Classified not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + put: + tags: + - Classifieds + summary: Assign packages to a classified + description: + 'Use this resource to assign classified packages to an offer. Read more: PL / EN.' + operationId: assignClassifiedPackagesUsingPUT + parameters: + - name: offerId + in: path + description: The offer ID. + required: true + schema: + type: string + responses: + '200': + description: Packages have been successfully assigned to the classified. + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Classified not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Validation error + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + description: Packages that should be assigned to the classified. + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ClassifiedPackages' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/classifieds-packages: + get: + tags: + - Classifieds + summary: Get configurations of packages + description: + 'Use this resource to retrieve configurations of classifieds packages for a category. Read more: PL / EN.' + operationId: getClassifiedPackageConfigurationsForCategoryUsingGET + parameters: + - name: category.id + in: query + description: The category ID. + example: "23456" + required: true + schema: + type: string + responses: + '200': + description: Package configurations for the category returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ClassifiedPackageConfigs' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/classifieds-packages/{packageId}: + get: + tags: + - Classifieds + summary: Get the configuration of a package + description: + 'Use this resource to retrieve the configuration of a classifieds package. Read more: PL / EN.' + operationId: getClassifiedPackageConfigurationUsingGET + parameters: + - name: packageId + in: path + description: The classifieds package ID. + required: true + schema: + type: string + responses: + '200': + description: The package's configuration returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ClassifiedPackageConfig' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: The classifieds package not found. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /users/{userId}/ratings-summary: + get: + tags: + - Public user information + summary: "Get any user's ratings summary" + description: + 'Use this resource to receive feedback statistics. Read more: PL / EN.' + operationId: getUserSummaryUsingGET + parameters: + - name: userId + in: path + description: The ID of the user. + required: true + schema: + type: string + example: "41846511" + responses: + '200': + description: Feedback statistics returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/UserRatingSummaryResponse' + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/UserRatingSummaryResponseV2' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: User with the given ID not found or user is not a seller. + security: + - bearer-token-for-user: + - allegro:api:profile:read + /sale/user-ratings: + get: + tags: + - Information about user + summary: "Get the user's ratings" + description: + 'Use this resource to receive your sales ratings sorted by last change date, starting from the latest. Read more: PL / EN.' + operationId: getUserRatingsUsingGET + parameters: + - name: Accept-Language + in: header + required: false + description: Expected language of messages. The header is available only for content version 'application/vnd.allegro.beta.v1+json'. + example: pl-PL + schema: + type: string + format: BCP-47 language code + enum: + - en-US + - pl-PL + - uk-UA + - sk-SK + - cs-CZ + - hu-HU + default: pl-PL + - name: recommended + in: query + description: Filter by recommended. + required: false + schema: + type: string + example: "true" + enum: + - 'true' + - 'false' + - name: lastChangedAt.gte + in: query + description: >- + Last change (creation or latest edition) date time in ISO 8601 format. + The lower bound of date time range from which ratings will be fetched. + example: "2020-11-13T12:45:20.818Z" + required: false + schema: + type: string + format: date-time + - name: lastChangedAt.lte + in: query + description: >- + Last change (creation or latest edition) date time in ISO 8601 format. + The upper bound of date time range from which ratings will be fetched. + example: "2020-11-13T12:45:20.818Z" + required: false + schema: + type: string + format: date-time + - name: offset + in: query + description: The offset of elements in the response. + example: 101 + required: false + schema: + type: integer + format: int32 + minimum: 0 + maximum: 20000 + default: 0 + - name: limit + in: query + description: The limit of elements in the response. + example: 100 + required: false + schema: + type: integer + format: int32 + minimum: 1 + maximum: 100 + default: 20 + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/UserRatingListResponse' + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/UserRatingListResponseVBeta1' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:ratings + + /sale/user-ratings/{ratingId}: + get: + tags: + - Information about user + summary: "Get the user's rating by given rating id" + description: + 'Use this resource to receive your sales rating by given rating id. Read more: PL / EN.' + operationId: getUserRatingUsingGET + parameters: + - name: Accept-Language + in: header + required: false + description: Expected language of messages. The header is available only for content version 'application/vnd.allegro.beta.v1+json'. + example: pl-PL + schema: + type: string + format: BCP-47 language code + enum: + - en-US + - pl-PL + - uk-UA + - sk-SK + - cs-CZ + - hu-HU + default: pl-PL + - name: ratingId + in: path + description: The ID of the rating. + required: true + schema: + type: string + example: '5df0a6d1ef437e00255572a1' + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/UserRating' + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/UserRatingVBeta1' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:ratings + /sale/user-ratings/{ratingId}/answer: + put: + tags: + - Information about user + summary: "Answer for user's rating" + description: + 'Use this resource to answer for received rating. Read more: PL / EN.' + operationId: answerUserRatingUsingPUT + parameters: + - name: ratingId + in: path + description: ID of the rating. + required: true + schema: + type: string + example: "5df0a6d1ef437e00255572a1" + responses: + '201': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Answer' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + requestBody: + $ref: '#/components/requestBodies/UserRatingAnswerRequest' + security: + - bearer-token-for-user: + - allegro:api:ratings + /sale/user-ratings/{ratingId}/removal: + put: + tags: + - Information about user + summary: "Request removal of user's rating" + description: + 'Use this resource to request removal of received rating. Read more: PL / EN.' + operationId: userRatingRemovalUsingPUT + parameters: + - name: ratingId + in: path + description: ID of the rating. + required: true + schema: + type: string + example: "5df0a6d1ef437e00255572a1" + responses: + '201': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Removal' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + requestBody: + $ref: '#/components/requestBodies/UserRatingRemovalRequest' + security: + - bearer-token-for-user: + - allegro:api:ratings + /sale/quality: + get: + tags: + - Information about user + summary: "Get sales quality" + description: 'Use this resource to get current sales quality with at most 30 days history. Read more: PL / EN.' + operationId: getSaleQualityUsingGET + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SalesQualityHistoryResponse' + '401': + description: Unauthorized + '403': + description: Forbidden + security: + - bearer-token-for-user: + - allegro:api:profile:read + /me: + get: + tags: + - Information about user + summary: "Get basic information about user" + description: + 'Use this resource when you need basic information about authenticated user. Read more: PL / EN.' + operationId: meGET + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/MeResponse' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden - when token is without user context + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:profile:read + /sale/offer-additional-services/groups: + post: + tags: + - Additional services + summary: 'Create additional services group' + description: + 'Use this resource to create a group of additional services. Read more: PL / EN.' + operationId: createAdditionalServicesGroupUsingPOST + responses: + '201': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalServicesGroupResponse' + '401': + description: Unauthorized + '422': + description: Unprocessable Entity + requestBody: + $ref: '#/components/requestBodies/AdditionalServicesGroupRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + get: + tags: + - Additional services + summary: "Get the user's additional services groups" + description: + 'Use this resource to retrieve a list of groups with additional services available to a given user which you + may assign to offers. Read more: PL / EN.' + operationId: getListOfAdditionalServicesGroupsUsingGET + parameters: + - name: offset + in: query + description: The offset of elements in the response. + example: 200 + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + - name: limit + in: query + description: The limit of elements in the response. + example: 200 + required: false + schema: + type: integer + format: int32 + default: 100 + minimum: 1 + maximum: 1000 + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalServicesGroups' + '401': + description: Unauthorized + '403': + description: Forbidden + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + /sale/bundles: + post: + tags: + - Offer bundles + summary: Create a new offer bundle + description: >- + You can create offer bundle using this endpoint. + Bundle has to contain at least two offers and at least one of them has to be set as an entry point. + Bundle will be shown on offers' pages which are marked as entry points. + You can also specify how many units of each offer will be in bundle using `requiredQuantity` property. + +
+ Additionally, discount can be specified for each marketplace separately. + If you do not want to set discount, set `discounts` property to `null` or empty array. + Also, you do not have to specify discount on all marketplaces. Fill marketplaces in 'discounts' array accordingly to your needs. + +
+ Read more: PL / EN. + operationId: createOfferBundleUsingPOST + responses: + '201': + description: >- + Successfully created the requested offer bundle. + Once bundle is created it can be in one of two statuses on each marketplace separately: +
    +
  • `ACTIVE` means that bundle will be displayed on offer page; +
  • `SUSPENDED` means that bundle will NOT be displayed on offer page. +
+ Bundle is SUSPENDED on all marketplaces when at least one of offers is ended or out of stock. + Bundle is SUSPENDED on specific marketplace when at least one of offers: +
    +
  • is not visible on that marketplace;
  • +
  • is in campaign which lowers its price on that marketplace;
  • +
+ or when discount cannot be spread across offers considering their current prices on that marketplace. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferBundleDTO' + example: + id: 'a42d09c2-2669-4e7c-989b-7c341e84f787' + offers: + - id: '123456789' + requiredQuantity: 1 + entryPoint: true + - id: '987654321' + requiredQuantity: 2 + entryPoint: false + publication: + - marketplace: + id: 'allegro-pl' + status: 'ACTIVE' + discounts: + - marketplace: + id: 'allegro-pl' + amount: '10.15' + currency: 'PLN' + createdAt: '2023-09-21T10:22:02.999Z' + createdBy: 'USER' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthenticated action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: >- + Validation failed – request had correct syntax, but violated validation rules + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CreateOfferBundleDTO' + example: + offers: + - id: '123456789' + requiredQuantity: 1 + entryPoint: true + - id: '987654321' + requiredQuantity: 2 + entryPoint: false + discounts: + - marketplace: + id: 'allegro-pl' + amount: '10.15' + currency: 'PLN' + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + get: + tags: + - Offer bundles + summary: List seller's bundles + description: >- + You can fetch page of seller's offer bundles using this endpoint. + +
+ Paging: +
+ To move to next page, specify `page.id` parameter with value obtained in response from previous request. + Number of offer bundles on single page can be specified using `limit` parameter. + +
+ Filtering: +
+ Offer bundles can be filtered to bundles which contain offer specified in `offer.id` parameter. Read more: PL / EN. + + operationId: listSellersOfferBundlesUsingGET + parameters: + - name: limit + in: query + description: Limit of bundles per page. + example: 200 + required: false + schema: + type: integer + format: int32 + minimum: 1 + maximum: 5000 + default: 50 + - name: offer.id + in: query + description: Filter bundles which contains offer. + schema: + type: string + example: "123456789" + - name: page.id + in: query + description: ID of page which will be retrieved. + schema: + type: string + example: "MjAyNC0wOS0xMFQwNjo0OTowMi40NTBa" + responses: + '200': + description: Page of seller's bundles. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferBundlesDTO' + example: + bundles: + - id: 'a42d09c2-2669-4e7c-989b-7c341e84f787' + offers: + - id: '123456789' + requiredQuantity: 1 + entryPoint: true + - id: '987654321' + requiredQuantity: 2 + entryPoint: false + publication: + - marketplace: + id: 'allegro-pl' + status: 'ACTIVE' + discounts: + - marketplace: + id: 'allegro-pl' + amount: '10.15' + currency: 'PLN' + createdAt: '2023-09-21T10:22:02.999Z' + createdBy: 'USER' + nextPage: + id: 'MjAyNC0wOS0xMFQwNjo0OTowMi40NTBa' + + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthenticated action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: >- + Validation failed – request had correct syntax, but violated validation rules + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/bundles/{bundleId}: + get: + tags: + - Offer bundles + summary: Get bundle by ID + description: 'Use this resource to retrieve offer bundle by its unique identifier. Read more: PL / EN.' + operationId: getOfferBundleUsingGET + parameters: + - name: bundleId + in: path + description: Bundle ID. + required: true + schema: + type: string + responses: + '200': + description: Successfully returned the requested offer bundle + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferBundleDTO' + example: + id: 'a42d09c2-2669-4e7c-989b-7c341e84f787' + offers: + - id: '123456789' + requiredQuantity: 1 + entryPoint: true + - id: '987654321' + requiredQuantity: 2 + entryPoint: false + publication: + - marketplace: + id: 'allegro-pl' + status: 'ACTIVE' + discounts: + - marketplace: + id: 'allegro-pl' + amount: '10.15' + currency: 'PLN' + createdAt: '2023-09-21T10:22:02.999Z' + createdBy: 'USER' + '401': + description: Unauthenticated action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Bundle not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + delete: + tags: + - Offer bundles + summary: Delete bundle by ID + description: 'Use this resource to delete offer bundle by its unique identifier. Read more: PL / EN.' + operationId: deleteOfferBundleUsingGET + parameters: + - name: bundleId + in: path + description: Bundle ID. + required: true + schema: + type: string + responses: + '204': + description: Bundle successfully deleted. + '401': + description: Unauthenticated action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Bundle not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/bundles/{bundleId}/discount: + put: + tags: + - Offer bundles + summary: Update discount associated with bundle + description: >- + Use this resource to update discount per marketplaces associated with bundle specified by its unique identifier. + This will override currently set discounts for all marketplaces, so the unchanged discounts also must be specified in request. + In case discount for marketplace is not specified in request it will be deleted. Read more: PL / EN. + operationId: updateOfferBundleDiscountUsingPUT + parameters: + - name: bundleId + in: path + description: Bundle ID. + required: true + schema: + type: string + responses: + '200': + description: Bundle discount successfully changed. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferBundleDTO' + example: + id: 'a42d09c2-2669-4e7c-989b-7c341e84f787' + offers: + - id: '123456789' + requiredQuantity: 1 + entryPoint: true + - id: '987654321' + requiredQuantity: 2 + entryPoint: false + publication: + - marketplace: + id: 'allegro-pl' + status: 'ACTIVE' + discounts: + - marketplace: + id: 'allegro-pl' + amount: '10.15' + currency: 'PLN' + createdAt: '2023-09-21T10:22:02.999Z' + createdBy: 'USER' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthenticated action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: >- + Validation failed – request had correct syntax, but violated validation rules + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/UpdateOfferBundleDiscountDTO' + example: + discounts: + - marketplace: + id: 'allegro-pl' + amount: '10.15' + currency: 'PLN' + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/loyalty/promotions: + post: + tags: + - Rebates and promotions + summary: "Create a new promotion" + description: >- + This endpoint creates a new promotion. + You can create promotions only if your base marketplace is `allegro-pl`. + Created promotions are visible only on the `allegro-pl` marketplace. + You can define the following types of promotions: + + 1. Large order discount +
+ Only company users will see and be eligible for this type of promotion. + In order to create a large order discount, you also have to be a company user. Furthermore, you are allowed to have only one active order discount at a time. + Define a promotion with a single benefit of type **LARGE_ORDER_DISCOUNT** and a single criterion of type **ALL_OFFERS**. + The benefit specification should contain a list of order value based discount thresholds. + Threshold's order value defines the minimum total value of an order for which the threshold is applicable (`lowerBound`). + Threshold's discount defines the discount percentage applied when the threshold is applied. The percentage's fractional part must be equal to 0. + Only the highest applicable threshold (if any) will be applied to the total value of the order. + A threshold with a higher order value than another threshold in the order discount must also have a higher discount. + Large order discount is assigned automatically to all seller's offers. Moreover, it will be assigned to all newly added seller's offers once activated. + Please note that it may take some time to propagate this type of promotion to all of your offers. Read more: PL / EN. + + 2. Wholesale price list +
+ Only company users will see and be eligible for this type of promotion. + In order to create a wholesale price list, you also have to be a company user. Define a promotion with a single benefit + of type **WHOLESALE_PRICE_LIST** and a single criterion of type **OFFERS_ASSIGNED_EXTERNALLY**. + The benefit specification should contain a name (it will be visible to you only) and a list of quantity based discount thresholds. + Threshold's quantity defines the minimum number of units of an offer for which the threshold is applicable (`lowerBound`). + Threshold's discount defines the discount percentage applied when the threshold is applied. The percentage's fractional part must be equal to 0. + Only the highest applicable threshold (if any) will be applied to the total price of units of the offer bought. + A threshold with a higher quantity than another threshold in the price list must also have a higher discount. + In order to assign offers to a wholesale price list, use `discounts` field in batch offer modification. Read more: PL / EN. + + 3. Multipack +
+ In order to create a new multipack, you have to define a promotion with a single benefit of type **UNIT_PERCENTAGE_DISCOUNT** and a single criterion of type **CONTAINS_OFFERS**. The benefit specification should contain a configuration section with a percentage which indicates the specific discount for the discounted offer. This percentage should be an integer value greater than 15 for quantity 2, greater than 30 for quantity 3, greater than 40 for quantity 4, greater than 50 for quantity 5 and lower than or equal to 100. The specification should also contain a trigger section with a field forEachQuantity that defines the amount of items in the multipack which is necessary to trigger the benefit. Additionally, the discountedNumber field must be set to 1 by default as you can only discount one unit in a multipack. Finally, the offer criterion specifies the offer for which the multipack promotion will take effect. Read more: PL / EN + + 4. Cross-offer multipack +
+ A cross-offer multipack is created in the same fashion as a standard multipack. The only difference is that you need to pass + more than 1 offer in the offer criterion section. This group of offers is then considered as a pool from which users can + pick and choose forEachQuantity offers and the cheapest of them gets a discount. + + operationId: createPromotionUsingPOST_1 + responses: + '201': + description: Successfully created the requested promotion + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SellerRebateDto' + examples: + large-order-discount: + summary: Large Order Discount + value: + status: "ACTIVE" + createdAt: "2019-05-12T10:02:31.123Z" + id: "72c40ffb-6127-4719-a473-867bf5775601" + benefits: + - specification: + type: LARGE_ORDER_DISCOUNT + thresholds: + - orderValue: + lowerBound: + amount: "1000.00" + currency: "PLN" + discount: + percentage: "5" + - orderValue: + lowerBound: + amount: "1500.00" + currency: "PLN" + discount: + percentage: "8" + offerCriteria: + - type: ALL_OFFERS + wholesale-price-list: + summary: Wholesale Price List + value: + status: "ACTIVE" + createdAt: "2019-05-12T10:02:31.123Z" + id: "72c40ffb-6127-4719-a473-867bf5775601" + benefits: + - specification: + type: WHOLESALE_PRICE_LIST + name: "Cardboard boxes" + thresholds: + - quantity: + lowerBound: 2000 + discount: + percentage: "5" + - quantity: + lowerBound: 4000 + discount: + percentage: "10" + - quantity: + lowerBound: 6000 + discount: + percentage: "15" + offerCriteria: + - type: OFFERS_ASSIGNED_EXTERNALLY + multipack: + summary: Multipack + value: + status: "ACTIVE" + createdAt: "2019-05-12T10:02:31.123Z" + id: "72c40ffb-6127-4719-a473-867bf5775601" + benefits: + - specification: + type: UNIT_PERCENTAGE_DISCOUNT + configuration: + percentage: 100 + trigger: + forEachQuantity: 3 + discountedNumber: 1 + offerCriteria: + - type: CONTAINS_OFFERS + offers: + - id: '1122334455' + cross-offer-multipack: + summary: Cross-offer Multipack + value: + status: "ACTIVE" + createdAt: "2019-05-12T10:02:31.123Z" + id: "72c40ffb-6127-4719-a473-867bf5775601" + benefits: + - specification: + type: UNIT_PERCENTAGE_DISCOUNT + configuration: + percentage: 100 + trigger: + forEachQuantity: 3 + discountedNumber: 1 + offerCriteria: + - type: CONTAINS_OFFERS + offers: + - id: '1122334455' + - id: '2233445566' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: >- + Forbidden action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Offer/Offers not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '412': + description: >- + Validation failed – request had correct syntax, but promotion properties exceeds acceptable limits + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: >- + Validation failed – request had correct syntax, but violated validation rules + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SellerCreateRebateRequestDto' + examples: + large-order-discount: + summary: Large Order Discount + value: + benefits: + - specification: + type: LARGE_ORDER_DISCOUNT + thresholds: + - orderValue: + lowerBound: + amount: "1000.00" + currency: "PLN" + discount: + percentage: "5.00" + - orderValue: + lowerBound: + amount: "1500.00" + currency: "PLN" + discount: + percentage: "8.00" + offerCriteria: + - type: ALL_OFFERS + wholesale-price-list: + summary: Wholesale Price List + value: + benefits: + - specification: + type: WHOLESALE_PRICE_LIST + name: "Cardboard boxes" + thresholds: + - quantity: + lowerBound: 2000 + discount: + percentage: "5" + - quantity: + lowerBound: 4000 + discount: + percentage: "10" + - quantity: + lowerBound: 6000 + discount: + percentage: "15" + offerCriteria: + - type: OFFERS_ASSIGNED_EXTERNALLY + multipack: + summary: Multipack + value: + benefits: + - specification: + type: UNIT_PERCENTAGE_DISCOUNT + configuration: + percentage: 100 + trigger: + forEachQuantity: 3 + discountedNumber: 1 + offerCriteria: + - type: CONTAINS_OFFERS + offers: + - id: '1122334455' + cross-offer-multipack: + summary: Cross-offer Multipack + value: + benefits: + - specification: + type: UNIT_PERCENTAGE_DISCOUNT + configuration: + percentage: 100 + trigger: + forEachQuantity: 3 + discountedNumber: 1 + offerCriteria: + - type: CONTAINS_OFFERS + offers: + - id: '1122334455' + - id: '2233445566' + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + get: + tags: + - Rebates and promotions + summary: "Get the user's list of promotions" + description: >- + Get a list of promotions defined by the authorized user and filtered by promotion type. + +

Restrictions:

+

Filtering by promotion type is required.

+ +

Sum of limit and offset must be equal to or lower than 50000. Limit must be equal to or lower than 5000.

+

Example:

+

offset = 49950 and limit = 50 will return promotions

+

offset = 49950 and limit = 51 will return 422 http error

+

offset = 0 and limit = 5000 will return promotions

+

offset = 0 and limit = 5001 will return 422 http error

+ +

Read more about: Large order discount PL / EN, Wholesale price list PL / EN, Multipack PL / EN.

+ + operationId: listSellerPromotionsUsingGET_1 + parameters: + - name: limit + in: query + description: Limit of promotions per page. + required: false + schema: + type: integer + format: int32 + minimum: 1 + maximum: 5000 + default: 50 + - name: offset + in: query + description: Distance between the beginning of the document and the point from which promotions are returned. + required: false + schema: + type: integer + format: int32 + minimum: 0 + maximum: 49999 + default: 0 + - name: offer.id + in: query + description: Filter by offer id. No promotions with `OFFERS_ASSIGNED_EXTERNALLY` or `ALL_OFFERS` criteria will be returned if this parameter is present. + schema: + type: string + example: "8226673525" + - name: promotionType + in: query + description: Filter by promotion type. + required: true + schema: + type: string + enum: + - MULTIPACK + - CROSS_MULTIPACK + - LARGE_ORDER_DISCOUNT + - WHOLESALE_PRICE_LIST + responses: + '200': + description: Successfully returned the requested list of promotions + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SellerRebatesDto' + '400': + description: Bad request + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '422': + description: Restrictions were not satisfied + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/loyalty/promotions/{promotionId}: + get: + tags: + - Rebates and promotions + summary: "Get a promotion data by id" + description: >- +
+ Use this resource to return the requested promotion. You need to use its unique id. +
+ Read more about: Large order discount PL / EN, Wholesale price list PL / EN, Multipack PL / EN. + + operationId: getPromotionUsingGET + parameters: + - name: promotionId + in: path + description: Promotion identifier. + required: true + schema: + type: string + responses: + '200': + description: Successfully returned the requested promotion + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SellerRebateDto' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Promotion not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + put: + tags: + - Rebates and promotions + summary: "Modify a promotion" + description: >- + Use this resource to update a promotion by its unique id. +
+ It supports editing bundle's discount, wholesale price lists and large order discounts. + Read more about: Large order discount PL / EN, Wholesale price list PL / EN. + operationId: updatePromotionUsingPUT + parameters: + - name: promotionId + in: path + description: Promotion identifier. + required: true + schema: + type: string + responses: + '200': + description: Successfully updated the requested promotion + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SellerRebateDto' + examples: + large-order-discount: + summary: Large Order Discount + value: + status: "ACTIVE" + createdAt: "2019-05-12T10:02:31.123Z" + id: "72c40ffb-6127-4719-a473-867bf5775601" + benefits: + - specification: + type: LARGE_ORDER_DISCOUNT + thresholds: + - orderValue: + lowerBound: + amount: "1000.00" + currency: "PLN" + discount: + percentage: "5" + - orderValue: + lowerBound: + amount: "1500.00" + currency: "PLN" + discount: + percentage: "8" + - orderValue: + lowerBound: + amount: "2000.00" + currency: "PLN" + discount: + percentage: "10" + offerCriteria: + - type: ALL_OFFERS + wholesale-price-list: + summary: Wholesale Price List + value: + status: "ACTIVE" + createdAt: "2019-05-12T10:02:31.123Z" + id: "72c40ffb-6127-4719-a473-867bf5775601" + benefits: + - specification: + type: WHOLESALE_PRICE_LIST + name: "Cardboard boxes - new version" + thresholds: + - quantity: + lowerBound: 1500 + discount: + percentage: "6" + - quantity: + lowerBound: 3000 + discount: + percentage: "11" + - quantity: + lowerBound: 4500 + discount: + percentage: "16" + offerCriteria: + - type: OFFERS_ASSIGNED_EXTERNALLY + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: >- + Forbidden action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Promotion not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: >- + Validation failed – request had correct syntax, but violated validation rules + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SellerCreateRebateRequestDto' + examples: + large-order-discount: + summary: Large Order Discount + value: + benefits: + - specification: + type: LARGE_ORDER_DISCOUNT + thresholds: + - orderValue: + lowerBound: + amount: "1000.00" + currency: "PLN" + discount: + percentage: "5.00" + - orderValue: + lowerBound: + amount: "1500.00" + currency: "PLN" + discount: + percentage: "8.00" + - orderValue: + lowerBound: + amount: "2000.00" + currency: "PLN" + discount: + percentage: "10.00" + offerCriteria: + - type: ALL_OFFERS + wholesale-price-list: + summary: Wholesale Price List + value: + benefits: + - specification: + type: WHOLESALE_PRICE_LIST + name: "Cardboard boxes - new version" + thresholds: + - quantity: + lowerBound: 1500 + discount: + percentage: "6" + - quantity: + lowerBound: 3000 + discount: + percentage: "11" + - quantity: + lowerBound: 4500 + discount: + percentage: "16" + offerCriteria: + - type: OFFERS_ASSIGNED_EXTERNALLY + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + delete: + tags: + - Rebates and promotions + summary: "Deactivate a promotion by id" + description: >- + Use this resource to deactivate the requested promotion. You need to use its unique id. +
+ Read more about: Large order discount PL / EN, Wholesale price list PL / EN, Multipack PL / EN. + operationId: deactivatePromotionUsingDELETE + parameters: + - name: promotionId + in: path + description: Promotion identifier. + required: true + schema: + type: string + responses: + '204': + description: Successfully deactivated the requested promotion + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Promotion not found + content: + '*/*': + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/turnover-discount/{marketplaceId}: + put: + tags: + - Rebates and promotions + summary: "Create/modify turnover discount for marketplace" + description: >- + Create or modify the turnover discount for the specified marketplace. + Currently, the only supported marketplace is `allegro-business-cz`. +
+ Turnover discount is assigned to all offers available on the given marketplace. + Only B2B users will see and be eligible for this discount. + In order to create a turnover discount definition, you also have to be a B2B user. +
+ Created turnover discount becomes visible for B2B users with the first day of the next month. + Since that day, B2B users begin cumulating their spending on your offers they purchased. + Turnover cumulated within the month translate into appropriate percentage of the discount for all orders of your offers in the following month. +
+ Turnover discount created in a given month is susceptible for change only until the end of that month. + After that, as mentioned before, turnover discount becomes available for the users and can no longer be modified instantly. + Modifying turnover discount in such case will result in creation of the new definition of the discount. + This new definition will become available for the users on the same basis that the previously created one, with the start of the next month. + Also, similarly, newly created definition can be modified only until the the end of the month. Read more: PL / EN. + operationId: createOrModifyTurnoverDiscountUsingPUT + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + parameters: + - name: marketplaceId + in: path + description: Marketplace identifier. + required: true + schema: + type: string + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TurnoverDiscountRequest' + description: request + required: true + responses: + '200': + description: Successfully created/modified turnover discount for marketplace + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TurnoverDiscountDto' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Marketplace not supported + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Validation failed – request had correct syntax, but violated validation rules + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + /sale/turnover-discount: + get: + tags: + - Rebates and promotions + summary: "Get the list of turnover discounts" + description: >- + Get a list of turnover discounts for all supported marketplaces. Read more: PL / EN. + Currently, the only supported marketplace is `allegro-business-cz`. +
+ Turnover discount for the marketplace can have one of the three statuses: + + 1. `ACTIVATING` - neither accumulation of the turnover, nor applying of the discount has started yet. + Turnover will be being accumulated from the beginning of the next month. + + 2. `ACTIVE` - there is ongoing accumulation of the turnover and/or applying of the discount. + The latest discount definition does not have fields `cumulatingToDate` and `spendingToDate` set to a specific date. + There may be multiple (up to 3) definitions of the discount returned for each marketplace. + Only one definition can be accumulated against, and only one definition can be applied at the same time - appropriate periods from different definitions will not overlap. + + 3. `DEACTIVATING` - there is ongoing accumulation of the turnover and/or applying of the discount. + Accumulation of the turnover will be continued until `cumulatingToDate` of the last definition. + Applying of the discount will be continued until `spendingToDate` of the last definition. + operationId: getTurnoverDiscountsUsingGET + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + parameters: + - name: marketplaceId + in: query + description: >- + List of marketplace identifiers. Only turnover discounts for specified marketplaces are returned. +
+ Currently, only `allegro-business-cz` is supported. + required: false + schema: + type: array + items: + type: string + responses: + '200': + description: List of turnover discounts for marketplaces + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TurnoverDiscountListDto' + examples: + newDiscount: + summary: New discount + value: + - marketplaceId: "allegro-business-cz" + status: "ACTIVATING" + definitions: + - cumulatingFromDate: "2025-01-01" + cumulatingToDate: null + spendingFromDate: "2025-02-01" + spendingToDate: null + createdAt: "2024-12-10T10:12:32.321Z" + updatedAt: "2024-12-10T10:12:32.321Z" + thresholds: + - minimumTurnover: + amount: "2000" + currency: "CZK" + discount: + percentage: "3" + - minimumTurnover: + amount: "3000" + currency: "CZK" + discount: + percentage: "5" + modifiedDiscount: + summary: Edited discount + value: + - marketplaceId: "allegro-business-cz" + status: "ACTIVE" + definitions: + - cumulatingFromDate: "2025-01-01" + cumulatingToDate: "2025-03-01" + spendingFromDate: "2025-02-01" + spendingToDate: "2025-04-01" + createdAt: "2024-12-10T10:12:32.321Z" + updatedAt: "2025-02-23T13:53:47.264Z" + thresholds: + - minimumTurnover: + amount: "2000" + currency: "CZK" + discount: + percentage: "3" + - minimumTurnover: + amount: "3000" + currency: "CZK" + discount: + percentage: "5" + - cumulatingFromDate: "2025-03-01" + cumulatingToDate: null + spendingFromDate: "2025-04-01" + spendingToDate: null + createdAt: "2025-02-23T13:53:47.264Z" + updatedAt: "2025-02-23T13:53:47.264Z" + thresholds: + - minimumTurnover: + amount: "3000" + currency: "CZK" + discount: + percentage: "4" + - minimumTurnover: + amount: "5000" + currency: "CZK" + discount: + percentage: "5" + deactivatingDiscount: + summary: Deactivating discount + value: + - marketplaceId: "allegro-business-cz" + status: "DEACTIVATING" + definitions: + - cumulatingFromDate: "2024-10-01" + cumulatingToDate: "2025-02-01" + spendingFromDate: "2024-11-01" + spendingToDate: "2025-03-01" + createdAt: "2024-09-17T10:12:32.321Z" + updatedAt: "2025-01-04T13:53:47.264Z" + thresholds: + - minimumTurnover: + amount: "2000" + currency: "CZK" + discount: + percentage: "3" + - minimumTurnover: + amount: "3000" + currency: "CZK" + discount: + percentage: "5" + noDiscount: + summary: Discount not defined + value: + - marketplaceId: "allegro-business-cz" + status: null + definitions: null + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + /sale/turnover-discount/{marketplaceId}/deactivate: + put: + tags: + - Rebates and promotions + summary: "Deactivate turnover discount for marketplace" + description: >- + Deactivate turnover discount for a given marketplace. Read more: PL / EN. + Currently, the only supported marketplace is `allegro-business-cz`. +
+ Turnover discount will stop being cumulated with the end of the current month. + Discount based on cumulated turnover will stop being applied with the end of the next month. + After that, the discount will be completely deactivated. +
+ When deactivating the discount that still has `ACTIVATING` status, turnover discount is deactivated immediately. + In that case, no turnover discount will start being cumulated with the new month. + operationId: deactivateTurnoverDiscountsUsingPUT + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + parameters: + - name: marketplaceId + in: path + description: Marketplace identifier. + required: true + schema: + type: string + responses: + '200': + description: Turnover discount for marketplace after deactivation + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TurnoverDiscountDto' + example: + marketplaceId: "allegro-business-cz" + status: "DEACTIVATING" + definitions: + - cumulatingFromDate: "2024-10-01" + cumulatingToDate: "2025-02-01" + spendingFromDate: "2024-11-01" + spendingToDate: "2025-03-01" + createdAt: "2024-09-17T10:12:32.321Z" + updatedAt: "2025-01-04T13:53:47.264Z" + thresholds: + - minimumTurnover: + amount: "2000" + currency: "CZK" + discount: + percentage: "3" + - minimumTurnover: + amount: "3000" + currency: "CZK" + discount: + percentage: "5" + '204': + description: Discount with `ACTIVATING` status was deactivated + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Marketplace not supported + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + /pricing/offer-fee-preview: + post: + tags: + - Pricing + summary: 'Calculate fee and commission for an offer' + description: + 'Provides information about fee and commission for an offer. This resource is limited to 25 requests per second for a single user. Read more: PL / EN.' + operationId: calculateFeePreviewUsingPOST + responses: + '200': + description: Fee calculated successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/FeePreviewResponse' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '422': + description: Unprocessable Entity + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PublicOfferPreviewRequest' + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offer-modification-commands/{commandId}: + put: + tags: + - Batch offer modification + summary: 'Batch offer modification' + description: + 'Use this resource to modify multiple offers at once. Read more: PL / EN. + This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute.' + operationId: modificationCommandUsingPUT + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + responses: + '201': + description: Command was registered + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GeneralReport' + '400': + description: Semantically incorrect request or provided conditions not correct + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '409': + description: Command id was already used + '422': + description: Unprocessable Entity + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferChangeCommand' + description: offerChangeCommandDto + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + get: + tags: + - Batch offer modification + summary: "Modification command summary" + description: + 'Use this resource to find out how many offers were edited within one {commandId}. You will receive a summary + with a number of successfully edited offers. Read more: PL / EN. + This resource is rate limited to retrieving information about 270 000 offer changes per minute.' + operationId: getGeneralReportUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + responses: + '200': + description: report was generated and successfully returned + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GeneralReport' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Command not found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offer-modification-commands/{commandId}/tasks: + get: + tags: + - Batch offer modification + summary: "Modification command detailed report" + description: + 'Use this resource to retrieve a detailed summary of changes introduced within one {commandId} (defaults: + limit = 100, offset = 0). Read more: PL / EN. + This resource is rate limited to retrieving information about 270 000 offer changes per minute.' + operationId: getTasksUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + - name: limit + in: query + description: The limit of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 100 + minimum: 1 + maximum: 1000 + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + maximum: 999 + responses: + '200': + description: Task status successfully returned + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TaskReport' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Command not found + '422': + description: Unprocessable Entity + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offer-price-change-commands/{commandId}: + put: + tags: + - Batch offer modification + summary: "Batch offer price modification" + operationId: priceModificationCommandUsingPUT + description: >- + Change price of offers. Read more: PL / EN. + This resource is rate limited to 150 000 offer changes per hour or 9000 offer changes per minute. + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + responses: + '201': + description: Command was registered + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GeneralReport' + '400': + description: Semantically incorrect request or provided conditions not correct + '401': + description: Unauthorized + '409': + description: Command id was already used + '422': + description: Unprocessable Entity + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferPriceChangeCommand' + description: offerPriceChangeCommandDto + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + get: + tags: + - Batch offer modification + summary: "Change price command summary" + description: + 'Returns status and summary of particular command execution. Read more: PL / EN. + This resource is rate limited to retrieving information about 270 000 offer changes per minute.' + operationId: getPriceModificationCommandStatusUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + responses: + '200': + description: report was generated and successfully returned + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GeneralReport' + '401': + description: Unauthorized + '404': + description: Command not found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offer-price-change-commands/{commandId}/tasks: + get: + tags: + - Batch offer modification + summary: "Change price command detailed report" + description: + 'Defaults: limit = 100, offset = 0. Read more: PL / EN. + This resource is rate limited to retrieving information about 270 000 offer changes per minute.' + operationId: getPriceModificationCommandTasksStatusesUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + - name: limit + in: query + description: The limit of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 100 + minimum: 1 + maximum: 1000 + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + maximum: 999 + responses: + '200': + description: Task status successfully returned + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TaskReport' + '401': + description: Unauthorized + '404': + description: Command not found + '422': + description: Unprocessable Entity + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offer-quantity-change-commands/{commandId}: + put: + tags: + - Batch offer modification + summary: "Batch offer quantity modification" + description: >- + Change quantity of multiple offers. Read more: PL / EN. + This resource is rate limited to 250 000 offer changes per hour or 9000 offer changes per minute - limit applies to a single user of the application. + operationId: quantityModificationCommandUsingPUT + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + responses: + '201': + description: Command was registered + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GeneralReport' + '400': + description: Semantically incorrect request or provided conditions not correct + '401': + description: Unauthorized + '409': + description: Command id was already used + '422': + description: Unprocessable Entity + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferQuantityChangeCommand' + description: offerQuantityChangeCommandDto + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + get: + tags: + - Batch offer modification + summary: "Change quantity command summary" + description: + 'Returns status and summary of the command. Read more: PL / EN. + This resource is rate limited to retrieving information about 270 000 offer changes per minute.' + operationId: getQuantityModificationCommandStatusUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + responses: + '200': + description: Report was generated and successfully returned + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GeneralReport' + '401': + description: Unauthorized + '404': + description: Command not found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offer-quantity-change-commands/{commandId}/tasks: + get: + tags: + - Batch offer modification + summary: 'Change quantity command detailed report' + description: + 'Defaults: limit = 100, offset = 0. Read more: PL / EN. + This resource is rate limited to retrieving information about 270 000 offer changes per minute.' + operationId: getQuantityModificationCommandTasksStatusesUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + - name: limit + in: query + description: The limit of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 100 + minimum: 1 + maximum: 1000 + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + maximum: 999 + responses: + '200': + description: Task status successfully returned + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TaskReport' + '401': + description: Unauthorized + '404': + description: Command not found + '422': + description: Unprocessable Entity + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offer-price-automation-commands: + post: + tags: + - Batch offer modification + summary: "Batch offer automatic pricing rules modification" + description: + 'Use this resource to modify the automatic pricing rules of multiple offers at the same time. Read more: PL / EN. + This resource is rate limited to 150 000 offer changes per hour or 9000 offer changes per minute.' + operationId: offerAutomaticPricingModificationCommandUsingPOST + responses: + '201': + description: Command was registered + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GeneralReport' + '400': + description: Semantically incorrect request or provided conditions not correct + '401': + description: Unauthorized + '403': + description: Forbidden + '409': + description: Command id was already used + '422': + description: Unprocessable Entity + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferAutomaticPricingCommand' + description: OfferAutomaticPricingCommand + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offer-price-automation-commands/{commandId}: + get: + tags: + - Batch offer modification + summary: "Automatic pricing command summary" + description: + 'Returns status and summary of the offer-price-automation-command. Read more: PL / EN. + This resource is rate limited to retrieving information about 270 000 offer changes per minute.' + operationId: getofferAutomaticPricingModificationCommandStatusUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + responses: + '200': + description: report was generated and successfully returned + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GeneralReport' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Command not found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offer-price-automation-commands/{commandId}/tasks: + get: + tags: + - Batch offer modification + summary: 'Automatic pricing command detailed report' + description: + 'Defaults: limit = 100, offset = 0. Returns status and report of the offer-price-automation-command. Read more: PL / EN. + This resource is rate limited to retrieving information about 270 000 offer changes per minute.' + operationId: getofferAutomaticPricingModificationCommandTasksStatusesUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + - name: limit + in: query + description: The limit of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 100 + minimum: 1 + maximum: 1000 + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + maximum: 999 + responses: + '200': + description: Task status successfully returned + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TaskReport' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Command not found + '422': + description: Unprocessable Entity + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + '/sale/price-automation/rules': + get: + tags: + - Automatic pricing + summary: "Get automatic pricing rules" + description: + 'Use this resource to get automatic pricing rules. + Rules with property **default** set to **true** are default rules created by Allegro for each merchant. + This resource is rate limited to 5 requests per second. Read more: PL / EN.' + operationId: getAutomaticPricingRulesUsingGET + responses: + '200': + description: The list of automatic pricing rules returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AutomaticPricingRulesResponse' + example: + rules: + - id: "a41c73feaef0a8281a3d11f8" + type: "FOLLOW_BY_ALLEGRO_MIN_PRICE" + name: "Lowest price on Allegro" + default: true + updatedAt: "2023-03-23T15:45:02Z" + - id: "b41c73feaef0a8281a3d11f8" + type: "FOLLOW_BY_MARKET_MIN_PRICE" + name: "Lowest price on market" + default: true + updatedAt: "2023-03-23T15:45:02Z" + - id: "c41c73feaef0a8281a3d11f8" + type: "EXCHANGE_RATE" + name: "Price Converter" + default: true + updatedAt: "2023-03-23T15:45:02Z" + - id: "67cae610a9cbfa768ca5c17a" + type: "FOLLOW_BY_TOP_OFFER_PRICE" + name: "Top offer" + default: true + updatedAt: "2023-03-23T15:45:02Z" + '401': + description: Unauthorized + '403': + description: Forbidden + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + post: + tags: + - Automatic pricing + summary: "Post automatic pricing rule" + description: + 'Use this resource to create automatic pricing rule. + This resource is rate limited to 5 requests per second. Read more: PL / EN.' + operationId: createAutomaticPricingRulesUsingPost + requestBody: + description: The automatic pricing rule. + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AutomaticPricingRulePostRequest' + examples: + without-configuration: + summary: Without configuration + value: + name: "My price on Allegro" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + change-by-percentage: + summary: With change by percentage configuration + value: + name: "My price on Allegro +10%" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + configuration: + changeByPercentage: + operation: ADD + value: '10' + change-by-amount: + summary: With change by amount configuration + value: + name: "My price on Allegro + 10PLN, 2EUR" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + configuration: + changeByAmount: + operation: ADD + values: + - currency: "PLN" + amount: "10.00" + - currency: "EUR" + amount: "2.00" + responses: + '201': + description: The automatic pricing rules created. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AutomaticPricingRuleResponse' + examples: + without-configuration: + summary: Without configuration + value: + id: "641c73feaef0a8281a3d11f8" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + name: "My price on Allegro" + default: false + updatedAt: "2023-03-23T15:45:02Z" + change-by-percentage: + summary: With change by percentage configuration + value: + id: "641c73feaef0a8281a3d11f7" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + name: "My price on Allegro +10%" + default: false + configuration: + changeByPercentage: + operation: ADD + value: '10' + updatedAt: "2023-03-23T15:45:02Z" + change-by-amount: + summary: With change by amount configuration + value: + id: "641c73feaef0a8281a3d11f6" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + name: "My price on Allegro + 10PLN, 2EUR" + default: false + configuration: + changeByAmount: + operation: ADD + values: + - currency: "PLN" + amount: "10.00" + - currency: "EUR" + amount: "2.00" + updatedAt: "2023-03-23T15:45:02Z" + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '409': + description: 'Conflict - rule with that name already exists for this seller' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + '/sale/price-automation/rules/{ruleId}': + get: + tags: + - Automatic pricing + summary: "Get automatic pricing rule by id" + description: + 'Use this resource to get automatic pricing rule by id. + Rules with property **default** set to **true** are default rules created by Allegro for each merchant and cannot be modified. + This resource is rate limited to 5 requests per second. Read more: PL / EN.' + operationId: getAutomaticPricingRuleByIdUsingGET + parameters: + - name: ruleId + in: path + description: The rule identifier. + required: true + schema: + type: string + example: "66466e2b07ba0029b829f08d" + responses: + '200': + description: The automatic pricing rule returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AutomaticPricingRuleResponse' + examples: + without-configuration: + summary: Without configuration + value: + id: "641c73feaef0a8281a3d11f5" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + name: "My price on Allegro" + default: false + updatedAt: "2023-03-23T15:45:02Z" + change-by-percentage: + summary: With change by percentage configuration + value: + id: "641c73feaef0a8281a3d11f4" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + name: "My price on Allegro plus 10%" + default: false + configuration: + changeByPercentage: + operation: ADD + value: '10' + updatedAt: "2023-03-23T15:45:02Z" + change-by-amount: + summary: With change by amount configuration + value: + id: "641c73feaef0a8281a3d11f3" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + name: "My price on Allegro + 10PLN, 2EUR" + default: false + configuration: + changeByAmount: + operation: ADD + values: + - currency: "PLN" + amount: "10.00" + - currency: "EUR" + amount: "2.00" + updatedAt: "2023-03-23T15:45:02Z" + '401': + description: Unauthorized + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + put: + tags: + - Automatic pricing + summary: "Edit automatic pricing rule" + description: + 'Use this resource to update automatic pricing rule. + This resource is rate limited to 5 requests per second. Read more: PL / EN.' + operationId: updateAutomaticPricingRuleUsingPut + parameters: + - name: ruleId + in: path + description: The rule identifier. + required: true + schema: + type: string + example: "66466e2b07ba0029b829f08d" + requestBody: + description: The automatic pricing rule. + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AutomaticPricingRulePutRequest' + examples: + without-configuration: + summary: Without configuration + value: + name: "My price on Allegro" + change-by-percentage: + summary: With change by percentage configuration + value: + name: "My price on Allegro + 10%" + configuration: + changeByPercentage: + operation: ADD + value: '10' + change-by-amount: + summary: With change by amount configuration + value: + name: "My price on Allegro + 10PLN, 2EUR" + configuration: + changeByAmount: + operation: ADD + values: + - currency: "PLN" + amount: "10.00" + - currency: "EUR" + amount: "2.00" + responses: + '200': + description: The automatic pricing rule updated. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AutomaticPricingRuleResponse' + examples: + without-configuration: + summary: Without configuration + value: + id: "641c73feaef0a8281a3d11c8" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + name: "My price on Allegro" + default: false + updatedAt: "2023-03-23T15:45:02Z" + change-by-percentage: + summary: With change by percentage configuration + value: + id: "641c73feaef0a8281a3d11c7" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + name: "My price on Allegro plus 10%" + default: false + configuration: + changeByPercentage: + operation: ADD + value: '10' + updatedAt: "2023-03-23T15:45:02Z" + change-by-amount: + summary: With change by amount configuration + value: + id: "641c73feaef0a8281a3d11c6" + type: FOLLOW_BY_ALLEGRO_MIN_PRICE + name: "My price on Allegro + 10PLN, 2EUR" + default: false + configuration: + changeByAmount: + operation: ADD + values: + - currency: "PLN" + amount: "10.00" + - currency: "EUR" + amount: "2.00" + updatedAt: "2023-03-23T15:45:02Z" + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '409': + description: 'Conflict - rule with that name already exists for this seller' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + delete: + tags: + - Automatic pricing + summary: "Delete automatic pricing rule" + description: + 'Use this resource to delete automatic pricing rule. + This resource is rate limited to 5 requests per second. Read more: PL / EN.' + operationId: deleteAutomaticPricingRuleUsingDelete + parameters: + - name: ruleId + in: path + description: The rule identifier. + required: true + schema: + type: string + example: "66466e2b07ba0029b829f08d" + responses: + '204': + description: The automatic pricing rules deleted. + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + '/sale/price-automation/offers/{offerId}/rules': + get: + tags: + - Automatic pricing + summary: "Get automatic pricing rules assigned to the offer" + description: + 'Use this resource to get automatic pricing rules for offer. + This resource is rate limited to 5 requests per second. Read more: PL / EN.' + operationId: getAutomaticPricingRulesForOfferUsingGET + parameters: + - name: offerId + in: path + description: The offer identifier. + required: true + schema: + type: string + example: "15521818197" + responses: + '200': + description: The list of automatic pricing rules assigned to offer returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferRules' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/categories: + get: + tags: + - Categories and parameters + summary: 'Get IDs of Allegro categories' + description: >- + Use this resource to traverse the Allegro categories tree. It returns the list of the given category's children + or a list of the main Allegro categories. Read more: PL / EN. + operationId: getCategoriesUsingGET + security: + - bearer-token-for-application: [] + - bearer-token-for-user: [] + parameters: + - name: parent.id + in: query + description: >- + The ID of the category which children should be returned. If omitted, the list of main Allegro categories + will be returned. + example: "954b95b6-43cf-4104-8354-dea4d9b10ddf" + required: false + schema: + type: string + default: "954b95b6-43cf-4104-8354-dea4d9b10ddf" + responses: + '200': + description: The list of categories returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CategoriesDto' + '404': + description: The category with the given ID does not exist. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '/sale/categories/{categoryId}': + get: + tags: + - Categories and parameters + summary: 'Get a category by ID' + description: >- + Use this resource to get the details of a specific category. Read more: PL / EN. + operationId: getCategoryUsingGET_1 + security: + - bearer-token-for-application: [] + - bearer-token-for-user: [] + parameters: + - name: categoryId + in: path + description: The category ID. + required: true + schema: + type: string + example: "6061" + responses: + '200': + description: The details of a category returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CategoryDto' + '404': + description: The category with the given ID does not exist. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '/sale/categories/{categoryId}/parameters': + get: + tags: + - Categories and parameters + summary: 'Get parameters supported by a category' + description: >- + Use this resource to get the list of parameters that are supported by the given category. + Read more: PL / EN. + operationId: getFlatParametersUsingGET_2 + security: + - bearer-token-for-application: [] + - bearer-token-for-user: [] + parameters: + - name: categoryId + in: path + description: The category ID. + required: true + schema: + type: string + example: "709" + responses: + '200': + description: The list of parameters for the category returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CategoryParameterList' + examples: + integer: + summary: Integer + value: + parameters: + - id: "202877" + name: "Liczba rdzeni procesora" + type: "integer" + required: true + requiredForProduct: false + requiredIf: + parametersWithValue: + - id: "202870" + oneOfValueIds: ["202870_1"] + parametersWithoutValue: [] + displayedIf: + parametersWithValue: + - id: "202870" + oneOfValueIds: ["202870_1", "202870_2"] + unit: null + options: + variantsAllowed: true + variantsEqual: false + ambiguousValueId: null + dependsOnParameterId: "202870" + describesProduct: false + customValuesEnabled: false + restrictions: + min: 0 + max: 1000000 + range: false + string_single: + summary: String single + value: + parameters: + - id: "224017" + name: "Kod producenta" + type: "string" + required: true + requiredForProduct: true + requiredIf: + parametersWithValue: + - id: "202870" + oneOfValueIds: ["202870_1"] + parametersWithoutValue: [] + displayedIf: + parametersWithValue: + - id: "202870" + oneOfValueIds: ["202870_1", "202870_2"] + unit: null + options: + variantsAllowed: false + variantsEqual: false + ambiguousValueId: null + dependsOnParameterId: "202870" + describesProduct: false + customValuesEnabled: false + restrictions: + minLength: 2 + maxLength: 35 + allowedNumberOfValues: 1 + dictionary: + summary: Dictionary + value: + parameters: + - id: "11323" + name: "Stan" + type: "dictionary" + required: true + requiredForProduct: false + requiredIf: + parametersWithValue: + - id: "202870" + oneOfValueIds: ["202870_1"] + parametersWithoutValue: [] + displayedIf: + parametersWithValue: + - id: "202870" + oneOfValueIds: ["202870_1", "202870_2"] + unit: null + options: + variantsAllowed: false + variantsEqual: true + ambiguousValueId: null + dependsOnParameterId: "202870" + describesProduct: false + customValuesEnabled: false + dictionary: + - id: "11323_1" + value: "Nowy" + dependsOnValueIds: + - "202870_1" + - id: "11323_2" + value: "Używany" + dependsOnValueIds: + - "202870_2" + - id: "11323_238066" + value: "Po zwrocie" + dependsOnValueIds: + - "202870_1" + - "202870_2" + - id: "11323_238058" + value: "Powystawowy" + dependsOnValueIds: + - "202870_1" + - id: "11323_238062" + value: "Uszkodzony" + dependsOnValueIds: + - "202870_1" + - id: "11323_246534" + value: "Odnowiony przez producenta" + dependsOnValueIds: + - "202870_2" + restrictions: + multipleChoices: false + float: + summary: Float + value: + parameters: + - id: "17448" + name: "Waga (z opakowaniem)" + type: "float" + required: true + requiredForProduct: false + requiredIf: + parametersWithValue: + - id: "202870" + oneOfValueIds: ["202870_1"] + parametersWithoutValue: [] + displayedIf: + parametersWithValue: + - id: "202870" + oneOfValueIds: ["202870_1", "202870_2"] + unit: "kg" + options: + variantsAllowed: false + variantsEqual: false + ambiguousValueId: null + dependsOnParameterId: "202870" + describesProduct: false + customValuesEnabled: false + restrictions: + min: 0 + max: 1000000 + range: false + precision: 3 + float_range: + summary: Float range + value: + parameters: + - id: "211966" + name: "Zakres regulacji wysokości koszenia" + type: "float" + required: true + requiredForProduct: false + requiredIf: + parametersWithValue: + - id: "202870" + oneOfValueIds: ["202870_1"] + parametersWithoutValue: [] + displayedIf: + parametersWithValue: + - id: "202870" + oneOfValueIds: ["202870_1", "202870_2"] + unit: "cm" + options: + variantsAllowed: false + variantsEqual: false + ambiguousValueId: null + dependsOnParameterId: "202870" + describesProduct: true + customValuesEnabled: false + restrictions: + min: 0 + max: 1000 + range: true + precision: 2 + '404': + description: The category with the given ID does not exist. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '/sale/categories/{categoryId}/product-parameters': + get: + tags: + - Products + summary: 'Get product parameters available in given category' + description: >- + Use this resource to get the list of product parameters available in given category. + You can use these parameters to create a new product. + Read more: PL / EN. + operationId: getFlatProductParametersUsingGET + security: + - bearer-token-for-application: [] + - bearer-token-for-user: [] + parameters: + - name: categoryId + in: path + description: The category ID. + required: true + schema: + type: string + example: "709" + responses: + '200': + description: 'The list of product parameters for the category returned successfully.' + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CategoryProductParameterList' + examples: + integer: + summary: Integer + value: + parameters: + - id: "202877" + name: "Liczba rdzeni procesora" + type: "integer" + required: false + unit: null + restrictions: + min: 0 + max: 1000000 + range: false + string_single: + summary: String single + value: + parameters: + - id: "224017" + name: "Kod producenta" + type: "string" + required: false + unit: null + restrictions: + minLength: 2 + maxLength: 35 + allowedNumberOfValues: 1 + dictionary: + summary: Dictionary + value: + parameters: + - id: "11323" + name: "Stan" + type: "dictionary" + required: false + unit: null + dictionary: + - id: "11323_1" + value: "Nowy" + - id: "11323_2" + value: "Używany" + - id: "11323_238066" + value: "Po zwrocie" + - id: "11323_238058" + value: "Powystawowy" + - id: "11323_238062" + value: "Uszkodzony" + - id: "11323_246534" + value: "Odnowiony przez producenta" + restrictions: + multipleChoices: false + float: + summary: Float + value: + parameters: + - id: "17448" + name: "Waga (z opakowaniem)" + type: "float" + required: false + unit: "kg" + restrictions: + min: 0 + max: 1000000 + range: false + precision: 3 + float_range: + summary: Float range + value: + parameters: + - id: "211966" + name: "Zakres regulacji wysokości koszenia" + type: "float" + required: false + unit: "cm" + restrictions: + min: 0 + max: 1000 + range: true + precision: 2 + '404': + description: The category with the given ID does not exist. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '/sale/category-parameters-scheduled-changes': + get: + tags: + - Categories and parameters + summary: 'Get planned changes in category parameters' + description: >- + Use this resource to get information about planned changes in category parameters. + Please note that in some cases, the returned events may finally not happen in the future. + + At present we support the following changes: + - REQUIREMENT_CHANGE - the parameter will be required in the category. Read more: PL / EN. + + operationId: getCategoryParametersScheduledChangesUsingGET_1 + security: + - bearer-token-for-application: [] + - bearer-token-for-user: [] + parameters: + - name: scheduledFor.gte + in: query + description: >- + The minimum date and time from which the change will be effective from in ISO 8601 format. + Should be greater than the current date time and less than 3 months from the current date. + example: "2020-11-13T12:45:20.818Z" + required: false + schema: + type: string + format: date-time + - name: scheduledFor.lte + in: query + description: >- + The maximum date and time from which the change will be effective from in ISO 8601 format. + Should be greater than the current date time and less than 3 months from the current date. + required: false + example: "2020-11-13T12:45:20.818Z" + schema: + type: string + format: date-time + - name: scheduledAt.gte + in: query + description: >- + The minimum date and time at which the change was scheduled in ISO 8601 format. + example: "2020-11-13T12:45:20.818Z" + required: false + schema: + type: string + format: date-time + - name: scheduledAt.lte + in: query + description: >- + The maximum date and time at which the change was scheduled in ISO 8601 format. + required: false + example: "2020-11-13T12:45:20.818Z" + schema: + type: string + format: date-time + - in: query + name: type + required: false + description: >- + The types of changes that will be returned in the response. All types of changes are returned by default. + schema: + type: array + items: + type: string + enum: + - REQUIREMENT_CHANGE + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + - name: limit + in: query + description: The limit of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 100 + minimum: 1 + maximum: 1000 + responses: + '200': + description: Category parameters changes returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CategoryParametersScheduledChangesResponse' + examples: + CategoryParameterChange: + summary: Category parameter requirement change + value: + scheduledChanges: + - scheduledAt: "2019-06-26T15:26:43.891Z" + scheduledFor: "2019-07-26T15:26:43.891Z" + type: "REQUIREMENT_CHANGE" + category: + id: "165" + parameter: + id: "11323" + '400': + description: Invalid parameters supplied in the request. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/AuthError' + /sale/category-events: + get: + tags: + - Categories and parameters + summary: 'Get changes in categories' + description: >- + Use this resource to get information about changes in categories. It returns changes that occurred in the last 3 months. + + At present we support the following changes: + - CATEGORY_CREATED - new category was created. + - CATEGORY_RENAMED - category name has been changed. + - CATEGORY_MOVED - category has been moved to a different place in category tree, category parent id field is changed. + - CATEGORY_DELETED - category is no longer available, category from redirectCategory field should be used instead. + + Read more: PL / EN. + + operationId: getCategoryEventsUsingGET_1 + security: + - bearer-token-for-application: [] + - bearer-token-for-user: [] + parameters: + - in: query + name: from + required: false + description: The ID of the last seen event. Changes that occurred after the given event will be returned. + schema: + type: string + example: "MTEzMjQzODU3NA" + maxLength: 256 + - in: query + name: limit + required: false + description: The number of events that will be returned in the response. + schema: + type: integer + default: 100 + minimum: 1 + maximum: 1000 + - in: query + name: type + required: false + description: >- + The types of events that will be returned in the response. All types of events are returned by default. + schema: + type: array + items: + type: string + example: CATEGORY_CREATED + enum: + - CATEGORY_CREATED + - CATEGORY_RENAMED + - CATEGORY_MOVED + - CATEGORY_DELETED + responses: + '200': + description: The list of category changes returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CategoryEventsResponse' + examples: + CategoryCreatedEvent: + summary: Category created event + value: + events: + - id: "MTEzMjQzODU3NA" + occurredAt: "2019-06-26T15:26:43.891Z" + type: "CATEGORY_CREATED" + category: + id: "165" + name: "Smartphones and Cell Phones" + parent: + id: "4" + leaf: false + CategoryRenamedEvent: + summary: Category renamed event + value: + events: + - id: "MTEzMjQzODU3NA" + occurredAt: "2019-06-26T15:26:43.891Z" + type: "CATEGORY_RENAMED" + category: + id: "165" + name: "Smartphones and Cell Phones Renamed" + parent: + id: "4" + leaf: false + CategoryMovedEvent: + summary: Category moved event + value: + events: + - id: "MTEzMjQzODU3NA" + occurredAt: "2019-06-26T15:26:43.891Z" + type: "CATEGORY_MOVED" + category: + id: "165" + name: "Smartphones and Cell Phones" + parent: + id: "7" + leaf: false + CategoryDeletedEvent: + summary: Category deleted event + value: + events: + - id: "MTEzMjQzODU3NA" + occurredAt: "2019-06-26T15:26:43.891Z" + type: "CATEGORY_DELETED" + category: + id: "165" + name: "Smartphones and Cell Phones" + parent: + id: "4" + leaf: false + redirectCategory: + id: "7" + '400': + description: Invalid parameters supplied in the request. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/AuthError' + /sale/offer-additional-services/categories: + get: + tags: + - Additional services + summary: "Get the additional services definitions by categories" + description: + 'Use this resource to get additional services definitions, grouped by additional services categories, available on given marketplace. Read more: PL / EN.' + operationId: getListOfAdditionalServicesDefinitionsCategoriesUsingGET + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CategoriesResponse' + '401': + description: Unauthorized + '403': + description: Forbidden + /sale/shipping-rates: + get: + tags: + - Delivery + summary: "Get the user's shipping rates" + description: + 'Use this resource to get a list of seller''s shipping rates. Read more: PL / EN.' + operationId: getListOfShippingRatestUsingGET + parameters: + - name: marketplace + in: query + description: Allows to filter shipping rates by marketplace that they are qualified for. + example: "allegro-cz" + required: false + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + type: object + properties: + shippingRates: + type: array + items: + type: object + properties: + id: + type: string + description: Shipping rate ID. + name: + type: string + description: User defined name of the shipping rates set. + marketplaces: + type: array + items: + type: object + properties: + id: + type: string + description: Marketplace ID. + description: List of marketplace ids where these shipping rates are qualified for. The list is calculated based on the delivery methods added to the shipping rates. + examples: + response: + value: + shippingRates: + - id: 758fcd59-fbfa-4453-ae07-4800d72c2ca0 + name: Cennik z wysyłką do Czech + marketplaces: + - id: "allegro-pl" + - id: "allegro-cz" + '401': + description: Authentication required + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + post: + tags: + - Delivery + summary: "Create a new shipping rates set" + description: + 'Use this resource to create a new seller''s shipping rates set. Read more: PL / EN.' + operationId: createShippingRatesSetUsingPOST + requestBody: + description: Shipping rates set + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ShippingRatesSet' + responses: + '201': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ShippingRatesSet" + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '401': + description: Authentication required + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '422': + description: The user has reached the limit of shipping rates sets. Information on the limit will be returned in the error message. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /sale/shipping-rates/{id}: + get: + tags: + - Delivery + summary: 'Get the details of a shipping rates set' + description: + 'Use this resource to get details of the given shipping rates set. Read more: PL / EN.' + operationId: getShippingRatesSetUsingGET + parameters: + - name: id + in: path + description: Shipping rates set identifier. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ShippingRatesSet" + examples: + response: + value: + id: 758fcd59-fbfa-4453-ae07-4800d72c2ca6 + name: Mój cennik + rates: + - deliveryMethod: + id: 758fcd59-fbfa-4453-ae07-4800d72c2ca5 + maxQuantityPerPackage: 6 + maxPackageWeight: + value: '19.000' + unit: 'KILOGRAM' + firstItemRate: + amount: '12.00' + currency: PLN + nextItemRate: + amount: '2.50' + currency: PLN + shippingTime: + from: P1D + to: P20D + lastModified: '2018-04-05T12:20:23.974Z' + '401': + description: Authentication required + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Shipping rates set with given ID not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + put: + tags: + - Delivery + summary: "Edit a user's shipping rates set" + description: + 'Use this resource to edit a new seller''s shipping rates set. Read more: PL / EN.' + operationId: modifyShippingRatesSetUsingPUT + parameters: + - name: id + in: path + description: Shipping rates set identifier. + required: true + schema: + type: string + requestBody: + description: Shipping rates set + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ShippingRatesSet" + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ShippingRatesSet" + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Authentication required + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Set with given id does not exist + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /sale/delivery-settings: + get: + tags: + - Delivery + summary: "Get the user's delivery settings" + description: >- + Use this resource to get the delivery settings declared by the seller. Read more: PL / EN. + operationId: getSaleDeliverySettings + parameters: + - name: marketplace.id + in: query + description: >- + Marketplace for which delivery settings will be returned. + By default (if the marketplace parameter is not set) the marketplace on which the seller has registered is used. + However, we recommend that the marketplace.id query parameter should always be explicitly set. + example: allegro-pl + required: false + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/DeliverySettingsResponse' + '401': + description: Authentication required. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden - not allowed to access user data. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity - not supported marketplace. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + put: + tags: + - Delivery + summary: "Modify the user's delivery settings" + description: >- + Use this resource to modify the delivery settings declared by the seller. Read more: PL / EN. + operationId: putSaleDeliverySettings + requestBody: + description: Delivery settings set + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/DeliverySettingsRequest" + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/DeliverySettingsResponse' + '401': + description: Authentication required. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden - not allowed to access user data. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity - wrong amount, wrong currency, wrong join policy strategy, unsupported marketplace, attempt to modify marketplace allegro-business-* - modifying the settings for such a marketplace should be done by modifying the allegro-* marketplace. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /points-of-service: + post: + tags: + - Points of service + summary: 'Create a point of service' + description: + 'Use this resource to create a point of service. Read more: PL / EN.' + operationId: createPOSUsingPOST + responses: + '201': + description: Created + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Pos' + '400': + description: Bad Request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '409': + description: Conflict - similar Point of Service already exists. Url of the existing POS is provided in the HTTP Location header field of the response. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + $ref: '#/components/requestBodies/Pos' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + get: + tags: + - Points of service + summary: "Get the user's points of service" + description: + 'Use this resource to get a list of points of service by seller ID. Read more: PL / EN.' + operationId: getPOSListUsingGET + parameters: + - name: seller.id + in: query + description: User identifier. + example: "29324" + required: true + schema: + type: string + - name: countryCode + in: query + description: Country code identifier in ISO format. In case of incorrect or unsupported country code, empty list is returned. If missing, list of all defined points is returned. If present, correct and supported, list of all points with given country code for the user is returned. + example: "PL" + required: false + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SearchResult' + '401': + description: Unauthorized + '404': + description: Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + /points-of-service/{id}: + get: + tags: + - Points of service + summary: "Get the details of a point of service" + description: + 'Use this resource to get a details of a point of service for a given ID. Read more: PL / EN.' + operationId: getPOSDataUsingGET + parameters: + - name: id + in: path + description: Point of service ID. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Pos' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + put: + tags: + - Points of service + summary: 'Modify a point of service' + description: + 'Use this resource to modify a point of service. Read more: PL / EN.' + operationId: modifyPOSUsingPUT + parameters: + - name: id + in: path + description: >- + Point of service ID. Must match values with 'id' property from the + body. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Pos' + '400': + description: Bad Request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '409': + description: Conflict - similar Point of Service already exists. Url of the existing POS is provided in the HTTP Location header field of the response. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + $ref: '#/components/requestBodies/Pos' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + delete: + tags: + - Points of service + summary: 'Delete a point of service' + description: + 'Use this resource to delete a point of service. Read more: PL / EN.' + operationId: deletePOSUsingDELETE + parameters: + - name: id + in: path + description: Point of service ID. + required: true + schema: + type: string + responses: + '204': + description: No content + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /sale/offer-contacts: + post: + tags: + - Contacts + summary: 'Create a new contact' + description: + 'Use this resource to create a new contact. Read more: PL / EN.' + operationId: createContactUsingPOST + responses: + '201': + description: Created + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ContactResponse' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Unprocessable Entity + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ContactRequest' + description: New contact + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + get: + tags: + - Contacts + summary: "Get the user's contacts" + description: + 'Use this resource to get details of many contacts. Read more: PL / EN.' + operationId: getListOfContactsUsingGET + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ContactResponseList' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + /sale/offer-contacts/{id}: + get: + tags: + - Contacts + summary: "Get contact details" + description: + 'Use this resource to get contact details. Read more: PL / EN.' + operationId: getContactUsingGET + parameters: + - name: id + in: path + description: Contact identifier. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ContactResponse' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + put: + tags: + - Contacts + summary: "Modify contact details" + description: + 'Use this resource to modify contact details. Read more: PL / EN.' + operationId: modifyContactUsingPUT + parameters: + - name: id + in: path + description: Contact identifier. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ContactResponse' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '422': + description: Unprocessable Entity + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ContactRequest' + description: Contact + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /sale/responsible-persons: + get: + tags: + - Responsible persons + summary: "Get the list of responsible persons" + description: + 'Use this resource to get a list of responsible persons for the compliance of the product with EU regulations. Read more: PL / EN.' + operationId: responsiblePersonsGET + parameters: + - name: offset + in: query + description: Index of first returned responsible persons data from all search results. + required: false + schema: + type: integer + default: 0 + minimum: 0 + maximum: 16000 + - name: limit + in: query + description: Number of returned responsible persons data. + required: false + schema: + type: integer + default: 1000 + minimum: 1 + maximum: 1000 + - name: Accept + in: header + description: Acceptable representation of the response. + required: true + example: "application/vnd.allegro.public.v1+json" + schema: + type: string + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + type: object + properties: + responsiblePersons: + type: array + items: + $ref: '#/components/schemas/ResponsiblePersonResponse' + count: + type: integer + format: int32 + minimum: 0 + description: Number of responsible persons data returned in search result for the given parameters. + example: 1 + totalCount: + type: integer + format: int32 + minimum: 0 + description: Total number of available responsible persons data. + example: 1 + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + post: + tags: + - Responsible persons + summary: "Create responsible person" + description: + 'Use this resource to create a new responsible person for the compliance of the product with EU regulations. Read more: PL / EN.' + operationId: responsiblePersonsPOST + parameters: + - name: Accept + in: header + description: Acceptable representation of the response. + required: true + example: "application/vnd.allegro.public.v1+json" + schema: + type: string + - name: Content-Type + in: header + description: Content type of the request body. + required: true + example: "application/vnd.allegro.public.v1+json" + schema: + type: string + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ResponsiblePersonResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CreateResponsiblePersonRequest' + required: true + /sale/responsible-persons/{id}: + put: + tags: + - Responsible persons + summary: "Update responsible person" + description: + 'Use this resource to update the responsible person for the compliance of the product with EU regulations. Read more: PL / EN.' + operationId: responsiblePersonsPUT + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + parameters: + - name: id + in: path + description: Responsible person ID. + required: true + schema: + type: string + format: uuid + - name: Accept + in: header + description: Acceptable representation of the response. + required: true + example: "application/vnd.allegro.public.v1+json" + schema: + type: string + - name: Content-Type + in: header + description: Content type of the request body. + required: true + example: "application/vnd.allegro.public.v1+json" + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ResponsiblePersonResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/UpdateResponsiblePersonRequest' + required: true + /sale/responsible-producers: + get: + tags: + - Responsible producers + summary: "Get the list of responsible producers" + description: + 'Use this resource to get a list of responsible producers for the compliance of the product with EU regulations. Read more: PL / EN.' + operationId: responsibleProducersGET + parameters: + - name: offset + in: query + description: Index of first returned responsible producers data from all search results. + required: false + schema: + type: integer + default: 0 + minimum: 0 + maximum: 50000 + - name: limit + in: query + description: Number of returned responsible producers data. + required: false + schema: + type: integer + default: 1000 + minimum: 1 + maximum: 1000 + - name: Accept + in: header + description: Acceptable representation of the response. + required: true + example: "application/vnd.allegro.public.v1+json" + schema: + type: string + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + type: object + properties: + responsibleProducers: + type: array + items: + $ref: '#/components/schemas/ResponsibleProducerResponse' + count: + type: integer + format: int32 + minimum: 0 + description: Number of responsible producers data returned in search result for the given parameters. + example: 1 + totalCount: + type: integer + format: int32 + minimum: 0 + description: Total number of available responsible producers data. + example: 1 + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + post: + tags: + - Responsible producers + summary: "Create responsible producer" + description: + 'Use this resource to create a new responsible producer for the compliance of the product with EU regulations. Read more: PL / EN.' + operationId: responsibleProducersPOST + parameters: + - name: Accept + in: header + description: Acceptable representation of the response. + required: true + example: "application/vnd.allegro.public.v1+json" + schema: + type: string + - name: Content-Type + in: header + description: Content type of the request body. + required: true + example: "application/vnd.allegro.public.v1+json" + schema: + type: string + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + responses: + '201': + description: Created + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ResponsibleProducerResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CreateResponsibleProducerRequest' + required: true + /sale/responsible-producers/{id}: + get: + tags: + - Responsible producers + summary: "Get responsible producer" + description: + 'Use this resource to get a responsible producer for the compliance of the product with EU regulations. Read more: PL / EN.' + operationId: responsibleProducerGET + parameters: + - name: id + in: path + description: Responsible producer ID. + required: true + schema: + type: string + format: uuid + - name: Accept + in: header + description: Acceptable representation of the response. + required: true + example: "application/vnd.allegro.public.v1+json" + schema: + type: string + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ResponsibleProducerResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + put: + tags: + - Responsible producers + summary: "Update responsible producer" + description: + 'Use this resource to update the responsible producer for the compliance of the product with EU regulations. Read more: PL / EN.' + operationId: responsibleProducersPUT + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + parameters: + - name: id + in: path + description: Responsible producer ID. + required: true + schema: + type: string + format: uuid + - name: Accept + in: header + description: Acceptable representation of the response. + required: true + example: "application/vnd.allegro.public.v1+json" + schema: + type: string + - name: Content-Type + in: header + description: Content type of the request body. + required: true + example: "application/vnd.allegro.public.v1+json" + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ResponsibleProducerResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/UpdateResponsibleProducerRequest' + required: true + /sale/delivery-methods: + get: + tags: + - Delivery + summary: "Get the list of delivery methods" + description: + 'Use this resource to get a list of all delivery methods currently available on the platform, as well as those that have already been discontinued. Read more: PL / EN.' + operationId: getListOfDeliveryMethodsUsingGET + parameters: + - name: marketplace + in: query + description: Allows to filter delivery methods by marketplace id. + example: "allegro-pl" + required: false + schema: + type: string + security: + - bearer-token-for-application: [] + - bearer-token-for-user: [] + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + type: object + properties: + deliveryMethods: + type: array + items: + type: object + properties: + id: + type: string + description: Delivery method id. + name: + type: string + description: >- + Delivery method name. Please note that only method ids are unique, not method names. + For duplicate names, check the marketplaces, paymentPolicy and allegroEndorsed properties as well. + marketplaces: + type: array + items: + type: string + description: List of marketplace ids where this delivery method is available for buyers. + paymentPolicy: + type: string + enum: + - IN_ADVANCE + - CASH_ON_DELIVERY + description: Whether the payment is to be collected in advance or on delivery. + allegroEndorsed: + type: boolean + description: >- + Indicates Allegro signed delivery method, which allows to easily distinguish similar delivery methods + with various restrictions, e.g. Allegro Paczkomaty 24/7 InPost from Paczkomaty 24/7. + dispatchCountry: + type: string + nullable: true + description: >- + Country code from which the shipment is dispatched, if null the country is undefined + and the shipment can be dispatched from any country. + destinationCountry: + type: string + description: >- + Country code to which the shipment is being sent. + shippingRatesConstraints: + type: object + description: Rules for the delivery method, i.e. price, quantity, shipping time, etc. + properties: + allowed: + type: boolean + description: Indicates whether delivery method can be used when adding or modifying shipping rates. + maxQuantityPerPackage: + type: object + description: Rules for the quantity per parcel. + properties: + max: + type: integer + description: Upper limit for quantity per package. + minimum: 1 + maximum: 999999 + example: 999999 + maxPackageWeight: + type: object + description: Rules for the maximum weight of a package. + properties: + supported: + type: boolean + description: Indicates whether the maximum package weight can be set in shipping rates for the delivery method. + example: true + min: + type: string + description: Lower limit for the maximum package weight, provided in a string format to avoid rounding errors. + nullable: true + example: "15.000" + max: + type: string + description: Upper limit for the maximum package weight, provided in a string format to avoid rounding errors. + nullable: true + example: "20.000" + unit: + type: string + description: Weight unit. Currently only `KILOGRAM` is supported. + nullable: true + example: "KILOGRAM" + firstItemRate: + type: object + description: Rules for the shipping cost for the first item in the parcel. + properties: + min: + type: string + description: Lower limit for the rate. + example: "0.00" + maxLength: 15 + max: + type: string + description: Upper limit for the rate. + example: "8.99" + maxLength: 15 + currency: + type: string + description: ISO 4217 currency code. + example: "PLN" + nextItemRate: + type: object + description: Rules for the shipping cost of another item in the parcel. + properties: + min: + type: string + description: Lower limit for the rate. + example: "0.00" + maxLength: 15 + max: + type: string + description: Upper limit for the rate. + example: "8.99" + maxLength: 15 + currency: + type: string + description: ISO 4217 currency code. + example: "PLN" + shippingTime: + type: object + description: Rules for the shipping time. + properties: + default: + type: object + description: Default shipping time. + properties: + from: + type: string + description: ISO 8601 duration format. + example: "PT24H" + to: + type: string + description: ISO 8601 duration format. + example: "PT48H" + customizable: + type: boolean + description: Indicates if custom shipping time can be set when adding or modifying shipping rates. + examples: + response: + value: + deliveryMethods: + - id: 758fcd59-fbfa-4453-ae07-4800d72c2ca5 + name: List polecony priorytetowy + marketplaces: + - "allegro-pl" + paymentPolicy: IN_ADVANCE + allegroEndorsed: false + dispatchCountry: null + destinationCountry: PL + shippingRatesConstraints: + allowed: true + maxQuantityPerPackage: + max: 999999 + maxPackageWeight: + supported: true + min: '1.000' + max: '30.000' + unit: 'KILOGRAM' + firstItemRate: + min: '0.00' + max: '100000000.00' + currency: PLN + nextItemRate: + min: '0.00' + max: '100000000.00' + currency: PLN + shippingTime: + default: + from: PT24H + to: PT48H + customizable: true + '401': + description: Authentication required. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '/sale/offer-additional-services/groups/{groupId}': + get: + tags: + - Additional services + summary: "Get the details of an additional services group" + description: + 'Use this resource to get additional services group for a given ID. Read more: PL / EN.' + operationId: getAdditionalServicesGroupUsingGET + parameters: + - name: groupId + in: path + description: Additional Service Group ID. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalServicesGroupResponse' + '401': + description: Unauthorized + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + put: + tags: + - Additional services + summary: "Modify an additional services group" + description: + 'Use this resource to modify existing additional service group. Read more: PL / EN.' + operationId: modifyAdditionalServicesGroupUsingPUT + parameters: + - name: groupId + in: path + description: Additional service group ID. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalServicesGroupResponse' + '401': + description: Unauthorized + '404': + description: Not Found + requestBody: + $ref: '#/components/requestBodies/AdditionalServicesGroupRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /sale/offer-additional-services/groups/{groupId}/translations: + get: + tags: + - Additional services translations + summary: 'Get translations for specified group' + description: + 'Use this resource to get translations for additional service group. Read more: PL / EN.' + operationId: getAdditionalServiceGroupTranslations + parameters: + - name: groupId + in: path + description: Additional Service Group ID. + required: true + schema: + type: string + - name: language + in: query + description: 'IETF language tag. When provided, the response will contain translations in only that language (if exists).' + example: en-US + required: false + schema: + type: string + minLength: 5 + maxLength: 5 + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalServiceGroupTranslationResponse' + '401': + description: Unauthorized + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + + /sale/offer-additional-services/groups/{groupId}/translations/{language}: + patch: + tags: + - Additional services translations + summary: 'Create/Update translations for specified group and language' + description: + 'Use this resource to create/update translation for additional service group and specified language. It is allowed to provide an incomplete list of services that belong to the group. Read more: PL / EN.' + operationId: updateAdditionalServiceGroupTranslation + parameters: + - name: groupId + in: path + description: Additional Service Group ID. + required: true + schema: + type: string + - name: language + in: path + description: IETF Language tag. + required: true + schema: + type: string + minLength: 5 + maxLength: 5 + example: pl-PL + requestBody: + description: Additonal service group translation. + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalServicesGroupTranslationRequest' + responses: + '200': + description: 'Translation created/updated for group and language.' + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalServiceGroupTranslationPatchResponse' + '401': + description: Unauthorized + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + delete: + tags: + - Additional services translations + summary: 'Delete a translation for a specified group and language' + description: >- + Use this resource to delete the translation for specified additional service group and language. Read more: PL / EN. + operationId: deleteAdditionalServiceGroupTranslation + parameters: + - name: groupId + in: path + description: Additional service group ID. + required: true + schema: + type: string + - name: language + in: path + description: IETF Language tag. + required: true + schema: + type: string + minLength: 5 + maxLength: 5 + example: pl-PL + responses: + '204': + description: Translation deleted successfully + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Additional service group or translation not found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + + /sale/size-tables/{tableId}: + get: + tags: + - Size tables + summary: 'Get a size table' + description: + 'Use this resource to get selected size table. Read more: PL / EN.' + operationId: getTableUsingGET + parameters: + - name: tableId + in: path + description: Table identifier. + required: true + schema: + type: string + responses: + '200': + description: Size table returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PublicTableDto' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + put: + tags: + - Size tables + summary: 'Update a size table' + description: + 'Use this resource to update selected size table. Read more: PL / EN.' + operationId: modifyTableUsingPUT + parameters: + - name: tableId + in: path + description: Table identifier. + required: true + schema: + type: string + responses: + '200': + description: Size table updated successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PublicTableDto' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + requestBody: + description: Size table details + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SizeTablePutRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /sale/size-tables: + get: + tags: + - Size tables + summary: "Get the user's size tables" + description: + 'Use this resource to get all size tables assigned to a seller account. + Read more: PL / EN.' + operationId: getTablesUsingGET + responses: + '200': + description: Size tables returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PublicTablesDto' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + post: + tags: + - Size tables + summary: 'Create a size table' + description: + 'Use this resource to create size table. Read more: PL / EN.' + operationId: createTableUsingPOST + responses: + '201': + description: Size table created successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PublicTableDto' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + requestBody: + description: Size table details + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SizeTablePostRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /sale/size-tables-templates: + get: + tags: + - Size tables + summary: "Get the size tables templates" + description: + 'Use this resource to get all size tables templates. + Read more: PL / EN.' + operationId: getTablesTemplatesUsingGET + responses: + '200': + description: Size tables templates returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SizeTableTemplatesResponse' + '401': + description: Unauthorized + '403': + description: Forbidden + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + /after-sales-service-conditions/return-policies: + get: + tags: + - After sale services + summary: "Get the user's return policies" + description: + 'Use this resource to get seller return policies listing. Read more: PL / EN.' + operationId: getPublicSellerListingUsingGET_1 + parameters: + - name: limit + in: query + description: The limit of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 60 + minimum: 1 + maximum: 60 + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + maximum: 59 + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ReturnPoliciesList_ReturnPolicy_' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + post: + tags: + - After sale services + summary: "Create new user's return policy" + description: + 'Use this resource to create a return policy definition. Read more: PL / EN.' + operationId: createAfterSalesServiceReturnPolicyUsingPOST + responses: + '201': + description: Created + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ReturnPolicyResponse' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Unprocessable Entity + requestBody: + description: Return Policy + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ReturnPolicyRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /after-sales-service-conditions/return-policies/{returnPolicyId}: + get: + tags: + - After sale services + summary: "Get the user's return policy" + description: + 'Use this resource to get a return policy details. Read more: PL / EN.' + operationId: getAfterSalesServiceReturnPolicyUsingGET + parameters: + - name: returnPolicyId + in: path + description: The ID of the return policy. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ReturnPolicyResponse' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + put: + tags: + - After sale services + summary: "Change the user's return policy" + description: + 'Use this resource to modify the return policy details. Read more: PL / EN.' + operationId: updateAfterSalesServiceReturnPolicyUsingPUT + parameters: + - name: returnPolicyId + in: path + description: The ID of the return policy. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ReturnPolicyResponse' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '422': + description: Unprocessable Entity + requestBody: + description: Return Policy + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ReturnPolicyRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + delete: + tags: + - After sale services + summary: "Delete the user's return policy" + description: + 'Use this resource to delete a return policy definition.' + operationId: deleteAfterSalesServiceReturnPolicyUsingDELETE + parameters: + - name: returnPolicyId + in: path + description: The ID of the return policy. + required: true + schema: + type: string + responses: + '204': + description: No content + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + + /after-sales-service-conditions/implied-warranties: + get: + tags: + - After sale services + summary: "Get the user's implied warranties" + description: + 'Use this resource to get seller implied warranties listing. Read more: PL / EN.' + operationId: getPublicSellerListingUsingGET + parameters: + - name: limit + in: query + description: The limit of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 60 + minimum: 1 + maximum: 60 + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + maximum: 59 + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/ImpliedWarrantiesList_ImpliedWarrantyBasic_ + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + post: + tags: + - After sale services + summary: "Create new user's implied warranty" + description: + 'Use this resource to create an implied warranty definition. Read more: PL / EN.' + operationId: createAfterSalesServiceImpliedWarrantyUsingPOST + responses: + '201': + description: Created + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ImpliedWarrantyResponse' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Unprocessable Entity + requestBody: + description: Implied warranty + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ImpliedWarrantyRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /after-sales-service-conditions/implied-warranties/{impliedWarrantyId}: + get: + tags: + - After sale services + summary: "Get the user's implied warranty" + description: + 'Use this resource to get an implied warranty details. Read more: PL / EN.' + operationId: getAfterSalesServiceImpliedWarrantyUsingGET + parameters: + - name: impliedWarrantyId + in: path + description: The ID of the implied warranty. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ImpliedWarrantyResponse' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + put: + tags: + - After sale services + summary: "Change the user's implied warranty" + description: + 'Use this resource to modify the implied warranty details. Read more: PL / EN.' + operationId: updateAfterSalesServiceImpliedWarrantyUsingPUT + parameters: + - name: impliedWarrantyId + in: path + description: The ID of the implied warranty. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ImpliedWarrantyResponse' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '422': + description: Unprocessable Entity + requestBody: + description: Implied warranty + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ImpliedWarrantyRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /after-sales-service-conditions/warranties: + get: + tags: + - After sale services + summary: "Get the user's warranties" + description: + 'Use this resource to get seller warranties listing. Read more: PL / EN.' + operationId: getPublicSellerListingUsingGET_2 + parameters: + - name: limit + in: query + description: The limit of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 60 + minimum: 1 + maximum: 60 + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + maximum: 59 + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/WarrantiesList_WarrantyBasic_' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + post: + tags: + - After sale services + summary: "Create new user's warranty" + description: + 'Use this resource to create a warranty definition. Read more: PL / EN.' + operationId: createAfterSalesServiceWarrantyUsingPOST + responses: + '201': + description: Created + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/WarrantyResponse' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Unprocessable Entity + requestBody: + description: Warranty + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/WarrantyRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /after-sales-service-conditions/warranties/{warrantyId}: + get: + tags: + - After sale services + summary: "Get the user's warranty" + description: + 'Use this resource to get a warranty details. Read more: PL / EN.' + operationId: getAfterSalesServiceWarrantyUsingGET + parameters: + - name: warrantyId + in: path + description: The ID of the warranty. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/WarrantyResponse' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + put: + tags: + - After sale services + summary: "Change the user's warranty" + description: + 'Use this resource to modify the warranty details. Read more: PL / EN.' + operationId: updateAfterSalesServiceWarrantyUsingPUT + parameters: + - name: warrantyId + in: path + description: The ID of the warranty. + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/WarrantyResponse' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '422': + description: Unprocessable Entity + requestBody: + description: Warranty + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/WarrantyRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /after-sales-service-conditions/attachments: + post: + tags: + - After sale services + summary: "Create a warranty attachment metadata" + description: >- + You can attach PDF files to warranties. + + Uploading attachments flow: + 1. Create an attachment object to receive an upload URL (*POST /after-sales-service-conditions/attachments*), + 2. Use the upload URL to submit the PDF file (*PUT /after-sales-service-conditions/attachments/{attachmentId}*), + 3. Create (or update) warranty with attachment (*POST /after-sales-service-conditions/warranties*). + + Read more: PL / EN. + + operationId: createAfterSalesServiceConditionsAttachmentUsingPOST + responses: + '201': + description: Attachment created successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AfterSalesServicesAttachment' + '400': + description: Syntactically incorrect request. + '401': + description: Invalid or missing bearer token. + '403': + description: Forbidden + '415': + description: Unsupported media type. + '422': + description: Unprocessable Entity. + requestBody: + description: After sale services attachment + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + type: object + properties: + name: + type: string + example: uploaded_file.pdf + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /after-sales-service-conditions/attachments/{attachmentId}: + put: + tags: + - After sale services + summary: "Upload an warranty attachment" + description: >- + Upload an after sale services attachment. + + This operation should be used after creating an offer attachment with *POST /sale/offer-attachments* + + **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /after-sales-service-conditions/attachments*. + The URL is unique and one-time. As its format may change in time, you should always use the address from the header. + Do not compose the address on your own. Read more: PL / EN. + operationId: uploadAfterSalesServiceConditionsAttachmentUsingPUT + parameters: + - name: attachmentId + in: path + description: The ID of the attachment. + required: true + schema: + type: string + servers: + - url: https://upload.{environment} + variables: + environment: + default: allegro.pl + enum: + - allegro.pl + - allegro.pl.allegrosandbox.pl + requestBody: + content: + application/pdf: + schema: + type: string + format: binary + description: File in a binary format + responses: + '200': + description: File uploaded correctly. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AfterSalesServicesAttachment' + '400': + description: Syntactically incorrect request. + '401': + description: Invalid or missing bearer token. + '403': + description: Forbidden + '404': + description: Not found. + '413': + description: Payload too large. + '422': + description: Invalid file content. + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /pricing/offer-quotes: + get: + tags: + - Pricing + summary: "Get the user's current offer quotes" + description: >- + This endpoint returns current offer quotes (listing and promo fees) + cycles for authenticated user and list of offers. + Read more: PL / EN. + operationId: offerQuotesPublicUsingGET + parameters: + - name: offer.id + in: query + description: 'List of offer Ids, maximum 20 values.' + required: true + allowEmptyValue: false + explode: true + schema: + type: array + items: + type: string + responses: + '200': + description: Returns current offer quotes + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferQuotesDto' + '400': + description: Invalid request. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Full authentication is required to access this resource + '403': + description: Forbidden + '503': + description: Service is currently unavailable. Please try again later. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:billing:read + /sale/offer-variants: + post: + tags: + - Offer variants + summary: 'Create variant set' + description: >- + Use this resource to create variant set. + + A valid variant set must consist of three required elements: + - name: + - it can't be blank and must not be longer than 75 characters + - parameters: + - it should contain parameter identifiers used for offer grouping + - parameter identifiers from the offers and special `color/pattern` value (for grouping via image) are permitted + - it must contain at least one element (up to 2) + - offers: + - it must contain at least 2 offers (500 at most) + - `colorPattern` value must be set for every offer if `color/pattern` parameter is used + - `colorPattern` value can't be blank and must not be longer than 50 characters + - `colorPattern` can take arbitrary string value like `red`, `b323592c-522f-4ec1-b9ea-3764538e0ac4` (UUID), etc. + - offers having the same image should have identical `colorPattern` value + - offers must have `publication.marketplaces.base` equal to `allegro-pl` + + + Let's assume we have 4 offers: + - offer with id 2 having an image of a red t-shirt and S as a value of parameter with id 21 + - offer with id 3 having an image of a red t-shirt and M as a value of parameter with id 21 + - offer with id 4 having an image of a blue t-shirt and S as a value of parameter with id 21 + - offer with id 5 having an image of a blue t-shirt and M as a value of parameter with id 21 + + + You can build a variant set by grouping offers using combination of available parameters - examples are available in Request samples. + + + More general information about variant sets can be found [here](https://allegro.pl/pomoc/faq/wielowariantowosc-jak-polaczyc-oferty-xGgaOByGgTb#dodatkowe-informacje). Read more: PL / EN. + operationId: createVariantSet + responses: + '201': + description: Variant set created successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/VariantSetResponse' + + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Unprocessable Entity + requestBody: + $ref: '#/components/requestBodies/VariantSetRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + get: + tags: + - Offer variants + summary: "Get the user's variant sets" + description: >- + Use this resource to get created variant sets. + The returned variant sets are ordered by name. + Read more: PL / EN. + operationId: getVariantSets + parameters: + - name: offset + in: query + description: Index of first returned variant set. + required: false + schema: + type: integer + default: 0 + minimum: 0 + maximum: 9950 + - name: limit + in: query + description: Maximum number of returned variant sets. + required: false + schema: + type: integer + default: 10 + minimum: 1 + maximum: 50 + - name: query + in: query + description: Filter variant sets by name or offer id. + required: false + schema: + type: string + maxLength: 50 + responses: + '200': + description: Variant sets returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/VariantSets' + '401': + description: Unauthorized + '403': + description: Forbidden + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offer-variants/{setId}: + put: + tags: + - Offer variants + summary: 'Update variant set' + description: >- + Use this resource to edit variant set. + + A valid variant set must consist of three required elements: + - name: + - it can't be blank and must not be longer than 75 characters + - parameters: + - it should contain parameter identifiers used for offer grouping + - parameter identifiers from the offers and special `color/pattern` value (for grouping via image) are permitted + - it must contain at least one element (up to 2) + - offers: + - it must contain at least 2 offers (500 at most) + - `colorPattern` value must be set for every offer if `color/pattern` parameter is used + - `colorPattern` value can't be blank and must not be longer than 50 characters + - `colorPattern` can take arbitrary string value like `red`, `b323592c-522f-4ec1-b9ea-3764538e0ac4` (UUID), etc. + - offers having the same image should have identical `colorPattern` value + - offers must have `publication.marketplaces.base` equal to `allegro-pl` + + + Let's assume we have 4 offers: + - offer with id 2 having an image of a red t-shirt and S as a value of parameter with id 21 + - offer with id 3 having an image of a red t-shirt and M as a value of parameter with id 21 + - offer with id 4 having an image of a blue t-shirt and S as a value of parameter with id 21 + - offer with id 5 having an image of a blue t-shirt and M as a value of parameter with id 21 + + + You can build a variant set by grouping offers using combination of available parameters - examples are available in Request samples. + + + More general information about variant sets can be found [here](https://allegro.pl/pomoc/faq/wielowariantowosc-jak-polaczyc-oferty-xGgaOByGgTb#dodatkowe-informacje). Read more: PL / EN. + operationId: updateVariantSet + parameters: + - name: setId + in: path + description: Variant set identifier. + required: true + schema: + type: string + responses: + '200': + description: Variant set updated successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/VariantSetResponse' + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Unprocessable Entity + requestBody: + $ref: '#/components/requestBodies/VariantSetRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + get: + tags: + - Offer variants + summary: 'Get a variant set' + description: + 'Use this resource to get variant set by set id. Read more: PL / EN.' + operationId: getVariantSet + parameters: + - name: setId + in: path + description: Variant set identifier. + required: true + schema: + type: string + responses: + '200': + description: Variant set returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/VariantSetResponse' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + delete: + tags: + - Offer variants + summary: 'Delete a variant set' + description: >- + Use this resource to delete variant set by id. + Offers included in variant set will not be stopped or modified by this operation. + Read more: PL / EN. + operationId: deleteVariantSet + parameters: + - name: setId + in: path + description: Variant set identifier. + required: true + schema: + type: string + responses: + '204': + description: Variant set deleted successfully + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Variant set not found + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/images: + post: + tags: + - Images and attachments + summary: "Upload an offer image" + description: >- + Upload image to our servers. + + You can choose from two upload options: + * \- provide a link and we will download an image for you + * \- send an image as binary data + + **Important!** Remember to use dedicated domain for upload, i.e. + * \- https://upload.allegro.pl for Production + * \- https://upload.allegro.pl.allegrosandbox.pl for Sandbox + + Read more about the rules for photos in an offer's gallery and description: + PL / EN. + operationId: uploadOfferImageUsingPOST + servers: + - url: https://upload.{environment} + variables: + environment: + default: allegro.pl + enum: + - allegro.pl + - allegro.pl.allegrosandbox.pl + responses: + '201': + description: Image uploaded correctly + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferImageUploadResponse' + '400': + description: Syntactically incorrect request + '401': + description: Invalid or missing bearer token + '403': + description: Authorization problem + '413': + description: Image is too big + '415': + description: Unsupported media type + '422': + description: Unprocessable entity (problem with image server) + requestBody: + $ref: '#/components/requestBodies/OfferImageUploadRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offer-attachments: + post: + tags: + - Images and attachments + summary: "Create an offer attachment" + description: >- + You can attach pdf, jpeg or png files to your offers. + We will present them under the offer description in the Additional information section. + + You can attach up to 9 files to one offer – one per each type from the list: + * Guide (MANUAL). Allowed media types: PDF + * Special offer terms (SPECIAL_OFFER_RULES). Allowed media types: PDF + * Competition terms (COMPETITION_RULES). Allowed media types: PDF + * Book excerpt (BOOK_EXCERPT). Allowed media types: PDF + * Manual (USER_MANUAL). Allowed media types: PDF + * Installation manual (INSTALLATION_INSTRUCTIONS). Allowed media types: PDF + * Game manual (GAME_INSTRUCTIONS). Allowed media types: PDF + * Energy label (ENERGY_LABEL). Allowed media types: JPEG, JPG, PNG + * Product information sheet (PRODUCT_INFORMATION_SHEET). Allowed media types: PDF + * Tire label (TIRE_LABEL). Allowed media types: JPEG, JPG, PNG + + You can attach up to 20 files to one product for: + * Safety information manual (SAFETY_INFORMATION_MANUAL). Allowed media types: PDF, JPEG, JPG, PNG + + Uploading attachments flow: + 1. Create an attachment object to receive an upload URL (*POST /sale/offer-attachments*), + 2. Use the upload URL to submit the file (*PUT /sale/offer-attachments/{attachmentId}*), + 3. Add attachments to the offer (*PATCH /sale/product-offers/{offerId}*). + + Read more: PL / EN. + + operationId: createOfferAttachmentUsingPOST + responses: + '201': + description: Attachment created successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferAttachment' + '400': + description: Syntactically incorrect request + '401': + description: Invalid or missing bearer token + '415': + description: Unsupported media type + '422': + description: Unprocessable Entity + requestBody: + $ref: '#/components/requestBodies/OfferAttachmentRequest' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offer-attachments/{attachmentId}: + put: + tags: + - Images and attachments + summary: "Upload an offer attachment" + description: >- + Upload an offer attachment. + + This operation should be used after creating an offer attachment with *POST /sale/offer-attachments* + + **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /sale/offer-attachments*. + The URL is unique and one-time. As its format may change in time, you should always use the address from the header. + Do not compose the address on your own. Read more: PL / EN. + operationId: uploadOfferAttachmentUsingPUT + parameters: + - name: attachmentId + in: path + description: The ID of the attachment. + required: true + schema: + type: string + servers: + - url: https://upload.{environment} + variables: + environment: + default: allegro.pl + enum: + - allegro.pl + - allegro.pl.allegrosandbox.pl + requestBody: + content: + application/pdf: + schema: + type: string + format: binary + description: File in a binary format + image/jpeg: + schema: + type: string + format: binary + description: File in a binary format + image/png: + schema: + type: string + format: binary + description: File in a binary format + responses: + '200': + description: File uploaded correctly + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferAttachment' + '400': + description: Syntactically incorrect request + '401': + description: Invalid or missing bearer token + '415': + description: Unsupported media type + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + get: + tags: + - Images and attachments + summary: "Get offer attachment details" + description: >- + Get details of an offer attachments, including download link, by attachment identifier ("attachmentId"). + The attachment id can be retrieved by querying a particular offer, for example by using + `GET /sale/product-offers/{offerId}`. + operationId: getOfferAttachment + parameters: + - name: attachmentId + in: path + description: The ID of the attachment. + required: true + schema: + type: string + responses: + '200': + description: Offer attachment details + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferAttachment' + '403': + description: User has no access to an attachment + '404': + description: Non existing attachment + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /offers/listing: + get: + tags: + - Public offer information + summary: "Search offers" + description: >- + Access for verified applications only. + Use this resource to get a list of offers based on the provided query parameters. + At least one of: phrase, seller.id or category.id is required. + Additional available parameters vary depending on category.id. The + parameters are defined in the filters entity. + + Changing the marketplace, country of delivery, currency or language may impact the availability of offers and filters. + Note that requests for closed offers may be limited. + + + Read more: PL / EN. + operationId: getListing + security: + - bearer-token-for-application: [] + - bearer-token-for-user: [] + parameters: + - name: category.id + in: query + description: The identifier of the category, where you want to search for offers. + required: false + schema: + type: string + - name: phrase + in: query + description: >- + The search phrase. The phrase is searched in different fields of the offers depending on the value of the + `searchMode` parameter. + required: false + schema: + type: string + - name: seller.id + in: query + description: >- + The identifier of a seller, to limit the results to offers from this seller. May be provided more than once. + Should not be provided when seller.login is given. + required: false + schema: + type: string + - name: seller.login + in: query + description: >- + The login of a seller, to limit the results to offers from this seller. May be provided more than once. + Should not be provided when seller.id is given. + required: false + schema: + type: string + - name: marketplaceId + in: query + description: >- + Id of a marketplace where offers are visible. + + *Acceptable values* : `allegro-pl`, `allegro-cz`, `allegro-sk`, `allegro-hu`. + required: false + schema: + type: string + default: allegro-pl + - name: shipping.country + in: query + description: Expected language of messages. + required: false + example: PL + schema: + type: string + description: ISO 3166-1 alpha-2 format + - name: currency + in: query + description: >- + Currency of the offer prices. + + *Default value* : depends on marketplace, for allegro-pl: `PLN`, for allegro-cz: `CZK`, for allegro-sk: `EUR`. + + Check endpoint GET /marketplaces for acceptable currency values. + required: false + example: PLN + schema: + type: string + format: ISO 4217 currency code + - name: Accept-Language + in: header + required: false + description: >- + Limits offers to the only translated to specified language. Also expected language of messages. + + *Default value* : depends on marketplace, for allegro-pl: `pl-PL`, for allegro-cz: `cs-CZ`, for allegro-sk: `sk-SK`. + + Check endpoint GET /marketplaces for acceptable language values. + example: pl-PL + schema: + type: string + format: BCP-47 language code + - name: searchMode + in: query + description: >- + Defines where the given phrase should be searched in. Allowed values: + + - *REGULAR* - searching for a phrase in the title, + - *CLOSED* - searching for a phrase in the title of closed offers. Available only for `allegro-pl` marketplace. + required: false + schema: + type: string + enum: + - REGULAR + - CLOSED + default: REGULAR + - name: offset + in: query + description: >- + Index of the first returned offer from all search results. Max offset is `600 - `. + required: false + schema: + type: integer + minimum: 0 + maximum: 599 + default: 0 + - name: limit + in: query + description: >- + The maximum number of offers in a response. + required: false + schema: + type: integer + minimum: 1 + maximum: 60 + default: 60 + - name: sort + in: query + description: >- + Search results sorting order. `+` or no prefix in the value means ascending order. `-` prefix means + descending order. + required: false + schema: + type: string + enum: + - relevance + - +price + - -price + - +withDeliveryPrice + - -withDeliveryPrice + - +endTime + - -startTime + default: relevance + - name: include + in: query + description: >- + Specify parts of the response that should be included in the output. Allowed values are the names of top + level entities and *all* as an alias to all entities. By default, all top level entities are included. + Use `-` prefix to exclude an entity. + + Example: + + `include=-all&include=filters&include=sort` - returns only filters and sort entities. + required: false + schema: + type: string + - name: fallback + in: query + description: >- + Defines the behaviour of the search engine when no results with exact phrase match are found: + + - *true* - related (not exact) results are returned, + - *false* - empty results are returned. + required: false + schema: + type: boolean + default: true + - name: "Dynamic filters" + in: query + description: >- + You can filter and customize your search results to find exactly what you need by applying filters ids and their dictionary values to query according to the flowing pattern: id=value. + When the filter definition looks like: + ```` + { + "id": "parameter.11323", + "type": "MULTI", + "name": "Stan", + "values": [{ + "value": "11323_1", + "name": "nowe", + "count": 21, + "selected": false + }, + { + "value": "11323_2", + "name": "używane", + "count": 157, + "selected": false + }, + { + "value": "11323_238066", + "name": "po zwrocie", + "count": 1, + "selected": false + } + ] + } + ```` + You can use 'Stan' filter to query results, i.e.: + * `parameter.11323=11323_1` for "nowe" + * `parameter.11323=11323_2` for "używane" + * `parameter.11323=11323_238066` for "po zwrocie". + required: false + schema: + type: object + additionalProperties: + x-additionalPropertiesName: filter's id + type: string + description: Filter value. + responses: + '200': + description: The request successfully returns the search result. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ListingResponse' + '400': + description: Bad request. Check if all necessary parameters are provided. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '403': + description: >- + Access is denied. Application verification required. + Read more: PL / EN + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '404': + description: Given category was not found. Check category.id parameter. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '406': + description: >- + Value of one of Accept headers is invalid. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '422': + description: >- + One of parameters have invalid value or given parameters combination + is forbidden. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '429': + description: >- + Request was rejected because the limit was exceeded. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '500': + description: Internal service error. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '502': + description: Error caused by upstream service failure. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '/order/events': + get: + tags: + - Order management + summary: 'Get order events' + description: >- + Use this resource to return events that allow you to monitor actions which clients perform, i.e. + making a purchase, filling in the checkout form (FOD), finishing payment process, making a surcharge. Read more: PL / EN. + operationId: getOrderEventsUsingGET + parameters: + - name: from + in: query + description: 'You can use the event ID to retrieve subsequent chunks of events.' + required: false + schema: + type: string + - name: type + in: query + description: >- + Specify array of event types for filtering. + Allowed values are: + * `BOUGHT`: purchase without checkout form filled in + * `FILLED_IN`: checkout form filled in but payment is not completed yet so data could still change + * `READY_FOR_PROCESSING`: payment completed. Purchase is ready for processing + * `BUYER_CANCELLED`: purchase was cancelled by buyer + * `FULFILLMENT_STATUS_CHANGED`: fulfillment status changed + * `AUTO_CANCELLED`: purchase was cancelled automatically by Allegro. + required: false + schema: + type: array + items: + type: string + - name: limit + in: query + description: 'The maximum number of events returned in the response.' + required: false + schema: + type: integer + format: int32 + minimum: 1 + maximum: 1000 + default: 100 + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OrderEventsList' + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Unprocessable Entity - Returned when query parameters are incorrect. + security: + - bearer-token-for-user: + - allegro:api:orders:read + /order/event-stats: + get: + tags: + - Order management + summary: 'Get order events statistics' + description: >- + Use this resource to returns object that contains event id and occurrence date of the latest event. + It gives you current starting point for reading events. Read more: PL / EN. + operationId: getOrderEventsStatisticsUsingGET + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OrderEventStats' + '401': + description: Unauthorized + security: + - bearer-token-for-user: + - allegro:api:orders:read + /order/checkout-forms: + get: + tags: + - Order management + summary: "Get the user's orders" + description: >- + Use this resource to get an order list. Read more: PL / EN. + operationId: getListOfOrdersUsingGET + parameters: + - name: offset + in: query + description: Index of first returned checkout-form from all search results. + required: false + schema: + type: integer + minimum: 0 + default: 0 + - name: limit + in: query + description: >- + Maximum number of checkout-forms in response. + required: false + schema: + type: integer + minimum: 1 + maximum: 100 + default: 100 + - name: status + in: query + schema: + type: string + description: >- + Specify status value that checkout-forms must have to be included in the output. + Allowed values are: + * `BOUGHT`: purchase without checkout form filled in. + * `FILLED_IN`: checkout form filled in but payment is not completed yet so data could still change. + * `READY_FOR_PROCESSING`: payment completed. Purchase is ready for processing. + * `CANCELLED`: purchase cancelled by buyer. + - name: fulfillment.status + in: query + schema: + type: string + description: >- + Specify seller status value that checkout-forms must have to be included in the output. + Allowed values are: + * `NEW` + * `PROCESSING` + * `READY_FOR_SHIPMENT` + * `READY_FOR_PICKUP` + * `SENT` + * `PICKED_UP` + * `CANCELLED` + * `SUSPENDED` + * `RETURNED`. + - name: fulfillment.shipmentSummary.lineItemsSent + in: query + schema: + type: string + description: >- + Specify filter for line items sending status. + Allowed values are: + * `NONE`: none of line items have tracking number specified + * `SOME`: some of line items have tracking number specified + * `ALL`: all of line items have tracking number specified. + - name: lineItems.boughtAt.lte + in: query + schema: + type: string + format: date-time + description: Latest line item bought date. The upper bound of date time range from which checkout forms will be taken. + - name: lineItems.boughtAt.gte + in: query + schema: + type: string + format: date-time + description: Latest line item bought date. The lower bound of date time range from which checkout forms will be taken. + - name: payment.id + in: query + schema: + type: string + description: Find checkout-forms having specified payment id. + - name: surcharges.id + in: query + schema: + type: string + description: Find checkout-forms having specified surcharge id. + - name: delivery.method.id + in: query + schema: + type: string + description: Find checkout-forms having specified delivery method id. + - name: buyer.login + in: query + schema: + type: string + description: Find checkout-forms having specified buyer login. + - name: marketplace.id + in: query + schema: + type: string + description: Find checkout-forms of orders purchased on specified marketplace. + - name: updatedAt.lte + in: query + schema: + type: string + format: date-time + description: Checkout form last modification date. The upper bound of date time range from which checkout forms will be taken. + - name: updatedAt.gte + in: query + schema: + type: string + format: date-time + description: Checkout form last modification date. The lower bound of date time range from which checkout forms will be taken. + - name: sort + in: query + description: >- + The results' sorting order. No prefix in the value means ascending order. `-` prefix means descending order. + If you don't provide the sort parameter, the list is sorted by line item boughtAt date, descending. + required: false + schema: + type: string + enum: + - lineItems.boughtAt + - -lineItems.boughtAt + - updatedAt + - -updatedAt + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CheckoutForms' + '400': + description: > + Bad Request - Returned when request parameters contains illegal values. + '401': + description: Unauthorized + '406': + description: Not Acceptable + '422': + description: > + Unprocessable Entity - Returned when limit or offset value is outside an acceptable range + security: + - bearer-token-for-user: + - allegro:api:orders:read + /order/checkout-forms/{id}: + get: + tags: + - Order management + summary: "Get an order's details" + description: >- + Use this resource to get an order details. Read more: PL / EN. + operationId: getOrdersDetailsUsingGET + parameters: + - name: id + in: path + description: Checkout form identifier. + required: true + schema: + type: string + format: uuid + example: "29738e61-7f6a-11e8-ac45-09db60ede9d6" + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CheckoutForm' + '401': + description: Unauthorized + '404': + description: Not Found + '406': + description: Not Acceptable + '422': + description: > + Unprocessable Entity - Returned when order id is malformed UUID. + security: + - bearer-token-for-user: + - allegro:api:orders:read + /order/carriers: + get: + tags: + - Order management + summary: "Get a list of available shipping carriers" + description: >- + Shipping carriers are essential to provide accurate tracking experience for customers. + Use this resource to get a list of all available shipping carriers. + + + The response of this resource can be stored in accordance with returned caching headers. Read more: PL / EN. + operationId: getOrdersCarriersUsingGET + security: + - bearer-token-for-application: [] + - bearer-token-for-user: [] + responses: + '200': + description: List of available shipping carriers. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OrdersShippingCarriersResponse' + examples: + order-carriers: + summary: Order carriers + value: + carriers: + - id: 'POCZTA_POLSKA' + name: 'Poczta Polska' + - id: 'DHL' + name: 'DHL' + - id: 'YUN_EXPRESS' + name: 'Yun Express' + - id: 'OTHER' + '401': + description: Unauthorized + '404': + description: Not Found + '/order/checkout-forms/{id}/shipments': + get: + tags: + - Order management + summary: "Get a list of parcel tracking numbers" + description: >- + Get a list of parcel tracking numbers currently assigned to the order. + Orders can be retrieved using REST API resource GET /order/checkout-forms. + Please note that the shipment list may contain parcel tracking numbers added + through other channels such as Moje Allegro or by the carrier that delivers the parcel. Read more: PL / EN. + operationId: getOrderShipmentsUsingGET + parameters: + - name: id + in: path + description: Order identifier. + required: true + schema: + type: string + responses: + '200': + description: >- + Returns a list of parcel tracking numbers (shipments) + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CheckoutFormOrderWaybillResponse' + '401': + description: Authentication failed, e.g. token is expired + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Order not found or doesn’t belong to the seller + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:orders:read + post: + tags: + - Order management + summary: "Add a parcel tracking number" + description: >- + Add a parcel tracking number (shipment) to given order line items. Read more: PL / EN. + operationId: createOrderShipmentsUsingPOST + parameters: + - name: id + in: path + description: Order identifier. + required: true + schema: + type: string + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CheckoutFormAddWaybillRequest' + description: request + required: true + responses: + '201': + description: The request is OK and the parcel tracking number will be assigned to the order + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CheckoutFormAddWaybillCreated' + '400': + description: Missing required field or invalid value in the request (e.g. unknown carrier id, carrier name too long, invalid tracking number structure) + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Authentication failed, e.g. token is expired + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Order not found or doesn’t belong to the seller + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '409': + description: Maximum waybill usage exceeded (e.g. used in too many orders) + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Some of the provided data is invalid, e.g. line item doesn’t belong to the order + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:orders:write + /order/checkout-forms/{id}/fulfillment: + put: + tags: + - Order management + summary: "Set seller order status" + description: >- + Use to set seller order status. Read more: PL / EN. + operationId: setOrderFulfillmentUsingPUT + parameters: + - name: id + in: path + description: Order identifier. + required: true + schema: + type: string + - name: checkoutForm.revision + in: query + description: Checkout form revision. + required: false + schema: + type: string + example: "819b5836" + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CheckoutFormFulfillment' + description: request + required: true + responses: + '204': + description: Fulfillment set successfully + '401': + description: Authentication failed, e.g. token is expired + '404': + description: Order not found or doesn’t belong to the seller + '409': + description: Conflict. Provided revision is outdated. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Some of the provided data is invalid, e.g. unrecognized status value or given status is not allowed to be set (e.g. `RETURNED` status). + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:orders:write + /order/checkout-forms/{id}/invoices: + get: + tags: + - Order management + summary: "Get order invoices details" + description: 'Use to get invoices details including antivirus scan results and EPT invoice verification status. Read more: PL / EN.' + operationId: getOrderInvoicesDetails + parameters: + - name: id + in: path + description: Order identifier. + required: true + schema: + type: string + responses: + '200': + description: Invoices fetched successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CheckoutFormsOrderInvoices' + '403': + description: You do not have permission to access this order + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Order with given id does not exist + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + post: + tags: + - Order management + summary: "Post new invoice" + description: 'Use to add new invoice metadata. Before you send an invoice file, you need to initialize the invoice instance with the required parameters. Read more: PL / EN.' + operationId: addOrderInvoicesMetadata + parameters: + - name: id + in: path + description: Order identifier. + required: true + schema: + type: string + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CheckFormsNewOrderInvoice' + description: request + required: true + responses: + '201': + description: Invoice created successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CheckFormsNewOrderInvoiceId' + '403': + description: You do not have permission to access this order + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Order with given id does not exist + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '409': + description: Order with given id already has seller invoice + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Some of the provided data is invalid or order does not allow an invoice or order's payment is rejected or previously uploaded file is still in scanning. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '429': + description: You're trying to add another metadata too fast. Upload a file to previously added metadata or wait a few seconds before adding next metadata. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + /order/checkout-forms/{id}/invoices/{invoiceId}/file: + put: + tags: + - Order management + summary: "Upload invoice file" + description: 'Use to upload invoice file to match created invoice metadata. Read more: PL / EN.' + operationId: uploadOrderInvoiceFile + parameters: + - name: id + in: path + description: Order identifier. + required: true + schema: + type: string + - name: invoiceId + in: path + description: Invoice identifier. + required: true + schema: + type: string + requestBody: + content: + application/pdf: + schema: + type: string + format: binary + description: File in a binary format + responses: + '200': + description: Invoice file uploaded successfully + '403': + description: You do not have permission to access this order + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Order or invoice with given id does not exist + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '409': + description: Invoice with given id already has invoice file uploaded + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '413': + description: The file is too large. Max file size is 3MB + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Uploaded file is empty or order's payment is rejected + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '/order/carriers/ALLEGRO/points': + get: + tags: + - Order management + summary: "Get Allegro pickup drop off points" + description: >- + Get a list of Allegro pickup drop off points. Read more: PL / EN. + operationId: getAllegroPickupDropOffPointsGET + parameters: + - name: carriers + in: query + description: 'List of carrier ids to filter the drop off/pick up points to only the ones where any of the listed carriers operate. + In case of an empty list, all points are returned.' + required: false + schema: + type: array + items: + $ref: '#/components/schemas/AllegroCarrier' + - name: If-Modified-Since + in: header + description: 'Date of last data modification. If data has been modified after specified date, + full set of data is returned. If header is not specified, full set of data + is returned. Date has to be provided in HTTP-date format. + Information about date (the same HTTP-date format) of last modified data is + available in response - `Last-Modified`.' + required: false + schema: + type: string + format: ', :: GMT' + example: 'Sat, 01 Dec 2018 10:00:00 GMT' + responses: + '200': + description: >- + Returns a list of Allegro pickup drop off points + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AllegroPickupDropOffPointsResponse' + '304': + description: 'Data has not been modified after the date provided in If-Modified-Since header.' + '400': + description: 'Bad request. Invalid query parameters.' + '401': + description: Authentication failed, e.g. token is expired + security: + - bearer-token-for-application: [ ] + - bearer-token-for-user: [ ] + '/order/carriers/{carrierId}/tracking': + get: + tags: + - Order management + summary: "Get carrier parcel tracking history" + description: >- + Get tracking history for parcels. Read more: PL / EN. + operationId: getParcelTrackingUsingGET + parameters: + - name: carrierId + in: path + description: Carrier identifier. + required: true + schema: + type: string + - name: waybill + in: query + description: >- + Waybill number (parcel tracking number). + Example: `waybill=AAA0000E5D201&waybill=BBB00000E5D202` - returns parcel tracking history for `AAA0000E5D201` as well as for `BBB00000E5D202`. + required: true + schema: + type: array + maxItems: 20 + items: + type: string + responses: + '200': + description: >- + Returns parcel tracking history for given waybills + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CarrierParcelTrackingResponse' + '400': + description: Bad request, e.g. unknown carrier id, missing or too many waybills in query parameter + '401': + description: Unauthorized, e.g. token is expired + security: + - bearer-token-for-application: [ ] + - bearer-token-for-user: [ ] + /sale/disputes: + get: + tags: + - Disputes + summary: "Get the user's disputes" + description: >- + Use this resource to get the list of your disputes ordered by descending opened date. + Read more: PL / EN. + operationId: getListOfDisputesUsingGET + parameters: + - name: checkoutForm.id + in: query + description: Checkout form identifier. + required: false + schema: + type: string + format: uuid + example: "29738e61-7f6a-11e8-ac45-09db60ede9d6" + - name: limit + in: query + description: The maximum number of disputes in a response. + required: false + schema: + type: integer + format: int32 + minimum: 1 + maximum: 100 + default: 10 + - name: offset + in: query + description: Index of first returned dispute. + required: false + schema: + type: integer + format: int32 + minimum: 0 + default: 0 + - name: status + in: query + description: Filter disputes with given set of statuses. + required: false + schema: + type: array + items: + type: string + enum: + - CLOSED + - ONGOING + - UNRESOLVED + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/DisputeListResponse' + '401': + description: Unauthorized + '404': + description: Not Found + '422': + description: Unprocessable Entity + security: + - bearer-token-for-user: + - allegro:api:disputes + /sale/disputes/{disputeId}: + get: + tags: + - Disputes + summary: "Get a single dispute" + description: >- + Use this resource to get a single dispute. Read more: PL / EN. + operationId: getDisputeUsingGET + parameters: + - name: disputeId + in: path + description: Dispute identifier. + required: true + schema: + type: string + format: uuid + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Dispute' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:disputes + /sale/disputes/{disputeId}/messages: + get: + tags: + - Disputes + summary: "Get the messages within a dispute" + description: >- + Use this resource to get the list of messages within dispute. Read more: PL / EN. + operationId: getMessagesFromDisputeUsingGET + parameters: + - name: disputeId + in: path + description: Dispute identifier. + required: true + schema: + type: string + format: uuid + - name: limit + in: query + description: The maximum number of messages within dispute returned in a response. + required: false + schema: + type: integer + format: int32 + minimum: 1 + maximum: 100 + default: 10 + - name: offset + in: query + description: Index of first returned message within dispute. + required: false + schema: + type: integer + format: int32 + minimum: 0 + default: 0 + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/DisputeMessageList' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:disputes + post: + tags: + - Disputes + summary: "Add a message to a dispute" + parameters: + - name: disputeId + in: path + description: Dispute identifier. + required: true + schema: + type: string + format: uuid + description: >- + Use this resource to post a message in certain dispute. At least one of fields: 'text', 'attachment' has to + be present. Read more: PL / EN. + operationId: addMessageToDisputeUsingPOST + responses: + '201': + description: CREATED + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/DisputeMessage' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '409': + description: Dispute is in a state that forbids adding new messages + '422': + description: Unprocessable Entity + requestBody: + $ref: '#/components/requestBodies/MessageRequest' + security: + - bearer-token-for-user: + - allegro:api:disputes + /sale/dispute-attachments: + post: + tags: + - Disputes + summary: "Create an attachment declaration" + description: >- + Use this resource to post an attachment declaration. Read more: PL / EN. + operationId: createAnAttachmentUsingPOST + responses: + '201': + description: CREATED + headers: + Location: + schema: + type: string + description: Use this URL to perform PUT request with binary data file coherent with the attachment declaration. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/DisputeAttachmentId' + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Unprocessable Entity + requestBody: + $ref: '#/components/requestBodies/AttachmentDeclaration' + security: + - bearer-token-for-user: + - allegro:api:disputes + /sale/dispute-attachments/{attachmentId}: + put: + tags: + - Disputes + summary: "Upload a dispute message attachment" + description: >- + Upload a dispute message attachment. + + This operation should be used after creating an attachment declaration with *POST /sale/dispute-attachments* + + **Important!** You can find the URL address to upload the file to our server in the *Location* response header of *POST /sale/dispute-attachments*. + The URL is unique and one-time. As its format may change in time, you should always use the address from the header. + Do not compose the address on your own. Read more: PL / EN. + + operationId: uploadDisputeAttachmentUsingPUT + parameters: + - name: attachmentId + in: path + required: true + description: Attachment identifier. + schema: + type: string + format: uuid + servers: + - url: https://upload.{environment} + variables: + environment: + default: allegro.pl + enum: + - allegro.pl + - allegro.pl.allegrosandbox.pl + responses: + '200': + description: File uploaded correctly + '400': + description: Syntactically incorrect request + '401': + description: Invalid or missing bearer token + '413': + description: File is too big + '415': + description: Unsupported media type + '422': + description: Unprocessable Entity + requestBody: + required: true + content: + image/png: + schema: + type: string + format: binary + description: File in a binary format + image/gif: + schema: + type: string + format: binary + description: File in a binary format + image/bmp: + schema: + type: string + format: binary + description: File in a binary format + image/tiff: + schema: + type: string + format: binary + description: File in a binary format + image/jpeg: + schema: + type: string + format: binary + description: File in a binary format + application/pdf: + schema: + type: string + format: binary + description: File in a binary format + security: + - bearer-token-for-user: + - allegro:api:disputes + get: + tags: + - Disputes + summary: "Get an attachment" + description: >- + Use this resource to get an attachment. Read more: PL / EN. + operationId: getAttachmentUsingGET + parameters: + - name: attachmentId + in: path + description: Attachment identifier. + required: true + schema: + type: string + format: uuid + responses: + '200': + description: OK + content: + '*/*': + schema: + type: string + format: binary + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:disputes + /sale/offer-tags: + post: + tags: + - Offer tags + summary: "Create a tag" + description: >- + Use this resource to create a new tag. You can create up to 100 tags. Read more: PL / EN. + operationId: createTagPOST_1 + responses: + '200': + description: Successfully created the requested tag + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TagId' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: >- + Validation failed - your request was correct, but the tag + could not be created. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: User is not brandzone user and doesn't have tags subscription + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TagRequest' + description: request + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + get: + tags: + - Offer tags + summary: "Get the user's tags" + description: >- + Use this resource to get a list of tags defined by the specified user (Defaults: limit = 1000, offset = 0). Read more: PL / EN. + operationId: listSellerTagsGET_1 + parameters: + - name: limit + in: query + description: The limit of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 1000 + minimum: 1 + maximum: 1000 + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + responses: + '200': + description: Successfully returned the requested list of tags + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TagListResponse' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: User is not brandzone user and doesn't have tags subscription + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + + security: + - bearer-token-for-user: + - allegro:api:sale:settings:read + /sale/offer-tags/{tagId}: + delete: + tags: + - Offer tags + summary: "Delete a tag" + description: >- + Use this resource to delete the tag. Read more: PL / EN. + operationId: deleteTagUsingDELETE + parameters: + - name: tagId + in: path + description: Tag identifier. + required: true + schema: + type: string + responses: + '204': + description: Successfully deleted tag + '404': + description: Tag not found + content: + '*/*': + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: User is not brandzone user and doesn't have tags subscription + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + put: + tags: + - Offer tags + summary: "Modify a tag" + description: >- + Use this resource to update a tag. Read more: PL / EN. + This resource is rate limited to 1 million changes per hour. + operationId: updateTagPUT + parameters: + - name: tagId + in: path + description: Tag identifier. + required: true + schema: + type: string + responses: + '200': + description: Successfully updated the requested tag + '422': + description: >- + Validation failed - your request was correct, but the tag could not be updated. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: User is not brandzone user and doesn't have tags subscription + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Tag not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TagRequest' + description: request + required: true + + security: + - bearer-token-for-user: + - allegro:api:sale:settings:write + /sale/offers/{offerId}/tags: + post: + tags: + - Offer tags + summary: "Assign tags to an offer" + description: >- + Use this resource to assign a tag to offer. Read more: PL / EN. + operationId: assignTagToOfferPOST + parameters: + - name: offerId + in: path + description: Offer identifier. + required: true + schema: + type: string + responses: + '200': + description: Successfully assigned tag to offer + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '403': + description: Forbidden - offer is created by someone else or user is not brandzone user or doesn't have tags subscription + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: >- + Validation failed - your request was correct, but the tag + could not be assigned. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Offer not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TagIdsRequest' + description: request + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + get: + tags: + - Offer tags + summary: "Get tags assigned to an offer" + description: >- + Use this resource to get a list of tags assigned to offer. Read more: PL / EN. + operationId: listAssignedOfferTagsGET + parameters: + - name: offerId + in: path + description: Offer identifier. + required: true + schema: + type: string + responses: + '200': + description: Successfully returned list of assigned tags + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TagListResponse' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: User is not brandzone user and doesn't have tags subscription + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Not found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offers/{offerId}/rating: + get: + tags: + - Offer rating + summary: "Get offer rating" + description: 'Use this resource to get offer rating. Read more: PL / EN.' + operationId: offerRatingGET + parameters: + - name: offerId + in: path + description: Offer identifier. + example: "9991337999" + required: true + schema: + type: string + responses: + '200': + description: OK. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferRating' + '403': + description: Offer access denied. + '404': + description: Offer not found. + '401': + description: Unauthorized action. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offer-promotion-packages: + get: + tags: + - Offer management + summary: 'Get all available offer promotion packages' + description: + 'Use this resource to retrieve all available offer promotion packages. Read more: PL / EN.' + operationId: getAvailableOfferPromotionPackages + responses: + '200': + description: Offer promotion packages returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AvailablePromotionPackages' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + security: + - bearer-token-for-application: [] + - bearer-token-for-user: [] + /sale/offers/{offerId}/promo-options-modification: + post: + tags: + - Offer management + summary: 'Modify offer promotion packages' + description: + 'Use this resource to modify offer promotion packages. Read more: PL / EN.' + operationId: modifyOfferPromoOptionsUsingPOST + parameters: + - name: offerId + in: path + description: Offer identifier. + example: "9991337999" + required: true + schema: + type: string + responses: + '200': + description: Offer promotion packages modified successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferPromoOptions' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Offer does not belong to seller. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Offer does not exist or unsupported package name or unsupported change type. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PromoOptionsModifications' + description: request + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/offers/{offerId}/promo-options: + get: + tags: + - Offer management + summary: 'Get offer promotion packages' + description: + 'Use this resource to get promotion packages assigned to an offer. Read more: PL / EN.' + operationId: getOfferPromoOptionsUsingGET + parameters: + - name: offerId + in: path + description: Offer identifier. + example: "9991337999" + required: true + schema: + type: string + responses: + '200': + description: Offer promotion packages returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferPromoOptions' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Offer does not belong to seller. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offers/promo-options: + get: + tags: + - Offer management + summary: "Get promo options for seller's offers" + description: 'Use this resource to retrieve promo options for seller offers. Read more: PL / EN.' + operationId: getPromoOptionsForSellerOffersUsingGET + parameters: + - name: limit + in: query + description: Limit of promo options per page. + required: false + schema: + type: integer + format: int32 + minimum: 1 + maximum: 5000 + default: 5000 + - name: offset + in: query + description: Distance between the beginning of the document and the point from which promo options are returned. + required: false + schema: + type: integer + format: int64 + minimum: 0 + default: 0 + responses: + '200': + description: Promo options for seller offers successfully returned. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferPromoOptionsForSeller' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offers/promo-options-commands/{commandId}: + put: + tags: + - Offer management + summary: 'Batch offer promotion package modification' + description: + 'Use this resource to modify promotion packages on multiple offers at once. Read more: PL / EN.' + operationId: promoModificationCommandUsingPUT + parameters: + - name: commandId + in: path + description: Command identifier. Must be a UUID. + example: "aca8103b-14eb-4855-b9b3-de5bef06bd30" + required: true + schema: + type: string + responses: + '201': + description: Command was registered + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PromoGeneralReport' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '409': + description: Command id already in use. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Size of batch should be between 1 and 1000 offers or unsupported modification time. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + $ref: '#/components/requestBodies/PromoOptionsCommand' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + get: + tags: + - Offer management + summary: 'Modification command summary' + description: + 'Use this resource to find out how many offers were edited within one {commandId}. You will receive a summary + with a number of successfully edited offers and errors. Read more: PL / EN.' + operationId: getPromoModificationCommandResultUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + responses: + '200': + description: Summary successfully returned. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PromoGeneralReport' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Batch modification command does not belong to seller. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Batch modification command does not exist. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offers/promo-options-commands/{commandId}/tasks: + get: + tags: + - Offer management + summary: 'Modification command detailed result' + description: + 'Use this resource to retrieve the result of an offer modification command. Read more: PL / EN.' + operationId: getPromoModificationCommandDetailedResultUsingGET + parameters: + - name: commandId + in: path + description: Command identifier. + required: true + schema: + type: string + - name: limit + in: query + description: 'The limit of returned items.' + required: false + schema: + type: integer + minimum: 1 + maximum: 1000 + default: 100 + - name: offset + in: query + description: 'The offset of returned items.' + required: false + schema: + type: integer + minimum: 0 + default: 0 + responses: + '200': + description: Report successfully returned. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PromoModificationReport' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Batch modification command does not belong to seller. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Batch modification command does not exist. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/offers/{offerId}/smart: + get: + tags: + - User's offer information + summary: "Get Smart! classification report of the particular offer" + description: >- + Use this resource to get a full Smart! offer classification report of one of your offers. + Please keep in mind you have to meet Smart! seller conditions first - for more details, use *GET /sale/smart*. + To learn more about Smart! offer requirements, see our knowledge base article: [PL](https://allegro.pl/pomoc/dla-sprzedajacych/informacje-dla-sprzedajacych/co-zrobic-aby-moje-oferty-byly-oznaczone-ikona-allegro-smart-lDkP8VbKncV) / [EN](https://allegro.pl/help/for-sellers/allegro-smart-for-sellers/how-can-i-make-my-offers-be-marked-with-the-allegro-smart-badge-rKD1RV30jFM). Read more: PL / EN. + operationId: getOfferSmartClassificationGET + parameters: + - name: offerId + in: path + description: Offer identifier. + required: true + schema: + type: string + - name: marketplaceId + in: query + description: >- + Marketplace for which offer classification report will be returned. + If not specified, the result of the offer's base marketplace will be returned. + required: false + schema: + type: string + example: allegro-pl + responses: + '200': + description: Successfully returned offer Smart! classification report + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SmartOfferClassificationReport' + '400': + description: Bad Request + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Offer does not belong to seller + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '404': + description: Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: | + Unprocessable entity + - The offer is being created in our system and we are not able to process it yet. Try again later. + - Provided marketplaceId is not supported. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/products: + get: + tags: + - Products + summary: "Get search products results" + description: >- + Use this resource to get a list of products according to provided parameters. + At least ean or phrase parameter is required. Read more: PL / EN. + This resource is limited with Leaky Bucket mechanism, read more PL / EN. + operationId: getSaleProducts + parameters: + - name: ean + in: query + description: The EAN values can include EAN, ISBN, and UPC identifier types. Parameter is depracated and will be removed in the future. Please use combination of phrase and mode (`GTIN`) parameters instead. + required: false + deprecated: true + schema: + type: string + maxLength: 18 + - name: phrase + in: query + description: Search phrase. + required: false + schema: + type: string + maxLength: 1024 + - name: mode + in: query + required: false + description: >- + Search mode. If not specified, we are searching by GTIN, MPN, product's name, parameters, etc. + - `GTIN` - restricts the search filtering to GTINs (Global Trade Item Number), e.g. EAN, ISBN, UPC. + - `MPN` - restricts the search filtering to MPNs (Manufacturer Part Number). + schema: + type: string + enum: + - GTIN + - MPN + - name: language + in: query + description: >- + Language indicates the language for searching products. Allows to specify the language of the given phrase. + required: false + schema: + type: string + format: BCP-47 language code + example: 'en-US' + enum: + - en-US + - pl-PL + - uk-UA + - sk-SK + - cs-CZ + - hu-HU + - name: category.id + in: query + description: The category identifier to filter results. This can only be used when searching by phrase. + required: false + schema: + type: string + - name: "Dynamic filters" + in: query + description: >- + You can filter and customize your search results to find exactly what you need by applying filters ids and their dictionary values to query according to the flowing pattern: id=value. + When the filter definition looks like: + ```` + { + "id": "127448", + "name": "Kolor", + "type": "SINGLE", + "values": [ + { + "name": "biały", + "value": "127448_2" + }, + { + "name": "czarny", + "value": "127448_1" + } + ] + } + ```` + You can use 'Kolor' filter to query results, i.e.: + * `127448=127448_2` for "biały" + * `127448=127448_1` for "czarny". + required: false + schema: + type: object + additionalProperties: + x-additionalPropertiesName: filter's id + type: string + description: Filter value. + - name: page.id + in: query + description: A "cursor" to the next set of results. + required: false + schema: + type: string + - name: searchFeatures + in: query + description: >- + Enables additional search options: + - *SIMILAR_CATEGORIES* - searching in the indicated category (category.id) and in 'similar categories' (works only if category.id is a leaf category). + required: false + schema: + type: string + enum: + - SIMILAR_CATEGORIES + - name: includeDrafts + in: query + description: Include products in draft state. + required: false + schema: + type: boolean + responses: + '200': + description: Successful operation. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GetSaleProductsResponse' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '422': + description: >- + One of parameters have invalid value. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/products/{productId}: + get: + tags: + - Products + summary: 'Get all data of the particular product' + description: >- + Use this resource to retrieve all data of the particular product. + Read more: PL / EN. + This resource is limited with Leaky Bucket mechanism. + operationId: getSaleProduct + parameters: + - name: productId + in: path + description: The product identifier. + required: true + schema: + type: string + - name: category.id + in: query + description: The similar category identifier. You can choose a category from 'similar categories' to filter the list of parameters available in the category context. + required: false + schema: + type: string + - name: includeDrafts + in: query + description: Return also if product is in draft state. + required: false + schema: + type: boolean + - name: language + in: query + description: >- + The language version of product. You can indicate the language for the returned product data. + required: false + schema: + type: string + format: BCP-47 language code + example: 'en-US' + enum: + - en-US + - pl-PL + - uk-UA + - sk-SK + - cs-CZ + - hu-HU + responses: + '200': + description: Product returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SaleProductDto' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: A product's not found or language version of the product is currently unavailable. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: One of parameters have invalid value. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/product-proposals: + post: + tags: + - Products + summary: "Propose a product" + description: >- + Use this resource to propose a product. Read more: PL / EN. + operationId: proposeSaleProduct + parameters: + - name: Accept-Language + in: header + required: false + description: Expected language of messages. + example: pl-PL + schema: + type: string + format: BCP-47 language code + enum: + - en-US + - pl-PL + - uk-UA + - sk-SK + - cs-CZ + - hu-HU + responses: + '201': + description: Product proposed successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ProductProposalsResponse' + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden - not allowed to access. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '409': + description: >- + Product already exists. Url of the existing product is provided in the HTTP Location header field of the response. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ProductProposalsRequest' + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/products/{productId}/change-proposals: + post: + tags: + - Products + summary: "Propose changes in product" + description: >- + Use this resource to propose changes in product. Read more: PL / EN. This resource is limited to 100 suggestions per day for a single user. + operationId: productChangeProposal + parameters: + - name: productId + in: path + description: The product identifier. + required: true + schema: + type: string + - name: Accept-Language + in: header + required: false + description: Expected language of messages. + example: pl-PL + schema: + type: string + format: BCP-47 language code + enum: + - en-US + - pl-PL + - uk-UA + - sk-SK + - cs-CZ + - hu-HU + responses: + '201': + description: Product changes proposed successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ProductChangeProposalDto' + headers: + Location: + schema: + type: string + description: Url of the created product change proposal is provided in the HTTP Location header field of the response. + '400': + description: Bad request. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Product with the given Id not found. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ProductChangeProposalRequest' + required: true + security: + - bearer-token-for-user: + - allegro:api:sale:offers:write + /sale/products/change-proposals/{changeProposalId}: + get: + tags: + - Products + summary: 'Get all data of the particular product changes proposal' + description: 'Use this resource to retrieve all data of the particular product changes proposal. Read more: PL / EN.' + operationId: getProductChangeProposal + parameters: + - name: changeProposalId + in: path + description: The product changes proposal identifier. + required: true + schema: + type: string + - name: Accept-Language + in: header + required: false + description: Expected language of messages. + example: pl-PL + schema: + type: string + format: BCP-47 language code + enum: + - en-US + - pl-PL + - uk-UA + - sk-SK + - cs-CZ + - hu-HU + responses: + '200': + description: Product changes proposal returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ProductChangeProposalDto' + '401': + description: Unauthorized. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: You do not have permission to access change proposal that not belong to you + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Not Found. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + '/sale/offers/unfilled-parameters': + get: + tags: + - Offer management + summary: 'Get offers with missing parameters' + description: >- + Use this resource to get information about required parameters or parameters scheduled to become required that are not filled in offers. Read more: PL / EN. + operationId: getOffersUnfilledParametersUsingGET_1 + parameters: + - name: offer.id + in: query + description: 'List of offer ids. If empty all offers with unfilled parameters will be returned.' + required: false + explode: true + schema: + type: array + items: + type: string + - name: parameterType + in: query + description: Filter by parameter type. + schema: + type: string + enum: + - REQUIRED + - REQUIREMENT_PLANNED + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 0 + minimum: 0 + - name: limit + in: query + description: The limit of elements in the response. + required: false + schema: + type: integer + format: int32 + default: 100 + minimum: 1 + maximum: 1000 + responses: + '200': + description: Unfilled offer parameters were returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/UnfilledParametersResponse' + '400': + description: Bad Request + '401': + description: Unauthorized + '403': + description: Forbidden + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/compatibility-list/supported-categories: + get: + tags: + - Compatibility List + summary: 'Get list of categories where compatibility list is supported' + description: 'Compatibility list is available in particular categories, this resource allows to get the list of these categories with additional details. Read more: PL / EN.' + operationId: "getCategoriesThatSupportCompatibilityList" + responses: + '200': + description: 'Configuration of supported categories.' + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CompatibilityListSupportedCategoriesDto' + '401': + description: Unauthorized + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/compatibility-list-suggestions: + get: + tags: + - Compatibility List + summary: 'Get suggested compatibility list.' + description: 'Resource allows to fetch compatibility list suggestion for given offer or product. Read more: PL / EN.' + operationId: "getCompatibilityListSuggestion" + parameters: + - name: offer.id + in: query + description: 'Offer id on the basis of which we will return the suggested compatibility list.' + required: false + schema: + type: string + - name: product.id + in: query + description: 'Product id on the basis of which we will return the suggested compatibility list.' + required: false + schema: + type: string + - name: language + in: query + description: 'Locale on the basis of which we will return the suggested compatibility list. For product-based suggestions if missing pl-PL will be used. For offer-based suggestions if missing offer language will be used.' + required: false + example: "pl-PL" + schema: + type: string + responses: + '200': + description: 'Compatibility list suggestion returned successfully.' + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CompatibilityList' + '400': + description: 'Bad request.' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: 'Unauthorized.' + content: + application/json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: 'Suggestion was not found.' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '/sale/compatible-products/groups': + get: + tags: + - Compatibility List + summary: 'Get list of compatible product groups' + description: 'Compatible products are organized in groups, this resource allows to browse these groups. Read more: PL / EN.' + operationId: 'getCompatibleProductsGroups' + parameters: + - name: If-Modified-Since + in: header + description: 'Date of last data modification. If data has been modified after specified date, + full set of data is returned. If header is not specified, full set of data + is returned. Date has to be provided in HTTP-date format.' + required: false + schema: + type: string + format: ', :: GMT' + example: 'Sat, 01 Dec 2018 10:00:00 GMT' + - name: type + in: query + description: 'Type of compatible products. You can find available types in the response + for the GET supported-categories resource. + You can use value provided in `itemsType`, for categories where `inputType=ID`.' + required: true + schema: + type: string + example: 'CAR' + - name: limit + in: query + description: 'The limit of returned items.' + required: false + schema: + type: integer + minimum: 1 + maximum: 200 + default: 200 + - name: offset + in: query + description: 'The offset of returned items.' + required: false + schema: + type: integer + minimum: 0 + default: 0 + responses: + '200': + description: 'Groups of compatible products returned successfully.' + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CompatibleProductsGroupsDto' + '304': + description: 'Data has not been modified after the date provided in If-Modified-Since header.' + '400': + description: 'Bad request' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + '422': + description: 'Validation failed - for example type that was used is not supported' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/compatible-products: + get: + tags: + - Compatibility List + summary: 'Get list of compatible products' + description: 'Resource allows to fetch compatible products of given type. Read more: PL / EN.' + operationId: "getCompatibleProducts" + parameters: + - name: If-Modified-Since + in: header + description: 'Date of last data modification. If data has been modified after specified date, + full set of data is returned. If header is not specified, full set of data + is returned. Date has to be provided in HTTP-date format. + Header is ignored if `phrase` parameter is used.' + required: false + schema: + type: string + format: ', :: GMT' + example: 'Sat, 01 Dec 2018 10:00:00 GMT' + - name: type + in: query + description: 'Type of compatible products. You can find available types in the response + for the GET supported-categories resource. + You can use value provided in `itemsType`, for categories where `inputType=ID`.' + required: true + schema: + type: string + example: 'CAR' + - name: group.id + in: query + description: 'Group identifier from `/sale/compatible-products/groups` resource. + Parameter is required when parameter `tecdoc.kTypNr` or `tecdoc.nTypNr` or `phrase` is not specified.' + required: false + schema: + type: string + - name: tecdoc.kTypNr + in: query + description: 'Identifier of passenger vehicle (kTypNr) from TecDoc database. + When used, `group.id` parameter is ignored.' + required: false + schema: + type: string + - name: tecdoc.nTypNr + in: query + description: 'Identifier of commercial vehicle (nTypNr) from TecDoc database. + When used, `group.id` parameter is ignored.' + required: false + schema: + type: string + - name: phrase + in: query + description: 'Query for compatible products. + When used, parameters: `group.id`, `limit`, `offset` and header `If-Modified-Since` are ignored.' + required: false + schema: + type: string + - name: limit + in: query + description: 'The limit of returned items. If `phrase` parameter is present, + parameter is ignored and maximum value is set to `200`.' + required: false + schema: + type: integer + minimum: 1 + maximum: 200 + default: 200 + - name: offset + in: query + description: 'The offset of returned items. If `phrase` parameter is present, parameter is ignored.' + required: false + schema: + type: integer + minimum: 0 + default: 0 + responses: + '200': + description: 'Compatible products returned successfully.' + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CompatibleProductsListDto' + '304': + description: 'Data has not been modified after the date provided in If-Modified-Since header.' + '400': + description: 'Bad request' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + '422': + description: 'Validation failed - for example invalid format of If-Modified-Since header was passed' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /account/additional-emails: + get: + tags: + - Information about user + summary: "Get user's additional emails" + description: 'Use this resource to get a list of all additional email addresses assigned to account. Read more: PL / EN.' + operationId: getListOfAdditionalEmailsUsingGET + responses: + '200': + description: List of user's additional emails returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalEmailsResponse' + '401': + description: Unauthorized + content: + '*/*': + schema: + $ref: '#/components/schemas/AuthError' + security: + - bearer-token-for-user: + - allegro:api:profile:read + post: + tags: + - Information about user + summary: "Add a new additional email address to user's account" + description: 'Use this resource to add a new additional email address to account. Read more: PL / EN.' + operationId: addAdditionalEmailUsingPOST + responses: + '201': + description: Additional email added successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalEmail' + '400': + description: Bad request + content: + '*/*': + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + '*/*': + schema: + $ref: '#/components/schemas/AuthError' + '422': + description: Email address provided in the request is not valid + content: + '*/*': + schema: + $ref: '#/components/schemas/ErrorsHolder' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalEmailRequest' + description: request + required: true + security: + - bearer-token-for-user: + - allegro:api:profile:write + /account/additional-emails/{emailId}: + get: + tags: + - Information about user + summary: "Get information about a particular additional email" + description: 'Use this resource to retrieve a single additional email. Read more: PL / EN.' + operationId: getAdditionalEmailUsingGET + parameters: + - name: emailId + in: path + description: Id of the additional email. + required: true + schema: + type: string + responses: + '200': + description: Additional email returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalEmail' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Additional email not found + content: + '*/*': + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:profile:read + delete: + tags: + - Information about user + summary: "Delete an additional email address" + description: 'Use this resource to delete one of additional emails. Read more: PL / EN.' + operationId: deleteAdditionalEmailUsingDELETE + parameters: + - name: emailId + in: path + description: Id of the additional email to be deleted. + required: true + schema: + type: string + responses: + '204': + description: Successfully deleted additional email + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Additional email not found + content: + '*/*': + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:profile:write + /payments/payment-operations: + get: + tags: + - Payments + summary: Payment operations history + description: 'Use this endpoint to get the list of the seller payment operations. Read more: PL / EN.' + operationId: getPaymentsOperationHistory + parameters: + - name: wallet.type + in: query + description: >- + Type of the wallet: + * AVAILABLE - operations available for payout. + * WAITING - operations temporarily suspended for payout. + required: false + schema: + type: string + default: AVAILABLE + enum: + - AVAILABLE + - WAITING + - name: wallet.paymentOperator + in: query + description: >- + Payment operator: + * PAYU - operations processed by PAYU operator. + * P24 - operations processed by PRZELEWY24 operator. + * AF - operations processed by Allegro Finance operator. + * AF_P24 - operations processed by Allegro Finance with PRZELEWY24. + * AF_PAYU - operations processed by Allegro Finance with PAYU. + required: false + schema: + type: string + enum: + - PAYU + - P24 + - AF + - AF_P24 + - AF_PAYU + - name: payment.id + in: query + description: The payment ID. + required: false + schema: + type: string + format: uuid + - name: participant.login + in: query + description: >- + Login of the participant. In case of REFUND_INCREASE operation this is the login of the seller, + in other cases, of the buyer. + required: false + schema: + type: string + - name: occurredAt.gte + in: query + description: The minimum date and time of operation occurrence in ISO 8601 format. + example: "2019-05-08T09:45:20.818Z" + required: false + schema: + type: string + format: date-time + - name: occurredAt.lte + in: query + description: The maximum date and time of operation occurrence in ISO 8601 format. + required: false + example: "2019-05-08T09:45:20.818Z" + schema: + type: string + format: date-time + - name: group + in: query + description: >- + Group of operation types: + * INCOME - CONTRIBUTION, SURCHARGE, CORRECTION, DEDUCTION_INCREASE, COMPENSATION. + * OUTCOME - PAYOUT, PAYOUT_CANCEL, DEDUCTION_CHARGE. + * REFUND - REFUND_CHARGE, REFUND_CANCEL, REFUND_INCREASE, CORRECTION, PROVIDER_REFUND_TRANSFER_CHARGE, PROVIDER_REFUND_TRANSFER_INCREASE. + * BLOCKADES - BLOCKADE, BLOCKADE_RELEASE. + required: false + schema: + type: array + items: + type: string + enum: + - INCOME + - OUTCOME + - REFUND + - BLOCKADES + - name: marketplaceId + in: query + description: >- + The marketplace ID where operation was made. + When the parameter is omitted, searches for operations with all marketplaces. + Note, that there are operations not assigned to any marketplace. + required: false + schema: + type: string + enum: + - allegro-pl + - allegro-cz + example: allegro-pl + - name: currency + in: query + description: Currency of the operations. + required: false + schema: + type: string + example: 'PLN' + - name: limit + in: query + required: false + description: Number of returned operations. + schema: + type: integer + format: int32 + minimum: 1 + maximum: 50 + default: 50 + - name: offset + in: query + required: false + description: Index of the first returned payment operation from all search results. + schema: + type: integer + format: int32 + minimum: 0 + maximum: 10000 + default: 0 + responses: + '401': + description: Unauthorized + '200': + description: The payment operations history for given search criteria returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PaymentOperations' + '422': + description: >- + Returned when any of the given search parameters have an invalid value or when the search result reached + the limit of found operations - 10000. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:payments:read + /bidding/offers/{offerId}/bid: + put: + tags: + - Auctions and Bidding + operationId: placeBid + summary: 'Place a bid in an auction' + description: 'Place a bid in an auction. Read more: PL / EN.' + parameters: + - name: offerId + in: path + required: true + description: The offer ID. + schema: + type: string + requestBody: + content: + 'application/vnd.allegro.public.v1+json': + schema: + type: object + title: BidRequest + description: The bid request. + required: + - maxAmount + properties: + maxAmount: + $ref: '#/components/schemas/MaxPrice' + responses: + '200': + description: Bid succesfully placed + content: + 'application/vnd.allegro.public.v1+json': + schema: + $ref: '#/components/schemas/MyBidResponse' + '400': + description: Bad request. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Auction not found. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: If bidding was not allowed (see message for explanation). + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:bids + get: + tags: + - Auctions and Bidding + operationId: getBid + summary: "Get current user's bid information" + description: 'Get current user''s bid information. Read more: PL / EN.' + parameters: + - name: offerId + in: path + required: true + description: The offer ID. + schema: + type: string + responses: + '200': + description: Bid information succesfully found. + content: + 'application/vnd.allegro.public.v1+json': + schema: + $ref: '#/components/schemas/MyBidResponse' + '404': + description: Auction not found or user did not bid in the auction. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:bids + /sale/offer-events: + get: + tags: + - User's offer information + summary: "Get events about the seller's offers" + description: >- + Use this endpoint to get events from the last 24 hours concerning changes in the authorized seller's offers. + + At present we support the following events: + - OFFER_ACTIVATED - offer is visible on site and available for purchase, occurs when offer status changes from ACTIVATING to ACTIVE. + - OFFER_CHANGED - occurs when offer's fields has been changed e.g. description or photos. + - OFFER_ENDED - offer is no longer available for purchase, occurs when offer status changes from ACTIVE to ENDED. + - OFFER_STOCK_CHANGED - stock in an offer was changed either via purchase or by seller. + - OFFER_PRICE_CHANGED - occurs when price in an offer was changed. + - OFFER_ARCHIVED - offer is no longer available on listing and has been archived. + - OFFER_BID_PLACED - bid was placed on the offer. + - OFFER_BID_CANCELED - bid for offer was canceled. + - OFFER_TRANSLATION_UPDATED - translation of offer was updated. + - OFFER_VISIBILITY_CHANGED - visibility of offer was changed on marketplaces. + + Returned events may occur by actions made via browser or API. + The resource allows you to get events concerning active offers and offers scheduled for activation (status ACTIVE and ACTIVATING). Returned events do not concern offers in INACTIVE and ENDED status (the exception is OFFER_ARCHIVED event). + External id is returned for all event types except OFFER_BID_PLACED and OFFER_BID_CANCELED. + Please note that one change may result in more than one event. Read more: PL / EN. + + operationId: getOfferEvents + parameters: + - in: query + name: from + required: false + description: The ID of the last seen event. Events that occured after the given event will be returned. + schema: + type: string + example: "MTEzMjQzODU3NA" + maxLength: 256 + - in: query + name: limit + required: false + description: The number of events that will be returned in the response. + schema: + type: integer + default: 100 + minimum: 1 + maximum: 1000 + - in: query + name: type + required: false + description: >- + The types of events that will be returned in the response. All types of events are returned by default. + schema: + type: array + items: + type: string + enum: + - OFFER_ACTIVATED + - OFFER_CHANGED + - OFFER_ENDED + - OFFER_STOCK_CHANGED + - OFFER_PRICE_CHANGED + - OFFER_ARCHIVED + - OFFER_BID_PLACED + - OFFER_BID_CANCELED + - OFFER_TRANSLATION_UPDATED + - OFFER_VISIBILITY_CHANGED + responses: + '200': + description: The list of offer events returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SellerOfferEventsResponse' + examples: + offerEvent: + summary: offer event + value: + offerEvents: + - id: "MTEzMjQzODU3NA" + occurredAt: "2019-06-26T15:26:43.891Z" + type: "OFFER_ACTIVATED" + offer: + id: "2865624934" + external: + id: "externalId" + offerEndedEvent: + summary: offer ended event + value: + offerEvents: + - id: "MTEzMjQzODU3NA" + occurredAt: "2019-06-26T15:26:43.891Z" + type: "OFFER_ENDED" + offer: + id: "2865624934" + publication: + endedBy: "USER" + external: + id: "externalId" + offerBidPlaced: + summary: offer bid placed event + value: + offerEvents: + - id: "MTEzMjQzODU3NA" + occurredAt: "2019-06-26T15:26:43.891Z" + type: "OFFER_BID_PLACED" + offer: + id: "2865624934" + offerBidCanceled: + summary: offer bid canceled event + value: + offerEvents: + - id: "MTEzMjQzODU3NA" + occurredAt: "2019-06-26T15:26:43.891Z" + type: "OFFER_BID_CANCELED" + offer: + id: "2865624934" + translationChanged: + summary: offer translation updated event + value: + offerEvents: + - id: "MTEzMjQzODU3NA" + occurredAt: "2019-06-26T15:26:43.891Z" + type: "OFFER_TRANSLATION_UPDATED" + offer: + id: "2865624934" + external: + id: "externalId" + translations: + - language: "en-US" + - language: "pl-PL" + visibilityChanged: + summary: offer visibility on marketplaces changed event + value: + offerEvents: + - id: "MTEzMjQzODU3NA" + occurredAt: "2019-06-26T15:26:43.891Z" + type: "OFFER_VISIBILITY_CHANGED" + offer: + id: "2865624934" + external: + id: "externalId" + publication: + marketplaces: + base: "allegro-pl" + additional: + - id: "allegro-cz" + status: + type: "string" + enum: + - APPROVED + - IN_PROGRESS + - REFUSED + refusalReasons: + - code: "001" + parameters: + parameter-1-name: + - "First parameter one value" + - "Second parameter one value" + parameter-2-name: + - "First parameter two value" + - "Secon parameter two value" + relatedReasons: + - code: "001-related" + parameters: + parameter-1-name: + - "First parameter one value" + - "Second parameter one value" + parameter-2-name: + - "First parameter two value" + - "Secon parameter two value" + updatedMarketplaces: + - "allegro-pl" + - "allegro-cz" + '400': + description: >- + Invalid parameters supplied in the request. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/AuthError' + security: + - bearer-token-for-user: + - allegro:api:sale:offers:read + /sale/badge-campaigns: + get: + tags: + - Badge campaigns + summary: "Get a list of available badge campaigns" + description: >- + Badge campaigns are another way to promote your offers. + You can apply for a badge, which - depending on a type - will be displayed on your offer page of on the list of offers. + + First - use this resource to get a list of all available badge campaigns at the moment, then use *POST /sale/badges* to apply for badge. + Read more: PL / EN. + operationId: badgeCampaigns_get_all + parameters: + - name: marketplace.id + in: query + description: 'The marketplace of campaigns.' + required: false + schema: + type: string + example: 'allegro-pl' + responses: + '200': + description: List of available badge campaigns. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/GetBadgeCampaignsList' + examples: + badge-campaigns: + summary: Badge campaigns + value: + badgeCampaigns: + - id: 'BARGAIN' + name: 'Strefa okazji' + marketplace: + id: 'allegro-pl' + type: "DISCOUNT" + eligibility: + eligible: true + refusalReasons: [] + application: + type: 'ALWAYS' + visibility: + type: 'WITHIN' + from: '2018-01-01T23:00:00Z' + to: '2020-10-04T23:00:00Z' + publication: + type: 'UNTIL' + to": '2020-10-03T23:00:00Z' + regulationsLink: 'https://na.allegro.pl/regulamin-kampania-BARGAIN' + - id: 'HIT' + name: 'Hit' + marketplace: + id: 'allegro-pl' + type: 'STANDARD' + eligibility: + eligible: false + refusalReasons: + - code: 'BB1' + messages: + - text: 'The account does not meet the quality criteria' + link: null + application: + type: 'NEVER' + visibility: + type: 'ALWAYS' + publication: + type: 'SINCE' + from: '2018-11-04T23:00:00Z' + regulationsLink: 'https://na.allegro.pl/regulamin-kampania-HIT' + '400': + description: Invalid values supplied in the query parameters. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + invalid-parameters: + summary: 'Invalid values supplied in the query parameters.' + value: + errors: + - code: 'BB35' + details: null + message: 'Invalid [marketplace.id] parameter value.' + path: 'marketplace.id' + userMessage: 'Invalid [marketplace.id] parameter value.' + '401': + description: Unauthorized. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: The account is not a Business Account. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + not-business-account: + summary: 'The account is not a Business Account.' + value: + errors: + - code: BB2 + details: + message: 'The account is not a Business Account.' + path: + userMessage: 'The account is not a Business Account.' + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/badges: + post: + tags: + - Badge campaigns + summary: "Apply for badge in selected offer" + description: >- + This resource allows you to apply for a badge. Most badges involve additional fee charged. + + Your badge application will be verified and you will be notified about the verification status via e-mail. + You can use *Location* provided in header of the response to track your application status. + Application will be removed after 30 days when status of the application was changed form PROCESSED or DECLINED. + + Fees will be charged in accordance with Annex No. 1 to the + Daily deals zone terms and conditions. + + By using this resource you agree to the + Daily deals zone terms and conditions + or + Commission discount terms and conditions. + Read more: PL / EN. + operationId: postBadges + responses: + '202': + description: Successfully applied for a badge. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/BadgeApplication' + examples: + discountResponse: + summary: 'Discount badge application' + value: + id: '01234567-89ab-0123-456789ab' + createdAt: '2011-12-03T10:15:30Z' + updatedAt: '2011-12-03T10:15:30Z' + campaign: + id: 'BARGAIN' + offer: + id: '987654321' + prices: + market: + amount: '11.23' + currency: 'PLN' + bargain: + amount: '10.00' + currency: 'PLN' + process: + status: 'REQUESTED' + rejectionReasons: [] + limitResponse: + summary: 'Discount badge application with purchase limit' + value: + id: '01234567-89ab-0123-456789ab' + createdAt: '2011-12-03T10:15:30Z' + updatedAt: '2011-12-03T10:15:30Z' + campaign: + id: 'BARGAIN' + offer: + id: '987654321' + prices: + market: + amount: '11.23' + currency: 'PLN' + bargain: + amount: '10.00' + currency: 'PLN' + purchaseConstraints: + limit: + perUser: + maxItems: 1 + process: + status: 'REQUESTED' + rejectionReasons: [] + '400': + description: Syntactically incorrect request. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: The account is not a Business Account. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + not-business-account: + summary: 'The account is not a Business Account.' + value: + errors: + - code: 'BB2' + details: null + message: 'The account is not a Business Account.' + path: null + userMessage: 'The account is not a Business Account.' + '422': + description: Validation error. Invalid parameters provided in the request. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + unprocessable-request: + summary: 'Amount is not a valid number.' + value: + errors: + - code: 'BB5' + details: null + message: "Currency not supported." + path: 'prices.bargain.currency' + userMessage: "Currency not supported." + - code: 'BB6' + details: null + message: 'One of the numerical values is not a number.' + path: 'prices.bargain.amount' + userMessage: 'One of the numerical values is not a number.' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/BadgeApplicationRequest' + examples: + discount: + summary: 'Discount' + value: + campaign: + id: 'BARGAIN' + offer: + id: '12345678' + prices: + bargain: + amount: '9.99' + currency: 'PLN' + standard: + summary: 'Standard' + value: + campaign: + id: 'HIT' + offer: + id: '12345678' + sourcing: + summary: 'Sourcing' + value: + campaign: + id: 'SOURCING_CAMPAIGN' + offer: + id: '12345678' + prices: + bargain: + amount: '9.99' + currency: 'PLN' + limit: + summary: 'Discount with purchase limit' + value: + campaign: + id: 'BARGAIN' + offer: + id: '12345678' + prices: + bargain: + amount: '9.99' + currency: 'PLN' + purchaseConstraints: + limit: + perUser: + maxItems: 1 + security: + - bearer-token-for-user: + - allegro:api:campaigns + get: + tags: + - Badge campaigns + summary: 'Get a list of badges' + description: >- + Use this resource to get a list of badges in authorized seller's offers. + Read more: PL / EN. + operationId: getBadges + parameters: + - name: offer.id + in: query + description: 'Offer ID.' + required: false + schema: + type: string + - name: marketplace.id + in: query + description: 'The marketplace of badges.' + required: false + schema: + type: string + example: 'allegro-pl' + - name: offset + in: query + description: 'Offset.' + required: false + schema: + type: integer + minimum: 0 + - name: limit + in: query + description: 'The maximum number of badges returned in the response.' + required: false + schema: + type: integer + default: 50 + minimum: 1 + maximum: 1000 + responses: + '200': + description: Successfully returned list of badges. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/BadgesList' + examples: + badges: + summary: 'List of badges' + value: + badges: + - offer: + id: '4814482399' + campaign: + id: 'BARGAIN' + name: 'Strefa okazji' + publication: null + prices: + market: + amount: '20.00' + currency: 'PLN' + process: + status: 'IN_VERIFICATION' + rejectionReasons: [] + - offer: + id: '2091846836' + campaign: + id: 'SUBSIDY' + name: 'Allegro Cena' + publication: + type: 'SINCE' + from: '2019-05-08T05:54:46.966Z' + to: null + prices: + subsidy: + targetPrice: + amount: '10.00' + currency: 'PLN' + sellerPrice: + amount: '15.00' + currency: 'PLN' + process: + status: 'WAITING_FOR_PUBLICATION' + rejectionReasons: [ ] + - offer: + id: '7386670824' + campaign: + id: 'HIT' + name: 'Hit' + publication: + type: 'WITHIN' + from: '2019-05-08T05:54:46.966Z' + to: '2025-05-01T10:00:00Z' + prices: null + process: + status: 'FINISHED' + rejectionReasons: [] + - offer: + id: '5303917450' + campaign: + id: 'NOVELTY' + name: 'Nowość' + publication: null + prices: null + process: + status: 'DECLINED' + rejectionReasons: + - code: 'BA26' + messages: + - text: 'This offer does not meet the badge criteria.' + link: null + - text: 'See requirements' + link: 'https://allegro.pl/pomoc/dla-sprzedajacych/promowanie-ofert/specjalne-oznaczenia-ofert-na-listach-YL8zKmBRktz' + '400': + description: Invalid values supplied in the query parameters. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + invalid-parameters: + summary: 'Invalid values supplied in the query parameters.' + value: + errors: + - code: 'BB9' + details: null + message: 'Invalid [limit] parameter value.' + path: 'limit' + userMessage: 'Invalid [limit] parameter value.' + - code: 'BB10' + details: null + message: 'Invalid [offset] parameter value.' + path: 'offset' + userMessage: 'Invalid [offset] parameter value.' + - code: 'BB35' + details: null + message: 'Invalid [marketplace.id] parameter value.' + path: 'marketplace.id' + userMessage: 'Invalid [marketplace.id] parameter value.' + '401': + description: Unauthorized. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: The account is not a Business Account. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + not-business-account: + summary: 'The account is not a Business Account.' + value: + errors: + - code: BB2 + details: + message: 'The account is not a Business Account.' + path: + userMessage: 'The account is not a Business Account.' + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/badge-applications/{applicationId}: + get: + tags: + - Badge campaigns + summary: 'Get a badge application details' + description: >- + Use this resource to get a badge application details. + Read more: PL / EN. + operationId: badgeApplications_get_one + parameters: + - name: applicationId + in: path + description: 'Badge application ID.' + required: true + schema: + type: string + responses: + '200': + description: Successfully returned badge application. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/BadgeApplication' + examples: + processed: + summary: Processed + value: + id: '81ff5e67-d00b-4141-a79a-68636755df95' + createdAt: '2019-05-16T12:49:17.347Z' + updatedAt: '2019-05-16T12:49:17.530Z' + campaign: + id: 'BARGAIN' + offer: + id: '12345678' + prices: + bargain: + amount: '14.00' + currency: 'PLN' + process: + status: 'PROCESSED' + rejectionReasons: [] + requested: + summary: Requested + value: + id: '34ff2a86-6d1a-4607-ae22-3a81de4c8dd1' + createdAt: '2019-05-16T12:49:17.347Z' + updatedAt: '2019-05-16T12:49:17.530Z' + campaign: + id: 'HIT' + offer: + id: '12345678' + prices: null + process: + status: 'REQUESTED' + rejectionReasons: [] + declined: + summary: Declined + value: + id: '893d055c-ba0c-4996-94a0-93d593fdd483' + createdAt: '2019-05-16T12:49:17.347Z' + updatedAt: '2019-05-16T12:49:17.530Z' + campaign: + id: 'BARGAIN' + offer: + id: '12345678' + prices: + bargain: null + process: + status: 'DECLINED' + rejectionReasons: + - code: 'BA2' + messages: + - text: 'The discount price or suggested market price is not defined' + link: null + '401': + description: Unauthorized. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: The account is not a Business Account. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + not-business-account: + summary: 'The account is not a Business Account' + value: + errors: + - code: 'BB2' + details: null + message: 'The account is not a Business Account' + path: null + userMessage: 'The account is not a Business Account' + '404': + description: Badge application not found. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + application-not-found: + summary: 'Badge application not found.' + value: + errors: + - code: BB8 + details: + message: Submission does not exist. + path: + userMessage: Submission does not exist. + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/badge-applications: + get: + tags: + - Badge campaigns + summary: 'Get a list of badge applications' + description: >- + Use this resource to get a list of badge applications. + Read more: PL / EN. + operationId: badgeApplications_get_all + parameters: + - name: campaign.id + in: query + description: 'Campaign ID.' + required: false + schema: + type: string + - name: offer.id + in: query + description: 'Offer ID.' + required: false + schema: + type: string + - name: offset + in: query + description: 'Offset.' + required: false + schema: + type: integer + minimum: 0 + - name: limit + in: query + description: 'The maximum number of applications returned in the response.' + required: false + schema: + type: integer + default: 50 + minimum: 1 + maximum: 1000 + responses: + '200': + description: Successfully returned badge applications list. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/BadgeApplications' + examples: + badgeApplications: + summary: "List of badge applications." + value: + badgeApplications: + - id: '81ff5e67-d00b-4141-a79a-68636755df95' + createdAt: '2019-05-16T12:49:17.347Z' + updatedAt: '2019-05-16T12:49:17.530Z' + campaign: + id: 'BARGAIN' + offer: + id: '12345678' + prices: + bargain: + amount: '14.00' + currency: 'PLN' + process: + status: 'PROCESSED' + rejectionReasons: [] + - id: '34ff2a86-6d1a-4607-ae22-3a81de4c8dd1' + createdAt: '2019-05-16T12:49:17.347Z' + updatedAt: '2019-05-16T12:49:17.530Z' + campaign: + id: 'HIT' + offer: + id: '12345678' + prices: null + process: + status: 'REQUESTED' + rejectionReasons: [] + - id: '893d055c-ba0c-4996-94a0-93d593fdd483' + createdAt: '2019-05-16T12:49:17.347Z' + updatedAt: '2019-05-16T12:49:17.530Z' + campaign: + id: 'BARGAIN' + offer: + id: '12345678' + prices: + bargain: null + process: + status: 'DECLINED' + rejectionReasons: + - code: 'BA2' + messages: + - text: 'The discount price or suggested market price is not defined.' + link: null + '400': + description: Invalid values supplied in the query parameters. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + invalid-parameters: + summary: 'Invalid values supplied in the query parameters.' + value: + errors: + - code: 'BB9' + details: null + message: 'Invalid [limit] parameter value.' + path: 'limit' + userMessage: 'Invalid [limit] parameter value.' + - code: 'BB10' + details: null + message: 'Invalid [offset] parameter value.' + path: 'offset' + userMessage: 'Invalid [offset] parameter value.' + '401': + description: Unauthorized. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: The account is not a Business Account. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + not-business-account: + summary: 'The account is not a Business Account' + value: + errors: + - code: 'BB2' + details: + message: 'The account is not a Business Account.' + path: + userMessage: 'The account is not a Business Account.' + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/badge-operations/{operationId}: + get: + tags: + - Badge campaigns + summary: 'Get badge operation details' + description: >- + Use this resource to get badge operation details. + Read more: PL / EN. + operationId: badgeOperations_get_one + parameters: + - name: operationId + in: path + description: 'Badge operation ID.' + required: true + schema: + type: string + responses: + '200': + description: Successfully returned badge operation details. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/BadgeOperation' + examples: + processed: + summary: Processed + value: + id: '81ff5e67-d00b-4141-a79a-68636755df95' + type: 'FINISH' + createdAt: '2019-05-16T12:49:17.347Z' + updatedAt: '2019-05-16T12:49:17.530Z' + campaign: + id: 'BARGAIN' + offer: + id: '12345678' + process: + status: 'PROCESSED' + rejectionReasons: [ ] + requested: + summary: Requested + value: + id: '34ff2a86-6d1a-4607-ae22-3a81de4c8dd1' + type: 'UPDATE' + createdAt: '2019-05-16T12:49:17.347Z' + updatedAt: '2019-05-16T12:49:17.530Z' + campaign: + id: 'HIT' + offer: + id: '12345678' + prices: null + process: + status: 'REQUESTED' + rejectionReasons: [ ] + declined: + summary: Declined + value: + id: '893d055c-ba0c-4996-94a0-93d593fdd483' + type: 'UPDATE' + createdAt: '2019-05-16T12:49:17.347Z' + updatedAt: '2019-05-16T12:49:17.530Z' + campaign: + id: 'BARGAIN' + offer: + id: '12345678' + process: + status: 'DECLINED' + rejectionReasons: + - code: 'BA2' + messages: + - text: 'The discount price or suggested market price is not defined.' + link: null + '401': + description: Unauthorized. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: You don't have permission to access this resource. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + not-business-account: + summary: 'The account is not a Business Account' + value: + errors: + - code: 'BB2' + details: null + message: 'The account is not a Business Account.' + path: null + userMessage: 'The account is not a Business Account.' + '404': + description: Badge operation not found. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + application-not-found: + summary: 'Badge operation not found.' + value: + errors: + - code: 'BB14' + details: + message: 'Operation does not exist.' + path: + userMessage: 'Operation does not exist.' + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/badges/offers/{offerId}/campaigns/{campaignId}: + patch: + tags: + - Badge campaigns + summary: "Update campaign badge for the given offer" + description: >- + This resource allows you to update a campaign badge for the given offer. + You can use *Location* provided in header of the response to track your update status. + Update offer price in a campaign or finish marking an offer in a campaign. + + Read more: PL / EN. + + operationId: patchBadge + parameters: + - name: offerId + in: path + description: 'Offer ID.' + required: true + schema: + type: string + - name: campaignId + in: path + description: 'Campaign ID.' + required: true + schema: + type: string + responses: + '202': + description: Successfully requested badge update. + headers: + Location: + schema: + type: string + description: The location URI points to a resource that will display the status of the asynchronous processing. + content: + application/vnd.allegro.public.v1+json: + schema: + type: object + properties: + id: + type: string + description: Operation Id + examples: + response: + summary: Update was successfully requested + value: + id: "154179f0-ed4c-4b84-9260-302d2dec3801" + '400': + description: Syntactically incorrect request. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: You don't have permission to access this resource. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + not-business-account: + summary: 'The account is not a Business Account.' + value: + errors: + - code: 'BB2' + details: null + message: 'The account is not a Business Account' + path: null + userMessage: 'The account is not a Business Account' + '404': + description: Resource not found. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + offer-not-found: + summary: 'Offer not found.' + value: + errors: + - code: 'BA4' + details: + message: 'This offer does not exist.' + path: + userMessage: 'This offer does not exist.' + campaign-not-found: + summary: 'Campaign not found.' + value: + errors: + - code: 'BA10' + details: + message: 'This campaign does not exist.' + path: + userMessage: 'This campaign does not exist.' + '409': + description: Asynchronous badge operation for this offer already exists in status REQUESTED. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + operation-already-exists: + summary: Operation already exists in status REQUESTED. + value: + errors: + - code: 'BB12' + details: null + message: 'The operation already exists and has a REQUESTED status. Please wait until the status changes to PROCESSED or DECLINED.' + path: null + userMessage: 'The operation already exists and has a REQUESTED status. Please wait until the status changes to PROCESSED or DECLINED.' + '422': + description: Validation error. Invalid parameters provided in the request. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + examples: + unprocessable-request: + summary: 'Invalid currency and amount is not a valid number.' + value: + errors: + - code: 'BB5' + details: null + message: 'Currency not supported.' + path: 'prices.bargain.currency' + userMessage: 'Currency not supported.' + - code: 'BB6' + details: null + message: 'One of the numerical values is not a number.' + path: 'prices.bargain.amount' + userMessage: 'One of the numerical values is not a number.' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/BadgePatchRequest' + examples: + price-update: + summary: 'Price update for the given offer in the given campaign' + value: + prices: + bargain: + value: + amount: '9.99' + currency: 'PLN' + remove-badge: + summary: 'Remove campaign badge from the given offer' + value: + process: + status: 'FINISHED' + security: + - bearer-token-for-user: + - allegro:api:campaigns + /payments/refunds: + post: + tags: + - Payments + summary: Initiate a refund of a payment + description: 'Use this endpoint to initiate a refund of a payment. Read more: PL / EN.' + operationId: "initiateRefund" + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/InitializeRefund' + responses: + '200': + description: Refund request created successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/RefundDetails' + '400': + description: Syntactically incorrect request. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '422': + description: Unprocessable Entity. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '404': + description: Payment not found. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:payments:write + get: + tags: + - Payments + summary: 'Get a list of refunded payments' + description: 'Get a list of refunded payments. Read more: PL / EN.' + operationId: 'getRefundedPayments' + parameters: + - name: limit + in: query + required: false + description: Number of returned operations. + schema: + type: integer + format: int32 + minimum: 1 + maximum: 100 + default: 50 + - name: offset + in: query + required: false + description: Index of the first returned payment operation from all search results. + schema: + type: integer + format: int32 + minimum: 0 + default: 0 + - name: id + in: query + description: ID of the refund. + required: false + schema: + type: string + format: uuid + - name: payment.id + in: query + description: ID of the payment. + required: false + schema: + type: string + format: uuid + - name: order.id + in: query + description: ID of the order. + required: false + schema: + type: string + format: uuid + - name: occurredAt.gte + in: query + description: Minimum date and time when the refund occurred provided in ISO 8601 format. + example: "2019-05-08T09:45:43.818Z" + required: false + schema: + type: string + format: date-time + - name: occurredAt.lte + in: query + description: Maximum date and time when the refund occurred provided in ISO 8601 format. + required: false + example: "2019-05-08T09:45:32.818Z" + schema: + type: string + format: date-time + - name: status + in: query + description: Current status of payment refund. + required: false + schema: + type: array + items: + type: string + enum: + - WAITING + - IN_PROGRESS + - SUCCESS + - CANCELED + - PARTIAL + responses: + '200': + description: List of payments refunds returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + refunds: + type: array + description: Collection of payments refunds. + items: + $ref: '#/components/schemas/RefundDetails' + count: + type: integer + format: int32 + minimum: 0 + description: Number of payment operations returned in search result for the given parameters. + example: 50 + totalCount: + type: integer + format: int32 + minimum: 0 + description: Total number of payment operations for the given parameters. + example: 123 + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '422': + description: Unprocessable Entity. Returned when any of the given search parameters have an invalid value. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:payments:read + /billing/billing-entries: + get: + tags: + - Billing + summary: 'Get a list of billing entries' + description: 'The billing entries are sorted in a descending order (newest first) by date on which they occurred. Read more: PL / EN.' + operationId: "getBillingEntries" + parameters: + - name: marketplaceId + in: query + required: false + description: "The marketplace ID where operation was made. By default the marketplace ID where the user is registered. **Note:** Business marketplace is not a separate user's billing and defaults back to the main marketplace for given country." + example: "allegro-pl" + schema: + type: string + - name: occurredAt.gte + in: query + required: false + description: Date from which billing entries are filtered. If occurredAt.lte is also set, occurredAt.gte cannot be later. + example: "2019-05-08T09:45:32.818Z" + schema: + type: string + format: date-time + - name: occurredAt.lte + in: query + required: false + description: Date to which billing entries are filtered. If occurredAt.gte is also set, occurredAt.lte cannot be earlier. + example: "2019-05-08T09:45:32.818Z" + schema: + type: string + format: date-time + - name: type.id + in: query + required: false + description: List of billing types by which billing entries are filtered. + example: ["LIS", "SUC"] + schema: + type: array + items: + type: string + - name: offer.id + in: query + required: false + description: Offer ID by which billing entries are filtered. + example: "12345" + schema: + type: string + - name: order.id + in: query + required: false + description: Order UUID by which billing entries are filtered. + example: "29738e61-7f6a-11e8-ac45-09db60ede9d6" + schema: + type: string + format: uuid + - name: limit + in: query + required: false + description: Number of returned operations. + example: 10 + schema: + type: integer + format: int32 + minimum: 1 + maximum: 100 + default: 100 + - name: offset + in: query + required: false + description: Index of the first returned payment operation from all search results. + example: 10 + schema: + type: integer + format: int32 + minimum: 0 + maximum: 10000 + default: 0 + responses: + '200': + description: List of billing entries returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/BillingEntries' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '406': + description: Not Acceptable + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:billing:read + /billing/billing-types: + get: + tags: + - Billing + summary: 'Get a list of billing types' + description: 'List of all billing types. Type names are localized according to "Accept-Language" header. Read more: PL / EN.' + operationId: "getBillingTypes" + security: + - bearer-token-for-application: [] + - bearer-token-for-user: [] + parameters: + - in: header + name: Accept-Language + required: false + description: Expected language of name translations. + example: "pl-PL" + schema: + type: string + format: string + responses: + '200': + description: List of billing types returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + type: array + description: List of billing types. + items: + $ref: '#/components/schemas/BillingType' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '/order/refund-claims/{claimId}': + get: + tags: + - Commission refunds + summary: 'Get a refund application details' + description: 'Use this resource to get refund application details. Read more: PL / EN.' + operationId: 'getRefundApplication' + parameters: + - name: claimId + in: path + description: 'Refund application ID.' + required: true + schema: + type: string + responses: + '200': + description: Successfully returned refund application. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/RefundClaim' + '400': + description: Semantically incorrect request or provided conditions not correct. + '401': + description: Unauthorized. + '403': + description: Refund application does not belong to you. + '404': + description: Refund application not found. + '406': + description: Not Acceptable. + '422': + description: Unprocessable Entity. + security: + - bearer-token-for-user: + - allegro:api:orders:read + delete: + tags: + - Commission refunds + summary: 'Cancel a refund application' + description: 'Use this resource to cancel a refund application. This cannot be undone. Read more: PL / EN.' + operationId: 'cancelRefundApplication' + parameters: + - name: claimId + in: path + description: 'Refund application ID.' + required: true + schema: + type: string + responses: + '204': + description: Refund application was cancelled successfully. + '400': + description: Semantically incorrect request or provided conditions not correct. + '401': + description: Unauthorized. + '403': + description: Refund application does not belong to you. + '404': + description: Refund application not found. + '406': + description: Not Acceptable. + '422': + description: Refund application has already been processed. + security: + - bearer-token-for-user: + - allegro:api:orders:write + /order/refund-claims: + get: + tags: + - Commission refunds + summary: 'Get a list of refund applications' + description: 'Use this resource to get a list of refund applications based on the provided query parameters. Read more: PL / EN.' + operationId: 'getRefundApplications' + parameters: + - name: lineItem.offer.id + in: query + required: false + description: ID of the offer associated with the refund application. + schema: + type: string + - name: buyer.login + in: query + required: false + description: Login of the buyer that made the purchase associated with the refund application. + schema: + type: string + - name: status + in: query + required: false + description: Status of the refund application. + schema: + type: string + enum: + - "IN_PROGRESS" + - "WAITING_FOR_PAYMENT_REFUND" + - "GRANTED" + - "REJECTED" + - "REJECTED_AFTER_APPEAL" + - "CANCELLED" + - "APPEALED" + - name: limit + in: query + required: false + description: Maximum number of returned refund applications in response. + schema: + type: integer + format: int32 + minimum: 1 + maximum: 100 + default: 25 + - name: offset + in: query + required: false + description: Index of the first returned refund application from all search results. + schema: + type: integer + format: int32 + minimum: 0 + default: 0 + responses: + '200': + description: Successfully returned list of refund applications. + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + refundClaims: + type: array + description: Collection of refund applications. + items: + $ref: '#/components/schemas/RefundClaim' + count: + type: integer + minimum: 0 + format: int32 + description: Count of refund applications returned. + '400': + description: Semantically incorrect request or provided conditions not correct. + '401': + description: Unauthorized. + '403': + description: Refund application does not belong to you. + '406': + description: Not Acceptable. + '422': + description: Unprocessable Entity. + security: + - bearer-token-for-user: + - allegro:api:orders:read + post: + tags: + - Commission refunds + summary: 'Create a refund application' + description: 'Use this resource to create a refund application. Read more: PL / EN.' + operationId: 'createRefundApplication' + responses: + '201': + description: The refund application was created successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/RefundClaimResponse' + '400': + description: Semantically incorrect request or provided conditions not correct. + '401': + description: Unauthorized. + '403': + description: Forbidden. + '406': + description: Not Acceptable. + '422': + description: Unprocessable Entity. + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/RefundClaimRequest' + required: true + security: + - bearer-token-for-user: + - allegro:api:orders:write + /charity/fundraising-campaigns: + get: + tags: + - Charity + summary: Search fundraising campaigns + description: 'Use this resource to search fundraising campaigns. Read more: PL / EN.' + operationId: searchFundraisingCampaigns + parameters: + - name: limit + in: query + description: Maximum number of returned results. + required: true + allowEmptyValue: false + schema: + maximum: 100 + exclusiveMaximum: false + minimum: 1 + exclusiveMinimum: false + type: integer + format: int32 + - name: phrase + in: query + description: Fundraising campaign name or it's Organization name prefix to search for. + required: true + allowEmptyValue: false + schema: + type: string + responses: + '200': + description: The request successfully returns the search result. + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/FundraisingCampaigns' + '400': + description: Invalid or missing query parameters. + content: {} + '401': + description: Unauthorized + content: {} + '403': + description: Forbidden + content: {} + deprecated: false + /shipment-management/delivery-services: + get: + tags: + - Shipment management + summary: Get available delivery services + description: >- + Use this resource to get delivery services available for user. It returns services provided by Allegro and contracts with carriers owned by user and configured by GUI. Read more: PL / EN. + operationId: getDeliveryServices + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/DeliveryServicesDto + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '504': + description: Gateway Timeout + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error504' + security: + - bearer-token-for-user: + - allegro:api:shipments:write + /shipment-management/shipments/create-commands: + post: + tags: + - Shipment management + summary: Create new shipment + description: + 'Use this resource to create shipment for delivery. Read more: PL / EN.' + operationId: createNewShipment + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/ShipmentCreateCommandDto + required: true + responses: + '200': + description: OK + headers: + Retry-After: + schema: + type: integer + minimum: 1 + description: Suggested time interval (in seconds) between follow-up command status queries. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/ShipmentCreateCommandDto + '400': + description: Bad Request + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '504': + description: Gateway Timeout + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error504' + security: + - bearer-token-for-user: + - allegro:api:shipments:write + /shipment-management/shipments/create-commands/{commandId}: + get: + tags: + - Shipment management + summary: Get shipment creation command status + description: + 'Use this resource to get shipment creation status. Read more: PL / EN.' + operationId: getShipmentCreationStatus + parameters: + - name: commandId + in: path + required: true + schema: + type: string + example: 14e142cf-e8e0-48cc-bcf6-399b5fd90b32 + description: Command UUID. + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/CreateShipmentCommandStatusDto + '400': + description: Bad Request + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '404': + description: Not Found + '504': + description: Gateway Timeout + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error504' + security: + - bearer-token-for-user: + - allegro:api:shipments:write + /shipment-management/shipments/cancel-commands: + post: + tags: + - Shipment management + summary: Cancel shipment + description: 'Use this resource to cancel parcel. Read more: PL / EN.' + operationId: cancelShipment + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/ShipmentCancelCommandDto + required: true + responses: + '200': + description: OK + headers: + Retry-After: + schema: + type: integer + minimum: 1 + description: Suggested time interval (in seconds) between follow-up command status queries. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/ShipmentCancelCommandDto + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + security: + - bearer-token-for-user: + - allegro:api:shipments:write + /shipment-management/shipments/cancel-commands/{commandId}: + get: + tags: + - Shipment management + summary: Get shipment cancellation status + description: 'Use this resource to get parcel cancellation status. Read more: PL / EN.' + operationId: getShipmentCancellationStatus + parameters: + - name: commandId + in: path + required: true + schema: + type: string + example: 14e142cf-e8e0-48cc-bcf6-399b5fd90b32 + description: Command UUID. + responses: + '200': + description: OK + headers: + Retry-After: + schema: + type: integer + minimum: 1 + description: Suggested time interval (in seconds) between follow-up command status queries. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/CancelShipmentCommandStatusDto + '400': + description: Bad Request + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '404': + description: Not Found + '504': + description: Gateway Timeout + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error504' + security: + - bearer-token-for-user: + - allegro:api:shipments:write + /shipment-management/shipments/{shipmentId}: + get: + tags: + - Shipment management + summary: Get shipment details + description: 'Use this resource to get parcel details. Read more: PL / EN.' + operationId: getShipmentDetails + parameters: + - name: shipmentId + in: path + required: true + description: Shipment id. + schema: + type: string + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/ShipmentDto + '400': + description: Bad Request + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '404': + description: Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error404' + '504': + description: Gateway Timeout + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error504' + security: + - bearer-token-for-user: + - allegro:api:shipments:read + /shipment-management/label: + post: + tags: + - Shipment management + summary: Get shipments labels + description: >- + Use this resource to get label for created shipment. +
Returned content type depends on created shipment. Read more: PL / EN. + operationId: getShipmentLabels + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/LabelRequestDto + required: true + responses: + '200': + description: OK + content: + application/octet-stream: + schema: + type: string + format: binary + description: File in a binary format + '204': + description: No Label For Given Parcel + '400': + description: Bad Request + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '404': + description: Shipment Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error404' + '504': + description: Gateway Timeout + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error504' + security: + - bearer-token-for-user: + - allegro:api:shipments:read + /shipment-management/protocol: + post: + tags: + - Shipment management + summary: Get shipments protocol + description: >- + Protocol availability depends on Carrier. + Read more: PL / EN. + operationId: getShipmentProtocol + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/ShipmentIdsDto + required: true + responses: + '200': + description: OK + content: + application/octet-stream: + schema: + type: string + format: binary + description: File in a binary format + '204': + description: No Protocol For Given Parcels + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '400': + description: Bad Request + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error400' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '404': + description: Shipment Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error404' + '504': + description: Gateway Timeout + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error504' + security: + - bearer-token-for-user: + - allegro:api:shipments:read + /shipment-management/pickup-proposals: + post: + tags: + - Shipment management + summary: Get shipments pickup proposals + description: >- + Use this resource to get parcels pickup date proposals. Pickup takes place, when courier arrives to take parcels for shipment. Read more: PL / EN. + operationId: getPickupProposals + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/PickupProposalsRequestDto + required: true + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + type: array + items: + $ref: >- + #/components/schemas/PickupProposalsResponseDto + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '504': + description: Gateway Timeout + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error504' + security: + - bearer-token-for-user: + - allegro:api:shipments:write + /shipment-management/pickups/create-commands: + post: + tags: + - Shipment management + summary: Request shipments pickup + description: 'Use this resource to request a pickup of shipments. Read more: PL / EN.' + operationId: createPickup + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/PickupCreateCommandDto + required: true + responses: + '200': + description: OK + headers: + Retry-After: + schema: + type: integer + minimum: 1 + description: Suggested time interval (in seconds) between follow-up command status queries. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/PickupCreateCommandDto + '400': + description: Bad request + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + security: + - bearer-token-for-user: + - allegro:api:shipments:write + /shipment-management/pickups/create-commands/{commandId}: + get: + tags: + - Shipment management + summary: Create pickup command status + description: 'Use this resource to get pickup request status. Read more: PL / EN.' + operationId: createPickupStatus + parameters: + - name: commandId + in: path + required: true + example: 14e142cf-e8e0-48cc-bcf6-399b5fd90b32 + description: Command UUID. + schema: + type: string + responses: + '200': + description: OK + headers: + Retry-After: + schema: + type: integer + minimum: 1 + description: Suggested time interval (in seconds) between follow-up command status queries. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: >- + #/components/schemas/CreatePickupCommandStatusDto + '400': + description: Bad Request + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error400' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error403' + '404': + description: Not Found + '504': + description: Gateway Timeout + content: + application/vnd.allegro.public.v1+json: + schema: + properties: + errors: + type: array + description: Array of errors. + items: + $ref: '#/components/schemas/Error504' + security: + - bearer-token-for-user: + - allegro:api:shipments:write + /sale/matching-categories: + get: + tags: + - Categories and parameters + summary: "Get categories suggestions" + description: + 'Use this resource to receive suggested categories for given phrase. Read more: PL / EN.' + operationId: categorySuggestionUsingGET + parameters: + - name: name + in: query + description: Product name for which you want to get suggested categories. + required: true + schema: + type: string + example: "bmw x3" + responses: + '200': + description: Category suggestion returned successfully. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CategorySuggestionResponse' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '406': + description: Not Acceptable + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + /sale/tax-settings: + get: + tags: + - Tax settings + summary: 'Get all tax settings for category' + description: >- + Use this resource to receive tax settings for given category. + Based on received settings you may set VAT tax settings for your offers. Read more: PL / EN. + operationId: getTaxSettingsForCategory + parameters: + - name: category.id + in: query + description: An identifier of a category for which all available tax settings will be returned. + required: true + schema: + type: string + example: "316194" + - name: countryCode + in: query + description: Country code for which tax settings will be returned. If not provided settings for all countries will be returned. + required: false + explode: true + example: ["PL"] + schema: + type: array + items: + type: string + enum: + - PL + - CZ + - SK + - HU + responses: + '200': + description: Tax settings for given category returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CategoryTaxSettings' + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/CategoryTaxSettings' + '400': + description: Bad Request + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '403': + description: Forbidden + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '406': + description: Not Acceptable + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + /sale/allegro-prices-offer-consents/{offerId}: + get: + tags: + - Allegro Prices + operationId: getAllegroPricesConsentForOffer + summary: "Get the current consents' state for an offer" + description: 'Use this resource to get the current Allegro Prices consent value for the offer on each of the available marketplaces. Read more: PL / EN.' + parameters: + - name: "offerId" + description: "The offer ID." + in: "path" + required: true + schema: + type: "string" + responses: + '200': + description: "Consent value returned successfully." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AllegroPricesOfferConsentChangeResponse" + example: + status: "ALLOWED" + additionalMarketplaces: + allegro-cz: + status: "ALLOWED" + allegro-xy: + status: "ALLOWED" + '401': + description: "Unauthorized." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '403': + description: "Offer does not belong to seller." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '404': + description: "Offer not found." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + security: + - bearer-token-for-user: + - allegro:api:campaigns + put: + tags: + - Allegro Prices + operationId: updateAllegroPricesConsentForOffer + summary: "Update consents for an offer" + description: 'Use this resource to update the Allegro Prices consent value for the offer on chosen marketplaces. Read more: PL / EN.' + parameters: + - name: "offerId" + description: "The offer ID." + in: "path" + required: true + schema: + type: "string" + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AllegroPricesOfferChangeRequest" + example: + status: "DENIED" + additionalMarketplaces: + allegro-cz: + status: "DENIED" + required: true + responses: + '200': + description: "Allegro Prices consents' state for the offer updated successfully." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AllegroPricesOfferConsentChangeResponse" + example: + status: "DENIED" + additionalMarketplaces: + allegro-cz: + status: "DENIED" + allegro-xy: + status: "ALLOWED" + '400': + description: "Bad request." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '401': + description: "Unauthorized." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '403': + description: "Offer does not belong to seller." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '404': + description: "Offer not found." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '422': + description: "Unprocessable Entity." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/allegro-prices-account-eligibility: + get: + tags: + - Allegro Prices + operationId: "getAllegroPricesEligibilityForAccount" + summary: "Get the current eligibility information for the account" + description: 'Use this resource to get the current Allegro Prices eligibility information for the account on each of the available marketplaces. Read more: PL / EN.' + responses: + '200': + description: "Allegro Prices eligibility information for the account returned successfully." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AllegroPricesEligibilityResponse" + example: + consent: "ALLOWED" + qualification: + status: "QUALIFIED" + additionalMarketplaces: + allegro-cz: + consent: "ALLOWED" + qualification: + status: "QUALIFIED" + allegro-xy: + consent: "ALLOWED" + qualification: + status: "QUALIFIED" + '401': + description: "Unauthorized." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/allegro-prices-account-consent: + put: + tags: + - Allegro Prices + operationId: "updateAllegroPricesConsentForAccount" + summary: "Update consents for the account" + description: 'Use this resource to update the Allegro Prices consent value for the account on chosen marketplaces. Read more: PL / EN.' + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/AllegroPricesAccountChangeRequest" + example: + status: "ALLOWED" + additionalMarketplaces: + allegro-cz: + status: "DENIED" + required: true + responses: + '200': + description: "Allegro Prices consents' state for the account was updated successfully." + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AllegroPricesAccountConsentChangeResponse" + example: + status: "ALLOWED" + additionalMarketplaces: + allegro-cz: + status: "DENIED" + allegro-xy: + status: "ALLOWED" + '400': + description: "Bad request" + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '401': + description: "Unauthorized" + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '422': + description: "Unprocessable Entity" + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/alle-discount/submit-offer-commands: + post: + tags: + - AlleDiscount + operationId: submitOfferToAlleDiscountCommands + summary: Create submit offer command + description: >- + Use this resource to create a command for submitting an offer. + Offer will be submitted to the AlleDiscount campaign only if command is processed successfully. Read more: PL / EN. + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AlleDiscountSubmitCommandRequest" + example: + commandId: "c1b3f63d-d293-4333-911d-a0c1053e2c81" + input: + offer: + id: "10394822344" + campaign: + id: "ALLEOBNIZKA_20230209" + proposedPrice: + amount: "100.00" + currency: "PLN" + required: true + responses: + '201': + description: Command has been created. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AlleDiscountSubmitCommandResponse" + example: + id: "c1b3f63d-d293-4333-911d-a0c1053e2c81" + input: + offer: + id: "10394822344" + campaign: + id: "ALLEOBNIZKA_2030209" + proposedPrice: + amount: "100.00" + currency: "PLN" + output: + status: "NEW" + createdAt: "2023-02-09T10:15:30.000Z" + updatedAt: "2023-02-09T10:15:30.000Z" + errors: [] + headers: + location: + description: The location of the created submit offer command (URI). + schema: + type: string + example: 'https://api.allegro.pl/sale/alle-discount/submit-offer-commands/c1b3f63d-d293-4333-911d-a0c1053e2c81' + '400': + description: >- + Bad request. Example error codes: + - CommandIdNotValidUuid + - ProposedPriceAmountInvalidNumberFormat + - ProposedPriceAmountNotPositive + - ProposedPriceAmountInvalidDecimalPlaces + - ProposedPriceAmountCannotBeNull + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + example: + errors: + - code: ProposedPriceAmountInvalidNumberFormat + details: null + message: Given proposedPrice is not a valid money representation. + path: null + userMessage: input.proposedPrice.amount has wrong number format. + '401': + description: Unauthorized. + '409': + description: Provided UUID is already being used. + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/alle-discount/submit-offer-commands/{commandId}: + get: + tags: + - AlleDiscount + operationId: getSubmitOfferToAlleDiscountCommandsStatus + summary: Get the offer submission command status + description: >- + Use this resource to get information about the submit offer command execution status. + Read more: PL / EN. + parameters: + - name: "commandId" + description: Command id in UUID format, must be unique. + in: "path" + required: true + schema: + type: string + responses: + '200': + description: Returns command output with status and possible errors. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AlleDiscountGetSubmitCommandResponse" + examples: + successfulCommand: + summary: "Submit command executed with status: SUCCESSFUL" + value: + id: "c1b3f63d-d293-4333-911d-a0c1053e2c81" + input: + offer: + id: "10394822344" + campaign: + id: "ALLEOBNIZKA_20230209" + proposedPrice: + amount: "100.00" + currency: "PLN" + output: + status: "SUCCESSFUL" + createdAt: "2023-02-09T10:15:30.000Z" + updatedAt: "2023-02-09T12:15:30.000Z" + newOfferParticipation: + participationId: "f9a4a70c-6db9-4473-976c-90f8df9f74e8" + errors: [] + failedCommand: + summary: "Submit command with status: FAILED" + value: + id: "c1b3f63d-d293-4333-911d-a0c1053e2c81" + input: + offer: + id: "10394822344" + campaign: + id: "wrong_campaign" + proposedPrice: + amount: "100.00" + currency: "PLN" + output: + status: "FAILED" + createdAt: "2023-02-09T10:15:30.000Z" + updatedAt: "2023-02-09T12:15:30.000Z" + errors: + - code: CampaignNotFound + details: null + message: Campaign doesn't exist or it isn't AlleDiscount campaign + path: null + userMessage: User has provided wrong campaign + '401': + description: Unauthorized. + '404': + description: Not Found. Check provided command id. + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/alle-discount/withdraw-offer-commands: + post: + tags: + - AlleDiscount + operationId: withdrawOfferFromAlleDiscountCommands + summary: Create withdraw offer command + description: >- + Use this resource to create a command for withdrawing an offer from specific campaign. + Offer will be withdrawn from the AlleDiscount campaign only if command is processed successfully. Read more: PL / EN. + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AlleDiscountWithdrawCommandRequest" + example: + commandId: "c1b3f63d-d293-4333-911d-a0c1053e2c81" + input: + participationId: "f9a4a70c-6db9-4473-976c-90f8df9f74e8" + required: true + responses: + '201': + description: Command has been created. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AlleDiscountWithdrawCommandResponse" + example: + id: "c1b3f63d-d293-4333-911d-a0c1053e2c81" + input: + participationId: "f9a4a70c-6db9-4473-976c-90f8df9f74e8" + output: + status: "NEW" + createdAt: "2023-02-09T10:15:30.000Z" + updatedAt: "2023-02-09T12:15:30.000Z" + headers: + location: + description: The location of the created withdraw offer command (URI). + schema: + type: string + example: 'https://api.allegro.pl/sale/alle-discount/withdraw-offer-commands/c1b3f63d-d293-4333-911d-a0c1053e2c81' + '400': + description: >- + Bad request. Example error codes: + - CommandIdNotValidUuid + - ParticipationIdMustBeUuid + - InputParticipationIdFieldMissing + - InputParticipationIdDoesNotExist + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + example: + errors: + - code: InputParticipationIdDoesNotExist + details: null + message: Participation id does not exist. + path: input.participationId + userMessage: Participation does not exist + '401': + description: Unauthorized. + '409': + description: Provided UUID is already being used. + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/alle-discount/withdraw-offer-commands/{commandId}: + get: + tags: + - AlleDiscount + operationId: getWithdrawOfferFromAlleDiscountCommandsStatus + summary: Get the offer withdrawal command status + description: >- + Use this resource to get information about the withdrawal command execution status. Read more: PL / EN. + parameters: + - name: "commandId" + description: Command id in UUID format, must be unique. + in: "path" + required: true + schema: + type: string + responses: + '200': + description: Returns command output with status and possible errors. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AlleDiscountGetWithdrawCommandResponse" + examples: + successfulWithdrawal: + summary: "Withdraw command with status: SUCCESSFUL" + value: + id: "c1b3f63d-d293-4333-911d-a0c1053e2c81" + input: + participationId: "f9a4a70c-6db9-4473-976c-90f8df9f74e8" + output: + status: "SUCCESSFUL" + createdAt: "2024-02-09T10:15:30.000Z" + updatedAt: "2024-02-09T12:15:30.000Z" + withdrawnOfferParticipation: + participationId: "f9a4a70c-6db9-4473-976c-90f8df9f74e8" + errors: [] + failedWithdrawal: + summary: "Withdraw command with status: FAILED" + value: + id: "c1b3f63d-d293-4333-911d-a0c1053e2c81" + input: + participationId: "f9a4a70c-6db9-4473-976c-90f8df9f74e8" + output: + status: "FAILED" + createdAt: "2024-02-09T10:15:30.000Z" + updatedAt: "2024-02-09T12:15:30.000Z" + withdrawnOfferParticipation: null + errors: + - code: Unauthorized + details: null + message: Not authorized + path: null + userMessage: You are not authorized to perform this operation. + '401': + description: Unauthorized. + '404': + description: Not Found. Check provided command id. + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/alle-discount/{campaignId}/eligible-offers: + get: + tags: + - AlleDiscount + operationId: getOffersEligibleForAlleDiscount + summary: List eligible offers + description: >- + Endpoint returning info about offers that can be submitted to a given AlleDiscount campaign. + Only offer linked to the product in published list of goods (products) can be submitted + to a given AlleDiscount campaign. Read more: PL / EN. + parameters: + - name: "campaignId" + description: Campaign id to list offers from. + in: "path" + required: true + schema: + type: string + - name: "limit" + description: Maximum number of offers returned in the eligibleOffers list; max value is 200. + in: "query" + required: false + schema: + type: integer + - name: "offset" + description: The number of offers to skip while listing the results. + in: "query" + required: false + schema: + type: integer + - name: "meetsConditions" + description: If true, filters offers that only meet conditions of the campaign. + in: "query" + required: false + schema: + type: boolean + - name: "offerId" + description: ID of an offer; if the offer with the given ID exists, returns at most one element in the eligibleOffers list. + in: "query" + required: false + schema: + type: string + responses: + '200': + description: Lists offers eligible for submission. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AlleDiscountListEligibleResponse" + examples: + offersMeetingConditions: + summary: Offers that meet conditions. + value: + eligibleOffers: + - id: "2865624934" + product: + id: "6e1727b4-2d2c-44f4-b1d2-be5c3540984f" + basePrice: + amount: "100.00" + currency: "PLN" + alleDiscount: + campaignConditions: + meetsConditions: true + violations: [] + requiredMerchantPrice: + amount: "100.00" + currency: "PLN" + minimumGuaranteedDiscount: + percentage: "6.00" + count: 1 + totalCount: 1 + offersNotMeetingConditions: + summary: Offers that don't meet conditions. + value: + eligibleOffers: + - id: "2865624934" + product: + id: "6e1727b4-2d2c-44f4-b1d2-be5c3540984f" + basePrice: + amount: "100.00" + currency: "PLN" + alleDiscount: + campaignConditions: + meetsConditions: false + violations: + - code: "NOT_ENOUGH_STOCK" + message: "NOT_ENOUGH_STOCK" + requiredMerchantPrice: + amount: "100.00" + currency: "PLN" + minimumGuaranteedDiscount: + percentage: "6.00" + count: 1 + totalCount: 1 + offersWithNoBasePrice: + summary: Offers for which we are still gathering price info. + value: + eligibleOffers: + - id: "2865624934" + product: + id: "6e1727b4-2d2c-44f4-b1d2-be5c3540984f" + basePrice: null + alleDiscount: + campaignConditions: + meetsConditions: false + violations: + - code: "OFFER_PRICE_VERIFICATION_IN_PROGRESS" + message: "OFFER_PRICE_VERIFICATION_IN_PROGRESS" + requiredMerchantPrice: + amount: "100.00" + currency: "PLN" + minimumGuaranteedDiscount: + percentage: "6.00" + count: 1 + totalCount: 1 + '400': + description: >- + Bad Request. Example error codes: + - OffsetNegative + - LimitBelowMin + - LimitAboveMax + - OfferIdInvalidFormat + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + example: + errors: + - code: OffsetNegative + details: null + message: Url parameter offset cannot be negative + path: offset + userMessage: Url parameter offset cannot be negative. + '401': + description: Unauthorized. + '403': + description: Forbidden. Access to the AlleDiscount campaign may have been restricted, check user message. + '404': + description: Not Found. Check provided AlleDiscount campaign id. + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/alle-discount/{campaignId}/submitted-offers: + get: + tags: + - AlleDiscount + operationId: getOffersSubmittedToAlleDiscount + summary: List offer participations + description: >- + Endpoint returning info about offer participations for a given AlleDiscount campaign. With this endpoint you are able to validate if the offer participates in AlleDiscount and if it has lowered price on the platform. Read more: PL / EN. + parameters: + - name: "campaignId" + description: Campaign id to list offers from. + in: "path" + required: true + schema: + type: string + - name: "limit" + description: Maximum number of offers returned in the eligibleOffers list; max value is 200. + in: "query" + required: false + schema: + type: integer + - name: "offset" + description: The number of offers to skip while listing the results. + in: "query" + required: false + schema: + type: integer + - name: "offerId" + description: ID of an offer; if the offer with the given ID exists, returns at most one element in the submittedOffers list. + in: "query" + required: false + schema: + type: string + - name: "participationId" + description: Id of the participation, returns at most one element in the submittedOffers list. + in: "query" + required: false + schema: + type: string + responses: + '200': + description: Lists offer participations. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/AlleDiscountListSubmittedResponse" + examples: + acceptedParticipation: + summary: Offer participation with status "ACCEPTED". + value: + submittedOffers: + - participationId: "5cb574c1-ea74-4362-828f-308e740c200e" + offer: + id: "10000000243" + campaign: + id: "ALLEOBNIZKA_20230209" + prices: + proposedPrice: + amount: "81.00" + currency: "PLN" + minimalPriceReduction: + amount: "8.10" + currency: "PLN" + maximumSellingPrice: + amount: "72.90" + currency: "PLN" + process: + status: "ACCEPTED" + errors: [] + purchaseLimit: 20 + count: 1 + totalCount: 1 + declinedParticipation: + summary: Offer participation with status "DECLINED". + value: + submittedOffers: + - id: "5cb574c1-ea74-4362-828f-308e740c200e" + offer: + id: "10000000243" + campaign: + id: "ALLEOBNIZKA_20230209" + prices: + proposedPrice: + amount: "81.00" + currency: "CZK" + minimalPriceReduction: + amount: "8.10" + currency: "PLN" + maximumSellingPrice: + amount: "72.90" + currency: "PLN" + process: + status: "DECLINED" + errors: + - code: "CURRENCY_NOT_SUPPORTED" + message: "CURRENCY_NOT_SUPPORTED" + purchaseLimit: 20 + count: 1 + totalCount: 1 + '400': + description: Bad Request. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + example: + errors: + - code: OffsetNegative + details: null + message: Url parameter offset cannot be negative + path: offset + userMessage: Url parameter offset cannot be negative. + '401': + description: Unauthorized. + '403': + description: Forbidden. Access to the AlleDiscount campaign may have been restricted, check user message. + '404': + description: Not Found. Check provided AlleDiscount campaign id. + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/alle-discount/campaigns: + get: + tags: + - AlleDiscount + operationId: getAlleDiscountCampaigns + summary: List AlleDiscount campaigns + description: >- + List current AlleDiscount campaigns. Each campaign has its own list of goods (products) that indicate + which offers can be submitted to it. Read more: PL / EN. + parameters: + - name: "campaignId" + in: "query" + schema: + type: string + description: Id of the searched campaign. If present, returns at most one entry. + required: false + responses: + '200': + description: Lists current AlleDiscount campaigns. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AlleDiscountListCampaignsResponse' + example: + alleDiscountCampaigns: + - id: "ALLEOBNIZKA_20230209" + name: "Alleobniżka 02.09.2023" + visibility: + type: "WITHIN" + from: "2023-08-20T11:00:00.000Z" + to: "2023-11-20T11:00:00.000Z" + application: + type: "WITHIN" + from: "2023-08-25T11:00:00.000Z" + to: "2023-09-16T11:00:00.000Z" + publication: + type: "WITHIN" + from: "2023-09-02T11:00:00.000Z" + to: "2022-09-16T11:00:00.000Z" + marketplace: + "id": "allegro-pl" + '404': + description: Not Found. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + example: + errors: + - code: CampaignNotFound + details: null + message: Campaign doesn't exist or it isn't AlleDiscount campaign + path: null + userMessage: Campaign with given id doesn't exist or isn't AlleDiscount campaign. Check the provided campaign id. + '400': + description: Bad Request. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: "#/components/schemas/ErrorsHolder" + '401': + description: Unauthorized. + security: + - bearer-token-for-user: + - allegro:api:campaigns + /sale/smart: + get: + tags: + - Information about user + summary: "Get Smart! seller classification report" + description: >- + Use this resource to get a full Smart! seller classification report. + Read more: PL / EN. + operationId: getSellerSmartClassificationGET + parameters: + - name: marketplaceId + in: query + description: >- + Marketplace for which seller classification report will be returned. + If not specified, the classification result for the seller's registration marketplace will be returned. + required: false + schema: + type: string + example: allegro-pl + responses: + '200': + description: Successfully returned seller Smart! classification report + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SmartSellerClassificationReport' + '401': + description: Unauthorized action + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '404': + description: Not Found + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable entity + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:profile:read + /marketplaces: + get: + tags: + - Information about marketplaces + summary: "Get details for all marketplaces in allegro" + description: 'Use this resource to get information about all the marketplaces on the platform. Read more: PL / EN.' + operationId: marketplacesGET + responses: + '200': + description: Successfully returned all available marketplaces in allegro + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AllegroMarketplaces' + /messaging/threads: + get: + tags: + - Message Center + summary: 'List user threads' + description: 'Use this resource to get the list of user threads sorted by last message date, starting from newest. Read more: PL / EN.' + operationId: listThreadsGET + security: + - bearer-token-for-user: + - allegro:api:messaging + parameters: + - name: limit + in: query + description: The maximum number of threads returned in the response. + required: false + schema: + type: integer + format: int32 + minimum: 1 + maximum: 20 + default: 20 + - name: offset + in: query + description: Index of the first returned thread from all results. + required: false + schema: + type: integer + format: int64 + minimum: 0 + maximum: 15000000 + default: 0 + responses: + '200': + description: OK + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ThreadsList' + '401': + description: User not authorized + '422': + description: Incorrect limit or offset + '/messaging/threads/{threadId}': + get: + tags: + - Message Center + summary: 'Get user thread' + description: 'Use this resource to get thread with provided identifier. Read more: PL / EN.' + operationId: getThreadGET + security: + - bearer-token-for-user: + - allegro:api:messaging + parameters: + - name: threadId + in: path + description: Identifier of thread to get. + required: true + schema: + type: string + responses: + '200': + description: Thread returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Thread' + '401': + description: User not authorized + '404': + description: Thread not found + + '/messaging/threads/{threadId}/read': + put: + tags: + - Message Center + summary: 'Mark a particular thread as read' + description: 'Use this resource to mark thread with provided identifier as read. Read more: PL / EN.' + operationId: changeReadFlagOnThreadPUT + security: + - bearer-token-for-user: + - allegro:api:messaging + responses: + '200': + description: Thread marked as read successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Thread' + '401': + description: User not authorized + '403': + description: User not allowed to update thread read flag + '404': + description: Thread not found + '422': + description: Validation errors - missing flag in the request body + parameters: + - name: threadId + in: path + description: Identifier of thread to be marked. + required: true + schema: + type: string + requestBody: + required: true + description: Updated read flag + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ThreadReadFlag' + /messaging/messages: + post: + tags: + - Message Center + summary: 'Write a new message' + description: 'Use this resource to write new message to recipient. This resource is rate limited to 1 request per second for a user. Read more: PL / EN.' + operationId: newMessagePOST + security: + - bearer-token-for-user: + - allegro:api:messaging + requestBody: + required: true + description: Object representing new message. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/NewMessage' + responses: + '201': + description: Message successfully written + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Message' + '401': + description: Authentication required + '422': + description: Validation errors + '/messaging/threads/{threadId}/messages': + get: + tags: + - Message Center + summary: 'List messages in thread' + description: 'Use this resource to list messages in thread with provided identifier. Read more: PL / EN.' + operationId: listMessagesGET + security: + - bearer-token-for-user: + - allegro:api:messaging + parameters: + - name: threadId + in: path + description: Identifier of thread to get messages from. + required: true + schema: + type: string + - name: limit + in: query + description: The maximum number of messages returned in the response. + required: false + schema: + type: integer + format: int32 + minimum: 1 + maximum: 20 + default: 20 + - name: offset + in: query + description: Index of the first returned message from all results. + required: false + schema: + type: integer + format: int64 + minimum: 0 + maximum: 15000 + default: 0 + - name: before + in: query + description: Message creation date before filter parameter (exclusive) - cannot be used with offset. + example: "2020-11-13T12:45:20.818Z" + required: false + schema: + type: string + format: date-time + - name: after + in: query + description: Message creation date after filter parameter (exclusive). + example: "2020-11-13T12:45:20.818Z" + required: false + schema: + type: string + format: date-time + responses: + '200': + description: Thread message list returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/MessagesList' + '401': + description: User not authorized + '403': + description: User not allowed to list messages in selected thread + '404': + description: Thread not found + '422': + description: Incorrect limit, offset, after or before + post: + tags: + - Message Center + summary: 'Write a new message in thread' + description: 'Use this resource to write new message in existing thread. This resource is rate limited to 1 request per second for a user. Read more: PL / EN.' + operationId: newMessageInThreadPOST + security: + - bearer-token-for-user: + - allegro:api:messaging + parameters: + - name: threadId + in: path + description: Identifier of thread to write message to. + required: true + schema: + type: string + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/NewMessageInThread' + required: true + responses: + '201': + description: Message in thread successfully written + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Message' + '401': + description: User not authorized + '403': + description: User not allowed to list messages in selected thread + '404': + description: Thread not found + '422': + description: Validation errors + '/messaging/messages/{messageId}': + get: + tags: + - Message Center + summary: 'Get single message' + description: 'Use this resource to get message with provided identifier. Read more: PL / EN.' + operationId: getMessageGET + security: + - bearer-token-for-user: + - allegro:api:messaging + parameters: + - name: messageId + in: path + description: Identifier of message to be returned. + required: true + schema: + type: string + responses: + '200': + description: Message returned successfully + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Message' + '401': + description: User not authorized + '404': + description: Message not found + delete: + tags: + - Message Center + summary: 'Delete single message' + description: 'Use this resource to delete message with provided identifier. Read more: PL / EN.' + operationId: deleteMessageDELETE + security: + - bearer-token-for-user: + - allegro:api:messaging + parameters: + - name: messageId + in: path + description: Identifier of the message to delete. + required: true + schema: + type: string + responses: + '204': + description: Message successfully deleted + '401': + description: User not authorized + '403': + description: User not allowed to delete particular message + '404': + description: Message not found + /messaging/message-attachments: + post: + tags: + - Message Center + summary: 'Add attachment declaration' + description: 'Use this resource to add attachment declaration before uploading. Read more: PL / EN.' + operationId: newAttachmentDeclarationPOST + security: + - bearer-token-for-user: + - allegro:api:messaging + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/NewAttachmentDeclaration' + required: true + responses: + '201': + description: Attachment declaration successfully added + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/MessageAttachmentId' + '401': + description: User not authorized + '415': + description: Unsupported mime type + '422': + description: Validation errors + /messaging/message-attachments/{attachmentId}: + put: + tags: + - Message Center + summary: 'Upload attachment binary data' + description: 'Use this resource to upload attachment using identifier that was declared. Read more: PL / EN.' + operationId: uploadAttachmentPUT + security: + - bearer-token-for-user: + - allegro:api:messaging + parameters: + - name: attachmentId + in: path + description: The identifier of attachment that will be uploaded. + required: true + schema: + type: string + requestBody: + required: true + content: + image/png: + schema: + type: string + format: binary + description: File in a binary format + image/gif: + schema: + type: string + format: binary + description: File in a binary format + image/bmp: + schema: + type: string + format: binary + description: File in a binary format + image/tiff: + schema: + type: string + format: binary + description: File in a binary format + image/jpeg: + schema: + type: string + format: binary + description: File in a binary format + application/pdf: + schema: + type: string + format: binary + description: File in a binary format + responses: + '200': + description: Attachment succesfully uploaded. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/MessageAttachmentId' + '401': + description: User not authorized + '403': + description: User does not have + '404': + description: Attachment declaration not found + '413': + description: Exceeded size limit + '415': + description: Unsupported mime type + get: + tags: + - Message Center + summary: 'Download attachment' + description: 'Use this resource to download attachment with provided identifier. Read more: PL / EN.' + operationId: downloadAttachmentGET + security: + - bearer-token-for-user: + - allegro:api:messaging + parameters: + - name: attachmentId + in: path + description: Identifier of the attachment that will be downloaded. + required: true + schema: + type: string + responses: + '200': + description: Attachment file returned successfully + headers: + Content-Disposition: + schema: + type: string + Content-Type: + schema: + type: string + content: + '*/*': + schema: + type: string + format: binary + '401': + description: User not authorized + '404': + description: Attachment not found + /order/customer-returns: + get: + tags: + - Customer returns + summary: '[BETA] Get customer returns by provided query parameters' + description: + 'Use this resource to get all customer returns filtered by query parameters. + Read more: PL / EN. This resource is limited to 25 requests per second for a single user and 50 requests per second for clientId.' + operationId: getCustomerReturns + parameters: + - name: customerReturnId + in: query + description: One or more customer return id's. + required: false + schema: + type: string + - name: orderId + in: query + description: One or more order id's. + required: false + schema: + type: string + - name: buyer.email + in: query + description: One or more buyer emails. + required: false + schema: + type: string + - name: buyer.login + in: query + description: One or more buyer logins. + required: false + schema: + type: string + - name: items.offerId + in: query + description: One or more returned item offer id's. + required: false + schema: + type: string + - name: items.name + in: query + description: One or more item names. + required: false + schema: + type: string + - name: parcels.waybill + in: query + description: One or more waybill id's. + required: false + schema: + type: string + - name: parcels.transportingWaybill + in: query + description: Waybill ids as generated by carriers physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. + required: false + schema: + type: string + - name: parcels.carrierId + in: query + description: One or more carrier id's. + required: false + schema: + type: string + - name: parcels.transportingCarrierId + in: query + description: Carrier id of a carrier physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. + required: false + schema: + type: string + - name: parcels.sender.phoneNumber + in: query + description: One or more phone numbers. + required: false + schema: + type: string + - name: referenceNumber + in: query + description: One or more reference numbers. + required: false + schema: + type: string + - name: from + in: query + description: The ID of the last seen customer return. Customer returns created after the given customer return will be returned. + required: false + schema: + type: string + - name: createdAt.gte + in: query + description: Date of the return in ISO 8601 format to search by greater or equal. + required: false + schema: + type: string + - name: createdAt.lte + in: query + description: Date of the return in ISO 8601 format to search by lower or equal. + required: false + schema: + type: string + - name: marketplaceId + in: query + description: The marketplace ID where operation was made. When the parameter is omitted, searches for operations with all marketplaces. + required: false + schema: + type: string + - name: status + in: query + description: >- + Current return timeline statuses. + The allowed values are: + * CREATED + * DISPATCHED + * IN_TRANSIT + * DELIVERED + * FINISHED + * FINISHED_APT + * REJECTED + * COMMISSION_REFUND_CLAIMED + * COMMISSION_REFUNDED + * WAREHOUSE_DELIVERED + * WAREHOUSE_VERIFICATION. + required: false + schema: + type: string + - name: limit + in: query + description: Limit of customer returns per page. + required: false + schema: + type: integer + format: int32 + minimum: 1 + default: 100 + maximum: 1000 + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + format: int32 + minimum: 0 + default: 0 + responses: + '200': + description: Successfully retrieved customer returns. + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/CustomerReturnResponse' + '400': + description: Bad request. + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '406': + description: Not Acceptable + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:orders:read + /order/customer-returns/{customerReturnId}: + get: + tags: + - Customer returns + summary: '[BETA] Get customer return by id' + description: 'Use this resource to get customer returns by its identifier. Read more: PL / EN.' + operationId: getCustomerReturnById + parameters: + - name: customerReturnId + in: path + description: Id of the customer return. + required: true + schema: + type: string + responses: + '200': + description: Successfully retrieved customer return. + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/CustomerReturn' + '400': + description: Bad request. + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Not found + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '406': + description: Not Acceptable + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:orders:read + /order/customer-returns/{customerReturnId}/rejection: + post: + tags: + - Customer returns + summary: '[BETA] Reject customer return refund' + description: 'Use this resource to reject customer return refund with provided reason. Read more: PL / EN.' + requestBody: + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/CustomerReturnRefundRejectionRequest' + required: true + operationId: rejectCustomerReturnRefund + parameters: + - name: customerReturnId + in: path + description: Id of the customer return. + required: true + schema: + type: string + responses: + '200': + description: Successfully rejected customer return. + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/CustomerReturn' + '400': + description: Bad request. + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '406': + description: Not Acceptable + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '422': + description: Unprocessable Entity. Might occur when customer return has already been rejected + content: + application/vnd.allegro.beta.v1+json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + security: + - bearer-token-for-user: + - allegro:api:orders:write + /fulfillment/advance-ship-notices: + get: + summary: 'Get list of Advance Ship Notices' + description: >- + Use this resource to get a list of Advance Ship Notices. The list is ordered by **createdAt** property. + Default **offset** is 0, default **limit** is 50. + A list can be filtered by statuses. Multiple status query parameters are allowed. + In such cases, filters are joined with **OR** logical operator. Read more: PL / EN. + tags: + - Advance Ship Notices + responses: + '200': + description: Returns list of Advance Ship Notices that belong to a seller. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdvanceShipNoticeList' + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Invalid request parameters. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + operationId: getAdvanceShipNotices + parameters: + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + minimum: 0 + default: 0 + - name: limit + in: query + description: Maximum number of elements in response. + required: false + schema: + type: integer + minimum: 1 + maximum: 200 + default: 50 + - name: status + in: query + description: A status of the Advance Ship Notices in the response. + style: form + required: false + explode: true + schema: + type: array + items: + $ref: '#/components/schemas/AdvanceShipNoticeStatus' + security: + - bearer-token-for-user: + - allegro:api:fulfillment:read + post: + summary: 'Create an Advance Ship Notice' + description: 'Use this resource to create an Advance Ship Notice. Read more: PL / EN.' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CreateAdvanceShipNoticeRequest' + required: true + responses: + '201': + description: Advance Ship Notice created. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/CreateAdvanceShipNoticeResponse' + headers: + location: + description: The location of created Advance Ship Notice (URI). + schema: + type: string + example: 'https://api.allegro.pl/fulfillment/advance-ship-notices/a1520fab-7801-4832-9ccd-fb068c707a74' + etag: + description: A current version of ASN. Use this value in combination with If-Match header to update ASN. + schema: + type: string + example: '123456' + '400': + description: Invalid request body. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Advance Ship Notice cannot be created due to improper input data. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + tags: + - Advance Ship Notices + operationId: createAdvanceShipNotice + security: + - bearer-token-for-user: + - allegro:api:fulfillment:write + /fulfillment/advance-ship-notices/{id}: + get: + summary: 'Get single Advance Ship Notice' + description: 'Use this resource to get an Advance Ship Notice. Read more: PL / EN.' + tags: + - Advance Ship Notices + responses: + '200': + description: Returns single Advance Ship Notice. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdvanceShipNoticeResponse' + headers: + etag: + description: A current version of ASN. Use this value in combination with If-Match header to update ASN. + schema: + type: string + example: '123456' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + operationId: getAdvanceShipNotice + parameters: + - name: id + in: path + description: The identifier of returned Advance Ship Notice. + required: true + schema: + type: string + format: uuid + example: 84529ad2-2265-4e15-b76b-c17025d848f6 + security: + - bearer-token-for-user: + - allegro:api:fulfillment:read + put: + summary: 'Update Advance Ship Notice' + description: >- + Use this resource to update an Advance Ship Notice. Any content property update will clear labels property. + Use Create labels command to create new labels for provided content. + + If a client wants to update read-only property, an error is returned (only in cases when sent value will be + different than actual on the server). Read more: PL / EN. + parameters: + - name: id + in: path + description: An identifier of Advance Ship Notice. + required: true + schema: + type: string + format: uuid + example: 84529ad2-2265-4e15-b76b-c17025d848f6 + - name: if-match + in: header + description: A current version of Advance Ship Notice (e.g. from etag header obtained via get). + required: true + schema: + type: string + example: '123456' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdvanceShipNotice' + required: true + responses: + '200': + description: Advance Ship Notice updated + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdvanceShipNoticeResponse' + headers: + etag: + description: A current version of ASN. Use this value in combination with If-Match header to update ASN. + schema: + type: string + example: '123456' + '400': + description: If-match header missing + '401': + description: Unauthorized + '403': + description: Forbidden + '412': + description: Concurrent modification of ASN + '422': + description: ASN is invalid or attempting to update read-only property + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + tags: + - Advance Ship Notices + operationId: updateAdvanceShipNotice + security: + - bearer-token-for-user: + - allegro:api:fulfillment:write + delete: + summary: 'Delete Advance Ship Notice' + description: 'Use this resource to delete an Advance Ship Notice. Read more: PL / EN.' + parameters: + - name: id + in: path + description: An identifier of the Advance Ship Notice to delete. + required: true + schema: + type: string + format: uuid + default: 0b488a23-bc99-470d-8842-0c585adf2479 + responses: + '204': + description: Advance Ship Notice was deleted. + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '422': + description: ASN cannot be deleted - it is not in DRAFT status. + tags: + - Advance Ship Notices + operationId: deleteAdvanceShipNotice + security: + - bearer-token-for-user: + - allegro:api:fulfillment:write + /fulfillment/advance-ship-notices/{id}/cancel: + put: + summary: 'Cancel Advance Ship Notice' + description: 'Use this resource to cancel an Advance Ship Notice in IN_TRANSIT status. Read more: PL / EN.' + parameters: + - name: id + in: path + description: An identifier of the Advance Ship Notice to cancel. + required: true + schema: + type: string + format: uuid + default: 0b488a23-bc99-470d-8842-0c585adf2479 + responses: + '200': + description: Advance Ship Notice was cancelled. + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '422': + description: ASN cannot be cancelled - it is not in IN_TRANSIT status. + tags: + - Advance Ship Notices + operationId: cancelAdvanceShipNotice + security: + - bearer-token-for-user: + - allegro:api:fulfillment:write + /fulfillment/advance-ship-notices/{id}/labels: + get: + summary: 'Get labels for Advance Ship Notice' + description: 'Use this resource to get labels for Advance Ship Notice after being created with "create labels command". Read more: PL / EN.' + tags: + - Advance Ship Notices + operationId: getAdvanceShipNoticeLabels + parameters: + - name: id + in: path + description: An identifier of the Advance Ship Notice. + required: true + schema: + type: string + format: uuid + example: 84529ad2-2265-4e15-b76b-c17025d848f6 + - name: accept + in: header + description: Content-type of generated labels. + required: true + schema: + type: string + enum: + - application/pdf + - x-application/zpl + responses: + '200': + description: Returns PDF or ZPL file with labels. + content: + application/pdf: + schema: + type: string + format: binary + x-application/zpl: + schema: + type: string + format: text + headers: + content-disposition: + description: The header contains filename directive with indicative file name. + schema: + type: string + example: 'inline; filename="labels-A-210825-0000001.pdf"' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + security: + - bearer-token-for-user: + - allegro:api:fulfillment:read + /fulfillment/submit-commands/{command-id}: + put: + summary: 'Submit the Advance Ship Notice' + description: >- + Use this resource to submit the Advance Ship Notice. After this operation, updates of the Advance Ship Notice are limited to selected properties only. See PUT /fulfillment/advance-ship-notices/{id}/submitted. + Read more: PL / EN. + parameters: + - name: command-id + in: path + description: The identifier of the command. + required: true + schema: + type: string + format: uuid + default: 725432a9-ae9e-43de-b8c5-7430606a81a4 + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SubmitCommand' + required: true + responses: + '201': + description: >- + Returns command output with status and possible errors. + + The command could fail with following error codes: + * ASN_NOT_FOUND - Cannot find ASN with id given in command input. + * COMMAND_FORBIDDEN - Requester has no access to run commands on given ASN. + * INVALID_ASN_STATE - Such command cannot be run on current ASN state e.g. ASN has no shipping information. + * COMMAND_FAILED - Any other error. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SubmitCommand' + examples: + runningCommand: + summary: running command + value: + id: '71529ad2-2265-4e15-b76b-c17025d848f7' + input: + advanceShipNoticeId: '123a08d7-ab9b-460d-b9cb-d6ed64b3a018' + output: + status: 'RUNNING' + successfulCommand: + summary: successful command + value: + id: '71529ad2-2265-4e15-b76b-c17025d848f7' + input: + advanceShipNoticeId: '123a08d7-ab9b-460d-b9cb-d6ed64b3a018' + output: + status: 'SUCCESSFUL' + failedCommand: + summary: failed command + value: + id: '71529ad2-2265-4e15-b76b-c17025d848f7' + input: + advanceShipNoticeId: '123a08d7-ab9b-460d-b9cb-d6ed64b3a018' + output: + status: 'FAILED' + errors: + - code: 'ASN_NOT_FOUND' + message: 'ASN not found' + details: null + path: null + userMesssage: 'ASN not found' + headers: + location: + description: A location to created command (URI). + schema: + type: string + example: 'https://api.allegro.pl/fulfillment/advance-ship-notices/a1520fab-7801-4832-9ccd-fb068c707a74' + '401': + description: Unauthorized + '422': + description: Invalid request parameters. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + operationId: submitCommand + tags: + - Advance Ship Notices + security: + - bearer-token-for-user: + - allegro:api:fulfillment:write + get: + summary: 'Get submit status' + description: 'Use this resource to get submit status of the Advance Ship Notice. Read more: PL / EN.' + parameters: + - name: command-id + in: path + description: An identifier of the command. + required: true + schema: + type: string + format: uuid + default: 882202c8-15ab-4a83-aeef-29ea505bf0d0 + tags: + - Advance Ship Notices + responses: + '200': + description: Returns command output with status and possible errors. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/SubmitCommand' + examples: + runningCommand: + summary: running command + value: + id: '71529ad2-2265-4e15-b76b-c17025d848f7' + input: + advanceShipNoticeId: '123a08d7-ab9b-460d-b9cb-d6ed64b3a018' + output: + status: 'RUNNING' + successfulCommand: + summary: successful command + value: + id: '71529ad2-2265-4e15-b76b-c17025d848f7' + input: + advanceShipNoticeId: '123a08d7-ab9b-460d-b9cb-d6ed64b3a018' + output: + status: 'SUCCESSFUL' + failedCommand: + summary: failed command + value: + id: '71529ad2-2265-4e15-b76b-c17025d848f7' + input: + advanceShipNoticeId: '123a08d7-ab9b-460d-b9cb-d6ed64b3a018' + output: + status: 'FAILED' + errors: + - code: 'ASN_NOT_FOUND' + message: 'ASN not found' + details: null + path: null + userMesssage: 'ASN not found' + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Invalid request parameters. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + operationId: getSubmitCommand + security: + - bearer-token-for-user: + - allegro:api:fulfillment:read + /fulfillment/advance-ship-notices/{id}/submitted: + put: + summary: 'Update submitted Advance Ship Notice' + description: >- + Use this resource to update already submitted Advance Ship Notice. Update is allowed only when Advance Ship Notice is in "IN_TRANSIT" status. + Modifications are limited to: + - changing items quantity + - removing items + - changing handling unit amount + - changing shipping courier id, name, tracking numbers or vehicle licence plate or third party delivery details (depending on the selected shipping method in the submitted advance ship notice) + Handling unit's amount property update clears labels property. Use Create labels command to create new labels for provided content. Read more: PL / EN. + operationId: updateSubmittedAdvanceShipNotice + parameters: + - name: id + in: path + description: An identifier of Advance Ship Notice. + required: true + schema: + type: string + format: uuid + example: 84529ad2-2265-4e15-b76b-c17025d848f6 + - name: if-match + in: header + description: A current version of Advance Ship Notice (e.g. from etag header obtained via get). + required: true + schema: + type: string + example: '123456' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/UpdateSubmittedAdvanceShipNoticeRequest' + required: true + responses: + '200': + description: Advance Ship Notice updated + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdvanceShipNoticeResponse' + headers: + etag: + description: A current version of ASN. Use this value in combination with If-Match header to update ASN. + schema: + type: string + example: '123456' + '400': + description: If-match header missing + '401': + description: Unauthorized + '403': + description: Forbidden + '412': + description: Concurrent modification of ASN + '422': + description: Validation error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + tags: + - Advance Ship Notices + security: + - bearer-token-for-user: + - allegro:api:fulfillment:write + /fulfillment/stock: + get: + summary: 'Get available stock' + description: 'Use this resource to get a list of the products belonging to the seller, which are in Allegro Warehouse. Read more: PL / EN.' + parameters: + - name: Accept-Language + in: header + required: false + description: Expected language of product name translation. + example: "en-US" + schema: + type: string + format: BCP-47 language code + default: "en-US" + enum: + - "en-US" + - "pl-PL" + - "uk-UA" + - name: offset + in: query + description: The offset of elements in the response. Ignored for text/csv content type. + required: false + schema: + type: integer + minimum: 0 + default: 0 + - name: limit + in: query + description: Maximum number of elements in response. Ignored for text/csv content type. + required: false + schema: + type: integer + minimum: 1 + maximum: 1000 + default: 50 + - name: phrase + in: query + description: Filtering search results by product name. + required: false + schema: + type: string + minLength: 3 + - name: sort + in: query + description: >- + Defines how elements are sorted in response. Minus sign can be added to imply descending sort order. + Ignored for text/csv content type. + + Possible values for the "sort" parameter: + * -available - sorting by quantity of available products (descending) + * available - sorting by quantity of available products (ascending) + * -unfulfillable - sorting by quantity of unfulfillable products (descending) + * unfulfillable - sorting by quantity of unfulfillable products (ascending) + * -name - sorting by product’s name (descending) + * name - sorting by product’s name (ascending) + * lastWeekSalesAverage - sorting by product last week average sales (ascending) + * -lastWeekSalesAverage - sorting by product last week average sales (descending) + * reserve - sorting by reserve.outOfStockIn field (ascending) + * -reserve - sorting by reserve.outOfStockIn field (descending) + * lastThirtyDaysSalesSum - sorting by product last month sum sales (ascending) + * -lastThirtyDaysSalesSum - sorting by product last month sum sales (descending) + * storageFee - sorting by storage fee (ascending). The order by fee status is: NOT_APPLICABLE, then INCLUDED_IN_STORAGE_FEE, then PREDICTION, then CHARGED ordered by amountGross ascending. + * -storageFee - sorting by storage fee (descending). The order by fee status is: CHARGED ordered by amountGross descending, then PREDICTION, then INCLUDED_IN_STORAGE_FEE, then NOT_APPLICABLE. + required: false + schema: + type: string + default: "name" + enum: + - "available" + - "-available" + - "unfulfillable" + - "-unfulfillable" + - "name" + - "-name" + - "lastWeekSalesAverage" + - "-lastWeekSalesAverage" + - "reserve" + - "-reserve" + - "lastThirtyDaysSalesSum" + - "-lastThirtyDaysSalesSum" + - "storageFee" + - "-storageFee" + - name: productId + in: query + description: Filtering search results by fulfillment product identifier. Ignored for text/csv content type. + required: false + schema: + type: string + format: uuid + - name: productAvailability + in: query + description: Filtering search results by availability. + required: false + explode: true + schema: + type: array + items: + type: string + enum: + - "SUFFICIENT" + - "UNAVAILABLE" + - "LOW" + - name: productStatus + in: query + description: Filtering search results by status. + required: false + schema: + type: string + enum: + - "UNFULFILLABLE" + - name: asnStatus + in: query + description: >- + Filtering search results by ASN status. Following values are allowed: + SUBMITTED - Advanced Ship Notice document has been submitted and it contains a particular product. Only the products that have ASN with products on it are returned. + NOT_FOUND - Advanced Ship Notice that contains a particular product was not found. It has not been submitted, may be expired, or products have already been delivered to the warehouse. Only the products that don't have related ASN with products on it are returned. + required: false + schema: + type: string + enum: + - "SUBMITTED" + - "NOT_FOUND" + - name: outOfStockInFrom + in: query + description: Filter by products with outOfStockIn greater than or equal. + required: false + schema: + type: integer + - name: outOfStockInTo + in: query + description: Filter by products with outOfStockIn less than or equal. + required: false + schema: + type: integer + tags: + - Fulfillment Stock + responses: + '200': + description: Returns available stock for the seller. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/StockProductList' + text/csv: + schema: + type: string + example: | + Product ID,Product name,GTIN,Offer ID,Total quantity,Available,Reserved,Unfulfillable,Sales in last 30 days,Avg. daily sales,Out of stock in,Pending delivery,Daily storage fee (PLN),Number of items with storage fee,Fee charge date,Predicted upcoming storage fee (PLN),Predicted number of items with upcoming storage fee,Storage fee start date + 1e435bb7-9fcd-4b70-b7d4-e4126d48502d,Apple Watch 3 42mm,7016489270639,7679273578,0,0,0,0,1,3,0,Yes,12.34,21,2023-02-13,,, + 21554f43-7800-4a95-be6c-889f1b703899,Huawei ShotX,9743272547507,7679273582,20,15,2,3,203,1,20,No,43.21,12,2023-02-14,,, + 52d3ee6b-330e-4924-a4a9-8b8d315c86de,Xiaomi Redmi Note 10,"1859832948338",7679273579,10,5,3,2,0,0,not enough data,No,included in service price,0,2023-02-14,,, + 1bdffdc8-3a8a-4c64-b363-1645d14dc3de,WITTCHEN Walizka kabinowa,"2746650558857,1859832948337",7679273578,10,5,3,2,0,0,not enough data,No,-,0,2023-02-14,,, + 31554f43-4b9x-6j59-6bc5-262hvg151nhb,iPad 6,4152861518618,2352342316,10,10,0,0,0,0,0,Yes,included in service price,0,2023-02-14,14.90,10,2023-02-21,10 + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Invalid request parameters. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + operationId: getFulfillmentStock + security: + - bearer-token-for-user: + - allegro:api:fulfillment:read + /fulfillment/orders/{orderId}/parcels: + get: + summary: "Get list of shipped parcels" + description: 'Use this resource to get list of parcels and included items for a given order. Items include detailed information such as expiration dates and serial numbers. Read more: PL / EN.' + parameters: + - name: orderId + in: path + description: The Allegro's platform order identifier. + required: true + schema: + type: string + format: uuid + tags: + - Fulfillment Parcels + responses: + '200': + description: Returns list of parcels shipped by warehouse in a given order. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/FulfillmentOrder' + '404': + description: Not Found + '401': + description: User not authenticated or token is expired + operationId: getFulfillmentOrderParcels + security: + - bearer-token-for-user: + - allegro:api:fulfillment:read + /fulfillment/available-products: + get: + summary: 'Get list of available products' + description: >- + Use this resource to get a list of products that can be added to Advance Ship Notice. + The list contains products for which the seller has created offers and is ordered by product's name. Read more: PL / EN. + parameters: + - name: Accept-Language + in: header + required: false + description: Expected language of product name translation. + example: "pl-PL" + schema: + type: string + format: BCP-47 language code + default: "en-US" + enum: + - "en-US" + - "pl-PL" + - "uk-UA" + - name: offset + in: query + description: The offset of elements in the response. + required: false + schema: + type: integer + minimum: 0 + default: 0 + - name: limit + in: query + description: Maximum number of elements in response. + required: false + schema: + type: integer + minimum: 1 + maximum: 100 + default: 50 + tags: + - Fulfillment Products + responses: + '200': + description: Returns list of products that can be added to Advance Ship Notice. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AvailableProductsList' + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Invalid request parameters. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + operationId: getAvailableProducts + security: + - bearer-token-for-user: + - allegro:api:fulfillment:read + /fulfillment/advance-ship-notices/{id}/receiving-state: + get: + summary: 'Check current state and details of Advance Ship Notice receiving' + description: >- + Use this resource to check the state of Advance Ship Notice receiving in Fulfillment Center in real time. The response contains a receiving progress and information about particular items - their quantities and conditions. + While the Advance Ship Notice is in UNPACKING state, report is updated dynamically, + which might result in different responses even at short time intervals. Read more: PL / EN. + tags: + - Advance Ship Notices + parameters: + - name: id + in: path + description: An identifier of advance ship notice. + required: true + schema: + type: string + format: uuid + default: 712fa46c-7d4a-4ba0-b094-b5d1d4f6155d + responses: + '200': + description: Returns the state of Advance Ship Notice receiving in Fulfillment Center + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/ReceivingState' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found (ASN doesn't exist or is in state DRAFT or IN_TRANSIT) + operationId: getAdvanceShipNoticeReceivingState + security: + - bearer-token-for-user: + - allegro:api:fulfillment:read + + /fulfillment/tax-id: + post: + summary: 'Add tax identification number' + description: 'Use this resource to add tax identification number. For international sellers only.' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TaxIdRequest' + required: true + responses: + '201': + description: Tax identification number successfully added + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + '422': + description: Tax identification number is invalid + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + tags: + - Tax Identification Number + operationId: addTaxId + security: + - bearer-token-for-user: + - allegro:api:fulfillment:write + put: + summary: 'Update tax identification number' + description: 'Use this resource to update tax identification number. For international sellers only.' + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TaxIdRequest' + required: true + responses: + '200': + description: Tax identification number updated + '401': + description: Unauthorized + '403': + description: Forbidden + '422': + description: Tax identification number is invalid + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + '404': + description: Not Found + tags: + - Tax Identification Number + operationId: updateTaxId + security: + - bearer-token-for-user: + - allegro:api:fulfillment:write + get: + summary: 'Get tax identification number' + description: 'Use this resource to get tax identification number with verification status. After adding or updating the tax identification number the status will be NOT_VERIFIED and you will have to wait for acceptance status to start selling.' + responses: + '200': + description: Returns tax identification number with verification status information + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/TaxIdResponse' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + tags: + - Tax Identification Number + operationId: getTaxId + security: + - bearer-token-for-user: + - allegro:api:fulfillment:read + + + /fulfillment/removal/preferences: + get: + summary: 'Get current active removal preference' + description: >- + Use this resource to read your current removal preference. + Removal preference is associated with system removal order at the moment of removal order is created. It means there can be not yet fulfilled removal orders associated with previously set removal preference. + Read more: PL / EN. + tags: + - Fulfillment Removal + responses: + '200': + description: Returns the current active Fulfillment Removal Preference + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/FulfillmentRemovalPreference' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + '404': + description: Not Found (Fulfillment Removal Preferences was never set) + operationId: getFulfillmentRemovalPreferences + security: + - bearer-token-for-user: + - allegro:api:fulfillment:read + put: + summary: 'Create new active Fulfillment Removal Preference' + description: >- + Use this resource to create new active removal preference. From the moment the preference is set, it becomes the active one, and all new system removal orders will be associated with this preference. + Removal preference is associated with system removal order at the moment of removal order is created. It means there can be not yet fulfilled removal orders associated with previously set removal preference. + Read more: PL / EN. + requestBody: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/FulfillmentRemovalPreference' + required: true + responses: + '201': + description: Active Fulfillment Removal Preference created. + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/FulfillmentRemovalPreference' + '401': + description: Unauthorized + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AuthError' + '403': + description: Forbidden + '422': + description: >- + Fulfillment Removal Preferences cannot be created due to invalid request body. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorsHolder' + tags: + - Fulfillment Removal + operationId: createFulfillmentRemovalPreferences + security: + - bearer-token-for-user: + - allegro:api:fulfillment:write +components: + securitySchemes: + bearer-token-for-user: + type: oauth2 + description: >- + **Important!** Do not require the user of your application to register a new instance of the application and send you Client_ID and Client_Secret. Regardless of the authorization method, the application must run on a single key (Client_ID). For more information PL / EN to read about authorization code flow + or PL / EN to read about the device code flow. + flows: + authorizationCode: + authorizationUrl: https://allegro.pl/auth/oauth/authorize + tokenUrl: https://allegro.pl/auth/oauth/token + scopes: {} + x-deviceCode: + authorizationUrl: https://allegro.pl/skojarz-aplikacje + tokenUrl: https://allegro.pl/auth/oauth/token + scopes: {} + bearer-token-for-application: + type: oauth2 + description: For more information, see PL / EN. + flows: + clientCredentials: + tokenUrl: https://allegro.pl/auth/oauth/token + scopes: {} + requestBodies: + Pos: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/Pos' + description: Point of service + required: true + OfferAttachmentRequest: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferAttachmentRequest' + description: offer attachment + required: true + AdditionalServicesGroupRequest: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AdditionalServicesGroupRequest' + description: Additional service group body + required: true + VariantSetRequest: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/VariantSet' + examples: + offerParameterOnly: + summary: 'offer parameter only' + value: + name: 't-shirt' + offers: + - id: '2' + - id: '3' + parameters: + - id: '21' + colorPatternParameterOnly: + summary: 'color/pattern parameter only' + value: + name: 't-shirt' + offers: + - id: '2' + colorPattern: 'red' + - id: '4' + colorPattern: 'blue' + parameters: + - id: 'color/pattern' + offerAndColorPatternParameters: + summary: 'offer and color/pattern parameters' + value: + name: 't-shirt' + offers: + - id: '2' + colorPattern: 'red' + - id: '3' + colorPattern: 'red' + - id: '4' + colorPattern: 'blue' + - id: '5' + colorPattern: 'blue' + parameters: + - id: 'color/pattern' + - id: '21' + required: true + MessageRequest: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/MessageRequest' + description: Message request + required: true + AttachmentDeclaration: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/AttachmentDeclaration' + description: A detailed declaration of a file to be uploaded + required: true + OfferImageUploadRequest: + required: true + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/OfferImageLinkUploadRequest' + image/jpeg: + schema: + type: string + format: binary + description: File in a binary format + image/png: + schema: + type: string + format: binary + description: File in a binary format + image/webp: + schema: + type: string + format: binary + description: File in a binary format + UserRatingAnswerRequest: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/UserRatingAnswerRequest' + description: 'User rating answer request.' + required: true + UserRatingRemovalRequest: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/UserRatingRemovalRequest' + description: 'User rating removal request.' + required: true + PromoOptionsCommand: + content: + application/vnd.allegro.public.v1+json: + schema: + $ref: '#/components/schemas/PromoOptionsCommand' + description: 'Promo packages modification command request.' + required: true + schemas: + BillingEntries: + type: object + properties: + billingEntries: + type: array + description: List of billing types. + items: + $ref: '#/components/schemas/BillingEntry' + BillingEntry: + properties: + id: + type: string + format: uuid + description: ID of the returned billing entry. + example: '09f0b4cc-7880-11e9-8f9e-2a86e4085a59' + occurredAt: + type: string + format: date-time + description: Date of billing entry. + example: '2019-05-08T09:45:32.818Z' + type: + type: object + properties: + id: + type: string + description: Three-letter code of the billing type of the returned billing entry. + example: 'LIS' + name: + type: string + description: Billing type of the returned billing entry. + This type is translated based on the value of the "Accept-Language" header. + By default a message in English is returned. + example: 'Listing fee' + offer: + type: object + description: Offer associated with the returned billing entry. + properties: + id: + type: string + description: ID of the offer associated with the billing entry. + example: '12345678' + name: + type: string + description: Name of the offer associated with the billing entry. + This field is populated asynchronously, which means the value may appear with a delay. + example: 'offer name' + value: + type: object + description: Money value of the returned billing entry. + properties: + amount: + type: string + description: Monetary amount of the returned billing entry. + example: '100.00' + currency: + type: string + description: Three-letter currency code (ISO-4217) of the returned billing entry. + example: 'PLN' + tax: + type: object + description: Tax rate applied to the returned billing entry. + Optional field percentage is present if the returned billing entry is subject to tax. + In this case, annotation is not returned. + Optional field annotation is present if the returned billing entry + is exempt from tax or tax is not applicable; the possible value is "OUT_OF_SCOPE". + In this case, percentage is not returned. + properties: + percentage: + type: string + description: Optional tax rate shown as a number in the range 0-100. + example: '0' + annotation: + type: string + description: Optional annotation explaining the tax rate. + example: 'OUT_OF_SCOPE' + balance: + type: object + description: User account balance calculated on billing date. + properties: + amount: + type: string + description: Monetary amount of the balance calculated for the returned billing entry. + example: '100.00' + currency: + type: string + description: Three-letter currency code (ISO-4217) of the balance of the returned billing entry. + example: 'PLN' + order: + type: object + description: Order associated with the returned billing entry. + properties: + id: + type: string + description: Order id + format: uuid + example: '09f0b4cc-7880-11e9-8f9e-2a86e4085a59' + additionalInfo: + type: array + description: Additional information associated with the returned billing entry. + items: + type: object + properties: + type: + type: string + description: The technical key identifying the type of additional information. + example: 'additional_service' + name: + type: string + description: The display name for the additional information type. + This value is translated based on the "Accept-Language" header. + By default a message in English is returned. + example: 'Name of additional service' + value: + type: string + description: The actual value associated with the given additional information type. + example: '55555555' + BillingType: + properties: + id: + type: string + format: string + description: ID of the billing type. + example: 'SUC' + description: + type: string + format: string + description: Localized type name. + example: 'Prowizja od sprzedaży' + InitializeRefund: + required: + - payment + - reason + properties: + payment: + $ref: '#/components/schemas/RefundPayment' + order: + $ref: '#/components/schemas/RefundOrder' + commandId: + type: string + example: 14e142cf-e8e0-48cc-bcf6-399b5fd90b32 + description: Command UUID. If empty, idempotency will not be supported. + reason: + type: string + description: Reason for a payment refund. + enum: + - "REFUND" + - "COMPLAINT" + - "PRODUCT_NOT_AVAILABLE" + - "PAID_VALUE_TOO_LOW" + - "OVERPAID" + - "CANCELLED_BY_BUYER" + - "NOT_COLLECTED" + lineItems: + type: array + description: List of order's line items which can be refunded. + items: + $ref: '#/components/schemas/RefundLineItem' + delivery: + type: object + properties: + value: + $ref: '#/components/schemas/RefundDeliveryValue' + description: Payment refund for delivery. + overpaid: + type: object + properties: + value: + $ref: '#/components/schemas/RefundOverpaidValue' + description: Payment refund for overpaid. + surcharges: + type: array + description: List of surcharges for payment which can be refunded. + items: + $ref: '#/components/schemas/PaymentsSurcharge' + additionalServices: + type: object + properties: + value: + $ref: '#/components/schemas/RefundAdditionalServicesValue' + description: Payment refund for additional services. + sellerComment: + type: string + description: Sellers optional justification for refund. + maxLength: 250 + example: 'Example seller comment.' + RefundClaim: + type: object + description: Detailed information about the refund application. + properties: + id: + type: string + format: uuid + description: ID of the returned refund application. + example: '09f0b4cc-7880-11e9-8f9e-2a86e4085a59' + status: + type: string + description: >- + Status of the returned refund application. + - `IN_PROGRESS` - the application is being processed or awaits user or admin action. + - `WAITING_FOR_PAYMENT_REFUND` - the application is being processed and awaits payment refund to buyer. + - `GRANTED` - the application was accepted and a commission refund was granted as requested, + or the application was rejected and the seller successfully appealed. + - `REJECTED` - the application was rejected and no commission was refunded. + - `REJECTED_AFTER_APPEAL` - the application was initially rejected and the seller unsuccessfully appealed. + - `CANCELLED` - the application was cancelled by the seller. + - `APPEALED` - the application was rejected and the seller appealed, but the appeal has not yet finished processing. + enum: + - "IN_PROGRESS" + - "WAITING_FOR_PAYMENT_REFUND" + - "GRANTED" + - "REJECTED" + - "REJECTED_AFTER_APPEAL" + - "CANCELLED" + - "APPEALED" + quantity: + type: integer + minimum: 1 + format: int32 + description: Quantity of product for which the seller filed the refund application. + commission: + type: object + description: Money value of the returned refund application. + properties: + amount: + type: number + description: Monetary amount of the returned refund application. + example: 100.00 + currency: + type: string + description: Three-letter currency code (ISO-4217) of the returned refund application. + example: 'PLN' + buyer: + type: object + description: Buyer associated with the refund application. + properties: + id: + type: string + description: ID of the buyer associated with the refund application. + example: '12345678' + login: + type: string + description: Login of the buyer associated with the refund application. + example: 'JanKowalski' + createdAt: + type: string + format: date-time + description: Date when the refund application was created. + lineItem: + type: object + description: Purchase associated with the refund application. + properties: + id: + type: string + description: ID of the purchase associated with the refund application. + example: '09f0b4cc-7880-11e9-8f9e-2a86e4085a59' + quantity: + type: integer + minimum: 1 + format: int32 + description: Total quantity of product purchased by the buyer. + Equal to or greater than quantity for which the seller filed the refund application. + boughtAt: + type: string + format: date-time + description: Date when the purchase was made. + offer: + type: object + description: Offer associated with the purchase. + properties: + id: + type: string + description: ID of the offer associated with the purchase. + example: '12345678' + name: + type: string + description: Name of the offer associated with the purchase. + type: + type: string + description: >- + Type of commission refund application. + - `MANUAL` - the application was created manually by the seller. + - `AUTOMATIC` - the application was created automatically. + enum: + - "MANUAL" + - "AUTOMATIC" + RefundClaimRequest: + type: object + properties: + lineItem: + type: object + description: Purchase for which a refund application will be created. + properties: + id: + type: string + description: ID of the purchase for which a refund application will be created. + quantity: + type: integer + minimum: 1 + format: int32 + description: Quantity of product for which the refund application will be created. Must be greater than zero. + RefundClaimResponse: + type: object + properties: + id: + type: string + description: ID of created claim. + RefundDetails: + type: object + description: Detailed information about the refund. + required: + - id + - payment + - reason + - status + - createdAt + - totalValue + properties: + id: + type: string + format: uuid + description: The payment refund identifier. + example: 09f0b4cc-7880-11e9-8f9e-2a86e4085a59 + payment: + $ref: '#/components/schemas/RefundPayment' + order: + $ref: '#/components/schemas/RefundOrder' + reason: + type: string + description: Reason for a payment refund. + enum: + - "REFUND" + - "COMPLAINT" + - "PRODUCT_NOT_AVAILABLE" + - "PAID_VALUE_TOO_LOW" + - "OVERPAID" + - "CANCELLED_BY_BUYER" + - "NOT_COLLECTED" + status: + type: string + description: Current status of payment refund. + enum: + - "SUCCESS" + - "CANCELED" + - "PARTIAL" + - "IN_PROGRESS" + - "VALIDATED" + - "VALIDATE_FAILED" + - "NEW" + createdAt: + type: string + format: date-time + example: '2017-05-17T08:36:57.292+02:00' + description: Date and time when the refund was created provided in ISO 8601 format. + totalValue: + $ref: '#/components/schemas/RefundTotalValue' + lineItems: + type: array + description: List of order's line items which can be refunded. + items: + $ref: '#/components/schemas/RefundLineItem' + delivery: + type: object + properties: + value: + $ref: '#/components/schemas/RefundDeliveryValue' + description: Payment refund for delivery. + overpaid: + type: object + properties: + value: + $ref: '#/components/schemas/RefundOverpaidValue' + description: Payment refund for overpaid. + surcharges: + type: array + description: List of surcharges for payment which can be refunded. + items: + $ref: '#/components/schemas/PaymentsSurcharge' + additionalServices: + type: object + properties: + value: + $ref: '#/components/schemas/RefundAdditionalServicesValue' + description: Payment refund for additional services. + sellerComment: + type: string + description: Sellers optional justification for refund. + maxLength: 250 + example: 'Example seller comment.' + RefundLineItem: + type: object + required: + - id + - type + properties: + id: + type: string + format: uuid + description: The line-item identifier. + example: 09f0b4cc-7880-11e9-8f9e-2a86e4085a59 + type: + type: string + description: Type for line items refund. QUANTITY is provided when you can refund one or more items. AMOUNT is provided when you can refund a partial price. + example: QUANTITY + enum: + - "AMOUNT" + - "QUANTITY" + quantity: + type: number + minimum: 0 + example: 5 + description: This field is provided for QUANTITY type only. It specifies how many items will be refunded. + value: + required: + - amount + - currency + type: object + nullable: true + description: This field is available for AMOUNT type only and specifies the amount refunded to the customer. + example: null + properties: + amount: + type: string + description: The amount provided in a string format to avoid rounding errors. + currency: + type: string + description: The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + RefundPayment: + type: object + description: Payment affected by refund operation. + title: RefundPayment + properties: + id: + type: string + format: uuid + description: The payment identifier. + example: a6bee8b2-8b4e-11e9-8918-07b31163120a + RefundOrder: + type: object + description: Order affected by refund operation. + title: RefundOrder + properties: + id: + type: string + format: uuid + description: The order identifier. + example: a114b176-4833-451c-84dc-c37463793417 + CustomerReturnRefundRejectionRequest: + type: object + required: + - rejection + properties: + rejection: + type: object + description: Refund rejection + required: + - code + properties: + code: + type: string + description: Refund rejection code + enum: + - REFUND_REJECTED + - NEW_ITEM_SENT + - ITEM_FIXED + - MISSING_PART_SENT + reason: + type: string + description: Refund rejection reason, required when code is REFUND_REJECTED + example: Returned item is damaged. + minLength: 1 + maxLength: 250 + CustomerReturnResponse: + type: object + required: + - count + - customerReturns + properties: + count: + type: integer + format: int64 + example: 1 + customerReturns: + type: array + description: List of matching customer returns. + items: + $ref: '#/components/schemas/CustomerReturn' + CustomerReturn: + type: object + properties: + id: + type: string + example: 'a3405c27-b01c-4357-9bea-e13925708b46' + createdAt: + type: string + format: date-time + example: '2020-01-11T09:36:57.00Z' + referenceNumber: + type: string + example: '1234/Z04A' + orderId: + type: string + example: 'a3405c27-b01c-4357-9bea-e13925708b46' + buyer: + $ref: '#/components/schemas/CustomerReturnBuyer' + items: + type: array + description: List of returned items. + items: + $ref: '#/components/schemas/CustomerReturnItem' + refund: + $ref: '#/components/schemas/CustomerReturnRefund' + parcels: + type: array + description: List of returned parcels. + items: + $ref: '#/components/schemas/CustomerReturnReturnParcel' + rejection: + $ref: '#/components/schemas/CustomerReturnRejection' + marketplaceId: + type: string + description: The marketplace ID where operation was made. + example: 'allegro-pl' + status: + type: string + description: >- + Current return timeline statuses. + The allowed values are: + * CREATED - The return has been declared, + * DISPATCHED - The returned items have been dispatched, + * IN_TRANSIT - The returned items are in transit, + * DELIVERED - The returned items have been delivered, + * FINISHED - The payment has been refunded, return process is finished, + * FINISHED_APT - The payment has been refunded by Allegro Protect, return process is finished, + * REJECTED - The return has been rejected, + * COMMISSION_REFUND_CLAIMED - The sales commission refund (transaction rebate) application has been claimed, + * COMMISSION_REFUNDED - The sales commission was refunded, + * WAREHOUSE_DELIVERED - The returned items have been delivered to Allegro Warehouse, + * WAREHOUSE_VERIFICATION - The returned items are under verification. + example: 'DELIVERED' + CustomerReturnRejection: + type: object + properties: + code: + type: string + description: Refund rejection code + enum: + - REFUND_REJECTED + - NEW_ITEM_SENT + - ITEM_FIXED + - MISSING_PART_SENT + reason: + type: string + description: Reason of refund cancellation. + example: Returned item is damaged. + createdAt: + type: string + format: date-time + example: '2020-01-11T09:36:57.663+01:00' + CustomerReturnBuyer: + type: object + properties: + email: + type: string + example: 'user-email@allegro.pl' + login: + type: string + example: 'User_Login' + CustomerReturnItem: + type: object + properties: + offerId: + type: string + example: '3e895572-9297-4d80-b151-353deb95bff6' + quantity: + type: integer + format: int64 + example: 1 + name: + type: string + example: 'Product name' + price: + $ref: '#/components/schemas/Price' + url: + type: string + example: 'https://allegro.pl/oferta/item-name-7678887152' + reason: + $ref: '#/components/schemas/CustomerReturnItemReason' + CustomerReturnRefund: + type: object + description: 'This field is present in the case of cash on delivery, bank transfer, Allegro Pay, and Allegro Pay Business payment options.' + properties: + bankAccount: + $ref: '#/components/schemas/CustomerReturnRefundBankAccount' + CustomerReturnReturnParcel: + type: object + properties: + createdAt: + type: string + format: date-time + example: '2020-01-11T09:36:57.663+01:00' + waybill: + type: string + example: 'AD00R28X72' + transportingWaybill: + type: string + example: '2171143568953' + description: Waybill id as generated by carriers physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. + nullable: true + carrierId: + type: string + example: 'ALLEGRO' + transportingCarrierId: + type: string + example: 'ORLEN' + description: Carrier id of a carrier physically transporting the parcel. Will be null if there's only one carrier involved in a parcel shipment. + nullable: true + sender: + $ref: '#/components/schemas/CustomerReturnParcelSender' + CustomerReturnItemReason: + type: object + properties: + type: + type: string + description: 'Possible values: "NONE", "MISTAKE", "TRANSPORT", "DAMAGED", "NOT_AS_DESCRIBED", "DONT_LIKE_IT", "OVERDUE_DELIVERY", "INCOMPLETE", "HIDDEN_FLAW", "OTHER_FLAW", "DIFFERENT", "COUNTERFEIT".' + example: 'MISTAKE' + userComment: + type: string + example: 'Purchased by mistake' + CustomerReturnRefundBankAccount: + type: object + properties: + owner: + type: string + example: '0000001abc' + accountNumber: + type: string + example: '40114000003382916456018050' + iban: + type: string + example: 'PL40114000003382916456018050' + swift: + type: string + example: 'ALBPPLPW' + address: + $ref: '#/components/schemas/CustomerReturnRefundBankAccountAddress' + CustomerReturnRefundBankAccountAddress: + type: object + properties: + street: + type: string + example: 'Jasna' + city: + type: string + example: 'Warsaw' + postCode: + type: string + example: '24-200' + countryCode: + type: string + example: 'PL' + CustomerReturnParcelSender: + type: object + properties: + phoneNumber: + type: string + example: '333444555' + PaymentsSurcharge: + type: object + properties: + id: + type: string + format: uuid + description: The payment identifier. + example: 09f0b4cc-7880-11e9-8f9e-2a86e4085a59 + value: + $ref: '#/components/schemas/RefundSurchargeValue' + AdditionalServiceDefinitionRequest: + type: object + required: + - id + properties: + id: + type: string + example: GIFT_WRAP + AdditionalServiceRequest: + type: object + required: + - configurations + - definition + - description + properties: + definition: + $ref: '#/components/schemas/AdditionalServiceDefinitionRequest' + description: + type: string + maxLength: 1000 + configurations: + type: array + items: + $ref: '#/components/schemas/Configuration' + AdditionalServiceResponse: + type: object + properties: + configurations: + type: array + items: + $ref: '#/components/schemas/Configuration' + definition: + $ref: '#/components/schemas/BasicDefinitionResponse' + description: + type: string + description: 'This is a description provided by merchant while configuring additional service group.' + example: Wrap as a gift in pretty colours paper + AdditionalServicesGroup: + type: object + properties: + id: + type: string + description: Id of additional service group + AdditionalServicesGroupRequest: + type: object + required: + - additionalServices + - name + - language + properties: + name: + type: string + minLength: 1 + maxLength: 100 + description: 'Name of the group provided by merchant, invisible for buyers.' + example: Gift wrap only + language: + type: string + minLength: 5 + maxLength: 5 + example: pl-PL + description: >- + IETF language tag. Must be equal to main language for given marketplace: 'pl-PL' on allegro.pl and 'cs-CZ' on allegro.cz while creating new group.
+ Cannot change the language of already created group while modifying existing group. + additionalServices: + type: array + items: + $ref: '#/components/schemas/AdditionalServiceRequest' + AdditionalServicesGroupResponse: + type: object + properties: + additionalServices: + type: array + items: + $ref: '#/components/schemas/AdditionalServiceResponse' + createdAt: + type: string + format: date-time + id: + type: string + updatedAt: + type: string + format: date-time + name: + type: string + description: 'Name of the group provided by merchant, invisible for buyers.' + example: Gift wrap only + seller: + $ref: '#/components/schemas/Reference' + language: + type: string + minLength: 5 + maxLength: 5 + example: pl-PL + description: IETF language tag. + nullable: true + AdditionalServicesGroups: + type: object + properties: + additionalServicesGroups: + type: array + items: + $ref: '#/components/schemas/AdditionalServicesGroupResponse' + + AdditionalServicesGroupTranslationRequest: + type: object + properties: + additionalServices: + $ref: '#/components/schemas/AdditionalServicesGroupTranslationWrapper' + + AdditionalServicesGroupTranslationWrapper: + type: object + properties: + translation: + type: array + items: + $ref: '#/components/schemas/AdditionalServiceTranslation' + + AdditionalServiceTranslation: + type: object + properties: + definition: + $ref: '#/components/schemas/AdditionalServiceDefinitionRequest' + description: + type: string + description: 'Description of an additional service - provided by merchants and visible by customers.' + example: Wrap product in a nice colours paper. + + AdditionalServiceGroupTranslationResponse: + type: object + properties: + translations: + "type": array + "items": + $ref: '#/components/schemas/AdditionalServiceGroupTranslation' + + AdditionalServiceGroupTranslation: + type: object + properties: + language: + type: string + example: pl-PL + description: IETF language tag. + additionalServices: + $ref: '#/components/schemas/AdditionalServicesGroupTranslationWrapperWithType' + + AdditionalServicesGroupTranslationWrapperWithType: + type: object + properties: + translation: + type: array + items: + $ref: '#/components/schemas/AdditionalServiceTranslation' + type: + type: string + description: Type of translation. + enum: + - 'MANUAL' + - 'AUTO' + + AdditionalServiceGroupTranslationPatchResponse: + type: object + properties: + language: + type: string + example: pl-PL + description: IETF language tag. + additionalServices: + $ref: '#/components/schemas/AdditionalServicesGroupTranslationWrapperWithType' + + Address: + type: object + required: + - city + - countryCode + - state + - zipCode + properties: + street: + type: string + maxLength: 80 + city: + type: string + maxLength: 40 + zipCode: + type: string + maxLength: 10 + state: + type: string + maxLength: 40 + countryCode: + type: string + format: ISO format + example: "PL" + coordinates: + $ref: '#/components/schemas/Coordinates' +# AdditionalMarketplaces: +# type: object +# description: Settings for each additional marketplace. +# additionalProperties: +# x-additionalPropertiesName: marketplace id +# $ref: '#/components/schemas/OfferAdditionalMarketplace' +# example: { +# 'allegro-cz': { +# 'publication': { +# 'status': 'APPROVED' +# }, +# 'sellingMode': { +# 'price': { +# 'amount': '639.37', +# 'currency': 'CZK' +# } +# } +# } +# } + OfferAdditionalMarketplace: + type: object + description: Additional marketplace settings. + properties: + publication: + $ref: '#/components/schemas/AdditionalMarketplacePublication' + sellingMode: + $ref: '#/components/schemas/AdditionalMarketplaceSellingMode' + AdditionalMarketplacePublication: + type: object + properties: + status: + $ref: '#/components/schemas/AdditionalMarketplacePublicationStatus' + AdditionalMarketplacePublicationStatus: + type: string + description: >- + The publication status of the offer on additional marketplace. The possible values: + + - *NOT_REQUESTED* - seller has not declared a willingness to list this offer on given marketplace + - *PENDING* - seller declared a willingness to list this offer on given marketplace, but the process has not started yet; e.g. the offer is not published yet + - *IN_PROGRESS* - we process the offer's qualification for given marketplace; the offer is not listed yet + - *APPROVED* - the offer is approved to list on given marketplace + - *REFUSED* - the offer is refused to list on given marketplace + enum: + - 'NOT_REQUESTED' + - 'PENDING' + - 'IN_PROGRESS' + - 'APPROVED' + - 'REFUSED' + example: + 'APPROVED' + AdditionalMarketplaceSellingMode: + type: object + description: "Offer's selling mode on given marketplace" + required: + - price + properties: + price: + $ref: '#/components/schemas/Price' + AfterSalesServices: + type: object + description: The definitions of the different after sales services assigned to the offer. + properties: + impliedWarranty: + $ref: '#/components/schemas/ImpliedWarranty' + returnPolicy: + $ref: '#/components/schemas/ReturnPolicy' + warranty: + $ref: '#/components/schemas/Warranty' + AfterSalesServicesAttachment: + type: object + properties: + id: + type: string + format: uuid + description: The Id of the attachment. + example: 54702c96-4ccd-4c0e-b4c7-382a71e810b5 + name: + type: string + description: Attachment file name. + url: + type: string + description: Direct link to the attachment. + ImpliedWarranty: + type: object + description: The implied warranty information. + properties: + id: + type: string + format: uuid + description: The ID of the implied warranty definition. + example: 09f0b4cc-7880-11e9-8f9e-2a86e4085a59 + ReturnPolicy: + type: object + description: The return policy information. + properties: + id: + type: string + format: uuid + description: The ID of the return policy definition. + example: 09f0b4cc-7880-11e9-8f9e-2a86e4085a59 + Warranty: + type: object + description: The warranty information. + properties: + id: + type: string + format: uuid + description: The ID of the warranty definition. + example: 09f0b4cc-7880-11e9-8f9e-2a86e4085a59 + WarrantyRequest: + type: object + properties: + name: + type: string + description: Warranty name. + maxLength: 200 + type: + $ref: '#/components/schemas/WarrantyType' + individual: + $ref: '#/components/schemas/WarrantyPeriod' + corporate: + $ref: '#/components/schemas/WarrantyPeriod' + attachment: + $ref: '#/components/schemas/WarrantyAttachment' + description: + type: string + maxLength: 10240 + description: Warranty description. + WarrantyResponse: + type: object + properties: + id: + type: string + format: uuid + description: The ID of the warranty definition. + example: 09f0b4cc-7880-11e9-8f9e-2a86e4085a59 + seller: + $ref: '#/components/schemas/Seller' + name: + type: string + description: Warranty name. + maxLength: 200 + type: + $ref: '#/components/schemas/WarrantyType' + individual: + $ref: '#/components/schemas/WarrantyPeriod' + corporate: + $ref: '#/components/schemas/WarrantyPeriod' + attachment: + $ref: '#/components/schemas/AfterSalesServicesAttachment' + description: + type: string + description: Warranty description. + WarrantyType: + type: string + description: Defines who is warrantor. + enum: + - 'MANUFACTURER' + - 'SELLER' + WarrantyPeriod: + type: object + properties: + period: + type: string + description: Period in ISO 8601 format. + example: 'P12M' + lifetime: + type: boolean + description: Indices if it is lifetime warranty. + example: false + WarrantyAttachment: + type: object + properties: + id: + type: string + format: uuid + description: The Id of the attachment received in a response from *POST /afters-sales-service-conditions/attachments* + example: 54702c96-4ccd-4c0e-b4c7-382a71e810b5 + name: + type: string + description: Attachment file name + example: 'warranty.pdf' + ImpliedWarrantyRequest: + type: object + properties: + name: + type: string + description: Warranty name. + maxLength: 200 + individual: + $ref: '#/components/schemas/ImpliedWarrantyPeriod' + corporate: + $ref: '#/components/schemas/ImpliedWarrantyPeriod' + address: + $ref: '#/components/schemas/AfterSalesServicesAddress' + description: + type: string + maxLength: 10240 + description: Implied warranty description. + ImpliedWarrantyResponse: + type: object + properties: + id: + type: string + format: uuid + description: The ID of the implied warranty definition. + example: 09f0b4cc-7880-11e9-8f9e-2a86e4085a59 + seller: + $ref: '#/components/schemas/Seller' + name: + type: string + description: Implied warranty name. + maxLength: 200 + individual: + $ref: '#/components/schemas/ImpliedWarrantyPeriod' + corporate: + $ref: '#/components/schemas/ImpliedWarrantyPeriod' + address: + $ref: '#/components/schemas/AfterSalesServicesAddress' + description: + type: string + description: Implied warranty description. + ImpliedWarrantyPeriod: + type: object + properties: + period: + type: string + description: Period in ISO 8601 format. Only periods in full years are accepted. + example: 'P2Y' + AfterSalesServicesAddress: + type: object + required: + - name + - street + - postCode + - city + - countryCode + properties: + name: + type: string + maxLength: 200 + description: Company or person name. + example: "Allegro.pl sp. z o.o." + street: + type: string + maxLength: 200 + description: Street name. + example: "Grunwaldzka 182" + postCode: + type: string + description: Post code. + example: '11-232' + city: + type: string + maxLength: 200 + description: City name. + example: "Poznań" + countryCode: + type: string + description: Country code. + example: "PL" + ReturnPolicyAddress: + type: object + nullable: true + description: The return address of the policy. Can be null if availability range is 'DISABLED'. + required: + - name + - street + - postCode + - city + - countryCode + properties: + name: + type: string + description: Company or person name. Length is dependent on specified 'countryCode' - for CZ and SK length is equal to 50 characters, for other countries - 200. + example: "Allegro.pl sp. z o.o." + street: + type: string + description: Street name. Length is dependent on specified 'countryCode' - for PL, CZ and SK length is equal to 35 characters, for other countries - 200. + example: "Grunwaldzka 182" + postCode: + type: string + description: Post code format is dependent on 'countryCode' - PL='XX-XXX', CZ='XXX XX', SK='XXX XX' for other countries format is less restrictive - 16 characters alphanumeric with ' '(space) and '-' allowed. + example: '11-232' + city: + type: string + description: City name. Length is dependent on specified 'countryCode' - for PL, CZ and SK length is equal to 30 characters, for other countries - 200. + example: "Poznań" + countryCode: + type: string + description: Country code. + example: "PL" + ReturnPolicyRequest: + type: object + required: + - name + - availability + - returnCost + - address + - options + properties: + name: + type: string + description: Return policy name. + maxLength: 200 + availability: + $ref: '#/components/schemas/ReturnPolicyAvailability' + withdrawalPeriod: + type: string + description: Period in ISO 8601 format. Only periods in full days are accepted. + example: 'P14D' + returnCost: + $ref: '#/components/schemas/ReturnPolicyReturnCost' + address: + $ref: '#/components/schemas/ReturnPolicyAddress' + contact: + $ref: '#/components/schemas/ReturnPolicyContact' + options: + $ref: '#/components/schemas/ReturnPolicyOptions' + ReturnPolicyResponse: + type: object + required: + - id + - seller + - name + - availability + properties: + id: + type: string + format: uuid + description: The ID of the return policy definition. + example: 09f0b4cc-7880-11e9-8f9e-2a86e4085a59 + seller: + $ref: '#/components/schemas/Seller' + name: + type: string + description: Return policy name. + maxLength: 200 + availability: + $ref: '#/components/schemas/ReturnPolicyAvailability' + withdrawalPeriod: + type: string + nullable: true + description: Period in ISO 8601 format. Can be null if availability range is 'DISABLED'. + example: 'P14D' + returnCost: + $ref: '#/components/schemas/ReturnPolicyReturnCost' + address: + $ref: '#/components/schemas/ReturnPolicyAddress' + contact: + $ref: '#/components/schemas/ReturnPolicyContact' + options: + $ref: '#/components/schemas/ReturnPolicyOptions' + ReturnPolicyAvailability: + type: object + required: + - range + properties: + range: + type: string + description: Indicates if return policy is full, restricted or disabled. + example: 'RESTRICTED' + enum: + - 'FULL' + - 'RESTRICTED' + - 'DISABLED' + restrictionCause: + $ref: '#/components/schemas/RestrictionCause' + RestrictionCause: + type: object + nullable: true + properties: + name: + type: string + description: >- + Type of return policy restrictions. Required if range of policy is set to RESTRICTED or DISABLED, otherwise must be empty. + Selected restriction depends on the chosen range of policy. Values 'ALCOHOL', 'FULLY_IMPLEMENTED_SERVICE' and 'BOOKED_SERVICE' are deprecated and should no longer be used. + Read more info [PL](https://developer.allegro.pl/tutorials/jak-zarzadzac-ofertami-7GzB2L37ase#jak-zarzadzac-warunkami-zwrotow) / [EN](https://developer.allegro.pl/tutorials/how-to-process-list-of-offers-m09BKA5v8H3#how-to-manage-return-policies). + enum: + - 'SEALED_MEDIA' + - 'SEALED_ITEM_NO_RETURN_DUE_HEALTH_OR_HYGIENE' + - 'CUSTOM_ITEM' + - 'SHORT_SHELF_LIFE' + - 'INSEPARABLY_LINKED' + - 'PRESS' + - 'MEDICINAL_PRODUCT' + - 'NOT_RECORDED_DIGITAL_CONTENT' + - 'VALUE_DEPENDENT_ON_FINANCIAL_MARKET' + - 'ALCOHOL' + - 'FULLY_IMPLEMENTED_SERVICE' + - 'BOOKED_SERVICE' + description: + type: string + ReturnPolicyReturnCost: + type: object + nullable: true + properties: + coveredBy: + type: string + description: Indicates who covers the return delivery costs. + enum: + - 'SELLER' + - 'BUYER' + description: Can be null if availability range is 'DISABLED'. + ReturnPolicyContact: + type: object + nullable: true + properties: + phoneNumber: + type: string + description: A valid phone number of the seller + nullable: true + example: '123 123 123' + email: + type: string + description: A valid email address of the seller + nullable: true + example: 'useridentifier@domain.com' + ReturnPolicyOptions: + type: object + nullable: true + description: Can be null if availability range is 'DISABLED'. + required: + - cashOnDeliveryNotAllowed + - refundLoweredByReceivedDiscount + - businessReturnAllowed + - collectBySellerOnly + - freeAccessoriesReturnRequired + properties: + cashOnDeliveryNotAllowed: + type: boolean + description: Order sent back with cash on pickup is not allowed + example: true + freeAccessoriesReturnRequired: + type: boolean + description: If free accessories were added to the order, the client needs to send them back + example: true + refundLoweredByReceivedDiscount: + type: boolean + description: If there was a discount granted after the order, the return is lowered by the received discount + example: true + businessReturnAllowed: + type: boolean + description: Returns for B2B purchases allowed + example: false + collectBySellerOnly: + type: boolean + description: Return items are picked up by the seller + example: false + Attachment: + type: object + properties: + id: + type: string + description: The ID of an attachment received in a response from *POST /sale/offer-attachments* + example: 1928302_MANUAL_45d7a0f543e1b0d05e12a1aef5642efe63389a1d419fe9286d0f158044391fdce + UserRatingAnswerRequest: + type: object + description: "Answer for user's rating." + required: + - message + properties: + message: + type: string + description: 'Answer message.' + maxLength: 500 + Answer: + type: object + description: 'Seller''s answer, if null seller did not publish answer' + required: + - createdAt + - message + properties: + createdAt: + type: string + example: '2017-05-17T08:36:57.292Z' + description: Answer creation datetime in ISO 8601 format + message: + type: string + description: Answer message + AnswerVBeta1: + type: object + description: "Seller's answer, if null seller did not publish answer" + required: + - createdAt + - text + - language + properties: + createdAt: + type: string + example: '2025-05-17T08:36:57.292Z' + description: Answer creation datetime in ISO 8601 format + text: + type: string + description: Answer message + language: + type: string + example: 'pl' + description: Language of the user comment. + + AvailableConstraint: + type: object + properties: + type: + type: string + nullable: true + description: 'One of the type COUNTRY_SAME_QUANTITY or COUNTRY_DELIVERY_SAME_QUANTITY' + availableDeliveryMethods: + type: array + nullable: true + description: 'All delivery methods ids, which are available for given additional service.' + items: + type: string + AverageRates: + type: object + properties: + delivery: + type: number + format: double + example: 4.7 + description: The average value of delivery rate. + minimum: 0 + maximum: 5 + deliveryCost: + type: number + format: double + example: 5 + description: The average value of delivery cost rate. + minimum: 0 + maximum: 5 + description: + type: number + format: double + example: 4.5 + description: The average value of description rate. + minimum: 0 + maximum: 5 + service: + type: number + format: double + example: 4.8 + description: The average value of service rate. + minimum: 0 + maximum: 5 + description: >- + The rates broken down into detailed categories. Note that this information is only available if the seller + has received enough detailed ratings. + BasicDefinitionResponse: + type: object + properties: + id: + type: string + description: 'Id of an additional service definition.' + example: GIFT_WRAP + Benefit: + type: object + required: + - specification + properties: + specification: + $ref: '#/components/schemas/BenefitSpecification' + BenefitSpecification: + type: object + description: "One of: LargeOrderDiscountBenefitSpecification, WholesalePriceListBenefitSpecification, MultiPackBenefitSpecification" + properties: + type: + type: string + description: Type of benefit. + required: + - type + discriminator: + propertyName: type + mapping: + LARGE_ORDER_DISCOUNT: '#/components/schemas/LargeOrderDiscountBenefitSpecification' + WHOLESALE_PRICE_LIST: '#/components/schemas/WholesalePriceListBenefitSpecification' + UNIT_PERCENTAGE_DISCOUNT: '#/components/schemas/MultiPackBenefitSpecification' + LargeOrderDiscountBenefitSpecification: + allOf: + - $ref: "#/components/schemas/BenefitSpecification" + - type: object + required: + - thresholds + properties: + type: + type: string + default: 'LARGE_ORDER_DISCOUNT' + thresholds: + type: array + description: 'List of order discount thresholds. A threshold with a higher orderValue.lowerBound.amount than another one must also have a higher discount.percentage.' + items: + type: object + required: + - orderValue + - discount + properties: + orderValue: + type: object + required: + - lowerBound + properties: + lowerBound: + $ref: '#/components/schemas/Price' + discount: + type: object + required: + - percentage + properties: + percentage: + type: string + example: "5" + description: 'Discount percentage applied when the threshold is applied. The fractional part must be equal to 0.' + WholesalePriceListBenefitSpecification: + allOf: + - $ref: "#/components/schemas/BenefitSpecification" + - type: object + required: + - name + - thresholds + properties: + type: + type: string + default: 'WHOLESALE_PRICE_LIST' + name: + type: string + description: 'Price list name (visible to you only).' + example: "Cardboard boxes" + thresholds: + type: array + description: 'List of discount thresholds. A threshold with a higher quantity.lowerBound than another must also have a higher discount.percentage.' + items: + type: object + required: + - quantity + - discount + properties: + quantity: + type: object + required: + - lowerBound + properties: + lowerBound: + type: number + example: 100 + minimum: 2 + maximum: 100000 + description: 'Minimum number of units of an offer for which the threshold is applicable.' + discount: + type: object + required: + - percentage + properties: + percentage: + type: string + example: "5" + description: 'Discount percentage applied when the threshold is applied. The fractional part must be equal to 0.' + MultiPackBenefitSpecification: + allOf: + - $ref: "#/components/schemas/BenefitSpecification" + - type: object + required: + - configuration + - trigger + properties: + type: + type: string + default: 'UNIT_PERCENTAGE_DISCOUNT' + configuration: + type: object + description: What rebate will be given. + required: + - percentage + properties: + percentage: + type: number + minimum: 1 + example: 100 + description: discount percentage + trigger: + description: Describes what will cause the rebate. + type: object + required: + - forEachQuantity + - discountedNumber + properties: + forEachQuantity: + type: number + minimum: 1 + description: >- + For every pack of this quantity new rebate will be given. + example: 3 + discountedNumber: + type: number + minimum: 1 + description: Describes how many offers in pack should be discounted by discount percentage. + example: 1 + Caption: + type: object + required: + - index + - value + properties: + index: + type: string + value: + type: string + title: Caption + CategoriesDto: + type: object + description: The list of categories. + properties: + categories: + type: array + items: + $ref: '#/components/schemas/CategoryDto' + Category: + type: object + properties: + id: + type: string + description: 'Category identifier.' + example: '257931' + OfferCategoryRequest: + type: object + allOf: + - $ref: '#/components/schemas/Category' + description: >- + Category in which the offer is listed for sale. + You can indicate a category from the product's 'similar categories' to set the offer's category. + OfferCategory: + type: object + allOf: + - $ref: '#/components/schemas/Category' + description: 'The category to which the offer is listed for sale.' + ProductCategory: + type: object + allOf: + - $ref: '#/components/schemas/Category' + description: 'Product category' + CategoryDto: + type: object + properties: + id: + type: string + description: >- + The ID of the category. This can be either in UUID format or an integer format. You should be ready to + accept any string value as the category ID. + example: "12" + leaf: + type: boolean + description: Indicates whether the category is at the lowest level. Leaf categories do not have any children. Offers can be listed only in leaf categories. + name: + type: string + description: Name of the category in Polish. + example: Pozostałe + options: + $ref: '#/components/schemas/CategoryOptionsDto' + parent: + type: object + properties: + id: + type: string + description: The ID of the parent category. + example: "709" + description: The parent category data. + description: The category data. + CategoryOptionsDto: + type: object + properties: + advertisement: + type: boolean + description: Indicates whether offers of type ADVERTISEMENT can be listed in this category. + advertisementPriceOptional: + type: boolean + description: >- + Indicates whether advertisements listed in this category must have a price given. If the value is `true` + then you don't have to provide a price when listing an advertisement in this category. + variantsByColorPatternAllowed: + type: boolean + description: >- + Indicates whether you can combine offers from this category into variant sets based on the color and + pattern. + offersWithProductPublicationEnabled: + type: boolean + description: Information whether the category supports assigning offers to a product. + productCreationEnabled: + type: boolean + description: Indicates whether the category supports creating products. + customParametersEnabled: + type: boolean + description: Indicates whether custom parameters can be added to offers in this category. + sellerCanRequirePurchaseComments: + type: boolean + description: Indicates whether the category supports message to seller in `REQUIRED` mode. + description: A list of the different options which can be used with this category. + CategorySuggestionCategoryNode: + type: object + description: Category suggestion category object. + properties: + id: + type: string + example: "2" + description: ID of category. + name: + type: string + example: Samochody Osobowe + description: Category name. + parent: + $ref: '#/components/schemas/CategorySuggestionCategoryNode' + required: + - id + - name + CategorySuggestionResponse: + type: object + required: + - matchingCategories + properties: + matchingCategories: + type: array + description: List of categories matching with given phrase. + items: + $ref: '#/components/schemas/CategorySuggestionCategoryNode' + example: + matchingCategories: + - id: "2" + name: "Samochody Osobowe" + parent: + id: "1" + name: Motoryzacja + parent: null + UnfilledParametersResponse: + type: object + properties: + offers: + type: array + description: 'List of offers unfilled parameters.' + items: + type: object + properties: + id: + type: string + description: 'Identifier of the offer.' + example: '8888203028' + parameters: + type: array + description: 'List of unfilled parameters.' + items: + type: object + properties: + id: + type: string + description: 'Parameter identifier.' + example: '14228' + category: + type: object + description: 'Category of offer with unfilled parameters' + properties: + id: + type: string + description: 'Category identifier.' + example: '257931' + count: + type: integer + minimum: 0 + description: 'Number of returned elements.' + example: 3 + totalCount: + type: integer + minimum: 0 + description: 'Total number of available elements.' + example: 256 + CategoryParametersScheduledChangesResponse: + type: object + required: + - scheduledChanges + properties: + scheduledChanges: + type: array + description: The list of scheduled changes. + items: + $ref: '#/components/schemas/CategoryParametersScheduledBaseChange' + CategoryParametersScheduledBaseChange: + type: object + required: + - type + - scheduledAt + - scheduledFor + description: The data of an scheduled change. + properties: + scheduledAt: + type: string + format: date-time + description: The date and time when the change was scheduled, provided in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + example: "2019-06-26T15:26:43.891Z" + scheduledFor: + type: string + format: date-time + description: The date and time when the change will be effective from, provided in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + example: "2019-07-26T15:26:43.891Z" + type: + type: string + description: The type of the change. + example: "REQUIREMENT_CHANGE" + discriminator: + propertyName: type + mapping: + REQUIREMENT_CHANGE: '#/components/schemas/RequirementChange' + RequirementChange: + allOf: + - $ref: '#/components/schemas/CategoryParametersScheduledBaseChange' + - type: object + required: + - category + - parameter + properties: + type: + type: string + default: 'REQUIREMENT_CHANGE' + category: + $ref: '#/components/schemas/CategoryParametersScheduledBaseChangeCategory' + parameter: + $ref: '#/components/schemas/CategoryParametersScheduledBaseChangeParameter' + CategoryParametersScheduledBaseChangeCategory: + type: object + description: Category parameter scheduled change category data. + properties: + id: + type: string + description: >- + The ID of the category. This can be either in UUID format or an integer format. You should be ready to + accept any string value as the category ID. + example: "165" + CategoryParametersScheduledBaseChangeParameter: + type: object + description: Category parameter scheduled change parameter data. + properties: + id: + type: string + description: >- + The ID of the Parameter. This can be either in UUID format or an integer format. You should be ready to + accept any string value as the parameter ID. + example: "11323" + CategoryEventsResponse: + type: object + required: + - events + properties: + events: + type: array + description: The list of events. + items: + $ref: '#/components/schemas/CategoryBaseEvent' + CategoryBaseEvent: + type: object + required: + - id + - type + - occurredAt + description: The data of an event. + properties: + id: + type: string + description: The ID of the event. It can be used in the `from` parameter of the query. + example: "MTEzMjQzODU3NA" + maxLength: 256 + occurredAt: + type: string + format: date-time + description: The date and time when the change occurred, provided in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + example: "2019-06-26T15:26:43.891Z" + type: + type: string + description: The type of the change. + example: "CATEGORY_CREATED" + discriminator: + propertyName: type + mapping: + CATEGORY_CREATED: '#/components/schemas/CategoryCreatedEvent' + CATEGORY_RENAMED: '#/components/schemas/CategoryRenamedEvent' + CATEGORY_MOVED: '#/components/schemas/CategoryMovedEvent' + CATEGORY_DELETED: '#/components/schemas/CategoryDeletedEvent' + CategoryCreatedEvent: + allOf: + - $ref: '#/components/schemas/CategoryBaseEvent' + - type: object + required: + - category + properties: + type: + type: string + default: 'CATEGORY_CREATED' + category: + $ref: '#/components/schemas/CategoryEventBaseCategory' + CategoryRenamedEvent: + allOf: + - $ref: '#/components/schemas/CategoryBaseEvent' + - type: object + required: + - category + properties: + type: + type: string + default: 'CATEGORY_RENAMED' + category: + $ref: '#/components/schemas/CategoryEventBaseCategory' + CategoryMovedEvent: + allOf: + - $ref: '#/components/schemas/CategoryBaseEvent' + - type: object + required: + - category + properties: + type: + type: string + default: 'CATEGORY_MOVED' + category: + $ref: '#/components/schemas/CategoryEventBaseCategory' + CategoryDeletedEvent: + allOf: + - $ref: '#/components/schemas/CategoryBaseEvent' + - type: object + required: + - category + properties: + type: + type: string + default: 'CATEGORY_DELETED' + category: + $ref: '#/components/schemas/CategoryEventBaseCategory' + redirectCategory: + type: object + description: Category that should be used instead of deleted one. + properties: + id: + type: string + description: The ID of the category. + example: "7" + CategoryEventBaseCategory: + type: object + description: Category event category data. + properties: + id: + type: string + description: >- + The ID of the category. This can be either in UUID format or an integer format. You should be ready to + accept any string value as the category ID. + example: "165" + leaf: + type: boolean + description: Indicates whether the category is at the lowest level. Leaf categories do not have any children. Offers can be listed only in leaf categories. + name: + type: string + description: Name of the category. + example: Smartphones and Cell Phones + parent: + type: object + description: The parent category data. + properties: + id: + type: string + description: The ID of the parent category. + example: "4" + CompatibilityListSupportedCategoriesDto: + type: object + properties: + supportedCategories: + type: array + description: 'List with information about categories where compatibility list is supported. Read more.' + items: + type: object + properties: + categoryId: + type: string + description: 'Identifier of the category, where you can use + the compatibility list in an offer listed in the category or + in all subcategories, which belongs to returned category.' + example: '620' + name: + type: string + description: 'Name of supported category.' + example: 'Części samochodowe' + itemsType: + type: string + description: 'Type of the compatible item.' + example: 'CAR' + inputType: + type: string + enum: [TEXT, ID] + description: 'Type of the representation of compatible item. +
    +
  • `TEXT` - item on compatibility list has to be provided as plain text.
  • +
  • `ID` - item on compatibility list has to be provided as identifier of compatible product. + To obtain it please use compatible-products resource together with `itemsType` supported in particular category. +
  • +
+ ' + example: 'TEXT' + validationRules: + type: object + description: 'Additional information about constraints assigned to the category.' + properties: + maxRows: + type: integer + minimum: 1 + description: 'Maximum number of items allowed on compatibility list.' + example: 2000 + maxCharactersPerLine: + type: integer + minimum: 1 + description: 'Maximum length of single item on the list.' + example: 160 + example: + - categoryId: '620' + name: 'Części samochodowe' + itemsType: 'CAR' + inputType: 'ID' + validationRules: + maxRows: 2000 + - categoryId: '257358' + name: 'Pióra wycieraczek' + itemsType: 'CAR' + inputType: 'ID' + validationRules: + maxRows: 2000 + - categoryId: '158' + name: 'Części motocyklowe' + itemsType: 'MOTORCYCLE_EXPLODED' + inputType: 'ID' + validationRules: + maxRows: 2000 + - categoryId: '9108' + name: 'Tusze' + itemsType: 'PRINTER' + inputType: 'TEXT' + validationRules: + maxRows: 200 + maxCharactersPerLine: 100 + CompatibleProductsGroupsDto: + type: object + properties: + groups: + type: array + description: 'List of groups for given type of compatible products.' + items: + type: object + properties: + id: + type: string + description: 'Identifier of the group.' + minLength: 32 + maxLength: 32 + example: 'b0dfe6de8fb2f2b1309ad94c6cc4e09d' + text: + type: string + description: 'Name of the group.' + example: 'ABARTH' + example: + - id: 'b0dfe6de8fb2f2b1309ad94c6cc4e09d' + text: 'ABARTH' + - id: '4144e097d2fa7a491cec2a7a4322f2bc' + text: 'AC' + - id: 'de3e2253f276cd1c757f58860d77b9bb' + text: 'ACURA' + count: + type: integer + minimum: 0 + description: 'Number of returned elements.' + example: 3 + totalCount: + type: integer + minimum: 0 + description: 'Total number of available elements.' + example: 256 + CompatibleProductsListDto: + type: object + properties: + compatibleProducts: + type: array + description: 'List of compatible products for given type and parameters.' + items: + $ref: '#/components/schemas/CompatibleProductDto' + example: + - id: 'fc1058e6-a901-4b58-be4d-3d7e1368f63e' + text: 'AUDI A6 (4G2, 4GC, C7) 2014/09-2018/09 3.0 TDI quattro 326KM/240kW' + group: + id: '19d71c872aa6c78663876a7e7bc7776d' + attributes: + - id: 'POWER_KW' + values: + - '240' + - id: 'MODEL_FROM' + values: + - '2010/11' + - id: 'BRAND' + values: + - 'AUDI' + - id: 'POWER_HP' + values: + - '326' + - id: 'MODEL_TO' + values: + - '2018/09' + - id: 'ENGINE_CODE' + values: + - 'CVUB' + - id: 'K_TYP_NR' + values: + - '108441' + - id: 'VERSION_FROM' + values: + - '2014/09' + - id: 'VERSION_TO' + values: + - '2018/09' + - id: 'MODEL' + values: + - 'A6 (4G2, 4GC, C7)' + - id: 'BODY' + values: + - 'sedan' + - id: 'TYPE' + values: + - '3.0 TDI quattro' + count: + type: integer + minimum: 0 + description: 'Number of returned elements.' + example: 1 + totalCount: + type: integer + minimum: 0 + description: 'Total number of available elements. + Field is not present when `phrase` parameter is used.' + example: 1448 + CompatibleProductDto: + type: object + properties: + id: + type: string + description: 'Identifier of the compatible product.' + example: 'fc1058e6-a901-4b58-be4d-3d7e1368f63e' + text: + type: string + description: 'Textual representation of the compatible product.' + example: 'AUDI A6 (4G2, 4GC, C7) 2014/09-2018/09 3.0 TDI quattro 326KM/240kW' + group: + type: object + description: 'Group to which compatible product is assigned to.' + properties: + id: + type: string + description: 'Identifier of the group.' + example: '19d71c872aa6c78663876a7e7bc7776d' + attributes: + type: array + description: "List of compatible products attributes." + items: + type: object + properties: + id: + type: string + description: "Identifier of an attribute" + example: "BRAND" + values: + type: array + description: "List of attribute's values." + items: + type: string + example: "AUDI" + example: + - id: 'BRAND' + values: + - 'AUDI' + Cells: + type: object + required: + - cells + properties: + cells: + type: array + items: + type: string + title: Cells + AutomaticPricingRulesResponse: + type: object + required: + - rules + properties: + rules: + type: array + description: List of rules. + items: + $ref: '#/components/schemas/AutomaticPricingRuleResponse' + OfferRules: + type: object + required: + - rules + - updatedAt + properties: + rules: + type: array + description: List of assigned rules. + items: + type: object + required: + - marketplace + - rule + - updatedAt + properties: + marketplace: + type: object + required: + - id + properties: + id: + $ref: '#/components/schemas/MarketplaceId' + rule: + type: object + required: + - id + - type + properties: + id: + $ref: '#/components/schemas/AutomaticPricingRuleId' + type: + allOf: + - description: >- + The field is deprecated and will be removed in the future. + To obtain rule details use the following resource with rule.id from the response. + - deprecated: true + - $ref: '#/components/schemas/AutomaticPricingRuleType' + configuration: + $ref: '#/components/schemas/AutomaticPricingOfferRuleConfiguration' + updatedAt: + type: string + format: date-time + description: 'The date the rule assignment to offer.marketplace was last modified in ISO 8601 format.' + example: '2023-03-23T15:45:02Z' + updatedAt: + type: string + format: date-time + description: 'The date the rule assignments to offer were last modified in ISO 8601 format.' + example: '2023-03-23T15:45:02Z' + OfferAutomaticPricingCommand: + type: object + required: + - modification + - offerCriteria + properties: + id: + type: string + format: uuid + description: + 'The Command identifier. This field is optional. + If the client does not provide their own command id then the service will generate a command id and return it in the response.' + example: 123a08d7-ab9b-460d-b9cb-d6ed64b3a018 + modification: + oneOf: + - $ref: '#/components/schemas/OfferAutomaticPricingModificationSet' + - $ref: '#/components/schemas/OfferAutomaticPricingModificationRemove' + offerCriteria: + type: array + description: List of offer criteria. + items: + $ref: '#/components/schemas/OfferCriterium' + OfferAutomaticPricingModificationSet: + type: object + properties: + set: + type: array + description: List of marketplaces to which the rules will be added. + items: + type: object + required: + - marketplace + - rule + properties: + marketplace: + type: object + required: + - id + properties: + id: + $ref: '#/components/schemas/MarketplaceId' + rule: + type: object + required: + - id + properties: + id: + $ref: '#/components/schemas/AutomaticPricingRuleId' + configuration: + $ref: '#/components/schemas/AutomaticPricingOfferRuleConfiguration' + OfferAutomaticPricingModificationRemove: + type: object + properties: + remove: + type: array + description: List of marketplaces from which rules will be removed. + items: + type: object + required: + - marketplace + properties: + marketplace: + type: object + required: + - id + properties: + id: + $ref: '#/components/schemas/MarketplaceId' + AutomaticPricingRuleResponse: + type: object + required: + - id + - name + - type + - default + - updatedAt + properties: + id: + $ref: '#/components/schemas/AutomaticPricingRuleId' + type: + $ref: '#/components/schemas/AutomaticPricingRuleType' + name: + $ref: '#/components/schemas/AutomaticPricingRuleName' + default: + $ref: '#/components/schemas/AutomaticPricingRuleDefault' + updatedAt: + $ref: '#/components/schemas/AutomaticPricingRuleUpdatedAt' + configuration: + $ref: '#/components/schemas/AutomaticPricingRuleConfiguration' + AutomaticPricingRuleConfiguration: + type: object + oneOf: + - $ref: '#/components/schemas/AutomaticPricingRuleConfigurationChangeByAmount' + - $ref: '#/components/schemas/AutomaticPricingRuleConfigurationChangeByPercentage' + nullable: true + AutomaticPricingRuleConfigurationChangeByAmount: + type: object + required: [ changeByAmount ] + properties: + changeByAmount: + type: object + required: + - operation + - values + properties: + operation: + type: string + enum: + - SUBTRACT + - ADD + example: "SUBTRACT" + values: + type: array + items: + type: object + required: + - amount + - currency + properties: + amount: + type: string + format: decimal + example: "10.99" + currency: + type: string + example: "PLN" + AutomaticPricingRuleConfigurationChangeByPercentage: + type: object + required: [ changeByPercentage ] + properties: + changeByPercentage: + type: object + required: + - operation + - value + properties: + operation: + type: string + enum: + - SUBTRACT + - ADD + example: "SUBTRACT" + value: + type: string + example: '10' + AutomaticPricingRulePostRequest: + type: object + required: + - name + - type + properties: + name: + $ref: '#/components/schemas/AutomaticPricingRuleName' + type: + $ref: '#/components/schemas/AutomaticPricingRuleType' + configuration: + $ref: '#/components/schemas/AutomaticPricingRuleConfiguration' + AutomaticPricingRulePutRequest: + type: object + required: + - name + properties: + name: + $ref: '#/components/schemas/AutomaticPricingRuleName' + configuration: + $ref: '#/components/schemas/AutomaticPricingRuleConfiguration' + AutomaticPricingRuleId: + type: string + description: Identifier of a automatic pricing rule. + example: "641c73feaef0a8281a3d11f8" + AutomaticPricingRuleName: + type: string + description: 'The rule name. Default rule names are automatically translated based on the value provided in the the "Accept-Language" header.' + maxLength: 33 + example: Lowest price on Allegro plus 10% + AutomaticPricingRuleDefault: + type: boolean + description: 'Indicates whether a rule is default (true) or created by merchant (false).' + example: false + AutomaticPricingRuleType: + type: string + enum: + - EXCHANGE_RATE + - FOLLOW_BY_ALLEGRO_MIN_PRICE + - FOLLOW_BY_MARKET_MIN_PRICE + - FOLLOW_BY_TOP_OFFER_PRICE + example: FOLLOW_BY_ALLEGRO_MIN_PRICE + description: > + The rule type. + * `EXCHANGE_RATE` - Calculates prices on additional marketplaces using the latest exchange rates and price from the offer base marketplace. +
Is not available on base marketplace and business marketplaces. +
More information about EXCHANGE_RATE type. + * `FOLLOW_BY_ALLEGRO_MIN_PRICE` - Calculates prices by following the lowest product price on Allegro for a given marketplace. +
Is not available on business marketplaces. +
More information about FOLLOW_BY_ALLEGRO_MIN_PRICE type. + * `FOLLOW_BY_MARKET_MIN_PRICE` - Calculates prices by following the lowest product price on market for a given marketplace. +
Is not available on business marketplaces. +
More information about FOLLOW_BY_MARKET_MIN_PRICE type. + * `FOLLOW_BY_TOP_OFFER_PRICE` - Calculates prices by following the top offer price on market for a given marketplace. +
Is not available on business marketplaces. +
More information about FOLLOW_BY_TOP_OFFER_PRICE type. + AutomaticPricingOfferRuleConfiguration: + type: object + description: Offer Rule configuration. For "EXCHANGE_RATE" the field is not allowed. For "FOLLOW_BY_ALLEGRO_MIN_PRICE", "FOLLOW_BY_MARKET_MIN_PRICE" and "FOLLOW_BY_TOP_OFFER_PRICE" it is necessary for the rule to work. + properties: + priceRange: + type: object + description: Price range. This field is optional. + required: + - type + - minPrice + - maxPrice + properties: + type: + type: string + enum: + - BASE_MARKETPLACE_CURRENCY + - MARKETPLACE_CURRENCY + description: > + Price range currency type. + * `BASE_MARKETPLACE_CURRENCY` - The price must be defined in the same currency as offer base marketplace currency. + * `MARKETPLACE_CURRENCY` - The price must be defined in the same currency as marketplace currency. For a base marketplace this is the only accepted value. + example: MARKETPLACE_CURRENCY + minPrice: + allOf: + - $ref: '#/components/schemas/Price' + description: 'The minimum price that can be set.' + example: + amount: '100.45' + currency: 'PLN' + maxPrice: + allOf: + - $ref: '#/components/schemas/Price' + description: 'The maximum price that can be set.' + example: + amount: '233.21' + currency: 'PLN' + AutomaticPricingRuleUpdatedAt: + type: string + format: date-time + description: 'The date the rule was last modified in ISO 8601 format.' + example: '2023-03-23T15:45:02Z' + ChangePrice: + type: object + required: + - input + properties: + id: + type: string + format: uuid + description: The unique command id provided in the input. + example: "6365996a-6cae-11e9-a923-1681be663d3e" + input: + $ref: '#/components/schemas/ChangePriceInput' + output: + $ref: '#/components/schemas/CommandOutput' + ChangePriceInput: + type: object + required: + - buyNowPrice + properties: + buyNowPrice: + $ref: '#/components/schemas/Price' + description: The input of the command, i.e. the new Buy Now price for the offer. + ChangePriceWithoutOutput: + type: object + required: + - input + properties: + id: + type: string + format: uuid + description: The unique command id generated by you. This should be the same UUID as used in the path. + example: "6365996a-6cae-11e9-a923-1681be663d3e" + input: + $ref: '#/components/schemas/ChangePriceInput' + CommandOutput: + type: object + properties: + status: + $ref: '#/components/schemas/ProcessingStatus' + errors: + type: array + items: + $ref: '#/components/schemas/Error' + description: The output of the command. + CommandTask: + type: object + properties: + field: + type: string + description: Modified field as JSON path. + message: + type: string + description: General fail reason. You should check the errors structure to get more detailed information of the encountered errors. + offer: + $ref: '#/components/schemas/OfferId' + status: + type: string + description: 'Available statuses: NEW, SUCCESS, FAIL' + errors: + description: The list of error objects explaining the problems with command processing for the given offer. + type: array + items: + $ref: '#/components/schemas/Error' + description: Status of single command task. + CompatibilityList: + type: object + properties: + type: + type: string + default: 'MANUAL' + description: 'Type of the compatibility list, two values are acceptable: `MANUAL`, `PRODUCT_BASED`. +
    +
  • `MANUAL` - for offers not associated with product - compatibility list is created with + items provided by user directly in the body of the request.
  • +
  • `PRODUCT_BASED` - for offers associated with product - if compatibility list is provided in + the product details (GET/sale/products/{productId}), it needs to + be included in the offer in unchanged form. +
  • +
' + required: + - type + discriminator: + propertyName: type + mapping: + MANUAL: '#/components/schemas/CompatibilityListManual' + PRODUCT_BASED: '#/components/schemas/CompatibilityListProductBased' + CompatibilityListProductOfferResponse: + type: object + properties: + type: + type: string + default: 'MANUAL' + description: 'Type of the compatibility list, two values are acceptable: `MANUAL`, `PRODUCT_BASED`. +
    +
  • `MANUAL` - for offers not associated with product - compatibility list is created with + items provided by user directly in the body of the request.
  • +
  • `PRODUCT_BASED` - for offers associated with product - if compatibility list is provided in + the product details (GET/sale/products/{productId}), it needs to + be included in the offer in unchanged form. +
  • +
' + required: + - type + discriminator: + propertyName: type + mapping: + MANUAL: '#/components/schemas/CompatibilityListManual' + PRODUCT_BASED: '#/components/schemas/CompatibilityListProductBasedProductOfferResponse' + CompatibilityListManual: + allOf: + - $ref: '#/components/schemas/CompatibilityList' + - $ref: '#/components/schemas/CompatibilityListManualType' + CompatibilityListManualType: + type: object + required: + - items + properties: + items: + type: array + items: + $ref: '#/components/schemas/CompatibilityListItem' + description: 'List of the compatible items. + Maximum number of elements on the list depends on type of included compatible items. + Configuration and details concerning the compatible items in selected category are provided in the response for GET + + supported-categories resource in `validationRules` object.' + CompatibilityListProductBased: + allOf: + - $ref: '#/components/schemas/CompatibilityList' + - type: object + required: + - id + properties: + id: + type: string + description: 'Id of product-based compatibility list.' + example: '460b2511-b786-47b9-9d7e-1f868728cfd6-f103931434fbf4aa06764f3df74d371df23aa138a9cd46dbe570f51af79db1c4-2' + items: + type: array + items: + $ref: '#/components/schemas/CompatibilityListItemProductBased' + description: 'Text representation of the compatibility list items. Provided for informational purposes only - + ignored when creating (Post) or updating (Put) compatibility list in the offer.' + CompatibilityListProductBasedProductOfferResponse: + allOf: + - $ref: '#/components/schemas/CompatibilityList' + - type: object + required: + - id + properties: + items: + type: array + items: + $ref: '#/components/schemas/CompatibilityListItemProductBased' + description: 'Text representation of the compatibility list items. Provided for informational purposes only - + ignored when creating (Post) or updating (Put) compatibility list in the offer.' + CompatibilityListItem: + type: object + properties: + type: + type: string + required: + - type + discriminator: + propertyName: type + mapping: + TEXT: '#/components/schemas/CompatibilityListTextItem' + ID: '#/components/schemas/CompatibilityListIdItem' + example: + type: "TEXT" + text: 'CITROËN C6 (TD_) 2005/09-2011/12 2.7 HDi 204KM/150kW' + CompatibilityListItemProductBased: + type: object + properties: + text: + type: string + description: "Text description of the compatible item." + example: "AUDI 90 (89, 89Q, 8A, B3) 1988/06-1991/09 2.3 E 20V quattro 170KM/125kW 1501" + CompatibilityListTextItem: + allOf: + - $ref: '#/components/schemas/CompatibilityListItem' + - type: object + required: + - text + properties: + type: + type: string + default: "TEXT" + text: + type: string + description: 'Text description of the compatible item. + Maximum length of the text depends on category where compatible item is used. + Should be used in categories where TEXT version of compatible list is supported. + See + supported-categories resource. Read more.' + example: 'CITROËN C6 (TD_) 2005/09-2011/12 2.7 HDi 204KM/150kW' + CompatibilityListIdItem: + allOf: + - $ref: '#/components/schemas/CompatibilityListItem' + - type: object + required: + - id + properties: + type: + type: string + default: "ID" + id: + type: string + description: 'Id of the compatible item. Should be used in categories + where ID version of compatible list is supported. + See + supported-categories resource. Read more.' + example: '0006563f-f2b9-44ea-ae67-4678679be1f1' + text: + type: string + description: 'Text description of the compatible item. When creating (Post) or updating (Put) a compatibility list the field is ignored.' + example: 'CITROËN C6 (TD_) 2005/09-2011/12 2.7 HDi 204KM/150kW' + additionalInfo: + type: array + items: + $ref: '#/components/schemas/CompatibilityListIdItemAdditionalInfo' + description: 'Details of the compatible item represented by ID.' + CompatibilityListIdItemAdditionalInfo: + type: object + required: + - value + properties: + value: + type: string + description: 'Additional information describing the compatible item. E.g. for cars it can be an engine code or an equipment version.' + example: 'only for versions with BDX engine code' + Configuration: + type: object + properties: + constraintCriteria: + $ref: '#/components/schemas/ConstraintCriteria' + price: + $ref: '#/components/schemas/Price' + ConstraintCriteria: + type: object + properties: + country: + type: string + type: + type: string + enum: + - COUNTRY_SAME_QUANTITY + - COUNTRY_DELIVERY_SAME_QUANTITY + description: 'Constraint type. COUNTRY_SAME_QUANTITY is used by additional services that are realised before shipping (e.g. GIFT_WRAP), while COUNTRY_DELIVERY_SAME_QUANTITY is for additional services that are realised in delivery (e.g. CARRY_IN).' + deliveryMethods: + type: array + items: + $ref: '#/components/schemas/JustId' + description: 'This is used by additional services that are realised in transport (e.g. CARRY_IN), and this field exists together with COUNTRY_DELIVERY_SAME_QUANTITY constraint type. It describes which delivery methods can realise particular service.' + ContactRequest: + type: object + properties: + name: + type: string + maxLength: 250 + emails: + type: array + maxItems: 1 + items: + $ref: '#/components/schemas/EmailRequest' + phones: + type: array + maxItems: 2 + items: + $ref: '#/components/schemas/PhonesRequest' + ContactResponse: + type: object + properties: + id: + type: string + name: + type: string + emails: + type: array + items: + $ref: '#/components/schemas/EmailResponse' + phones: + type: array + items: + $ref: '#/components/schemas/PhonesResponse' + ContactResponseList: + type: object + properties: + contacts: + type: array + items: + $ref: '#/components/schemas/ContactResponse' + Coordinates: + type: object + required: + - lat + - lon + properties: + lat: + type: number + minimum: -90 + maximum: 90 + format: double + lon: + type: number + minimum: -180 + maximum: 180 + format: double + CategoriesResponse: + type: object + properties: + categories: + type: array + items: + $ref: '#/components/schemas/CategoryResponse' + DeliveryBasic: + type: object + properties: + additionalInfo: + type: string + maxLength: 650 + deprecated: true + description: >- + Additional information about delivery. + Parameter is deprecated and will be removed in the future. + Additional information is only visible on marketplace `allegro-pl`. + handlingTime: + type: string + example: PT24H + description: >- + Handling time, ISO 8601 duration format. + This field must be set to one of the following: + PT0S for immediately, PT24H, P2D, P3D, P4D, P5D, P7D, P10D, P14D, P21D, P30D, P60D. + shippingRates: + $ref: '#/components/schemas/JustId' + DeliveryFull: + allOf: + - $ref: '#/components/schemas/DeliveryBasic' + - type: object + properties: + shipmentDate: + type: string + format: date-time + example: '2018-04-01T08:00:00Z' + description: 'Shipment date, Format (ISO 8601) - yyyy-MM-dd''T''HH:mm:ss.SSSZ' + DescriptionSection: + type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/DescriptionSectionItem' + DescriptionSectionItem: + type: object + description: 'One of: TextItem, ImageItem' + properties: + type: + type: string + required: + - type + discriminator: + propertyName: type + mapping: + TEXT: '#/components/schemas/DescriptionSectionItemText' + IMAGE: '#/components/schemas/DescriptionSectionItemImage' + DescriptionSectionItemText: + allOf: + - $ref: '#/components/schemas/DescriptionSectionItem' + - type: object + properties: + type: + type: string + default: 'TEXT' + content: + type: string + example: "

Example text

" + DescriptionSectionItemImage: + allOf: + - $ref: '#/components/schemas/DescriptionSectionItem' + - type: object + properties: + type: + type: string + default: 'IMAGE' + url: + type: string + example: "https://a.allegroimg.com/original/00e0c9/1d7c95614fd6a7c713b075d0251a" + EmailRequest: + type: object + properties: + address: + type: string + maxLength: 128 + description: The contact's email address. The user part (before `@`) cannot be longer than 64 characters. + EmailResponse: + type: object + properties: + address: + type: string + Error: + type: object + properties: + code: + type: string + description: The error code. You can use this code when contacting us about any problems with our systems. + example: "NotAcceptableException" + details: + type: string + nullable: true + description: >- + For some cases, this field provides more details regarding the error. This field can be empty. + example: '' + message: + type: string + description: >- + A message directed to the developer of the program. This message will always be in English and give you + some more technical details on what exactly has happened. + example: Not acceptable representation requested. Please check 'Accept' request header + path: + type: string + nullable: true + description: >- + This field will point to a specific field in object if the error is connected to a problem with such specific + field. This field can be empty + example: '' + userMessage: + type: string + description: >- + The message that can be presented directly to your user. It will not contain any technical information. This + message is translated based on the value of the "Accept-Language" header. By default message in English is + returned. + example: The request contains incorrect data. Contact the author of the application. + metadata: + type: object + additionalProperties: + type: string + description: >- + Additional technical properties of this error. Set of possible keys depends on the specific error. + example: {"productId": "13232515"} + # DEVELOPMENT HINT + # When adding a new metadata field, add a table to respective error response description. + # See Response 422 of PATCH /sale/product-offers/{offerId} for real-life example + # Preferred table format: + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + #
Error metadata fields
Error codeMetadata keyDescription
PARAMETER_MISMATCHproductIdID of an existing product that was matched to your request, but has parameter differences
parameterIdID of problematic parameter
+ Errors: + type: array + description: The list of all the error objects explaining the error. + items: + $ref: '#/components/schemas/Error' + ErrorsHolder: + type: object + properties: + errors: + $ref: '#/components/schemas/Errors' + title: ErrorsHolder + AuthError: + type: object + required: + - error + properties: + error: + type: string + description: Authorization error code + example: "unauthorized" + error_description: + type: string + description: Authorization error message + example: "Full authentication is required to access this resource" + Fee: + type: object + properties: + amount: + type: string + currency: + type: string + title: Fee + CategoryResponse: + type: object + properties: + name: + type: string + description: 'Name of the additional services category.' + example: 'Installation/assembly services' + definitions: + type: array + items: + $ref: '#/components/schemas/CategoryDefinitionResponse' + CategoryDefinitionResponse: + type: object + properties: + id: + type: string + description: 'Id of additional service definition.' + example: 'CARRY_IN' + name: + type: string + description: 'Name of additional service definition, that should be shown to the customer.' + example: 'Home delivery' + description: + $ref: '#/components/schemas/CategoryDefinitionDescriptionResponse' + maxPrice: + $ref: '#/components/schemas/Price' + availableConstraints: + type: array + nullable: true + items: + $ref: '#/components/schemas/AvailableConstraint' + updatedAt: + type: string + format: date-time + nullable: true + CategoryDefinitionDescriptionResponse: + type: object + properties: + hint: + type: string + nullable: true + description: 'Hint for the seller for better description for customers.' + example: 'Describe how you gonna pack product as a gift, what paper you use etc.' + editable: + type: boolean + description: "Determines whether the description of additional service can be set by the seller, or it's provided by Allegro and cannot be changed." + default: + type: string + nullable: true + description: 'Default description of special additional service, provided by Allegro.' + example: 'Home delivery and installation/assembly of refrigerator, changing door opening direction, disassembly of used equipment, collection of used equipment.' + FeePreviewResponse: + type: object + properties: + commissions: + type: array + description: 'An array of commissions.' + items: + $ref: '#/components/schemas/CommissionResponse' + quotes: + type: array + description: 'An array of quotes.' + items: + $ref: '#/components/schemas/QuoteResponse' + CommissionResponse: + properties: + name: + type: string + description: 'Commission fee name.' + example: 'Prowizja od sprzedaży' + type: + type: string + description: 'Commission fee type.' + example: 'commissionFee' + fee: + $ref: '#/components/schemas/Price' + QuoteResponse: + type: object + properties: + name: + type: string + description: 'Quote fee name.' + example: 'Opłata za wystawienie' + type: + type: string + description: 'Quote fee type.' + example: 'listingFee' + fee: + $ref: '#/components/schemas/Price' + cycleDuration: + type: string + description: 'Duration in ISO 8601 format.' + example: 'PT240H' + classifiedsPackage: + $ref: '#/components/schemas/ClassifiedPackage' + GeneralReport: + type: object + properties: + id: + type: string + description: Command ID + createdAt: + type: string + format: date-time + description: >- + Date of command creation. Format (ISO 8601) - + yyyy-MM-dd'T'HH:mm:ss.SSSZ + completedAt: + type: string + format: date-time + nullable: true + description: >- + Date of command completion. Format (ISO 8601) - + yyyy-MM-dd'T'HH:mm:ss.SSSZ + taskCount: + $ref: '#/components/schemas/TaskCount' + description: Command execution summary + Header: + type: object + required: + - name + properties: + name: + type: string + title: Header + ImageUrl: + type: object + properties: + url: + type: string + example: "https://a.allegroimg.com/original/00e0c9/1d7c95614fd6a7c713b075d0251a" + description: Image url + ImpliedWarrantyBasic: + type: object + properties: + id: + type: string + name: + type: string + JustId: + type: object + properties: + id: + type: string + example: "5637592a-0a24-4771-b527-d89b2767d821" + ExternalId: + type: object + description: The information on the offer in an external system. + properties: + id: + type: string + maxLength: 100 + description: The ID of the offer in the external system. + example: "AH-129834" + Location: + type: object + description: for offer with a delivery method it is a parcel dispatch location. For offers with personal pick-up it is a pick-up location, additionally we recommend to use points of service (https://developer.allegro.pl/documentation/#tag/Points-of-service) + properties: + city: + type: string + maxLength: 50 + example: "Poznań" + countryCode: + type: string + maxLength: 2 + example: "PL" + description: >- + The 2-letter country code as defined in ISO 3166. + postCode: + type: string + maxLength: 12 + example: "00-999" + description: >- + The format of post code depends on 'countryCode'. For countryCode equal to 'PL', the expected format is 'XX-XXX', for other countries format is less restrictive - 12 characters or less are expected. + province: + type: string + description: >- + This field is mandatory if countryCode is set to "PL", for other values, currently, it is ignored. + For countryCode equalling "PL", this field must be set to one of the following: DOLNOSLASKIE, + KUJAWSKO_POMORSKIE, LUBELSKIE, LUBUSKIE, + LODZKIE, MALOPOLSKIE, MAZOWIECKIE, OPOLSKIE, + PODKARPACKIE, PODLASKIE, POMORSKIE, SLASKIE, + SWIETOKRZYSKIE, WARMINSKO_MAZURSKIE, + WIELKOPOLSKIE, ZACHODNIOPOMORSKIE. + example: "WIELKOPOLSKIE" + Modification: + type: object + properties: + additionalServicesGroup: + $ref: '#/components/schemas/AdditionalServicesGroup' + delivery: + $ref: '#/components/schemas/ModificationDelivery' + discounts: + $ref: '#/components/schemas/ModificationDiscounts' + location: + $ref: '#/components/schemas/Location' + payments: + $ref: '#/components/schemas/ModificationPayments' + sizeTable: + $ref: '#/components/schemas/SizeTable' + publication: + $ref: '#/components/schemas/ModificationPublication' + responsiblePerson: + $ref: '#/components/schemas/ModificationResponsiblePerson' + responsibleProducer: + $ref: '#/components/schemas/ModificationResponsibleProducer' + safetyInformation: + $ref: '#/components/schemas/ModificationSafetyInformation' + marketedBeforeGPSRObligation: + $ref: '#/components/schemas/ModificationMarketedBeforeGPSRObligation' + description: Contains fields to change + ModificationDelivery: + type: object + properties: + shippingRates: + $ref: '#/components/schemas/ShippingRates' + handlingTime: + type: string + example: PT24H + enum: + - PT0S + - PT24H + - PT48H + - PT72H + - PT96H + - PT120H + - PT168H + - PT240H + - PT336H + - PT504H + - PT720H + - PT1440H + - P2D + - P3D + - P4D + - P5D + - P7D + - P10D + - P14D + - P21D + - P30D + - P60D + description: >- + Handling time, ISO 8601 duration format. PT0S for immediately. + description: Contains delivery details to change. + ModificationDiscounts: + type: object + properties: + wholesalePriceList: + type: object + properties: + id: + type: string + description: Promotion id of a wholesale price list to assign to the offer or `null` to unassign wholesale price list from the offer. + example: "5637592a-0a24-4771-b527-d89b2767d821" + description: Allows you to assign/unassign discounts (rebates) to/from offers. + ModificationPublication: + type: object + properties: + duration: + type: string + description: 'Offer duration time provided in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.' + enum: + - PT72H + - PT120H + - PT168H + - PT240H + - PT480H + - PT720H + - P3D + - P5D + - P7D + - P10D + - P20D + - P30D + durationUnlimited: + type: boolean + example: false + description: 'Unlimited duration time.' + description: 'Allows you to change duration of the offers. You can include only property in a request "duration" or "durationUnlimited".' + ModificationResponsiblePerson: + type: object + description: Allows you to assign/unassign responsible persons to/from offers. + properties: + id: + type: string + example: 52061f03-9f39-4354-8ef2-ff7b3fc7fe7a + description: > + The ID of a responsible person configured using the + Responsible persons API. + + + _Note: if the offer contains multiple products, the responsible person will only be changed for the first product._ + ModificationResponsibleProducer: + type: object + description: Allows you to assign/unassign responsible producers to/from offers. + properties: + id: + type: string + example: 88b21592-ce4a-4024-9174-ad764120d1dc + description: > + The ID of a responsible producer configured using the + Responsible Producers API. + + + _Note: if the offer contains multiple products, the responsible producer will only be changed for the first product._ + ModificationSafetyInformation: + type: object + description: Allows you to set safety information in offers. + properties: + type: + type: string + description: > + _Note: if the offer contains multiple products, the safety information will only be changed for the first product._ + example: + type: 'TEXT' + description: string + required: + - type + discriminator: + propertyName: type + mapping: + TEXT: '#/components/schemas/ModificationTextSafetyInformation' + ATTACHMENTS: '#/components/schemas/ModificationAttachmentSafetyInformation' + NO_SAFETY_INFORMATION: '#/components/schemas/ModificationNoSafetyInformation' + ModificationNoSafetyInformation: + allOf: + - $ref: '#/components/schemas/ModificationSafetyInformation' + - type: object + properties: + type: + description: The option is deprecated and will be removed in the future. + deprecated: true + type: string + ModificationAttachmentSafetyInformation: + allOf: + - $ref: '#/components/schemas/ModificationSafetyInformation' + - type: object + properties: + attachments: + type: array + description: Full list of safety information attachments. + items: + type: object + properties: + id: + type: string + example: 11a2df7f-8237-4625-baa2-cb7541f39946 + description: >- + Id of the attachment. + See how to create and upload an attachment. + ModificationTextSafetyInformation: + allOf: + - $ref: '#/components/schemas/ModificationSafetyInformation' + - type: object + properties: + description: + type: string + description: > + Safety warnings and instructions for the product in plain text form, if the information cannot be provided through attachments. + Text can't be longer than 5000 characters. + ModificationMarketedBeforeGPSRObligation: + type: boolean + nullable: true + example: true + deprecated: true + description: >- + The field is deprecated and will be removed in the future. + Allows you to declare whether the first product in the offer was marketed before the GPSR obligation. + ModificationPayments: + type: object + properties: + invoice: + type: string + description: 'Invoice type: VAT, VAT_MARGIN, WITHOUT_VAT, NO_INVOICE' + enum: + - VAT + - VAT_MARGIN + - WITHOUT_VAT + - NO_INVOICE + tax: + $ref: '#/components/schemas/Tax' + SizeTable: + type: object + properties: + id: + type: string + description: Id of size table + Contact: + type: object + properties: + id: + type: string + description: Id of contact. + ProductOfferFundraisingCampaignRequest: + type: object + properties: + id: + type: string + description: Id of fundraising campaign. + name: + type: string + description: Name of fundraising campaign. + ProductOfferFundraisingCampaignResponse: + type: object + properties: + id: + type: string + description: Id of fundraising campaign. + ProductOfferAdditionalServicesRequest: + type: object + properties: + id: + type: string + description: Id of additional services. + name: + type: string + description: Name of additional services. + description: 'Offer additional services.' + ProductOfferAdditionalServicesResponse: + type: object + properties: + id: + type: string + description: Id of additional services. + ProductOfferAttachment: + type: array + items: + type: object + properties: + id: + type: string + description: Id of attachment. + example: "07ee5e36-afc7-41eb-af49-3df5354ef85" + description: 'An array of offer attachments.' + OfferAttachment: + type: object + properties: + id: + type: string + type: + $ref: '#/components/schemas/AttachmentType' + file: + $ref: '#/components/schemas/AttachmentFile' + PublicOfferPreviewRequest: + properties: + offer: + $ref: '#/components/schemas/PricingOffer' + classifiedsPackages: + $ref: '#/components/schemas/ClassifiedsPackages' + marketplaceId: + type: string + description: >- + The marketplace on which the offer should be previewed. + If omitted, it will default to the base marketplace. + nullable: true + example: "allegro-pl" + ClassifiedsPackages: + type: object + properties: + basePackage: + $ref: '#/components/schemas/ClassifiedPackage' + extraPackages: + type: array + description: 'An array of extra packages.' + items: + $ref: '#/components/schemas/ClassifiedExtraPackage' + ClassifiedPackage: + type: object + properties: + id: + type: string + description: 'The classifieds package ID.' + example: 'e76d443b-c088-4da5-95f7-cc9aaf73bf7b' + ClassifiedExtraPackage: + type: object + properties: + id: + type: string + description: 'The classifieds extra package ID.' + example: 'bff60277-b92e-46b6-98a4-439f830ac0a1' + republish: + type: boolean + description: 'Extra package with this flag set to true will be recreated when offer is being republished' + example: false + OfferAttachmentRequest: + type: object + properties: + type: + $ref: '#/components/schemas/AttachmentType' + file: + $ref: '#/components/schemas/AttachmentFileRequest' + AttachmentType: + type: string + description: offer attachment type + enum: + - MANUAL + - SPECIAL_OFFER_RULES + - COMPETITION_RULES + - BOOK_EXCERPT + - USER_MANUAL + - INSTALLATION_INSTRUCTIONS + - GAME_INSTRUCTIONS + - ENERGY_LABEL + - PRODUCT_INFORMATION_SHEET + - TIRE_LABEL + - SAFETY_INFORMATION_MANUAL + AttachmentFile: + type: object + properties: + name: + type: string + maxLength: 200 + url: + type: string + maxLength: 200 + AttachmentFileRequest: + type: object + properties: + name: + type: string + maxLength: 200 + OfferImageLinkUploadRequest: + type: object + required: + - url + properties: + url: + type: string + description: >- + URL of the image. + It has to contain domain name, not an IP address. + Currently we support http and https protocols. When using https the certificate chain needs to be valid. + OfferImageUploadResponse: + type: object + properties: + expiresAt: + type: string + format: date-time + description: >- + Date of file expiration (removal from the server). + We will remove it unless you use it in your offer. + location: + type: string + description: Link to the uploaded image + PricingOffer: + type: object + required: + - name + properties: + fundraisingCampaign: + $ref: '#/components/schemas/JustId' + id: + type: string + category: + $ref: '#/components/schemas/Category' + parameters: + type: array + items: + $ref: '#/components/schemas/Parameter' + promotion: + $ref: '#/components/schemas/Promotion' + publication: + $ref: '#/components/schemas/PricingPublication' + sellingMode: + $ref: '#/components/schemas/SellingModeWithNetPrice' + description: Single offer data. + OfferChangeCommand: + type: object + properties: + modification: + $ref: '#/components/schemas/Modification' + offerCriteria: + type: array + description: List of offer criteria + items: + $ref: '#/components/schemas/OfferCriterium' + description: Modification command payload + OfferPriceChangeCommand: + type: object + properties: + modification: + $ref: '#/components/schemas/PriceModification' + offerCriteria: + type: array + description: List of offer criteria + items: + $ref: '#/components/schemas/OfferCriterium' + description: Price modification command payload + PriceModification: + type: object + description: >- + The way the offer price should be changed. One of three ways is possible: + new price, increase/decrease price, percentage change and only one can be chosen at once. + required: + - type + discriminator: + propertyName: type + mapping: + FIXED_PRICE: '#/components/schemas/PriceModificationFixedPrice' + INCREASE_PRICE: '#/components/schemas/PriceModificationValueChangeIncrease' + DECREASE_PRICE: '#/components/schemas/PriceModificationValueChangeDecrease' + INCREASE_PERCENTAGE: '#/components/schemas/PriceModificationPercentageChangeIncrease' + DECREASE_PERCENTAGE: '#/components/schemas/PriceModificationPercentageChangeDecrease' + properties: + type: + type: string + description: Type of the modification. + marketplaceId: + allOf: + - $ref: '#/components/schemas/MarketplaceId' + description: >- + The marketplace on which the price of the offer should be changed. + If omitted, the price will be changed on the base marketplace of the offer. + nullable: true + PriceModificationFixedPrice: + allOf: + - $ref: '#/components/schemas/PriceModification' + - type: object + properties: + type: + type: string + default: 'FIXED_PRICE' + price: + $ref: '#/components/schemas/PriceModificationFixedPriceHolder' + PriceModificationValueChangeIncrease: + allOf: + - $ref: '#/components/schemas/PriceModification' + - type: object + properties: + type: + type: string + default: 'INCREASE_PRICE' + value: + $ref: '#/components/schemas/PriceModificationValueChangeHolder' + PriceModificationValueChangeDecrease: + allOf: + - $ref: '#/components/schemas/PriceModification' + - type: object + properties: + type: + type: string + default: 'DECREASE_PRICE' + value: + $ref: '#/components/schemas/PriceModificationValueChangeHolder' + PriceModificationPercentageChangeIncrease: + allOf: + - $ref: '#/components/schemas/PriceModification' + - type: object + properties: + type: + type: string + default: 'INCREASE_PERCENTAGE' + percentage: + $ref: '#/components/schemas/PriceModificationPercentageChangeHolder' + PriceModificationPercentageChangeDecrease: + allOf: + - $ref: '#/components/schemas/PriceModification' + - type: object + properties: + type: + type: string + default: 'DECREASE_PERCENTAGE' + percentage: + $ref: '#/components/schemas/PriceModificationPercentageChangeHolder' + PriceModificationFixedPriceHolder: + allOf: + - $ref: '#/components/schemas/Price' + description: 'New offer buy now price, related to type FIXED_PRICE.' + PriceModificationValueChangeHolder: + allOf: + - $ref: '#/components/schemas/Price' + description: 'Change of offer buy now price, related to types: INCREASE_PRICE, DECREASE_PRICE.' + PriceModificationPercentageChangeHolder: + type: string + description: 'Percentage change of offer buy now price, related to types: INCREASE_PERCENTAGE, DECREASE_PERCENTAGE. Provided in a string format to avoid rounding errors.' + OfferQuantityChangeCommand: + type: object + properties: + modification: + $ref: '#/components/schemas/QuantityModification' + offerCriteria: + type: array + description: List of offer criteria + items: + $ref: '#/components/schemas/OfferCriterium' + description: Quantity modification command payload + QuantityModification: + type: object + description: >- + The way the offer quantity should be changed. One of two ways is possible: + new quantity, increase/decrease quantity and only one can be chosen at once. + properties: + changeType: + description: modification type + type: string + enum: + - 'FIXED' + - 'GAIN' + value: + type: integer + example: 1 + description: + '- For changeType = "FIXED", a new stock quantity > 0 + + - For changeType = "GAIN", an increase/decrease in stock quantity' + SellerRebateOfferCriterion: + type: object + required: + - type + properties: + offers: + type: array + description: >- + Set of offers – only if `type` is `CONTAINS_OFFERS` + items: + type: object + required: + - id + properties: + id: + type: string + description: Offer id + example: "1233432" + type: + type: string + description: 'Criteria type: CONTAINS_OFFERS or OFFERS_ASSIGNED_EXTERNALLY' + enum: + - CONTAINS_OFFERS + - OFFERS_ASSIGNED_EXTERNALLY + - ALL_OFFERS + OfferCriterium: + type: object + properties: + offers: + type: array + description: Set of offers + items: + $ref: '#/components/schemas/OfferId' + type: + type: string + description: 'Criteria type: CONTAINS_OFFERS' + enum: + - CONTAINS_OFFERS + description: Contains offers criteria + OfferId: + type: object + properties: + id: + type: string + description: Offer id + example: '123456789' + OfferQuoteDto: + type: object + properties: + enabled: + type: boolean + fee: + $ref: '#/components/schemas/Fee' + name: + type: string + nextDate: + type: string + format: date-time + offer: + $ref: '#/components/schemas/OfferId' + type: + type: string + title: OfferQuoteDto + OfferQuotesDto: + type: object + properties: + count: + type: integer + format: int32 + minimum: 0 + quotes: + type: array + items: + $ref: '#/components/schemas/OfferQuoteDto' + title: OfferQuotesDto + OfferStatsResponseDto: + description: >- + Data objects containing details for counted events per offer. + Includes a list of OfferStatResponseDto grouped by date + and a list of ClassifiedEventStat grouped by EventType for a specific period. + type: object + properties: + offerStats: + type: array + items: + $ref: '#/components/schemas/OfferStatResponseDto' + title: OfferStatsResponseDto + SellerOfferStatsResponseDto: + description: >- + Data class for a specific seller events. + Includes a list of OfferStatResponseDto grouped by date + and a list of ClassifiedEventStat grouped by EventType for a specific period. + type: object + properties: + eventStatsTotal: + type: array + items: + $ref: '#/components/schemas/ClassifiedEventStat' + eventsPerDay: + type: array + items: + $ref: '#/components/schemas/ClassifiedDailyEventStatResponseDto' + title: SellerOfferStatsResponseDto + OfferStatResponseDto: + type: object + properties: + offer: + $ref: '#/components/schemas/OfferStatModelDto' + eventStatsTotal: + type: array + items: + $ref: '#/components/schemas/ClassifiedEventStat' + eventsPerDay: + type: array + items: + $ref: '#/components/schemas/ClassifiedDailyEventStatResponseDto' + title: OfferStatResponseDto + OfferStatModelDto: + type: object + description: Offer details data, containg offer identifier. + properties: + id: + type: string + title: OfferStatModelDto + ClassifiedEventStat: + type: object + properties: + count: + type: integer + eventType: + $ref: '#/components/schemas/ClassifiedStatEventType' + title: ClassifiedEventStat + ClassifiedDailyEventStatResponseDto: + type: object + properties: + date: + type: string + description: Date in format yyyy-MM-dd + format: string + example: '2019-05-01' + eventStats: + type: array + description: List of event types with number of occurrences. + items: + $ref: '#/components/schemas/ClassifiedEventStat' + title: ClassifiedDailyEventStatResponseDto + ClassifiedStatEventType: + type: string + description: 'Classified statistical event type.' + enum: + - SHOWED_PHONE_NUMBER + - ASKED_QUESTION + - CLICKED_ASK_QUESTION + - ADDED_TO_FAVOURITES + - REMOVED_FROM_FAVOURITES + OpenHour: + type: object + required: + - dayOfWeek + - from + - to + properties: + dayOfWeek: + type: string + description: >- + Days of the week: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, + SATURDAY, SUNDAY. Date format ISO 8601 + from: + type: string + description: 'Date format (ISO 8601) - HH:mm:ss.SSS' + to: + type: string + description: 'Date format (ISO 8601) - HH:mm:ss.SSS' + Order: + type: object + required: + - id + - offers + properties: + id: + type: string + description: Order id + offers: + type: array + description: List of order offers + items: + type: object + required: + - id + - title + properties: + id: + type: string + description: Offer ID + title: + type: string + description: Offer title + snapshot: + type: string + description: Offer snapshot URL parameter pointing to historical offer view + Parameter: + type: object + required: + - id + properties: + id: + type: string + rangeValue: + $ref: '#/components/schemas/ParameterRangeValue' + values: + type: array + items: + type: string + valuesIds: + type: array + items: + type: string + description: Offer's parameter. + CategoryParameter: + type: object + required: + - type + discriminator: + propertyName: type + mapping: + integer: '#/components/schemas/IntegerCategoryParameter' + float: '#/components/schemas/FloatCategoryParameter' + string: '#/components/schemas/StringCategoryParameter' + dictionary: '#/components/schemas/DictionaryCategoryParameter' + properties: + id: + type: string + description: The ID of the parameter. + example: "11323" + name: + type: string + description: The name of the parameter in Polish. + example: "Stan" + type: + type: string + description: >- + The type of the parameter. Other fields in this structure may appear based on the type of the parameter. + required: + type: boolean + description: >- + Indicates whether the value of this parameter must be set in an offer. Offers without required parameters + set cannot be published. See also `requiredIf`. + requiredForProduct: + type: boolean + description: >- + Indicates whether the value of this parameter must be set in a product. Product without required parameters + set cannot be created. + requiredIf: + $ref: '#/components/schemas/CategoryParameterRequirementConditions' + displayedIf: + $ref: '#/components/schemas/CategoryParameterDisplayConditions' + unit: + type: string + nullable: true + description: The unit in which values of the parameter are used. May be `null`. + example: "kg" + options: + $ref: '#/components/schemas/CategoryParameterOptions' + CategoryProductParameter: + type: object + required: + - type + discriminator: + propertyName: type + mapping: + integer: '#/components/schemas/IntegerCategoryProductParameter' + float: '#/components/schemas/FloatCategoryProductParameter' + string: '#/components/schemas/StringCategoryProductParameter' + dictionary: '#/components/schemas/DictionaryCategoryProductParameter' + properties: + id: + type: string + description: The ID of the parameter. + example: "11323" + name: + type: string + description: The name of the parameter in Polish. + example: "Numer katalogowy" + type: + type: string + description: >- + The type of the product parameter. Other fields in this structure may appear based on the type of the parameter. + required: + type: boolean + description: >- + Indicates whether the value of this parameter must be set in a product. Product without required parameters + set cannot be created. See also `requiredIf`. + requiredIf: + $ref: '#/components/schemas/CategoryParameterRequirementConditions' + displayedIf: + $ref: '#/components/schemas/CategoryParameterDisplayConditions' + unit: + type: string + nullable: true + description: The unit in which values of the parameter are used. May be `null`. + example: "kg" + DictionaryCategoryProductParameter: + allOf: + - $ref: '#/components/schemas/CategoryProductParameter' + - type: object + properties: + type: + type: string + default: dictionary + restrictions: + type: object + description: The restrictions on values of this parameter. + properties: + multipleChoices: + type: boolean + description: Indicates whether this parameter can have more than one value. + dictionary: + type: array + description: Defines the values accepted for this parameter. + items: + type: object + properties: + id: + type: string + description: >- + The ID of the dictionary value. Use it to set the value in an offer or in a product. + example: "11323_1" + value: + type: string + description: The label of the dictionary value in Polish. + example: "Nowy" + IntegerCategoryProductParameter: + allOf: + - $ref: '#/components/schemas/CategoryProductParameter' + - type: object + properties: + type: + type: string + default: integer + restrictions: + type: object + description: The restrictions on values of this parameter. + properties: + min: + type: integer + description: The minimum value of this parameter. Lower than or equal to `max`. + example: 8 + max: + type: integer + description: The maximum value of this parameter. Greater than or equal to `min`. + example: 128 + range: + type: boolean + description: >- + Indicates whether this is a range parameter. If this is `true`, then you have to provide two values + for this parameter - `from` and `to`. Both these values have to be between the `min` and `max`. + FloatCategoryProductParameter: + allOf: + - $ref: '#/components/schemas/CategoryProductParameter' + - type: object + properties: + type: + type: string + default: float + restrictions: + type: object + description: The restrictions on values of this parameter. + properties: + min: + type: number + description: The minimum value of this parameter. Lower than or equal to `max`. + example: 0.0 + max: + type: number + description: The maximum value of this parameter. Greater than or equal to `min`. + example: 10000.0 + range: + type: boolean + description: >- + Indicates whether this is a range parameter. If this is `true`, then you have to provide two values + for this parameter - `from` and `to`. Both these values have to be between the `min` and `max`. + precision: + type: integer + minimum: 0 + description: Number of digits you can provide after a comma that can be transferred in the parameter value. + example: 3 + StringCategoryProductParameter: + allOf: + - $ref: '#/components/schemas/CategoryProductParameter' + - type: object + properties: + type: + type: string + default: string + restrictions: + type: object + description: The restrictions on values of this parameter. + properties: + minLength: + type: integer + minimum: 0 + description: The minimum length of the parameter value. + example: 3 + maxLength: + type: integer + minimum: 1 + description: The maximum length of the parameter value. + example: 250 + allowedNumberOfValues: + type: integer + minimum: 0 + description: Indicates how many different values can be provided for this parameter. + example: 5 + CategoryParameterOptions: + type: object + properties: + variantsAllowed: + type: boolean + description: Parameters with this option enabled can be used for offer variants creation. + variantsEqual: + type: boolean + description: All offer variants must have the same values in parameters with this option enabled. + ambiguousValueId: + type: string + nullable: true + description: >- + Indicates what value in the dictionary is defined as an ambiguous one. + Only parameters with dictionaries might have this option defined. + example: "128788_36" + dependsOnParameterId: + type: string + nullable: true + description: | + Indicates whether this parameter's allowed values depend on another parameter's values. This field is set + only for dictionary parameters which have at least one dictionary value with dependent values (see also + `dictionary[].dependsOnValueIds`). Otherwise this field is null. + example: "211062" + describesProduct: + type: boolean + description: Indicates if parameter is used to define products. + customValuesEnabled: + type: boolean + description: Indicates if a custom value can be added to a parameter with an ambiguous value. + description: A list of the different options which can be used with this parameter. + DictionaryCategoryParameter: + allOf: + - $ref: '#/components/schemas/CategoryParameter' + - type: object + properties: + type: + type: string + default: dictionary + restrictions: + type: object + description: The restrictions on values of this parameter. + properties: + multipleChoices: + type: boolean + description: Indicates whether this parameter can have more than one value. + dictionary: + type: array + description: Defines the values accepted for this parameter. + items: + type: object + properties: + id: + type: string + description: >- + The ID of the dictionary value. Use it to set the value in an offer or in a product. + example: "11323_1" + value: + type: string + description: The label of the dictionary value in Polish. + example: "Nowy" + dependsOnValueIds: + type: array + description: >- + The IDs of dictionary values from another parameter that this parameter value can be combined + with. The other parameter has the id from `options.dependsOnParameterId`. Empty if this parameter + value can be combined with any value from other parameters. Otherwise, this value might be set in + the offer only when one of the given values of `dependsOnValueIds` is set as well. + items: + type: string + example: "211062_246554" + IntegerCategoryParameter: + allOf: + - $ref: '#/components/schemas/CategoryParameter' + - type: object + properties: + type: + type: string + default: integer + restrictions: + type: object + description: The restrictions on values of this parameter. + properties: + min: + type: integer + description: The minimum value of this parameter. Lower than or equal to `max`. + example: 8 + max: + type: integer + description: The maximum value of this parameter. Greater than or equal to `min`. + example: 128 + range: + type: boolean + description: >- + Indicates whether this is a range parameter. If this is `true`, then you have to provide two values + for this parameter - `from` and `to`. Both these values have to be between the `min` and `max`. + FloatCategoryParameter: + allOf: + - $ref: '#/components/schemas/CategoryParameter' + - type: object + properties: + type: + type: string + default: float + restrictions: + type: object + description: The restrictions on values of this parameter. + properties: + min: + type: number + description: The minimum value of this parameter. Lower than or equal to `max`. + example: 0.0 + max: + type: number + description: The maximum value of this parameter. Greater than or equal to `min`. + example: 10000.0 + range: + type: boolean + description: >- + Indicates whether this is a range parameter. If this is `true`, then you have to provide two values + for this parameter - `from` and `to`. Both these values have to be between the `min` and `max`. + precision: + type: integer + minimum: 0 + description: Number of digits you can provide after a comma that can be transferred in the parameter value. + example: 3 + StringCategoryParameter: + allOf: + - $ref: '#/components/schemas/CategoryParameter' + - type: object + properties: + type: + type: string + default: string + restrictions: + type: object + description: The restrictions on values of this parameter. + properties: + minLength: + type: integer + minimum: 0 + description: The minimum length of the parameter value. + example: 3 + maxLength: + type: integer + minimum: 1 + description: The maximum length of the parameter value. + example: 250 + allowedNumberOfValues: + type: integer + minimum: 0 + description: Indicates how many different values can be provided for this parameter. + example: 5 + ParameterRangeValue: + type: object + required: + - from + - to + properties: + from: + type: string + example: "20" + to: + type: string + example: "80" + description: Parameter's range value + CategoryParameterRequirementConditions: + type: object + required: + - parametersWithValue + - parametersWithoutValue + description: >- + Restricts the circumstances when this parameter is required. `null` if solely the `required` flag determines if + this parameter is required. Present if this parameter is required only if all of the contained conditions of all + condition types are fulfilled. At least one condition is contained if this field is present. + properties: + parametersWithValue: + type: array + items: + $ref: '#/components/schemas/CategoryParameterWithValue' + description: >- + Condition type which requires this parameter only if each of the given other parameters has filled in one of + the respective given value ids in an offer or product. Empty if no condition of this type is present. + parametersWithoutValue: + type: array + items: + $ref: '#/components/schemas/CategoryParameterWithoutValue' + description: >- + Condition type which requires this parameter only if each of the given other parameters has filled neither + a value nor a value id in an offer or product. Empty if no condition of this type is present. + CategoryParameterDisplayConditions: + type: object + required: + - parametersWithValue + description: >- + Restricts the circumstances when this parameter should be displayed e.g. on a user form. `null` if this + parameter is displayed always. Present if this parameter should be displayed only if all of the contained + conditions of all condition types are fulfilled. At least one condition is contained if this field is present. + properties: + parametersWithValue: + type: array + items: + $ref: '#/components/schemas/CategoryParameterWithValue' + description: >- + Condition type which displays this parameter only if each of the given other parameters has filled in one of + the respective given value ids in an offer or product. Empty if no condition of this type is present. + CategoryParameterWithValue: + type: object + required: + - id + - oneOfValueIds + properties: + id: + type: string + description: Id of another parameter with a value dictionary. + example: "11323" + oneOfValueIds: + type: array + items: + type: string + description: A list of value ids. One of them must be chosen in order to fulfill this condition. Not empty. + example: ["11323_1"] + CategoryParameterWithoutValue: + type: object + required: + - id + properties: + id: + type: string + description: Id of another parameter. + example: "11323" + CategoryParameterList: + type: object + properties: + parameters: + type: array + description: The list of parameters supported by the category. + items: + $ref: '#/components/schemas/CategoryParameter' + CategoryProductParameterList: + type: object + properties: + parameters: + type: array + description: The list of product parameters supported by the category. + items: + $ref: '#/components/schemas/CategoryProductParameter' + CommentVBeta1: + type: object + properties: + text: + type: string + description: Text of user's comment. + language: + type: string + description: Language of the user comment. + Exclusion: + type: object + properties: + reason: + type: string + description: The reason why the rating was excluded from calculating average user rates. + The message is translated based on the value of the "Accept-Language" header and exists only when the rating was excluded. + Justification: + type: object + properties: + text: + type: string + description: Text of justification. + visibleForBuyer: + type: boolean + description: When set to false, given justification is visible only for the seller and not for the buyer. + Payment: + type: object + required: + - method + properties: + method: + type: string + description: 'Available forms of payment: CASH - cash, CARD - card.' + Payments: + type: object + properties: + invoice: + type: string + description: 'Invoice type' + enum: + - VAT + - VAT_MARGIN + - WITHOUT_VAT + - NO_INVOICE + PhonesRequest: + type: object + properties: + number: + type: string + maxLength: 250 + description: A valid phone number + PhonesResponse: + type: object + properties: + number: + type: string + Pos: + type: object + required: + - address + - confirmationType + - name + - openHours + - status + - type + properties: + id: + type: string + description: >- + UUID. When creating a point of service (Post) the field is ignored. + It is required when updating (Put) a point of service. + externalId: + type: string + description: ID from external client system. + maxLength: 80 + name: + type: string + maxLength: 80 + seller: + $ref: '#/components/schemas/Seller' + type: + type: string + description: Indicates point type. The only valid value so far is PICKUP_POINT. + address: + $ref: '#/components/schemas/Address' + phoneNumber: + type: string + maxLength: 16 + email: + type: string + maxLength: 64 + locations: + type: array + description: >- + IDs for a location. When creating (Post) or updating (Put) a point of service the field is ignored. + items: + $ref: '#/components/schemas/PosLocation' + openHours: + type: array + description: Possible empty list of opening hours. + items: + $ref: '#/components/schemas/OpenHour' + serviceTime: + type: string + description: >- + Delivery time / Time period for receipt. Date format ISO 8601 e.g. + 'PT24H' + payments: + type: array + description: An empty list of payment types is available. + items: + $ref: '#/components/schemas/Payment' + confirmationType: + type: string + description: >- + Confirmation method: AWAIT_CONTACT - We will inform you about the + time of receipt, CALL_US - Please make an appointment, + CONTACT_NOT_REQUIRED - Contact is not required. + status: + type: string + description: >- + Point of service status: ACTIVE - active, TEMPORARILY_CLOSED - + temporarily closed, CLOSED_DOWN - closed down, DELETED - deleted. + createdAt: + type: string + description: >- + Creation date. Date format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ + When creating (Post) or updating (Put) a point of service the field is ignored. + updatedAt: + type: string + description: >- + Modification date. Date format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ + When creating (Post) or updating (Put) a point of service the field is ignored. + PosLocation: + type: object + required: + - id + properties: + id: + type: string + Price: + type: object + description: The price data. + required: + - amount + - currency + properties: + amount: + type: string + description: The amount provided in a string format to avoid rounding errors. + example: '123.45' + currency: + type: string + format: ISO 4217 + description: The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + example: 'PLN' + ProcessingStatus: + type: string + description: The processing status of the command. + enum: + - QUEUEING + - RUNNING + - VALIDATED_AND_RUNNING + - RUNNING_BUT_WITH_ERRORS + - SUCCESSFUL + - PARTIAL_SUCCESS + - ERROR + Promotion: + type: object + description: Promo options on base marketplace. + properties: + emphasized1d: + type: boolean + emphasized10d: + type: boolean + promoPackage: + type: boolean + departmentPage: + type: boolean + PublicTableDto: + type: object + required: + - headers + - name + - values + properties: + headers: + type: array + description: size table headers + items: + $ref: '#/components/schemas/Header' + id: + type: string + description: size table id + name: + type: string + description: size table name + template: + $ref: '#/components/schemas/JustId' + values: + type: array + description: size table cells + items: + $ref: '#/components/schemas/Cells' + title: PublicTableDto + PublicTablesDto: + type: object + required: + - tables + properties: + tables: + type: array + items: + $ref: '#/components/schemas/PublicTableDto' + title: PublicTablesDto + SizeTableTemplateImageResponse: + type: object + description: size table template image + required: + - captions + - url + properties: + captions: + type: array + items: + $ref: '#/components/schemas/Caption' + url: + type: string + title: SizeTableTemplateImageResponse + SizeTableTemplateResponse: + type: object + required: + - id + - name + - headers + - values + properties: + id: + type: string + description: size table template id + name: + type: string + description: size table template name + image: + $ref: '#/components/schemas/SizeTableTemplateImageResponse' + headers: + description: size table template headers + type: array + items: + $ref: '#/components/schemas/Header' + values: + description: size table template cells + type: array + items: + $ref: '#/components/schemas/Cells' + title: SizeTableTemplateResponse + SizeTableTemplatesResponse: + type: object + required: + - templates + properties: + templates: + description: size tables templates + type: array + items: + $ref: '#/components/schemas/SizeTableTemplateResponse' + title: SizeTableTemplatesResponse + SizeTablePostRequest: + type: object + required: + - name + - template + - headers + - values + properties: + name: + type: string + description: size table name + template: + $ref: '#/components/schemas/JustId' + headers: + type: array + description: size table headers + items: + $ref: '#/components/schemas/Header' + values: + type: array + description: size table cells + items: + $ref: '#/components/schemas/Cells' + title: SizeTablePostRequest + SizeTablePutRequest: + type: object + required: + - name + - headers + - values + properties: + name: + type: string + description: size table name + headers: + type: array + description: size table headers + items: + $ref: '#/components/schemas/Header' + values: + type: array + description: size table cells + items: + $ref: '#/components/schemas/Cells' + title: SizeTablePutRequest + PricingPublication: + type: object + properties: + duration: + $ref: '#/components/schemas/OfferDuration' + PublicationRequest: + type: object + properties: + duration: + $ref: '#/components/schemas/OfferDuration' + startingAt: + $ref: '#/components/schemas/OfferStartingAt' + status: + $ref: '#/components/schemas/OfferStatus' + republish: + type: boolean + example: false + description: >- + Whether to republish an offer after ending. Automatically republish offers or auctions:
+ - `BUY_NOW` offer type are republished with initial stock, regardless of how many items you have sold.
+ - `AUCTION` offer type are republished only if they were not concluded with purchase.
+ - `ADVERTISEMENT` offer type are republished until it will be finished manually. + Publication: + allOf: + - $ref: '#/components/schemas/PublicationRequest' + - type: object + properties: + endingAt: + $ref: '#/components/schemas/OfferEndingAt' + endedBy: + type: string + readOnly: true + enum: + - USER + - ADMIN + - EXPIRATION + - EMPTY_STOCK + - PRODUCT_DETACHMENT + - ERROR + description: >- + Indicates the reason for ending the offer: + - `USER` - offer ended by the seller. + - `ADMIN` - offer ended by an admin. + - `EXPIRATION` - offer duration had expired (valid for offers with specified duration). + - `EMPTY_STOCK` - offer ended because all available items had been sold out. + - `PRODUCT_DETACHMENT` - offer ended because its link to the product was removed. Status will only occur + if the base marketplace of offer requires full productization. + - `ERROR` - offer ended due to internal problem with offer publication. The publication command responded with + success status, but further processing failed. + OfferDuration: + type: string + example: PT24H + description: >- + This field must be set to one of the following:
+ - for auctions: 1 day, 3 days, 5 days, 7 days, 10 days
+ - for buy-now offers: 3 days, 5 days, 7 days, 10 days, 20 days, 30 days
+ - for advertisements: 10 days, 20 days, 30 days.
+ The value is in ISO 8601 format (example: PT24H, PT72H). + OfferEndingAt: + type: string + example: "2031-01-04T11:01:59Z" + format: date-time + description: >- + Publication ending date: Format (ISO 8601) - + yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified + OfferStartingAt: + type: string + example: "2031-01-04T11:01:59Z" + format: date-time + description: >- + Publication starting date: Format (ISO 8601) - + yyyy-MM-dd'T'HH:mm:ss.SSSZ. Cannot be modified after activation or ending of the offer. + PublicationChangeCommandDto: + type: object + properties: + offerCriteria: + type: array + description: List of offer criteria + items: + $ref: '#/components/schemas/OfferCriterium' + publication: + $ref: '#/components/schemas/Publication_modification' + description: Publication modification command payload + Rates: + type: object + properties: + delivery: + type: integer + format: int32 + minimum: 0 + example: 5 + description: Delivery rate value + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + deliveryCost: + type: integer + format: int32 + minimum: 0 + example: 5 + description: Delivery cost rate value + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + description: + type: integer + format: int32 + minimum: 0 + example: 5 + description: Description rate value + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + service: + type: integer + format: int32 + minimum: 0 + example: 5 + description: Service rate value + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + Reference: + type: object + properties: + id: + type: string + SalesQualityHistoryResponse: + type: object + required: + - quality + properties: + quality: + type: array + items: + $ref: '#/components/schemas/SalesQualityForDay' + description: At most 30 day sales quality history, if seller doesn't have sales quality for given day, it won't be present in `quality` array. + SalesQualityForDay: + type: object + required: + - resultFor + - score + - grade + - maxScore + - metrics + properties: + resultFor: + type: string + format: date + description: Date for which the result is calculated. + example: "2024-08-07" + score: + type: number + format: int + description: The total score for the given day. + example: 140 + grade: + type: string + description: The main sales quality level for the given day. + example: "GOOD" + maxScore: + type: number + format: int + description: The maximum possible total score for the given day. + example: 500 + metrics: + type: array + items: + $ref: '#/components/schemas/SalesQualityMetric' + SalesQualityMetric: + type: object + required: + - code + - name + - score + properties: + code: + type: string + description: The code name of the metric. + example: "BUYER_SATISFACTION" + name: + type: string + description: Translated name of the metric. + example: "Zadowolenie kupujących" + score: + type: number + format: int + description: The score for the given metric. + example: 20 + maxScore: + type: number + format: int + description: The maximum possible score for the given metric. + example: 50 + Removal: + type: object + required: + - possibleTo + properties: + possibleTo: + type: string + example: '2017-05-17T08:36:57.292Z' + description: Date until a removal request can be submitted in ISO 8601 format + request: + $ref: '#/components/schemas/RemovalRequest' + RemovalRequest: + type: object + description: 'Submitted removal request, null if removal was not requested' + required: + - createdAt + - message + properties: + createdAt: + type: string + example: '2017-05-17T08:36:57.292Z' + description: Removal request creation datetime in ISO 8601 format + message: + type: string + description: Message containing explanation for removing rating + source: + type: string + enum: + - SELLER + - ADMIN + description: Message containing information who requested removing of a rating + example: "SELLER" + UserRatingRemovalRequest: + type: object + required: + - request + properties: + request: + type: object + required: + - message + properties: + message: + type: string + description: 'Message containing explanation for removing rating.' + maxLength: 500 + SearchResult: + properties: + posList: + type: array + items: + $ref: '#/components/schemas/Pos' + Seller: + type: object + required: + - id + properties: + id: + type: string + CreateOfferBundleDTO: + type: object + required: + - offers + properties: + offers: + description: Offers that will make up the bundle. + type: array + items: + $ref: '#/components/schemas/BundledOfferDTO' + discounts: + description: Discounts on marketplaces. Can be null or empty if bundle shouldn't have discount on any marketplace. + nullable: true + type: array + items: + $ref: '#/components/schemas/BundleDiscountDTO' + BundledOfferDTO: + type: object + required: + - id + - requiredQuantity + - entryPoint + properties: + id: + description: Offer ID + type: string + example: '123456789' + requiredQuantity: + description: How many units of this offer will be in bundle. + type: integer + example: 1 + entryPoint: + description: Set if bundle should be shown on offer page. + type: boolean + example: true + BundleDiscountDTO: + type: object + required: + - marketplace + - amount + - currency + properties: + marketplace: + $ref: '#/components/schemas/BundleMarketplaceDTO' + amount: + description: Discount value. + type: string + example: '10.15' + currency: + description: Discount currency as a 3-letter code in accordance with ISO 4217 standard. Has to be in base currency of specified marketplace. + type: string + example: 'PLN' + OfferBundleDTO: + type: object + required: + - id + - offers + - publication + - discounts + - createdAt + - createdBy + properties: + id: + description: Bundle ID. + type: string + example: 'a42d09c2-2669-4e7c-989b-7c341e84f787' + offers: + description: Offers included in bundle. + type: array + items: + $ref: '#/components/schemas/BundledOfferDTO' + publication: + description: Bundle status on each marketplace. + required: + - marketplace + - status + properties: + marketplace: + $ref: '#/components/schemas/BundleMarketplaceDTO' + status: + description: Bundle's status. + type: string + enum: + - ACTIVE + - SUSPENDED + example: 'ACTIVE' + discounts: + description: Discounts on marketplaces. + nullable: true + type: array + items: + $ref: '#/components/schemas/BundleDiscountDTO' + createdAt: + description: When this bundle was created in ISO_8601 format. + type: string + format: date-time + example: '2023-05-01T10:12:32.321Z' + createdBy: + description: >- + Who created this bundle. It is set to: +
    +
  • `USER` for all bundles created by seller on Allegro web page or via public API;
  • +
  • `ALLEGRO` when bundle was created automatically by Allegro.
  • +
+ type: string + enum: + - USER + - ALLEGRO + example: 'USER' + OfferBundlesDTO: + type: object + required: + - bundles + properties: + bundles: + description: Seller's bundles. + type: array + items: + $ref: '#/components/schemas/OfferBundleDTO' + nextPage: + description: Next page information. + type: object + required: + - id + properties: + id: + description: Next page ID. + type: string + example: 'MjAyNC0wOS0xMFQwNjo0OTowMi40NTBa' + BundleMarketplaceDTO: + type: object + required: + - id + properties: + id: + description: Marketplace ID. Available marketplaces can be determined using GET /marketplaces. + type: string + example: 'allegro-pl' + UpdateOfferBundleDiscountDTO: + type: object + properties: + discounts: + description: Discounts on marketplaces. Can be null or empty if bundle shouldn't have discount on any marketplace. + nullable: true + type: array + items: + $ref: '#/components/schemas/BundleDiscountDTO' + SellerCreateRebateRequestDto: + type: object + required: + - benefits + - offerCriteria + properties: + benefits: + description: What kind of rebate will be given + type: array + items: + $ref: '#/components/schemas/Benefit' + offerCriteria: + description: What offers will be included + type: array + items: + $ref: '#/components/schemas/SellerRebateOfferCriterion' + SellerRebateDto: + type: object + required: + - benefits + - id + - offerCriteria + - status + properties: + benefits: + description: What kind of rebate will be given + type: array + items: + $ref: '#/components/schemas/Benefit' + createdAt: + type: string + description: when was this rebate created + format: date-time + example: '2019-05-01T10:12:32.321Z' + id: + type: string + description: Rebate identifier + example: '7c9a76d3-9fd0-4d13-a4ce-5d49bec12c79' + offerCriteria: + description: What offers will be included + type: array + items: + $ref: '#/components/schemas/SellerRebateOfferCriterion' + status: + type: string + enum: + - ACTIVE + - INACTIVE + - SUSPENDED + SellerRebatesDto: + type: object + required: + - promotions + - totalCount + properties: + promotions: + type: array + items: + $ref: '#/components/schemas/SellerRebateDto' + totalCount: + type: integer + format: int64 + minimum: 0 + ShippingRate: + type: object + properties: + deliveryMethod: + type: object + properties: + id: + type: string + description: ID of the delivery method + maxQuantityPerPackage: + type: integer + description: >- + Maximum quantity per package for the given delivery + method. Minimum value is 1. + minimum: 1 + maxPackageWeight: + type: object + description: >- + Maximum weight of a package for the given delivery + method (allowed only for methods with shippingRatesConstraints.maxPackageWeight.supported set to true in the delivery-methods resource). + If not set, only maxQuantityPerPackage will be used to calculate the number of packages. + Please note that the weight value must be the same for both related delivery methods, i.e. with `IN_ADVANCE` and `CASH_ON_DELIVERY` payment policy if both methods are in the shipping rates set. + properties: + value: + type: string + description: Weight value with an accuracy of three decimal places. + unit: + type: string + nullable: true + description: Weight unit. Currently only `KILOGRAM` is supported. + firstItemRate: + type: object + description: >- + Rate for the first item in the parcel for the given delivery method. + The rate amount and currency must comply with the shippingRatesConstraints.firstItemRate restrictions described in the delivery-methods resource. + properties: + amount: + type: string + description: Amount + currency: + type: string + description: ISO 4217 currency code + nextItemRate: + type: object + description: >- + Rate for every other item, after the first, in the same parcel for the given delivery method. + The rate amount and currency must comply with the shippingRatesConstraints.nextItemRate restrictions described in the delivery-methods resource. + properties: + amount: + type: string + description: Amount + currency: + type: string + description: ISO 4217 currency code + shippingTime: + type: object + description: >- + Custom shipping time for the given delivery method (allowed only for methods with shippingRatesConstraints.shippingTime.customizable set to true in the delivery-methods resource). + If not set the default shipping time specified in the delivery-methods resource is used. + properties: + from: + type: string + description: 'ISO 8601 duration format, e.g. P3D for 3 days' + to: + type: string + description: 'ISO 8601 duration format, e.g. P3D for 3 days' + required: + - deliveryMethod + - firstItemRate + - maxQuantityPerPackage + - nextItemRate + ShippingRates: + type: object + properties: + id: + type: string + description: Id of shipping rates + OfferShippingRates: + type: object + properties: + rates: + type: array + description: >- + If empty there is the shipping rates set attached to offer. + You should use the GET /sale/offers/{offerId} resource to retrieve the shipping rates set ID. + items: + $ref: '#/components/schemas/ShippingRate' + ShippingRatesSet: + type: object + properties: + id: + type: string + description: >- + Shipping rates set ID (UUID) + When creating a shipping rates set (Post) the field is ignored. + It is required when updating (Put) a shipping rates. + name: + type: string + minLength: 1 + maxLength: 64 + description: >- + User defined name of the shipping rates set. + It may only contain: letters, numbers, hyphens, dots, commas and spaces. + rates: + type: array + items: + $ref: '#/components/schemas/ShippingRate' + lastModified: + type: string + description: >- + Date and time of the last modification of the set in UTC + ISO 8601 format. + When creating (Post) or updating (Put) a shipping rates set the field is ignored. + required: + - rates + DeliverySettingsResponse: + type: object + properties: + marketplace: + type: object + description: Marketplace for which delivery settings were returned. + properties: + id: + type: string + description: Marketplace id + example: 'allegro-pl' + required: + - id + freeDelivery: + type: object + description: A minimum total order amount required to qualify for free domestic delivery (for example for allegro-cz marketplace, only Czechia is treated as domestic). + properties: + amount: + type: string + description: The amount provided in a string format to avoid rounding errors. + example: '123.45' + currency: + type: string + format: ISO 4217 + description: ISO 4217 currency code. Currency code depends on marketplace, e.g. PLN for allegro-pl, CZK for allegro-cz. + example: 'PLN' + required: + - amount + - currency + abroadFreeDelivery: + type: object + description: A minimum total order amount required to qualify for free foreign delivery (for example for allegro-cz marketplace, all delivery countries other than Czechia are treated as foreign). + properties: + amount: + type: string + description: The amount provided in a string format to avoid rounding errors. + example: '900.12' + currency: + type: string + format: ISO 4217 + description: ISO 4217 currency code. Currency code depends on marketplace, e.g. PLN for allegro-pl, CZK for allegro-cz. + example: 'PLN' + required: + - amount + - currency + joinPolicy: + type: object + description: Policy of calculating delivery costs. + properties: + strategy: + type: string + description: >- + Strategy used to calculate delivery cost for items from offers with different delivery costs. + + The possible values: + * `MAX` - The buyer will pay for the most expensive delivery + * `MIN` - The buyer will pay for the cheapest delivery + * `SUM` - Items will be sent in separate parcels and delivery costs will be sum of delivery costs for each item. + enum: + - MIN + - MAX + - SUM + required: + - strategy + customCost: + description: Policy of custom delivery cost. + type: object + properties: + allowed: + type: boolean + example: false + description: >- + If true the customer can enter a custom shipping cost. + required: + - allowed + updatedAt: + type: string + description: >- + Date and time of the last modification of the set in UTC + ISO 8601 format. + required: + - marketplace + - joinPolicy + - customCost + - updatedAt + DeliverySettingsRequest: + type: object + properties: + marketplace: + type: object + description: >- + The marketplace for which delivery settings will be modified. + By default (if the marketplace parameter is not set) the marketplace on which the seller has registered is used. + However, we recommend that the marketplace parameter should always be explicitly set. + properties: + id: + type: string + description: Marketplace id + example: 'allegro-pl' + required: + - id + freeDelivery: + type: object + description: >- + A minimum total order amount required to qualify for free domestic delivery (for example for allegro-cz marketplace, only Czechia is treated as domestic). + If you do not want to set free domestic delivery threshold, do not set this value. + properties: + amount: + type: string + description: The amount provided in a string format to avoid rounding errors. + example: '123.45' + currency: + type: string + format: ISO 4217 + description: ISO 4217 currency code. The correct currency code for a given marketplace should be set, e.g. PLN for allegro-pl, CZK for allegro-cz. + example: 'PLN' + required: + - amount + - currency + abroadFreeDelivery: + type: object + description: >- + A minimum total order amount required to qualify for free foreign delivery (for example for allegro-cz marketplace, all delivery countries other than Czechia are treated as foreign). + If you do not want to set free foreign delivery threshold, do not set this value. + properties: + amount: + type: string + description: The amount provided in a string format to avoid rounding errors. + example: '900.12' + currency: + type: string + format: ISO 4217 + description: ISO 4217 currency code. The correct currency code for a given marketplace should be set, e.g. PLN for allegro-pl, CZK for allegro-cz. + example: 'PLN' + required: + - amount + - currency + joinPolicy: + type: object + description: Policy of calculating delivery costs. + properties: + strategy: + type: string + description: >- + Strategy used to calculate delivery cost for items from offers with different delivery costs. + + The possible values: + * `MAX` - The buyer will pay for the most expensive delivery + * `MIN` - The buyer will pay for the cheapest delivery + * `SUM` - Items will be sent in separate parcels and delivery costs will be sum of delivery costs for each item. + enum: + - MIN + - MAX + - SUM + required: + - strategy + customCost: + description: Policy of custom delivery cost. + type: object + properties: + allowed: + type: boolean + example: false + description: >- + If true the customer can enter a custom shipping cost. + required: + - allowed + required: + - joinPolicy + - customCost + StandardizedDescription: + type: object + description: The description section cannot have more than 40000 bytes in length. + properties: + sections: + type: array + items: + $ref: '#/components/schemas/DescriptionSection' + Discounts: + type: object + properties: + wholesalePriceList: + type: object + properties: + id: + type: string + description: Wholesale price list id + example: "5637592a-0a24-4771-b527-d89b2767d821" + Stock: + type: object + properties: + available: + type: integer + description: >- + Quantity of this offer available for sale - how many times this offer can be sold. + Offer can be activated only with stock being greater then 0. + Setting this quantity to 0 for 'ACTIVE' or 'ACTIVATING' offer will trigger changing its status to 'ENDED'. + format: int32 + minimum: 0 + example: 99 + unit: + type: string + description: 'Stock unit' + enum: + - UNIT + - PAIR + - SET + TaskCount: + type: object + properties: + failed: + type: integer + format: int32 + minimum: 0 + description: Current number of failed offers updates + success: + type: integer + format: int32 + minimum: 0 + description: Current number of success offers updates + total: + type: integer + format: int32 + minimum: 0 + description: Total number of scheduled offers updates + description: Offers updates summary + TaskReport: + type: object + properties: + tasks: + type: array + description: List of task results + items: + $ref: '#/components/schemas/CommandTask' + description: Contains list of task results + UUID: + type: string + format: uuid + description: >- + Universally Unique Identifier (UUID) generated by you that can be used + to enforce idempotency. UUID specification: + http://www.ietf.org/rfc/rfc4122.txt + User: + type: object + required: + - id + - login + properties: + id: + type: string + description: Buyer id + login: + type: string + description: Buyer's login + UserRating: + type: object + required: + - buyer + - createdAt + - id + - recommended + properties: + answer: + $ref: '#/components/schemas/Answer' + buyer: + $ref: '#/components/schemas/User' + comment: + type: string + description: Buyer's text comment + createdAt: + type: string + example: '2017-05-17T08:36:57.292Z' + description: Creation datetime in ISO 8601 format + editedAt: + type: string + example: '2017-05-19T08:36:57.292Z' + description: Edition datetime in ISO 8601 format + excludedFromAverageRates: + type: boolean + example: false + description: >- + If true this rating was not included in calculating average user + rates + excludedFromAverageRatesReason: + type: string + example: 'Rating not unique' + description: >- + The reason why the rating was excluded from calculating average user rates. + The message is translated based on the value of the "Accept-Language" header and exists only when the rating was excluded. + id: + type: string + description: Rating id + lastChangedAt: + type: string + example: '2017-05-19T08:36:57.292Z' + description: Last change (creation or latest edition) datetime in ISO 8601 format + order: + $ref: '#/components/schemas/Order' + rates: + $ref: '#/components/schemas/Rates' + recommended: + type: boolean + example: false + description: Whether buyer recommends the order + removal: + $ref: '#/components/schemas/Removal' + UserRatingListResponse: + type: object + required: + - ratings + properties: + ratings: + type: array + description: >- + List of ratings that match requested filter. Empty when no rating + matched. + items: + $ref: '#/components/schemas/UserRating' + UserRatingVBeta1: + type: object + required: + - buyer + - createdAt + - id + - order + - recommended + properties: + answer: + $ref: '#/components/schemas/AnswerVBeta1' + buyer: + $ref: '#/components/schemas/User' + comment: + $ref: '#/components/schemas/CommentVBeta1' + createdAt: + type: string + example: '2025-05-17T08:36:57.292Z' + description: Creation datetime in ISO 8601 format + editedAt: + type: string + example: '2025-05-19T08:36:57.292Z' + description: Edition datetime in ISO 8601 format + exclusion: + $ref: '#/components/schemas/Exclusion' + id: + type: string + description: Rating id + justifications: + type: array + description: >- + List of the justifications chosen by the buyer while creating rating + items: + $ref: '#/components/schemas/Justification' + lastChangedAt: + type: string + example: '2025-05-19T08:36:57.292Z' + description: Last change (creation or latest edition) datetime in ISO 8601 format + order: + $ref: '#/components/schemas/Order' + recommended: + type: boolean + example: false + description: Whether buyer recommends the order + removal: + $ref: '#/components/schemas/Removal' + UserRatingListResponseVBeta1: + type: object + required: + - ratings + properties: + ratings: + type: array + description: >- + List of ratings that match requested filter. Empty when no rating + matched. + items: + $ref: '#/components/schemas/UserRatingVBeta1' + UserRatingSummaryResponse: + type: object + required: + - notRecommended + - recommended + - recommendedPercentage + properties: + averageRates: + $ref: '#/components/schemas/AverageRates' + notRecommended: + description: Summary of data concerning users that do not recommend the seller. + type: object + required: + - total + - unique + properties: + total: + type: integer + format: int64 + minimum: 0 + example: 100 + description: Total number of negative feedbacks received. + unique: + type: integer + format: int64 + minimum: 0 + example: 80 + description: Number of unique users. + recommended: + description: Summary of data concerning users that recommend the seller. + type: object + required: + - total + - unique + properties: + total: + type: integer + format: int64 + minimum: 0 + example: 100 + description: Total number of positive feedbacks received. + unique: + type: integer + format: int64 + minimum: 0 + example: 75 + description: Number of unique users. + recommendedPercentage: + type: string + example: '99,8' + description: Percentage of unique buyers recommending the seller. + UserRatingSummaryResponseV2: + type: object + required: + - user + properties: + recommended: + type: object + required: + - unique + - total + description: Summary of data concerning users that recommend the seller. + properties: + unique: + type: integer + format: int64 + minimum: 0 + example: 80 + description: Number of recommending unique users. + total: + type: integer + format: int64 + minimum: 0 + example: 100 + description: Total number of positive feedbacks received. + notRecommended: + type: object + required: + - unique + - total + description: Summary of data concerning users that do not recommend the seller. + properties: + unique: + type: integer + format: int64 + minimum: 0 + example: 80 + description: Number of not recommending unique users. + total: + type: integer + format: int64 + minimum: 0 + example: 100 + description: Total number of negative feedbacks received. + recommendedPercentage: + type: string + example: '99,8' + description: Percentage of unique buyers recommending the seller. + statistics: + type: object + required: + - received + - excluded + - removed + description: Summary of ratings statistics. + properties: + received: + type: object + required: + - total + description: Summary of received ratings. + properties: + total: + type: integer + format: int64 + description: Total number of received ratings. + minimum: 0 + example: 150 + excluded: + type: object + required: + - total + description: Summary of excluded ratings. + properties: + total: + type: integer + format: int64 + description: Total number of excluded ratings. + minimum: 0 + example: 10 + removed: + type: object + required: + - total + - byAdmin + - byBuyer + - byBuyerDueToCompensation + description: Summary of removed ratings. + properties: + total: + type: integer + format: int64 + description: Total number of removed ratings. + minimum: 0 + example: 5 + byAdmin: + type: integer + format: int64 + description: Number of ratings removed by admin. + minimum: 0 + example: 2 + byBuyer: + type: integer + format: int64 + description: Number of ratings removed by buyer. + minimum: 0 + example: 2 + byBuyerDueToCompensation: + type: integer + format: int64 + description: Number of ratings removed by buyer due to compensation. + minimum: 0 + example: 1 + user: + type: object + required: + - numberOfProductsSoldWithin30Days + - createdAt + description: Information about the user. + properties: + numberOfProductsSoldWithin30Days: + type: integer + format: int64 + description: Number of products sold by the user within the last 30 days. + minimum: 0 + example: 120 + createdAt: + type: string + format: date + description: The date when the user account was created. + example: '2023-01-15' + Validation: + type: object + required: + - errors + properties: + errors: + type: array + items: + $ref: '#/components/schemas/ValidationError' + warnings: + type: array + items: + $ref: '#/components/schemas/ValidationWarning' + validatedAt: + type: string + format: date-time + ValidationError: + type: object + properties: + code: + type: string + details: + type: string + message: + type: string + path: + type: string + nullable: true + userMessage: + type: string + metadata: + type: object + additionalProperties: + type: string + description: >- + Additional technical properties of this error. Set of possible keys depends on the specific error. + example: { "productId": "13232515" } + # DEVELOPMENT HINT + # When adding a new metadata field, add a table to respective error response description. + # See Response 422 of PATCH /sale/product-offers/{offerId} for real-life example + # Preferred table format: + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + #
Error metadata fields
Error codeMetadata keyDescription
PARAMETER_MISMATCHproductIdID of an existing product that was matched to your request, but has parameter differences
parameterIdID of problematic parameter
+ ValidationWarning: + type: object + properties: + code: + type: string + details: + type: string + message: + type: string + path: + type: string + nullable: true + userMessage: + type: string + metadata: + type: object + additionalProperties: + type: string + description: >- + Additional technical properties of this error. Set of possible keys depends on the specific error. + example: { "productId": "13232515" } + # DEVELOPMENT HINT + # When adding a new metadata field, add a table to respective error response description. + # See Response 422 of PATCH /sale/product-offers/{offerId} for real-life example + # Preferred table format: + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + #
Error metadata fields
Error codeMetadata keyDescription
PARAMETER_MISMATCHproductIdID of an existing product that was matched to your request, but has parameter differences
parameterIdID of problematic parameter
+ WarrantyBasic: + type: object + properties: + id: + type: string + name: + type: string + Describes_listing_fee: + type: object + required: + - fee + - name + - type + - cycleDuration + properties: + fee: + $ref: '#/components/schemas/Fee' + name: + type: string + type: + type: string + cycleDuration: + type: string + example: "PT240H" + description: Pricing cycle duration, ISO 8601 duration format + Describes_success_commission_fee: + type: object + required: + - fee + - name + - type + properties: + fee: + $ref: '#/components/schemas/Fee' + name: + type: string + type: + type: string + ImpliedWarrantiesList_ImpliedWarrantyBasic_: + type: object + properties: + count: + type: integer + format: int32 + minimum: 0 + impliedWarranties: + type: array + items: + $ref: '#/components/schemas/ImpliedWarrantyBasic' + ParametersForPreviewPrice: + type: object + required: + - category + - unitPrice + properties: + category: + $ref: '#/components/schemas/Category' + condition: + type: string + description: 'Offer condition, if is new, used or other.' + enum: + - NEW + - USED + - OTHER + duration: + type: string + enum: + - PT72H + - PT120H + - PT168H + - PT240H + - PT336H + - PT480H + - PT720H + hasAnyQuantity: + type: boolean + numberOfBigPhotos: + type: integer + format: int32 + minimum: 0 + description: 'If set, minimum value 0' + numberOfPhotos: + type: integer + format: int32 + minimum: 0 + description: 'If set, minimum value 0' + quantity: + type: integer + format: int32 + minimum: 1 + description: 'Quantity of items to be sold. If set, minimum value 1' + shop: + type: boolean + example: false + description: >- + Deprecated. Value 'true' sets the 'offer.type' field to 'shop', + value 'false' to 'offer'. This field is ignored if 'offer.type' + field is set. + soldQuantity: + type: integer + format: int32 + minimum: 0 + description: >- + Quantity of sold items. Relates to commission success fee. If set, + minimum value 1 + type: + type: string + description: >- + Offer type. 'type' or 'shop' fields must be provided. Takes + precedence over 'shop' field. **Note:** if type = 'advertisement' then + either 'quantity' or 'soldQuantity' field must be set. + enum: + - shop + - offer + - advertisement + unitPrice: + type: number + minimum: 0 + bold: + type: boolean + highlight: + type: boolean + departmentPage: + type: boolean + emphasized: + type: boolean + emphasizedHighlightBoldPackage: + type: boolean + multiVariant: + type: boolean + Publication_modification: + type: object + properties: + action: + type: string + description: Action to perform + enum: + - ACTIVATE + - END + scheduledFor: + type: string + format: date-time + description: >- + Date and time for scheduling ACTIVATE action, will be ignored for + another actions + description: Contains publication's fields to change + ReturnPoliciesList_ReturnPolicy_: + type: object + properties: + count: + type: integer + format: int32 + minimum: 0 + returnPolicies: + type: array + items: + $ref: '#/components/schemas/ReturnPolicyResponse' + WarrantiesList_WarrantyBasic_: + type: object + properties: + count: + type: integer + format: int32 + minimum: 0 + warranties: + type: array + items: + $ref: '#/components/schemas/WarrantyBasic' + Wrapper_type_for_preview_conditions: + type: object + properties: + includeQuotingBundles: + type: boolean + example: false + description: >- + Include in calculation user's active bundles which allow to publish + for free offer or use for free promotion options. + offer: + $ref: >- + #/components/schemas/ParametersForPreviewPrice + Wraps_listing_and_commissions_fees: + type: object + required: + - commissions + - quotes + properties: + commissions: + type: array + items: + $ref: '#/components/schemas/Describes_success_commission_fee' + quotes: + type: array + items: + $ref: '#/components/schemas/Describes_listing_fee' + VariantSet: + type: object + required: + - offers + - name + - parameters + properties: + offers: + type: array + items: + $ref: '#/components/schemas/VariantSet_Offer' + name: + type: string + maxLength: 75 + parameters: + type: array + items: + $ref: '#/components/schemas/VariantSet_Parameter' + VariantSetResponse: + allOf: + - type: object + properties: + id: + type: string + - $ref: '#/components/schemas/VariantSet' + VariantSet_Offer: + type: object + required: + - id + properties: + id: + type: string + colorPattern: + type: string + maxLength: 50 + description: >- + Label that allows to group variants via image. All variants having the same image should have identical identifier in this field. + VariantSet_Parameter: + type: object + required: + - id + properties: + id: + type: string + VariantSets: + type: object + properties: + count: + type: integer + minimum: 0 + description: Total number of variant sets matching the query. + offerVariants: + type: array + items: + $ref: '#/components/schemas/VariantSets_VariantSet' + example: + count: 10 + offerVariants: + - id: 459fd49f-461f-4230-b22a-daff449b8548 + name: t-shirts + - id: 70e6effe-7ae6-45f6-8566-80867f466d0a + name: shoes + VariantSets_VariantSet: + type: object + properties: + id: + type: string + description: Variant set id. + name: + type: string + description: Variant set name. + ListingOffer: + type: object + properties: + id: + type: string + description: The offer ID. + example: "2865624934" + name: + type: string + description: The title of the offer. + example: Buty damskie adidas + seller: + $ref: '#/components/schemas/OfferSeller' + promotion: + $ref: '#/components/schemas/OfferPromotion' + delivery: + $ref: '#/components/schemas/OfferDelivery' + images: + type: array + description: >- + The gallery of images. Only the URL of the original sized image is provided. + The first image represents the thumbnail image used on listing. + items: + $ref: '#/components/schemas/OfferImages' + sellingMode: + $ref: '#/components/schemas/OfferSellingMode' + stock: + $ref: '#/components/schemas/OfferStock' + vendor: + $ref: '#/components/schemas/OfferVendor' + category: + $ref: '#/components/schemas/OfferCategory' + publication: + $ref: '#/components/schemas/OfferPublication' + ListingCategoryWithCount: + type: object + properties: + id: + type: string + description: The category ID. + example: "257929" + name: + type: string + description: The category name. + example: Sportowe + count: + type: integer + example: 123 + minimum: 0 + description: Results count in this category. + ListingCategory: + type: object + properties: + id: + type: string + description: The Category ID. + example: "257929" + name: + type: string + description: The category name. + example: Sportowe + ListingResponse: + type: object + properties: + items: + $ref: '#/components/schemas/ListingResponseOffers' + categories: + $ref: '#/components/schemas/ListingResponseCategories' + filters: + type: array + description: >- + An array of filters with counters available for given search. This can be used + to refine the search results. + items: + $ref: '#/components/schemas/ListingResponseFilters' + searchMeta: + $ref: '#/components/schemas/ListingResponseSearchMeta' + sort: + type: array + description: Available sorting options. + items: + $ref: '#/components/schemas/ListingResponseSort' + OfferSeller: + properties: + id: + type: string + description: The seller ID. + example: "41846511" + login: + type: string + description: The seller login. + example: "myLogin" + company: + type: boolean + description: Indicates whether the seller represents a registered business. + superSeller: + type: boolean + description: Indicates whether the seller has the "Super Sprzedawca" status. + description: Information about the seller. + OfferStock: + properties: + unit: + type: string + enum: + - UNIT + - PAIR + - SET + description: The unit type of the stock. + available: + type: integer + minimum: 0 + description: The available stock value. + example: 23 + description: Information about the stock. + OfferPromotion: + properties: + emphasized: + type: boolean + description: Indicates whether the offer is promoted. + bold: + type: boolean + description: Indicates whether the offer has bold title option. + highlight: + type: boolean + description: Indicates whether the offer has highlight option. + description: Information about promotion options for the item. + OfferLowestPrice: + properties: + amount: + type: string + description: The amount provided in a string format to avoid rounding errors. + example: '123.45' + currency: + type: string + format: ISO 4217 + description: The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + example: 'PLN' + description: >- + The lowest shipping cost available. Lack of this entity means that the offer has no + shipping options (i.e. it is an advertisement or an offer with electronic delivery + only). + OfferPrice: + properties: + amount: + type: string + description: The amount provided in a string format to avoid rounding errors. + example: '123.45' + currency: + type: string + format: ISO 4217 + description: The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + example: 'PLN' + description: >- + The price of the offer. It is the buy now price for *BUY_NOW* selling format and + current auction price for *AUCTION* format. + OfferFixedPrice: + properties: + amount: + type: string + description: The amount provided in a string format to avoid rounding errors. + example: '123.45' + currency: + type: string + format: ISO 4217 + description: The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). + example: 'PLN' + description: >- + Fixed (buy now) price of the offer in case of *AUCTION* selling format + with buy now option enabled. + OfferDelivery: + properties: + availableForFree: + type: boolean + description: Indicates whether the offer has free shipping option. + lowestPrice: + $ref: '#/components/schemas/OfferLowestPrice' + description: Information about shipping options for the offer. + OfferImages: + properties: + url: + type: string + description: The URL of the original sized image. + example: https://a.allegroimg.com/original/0129e7/f15ce8924166850eec3fb82bcd5s/BUTY-ADIDAS-DAMSKIE + OfferSellingMode: + properties: + format: + $ref: '#/components/schemas/SellingModeFormat' + price: + $ref: '#/components/schemas/OfferPrice' + fixedPrice: + $ref: '#/components/schemas/OfferFixedPrice' + popularity: + type: integer + minimum: 0 + description: Lower bound of popularity range of the offer for *BUY_NOW* selling format. + example: 51 + popularityRange: + type: string + description: >- + Popularity ranges of the offer for *BUY_NOW* selling format. + Possible values: 0, [1-5], [6-10], [11-20], [21-50], [51-100] and [101+] + example: "[51-100]" + bidCount: + type: integer + minimum: 0 + description: Number of bidders for *AUCTION* selling format. + example: 12 + description: This section describes the selling format and prices. + OfferVendor: + properties: + id: + type: string + enum: + - CHARYTATYWNI_ALLEGRO + - ALLEGRO_LOKALNIE + - MORIZON + - EBILET + - GRATKA + description: Identifier of the external service. + url: + type: string + description: URL to the web page of the offer. + example: https://charytatywni.allegro.pl/oferta-charytatywna-i1234567 + description: This section is available only for the charity, allegrolokalnie.pl, morizon.pl and ebilet.pl offers. + OfferPublication: + properties: + endingAt: + type: string + format: ISO 8601 + description: Publication ending date and time in UTC. + example: "2019-05-15T18:09:41.000Z" + description: >- + This section is available only for offers with a defined end of + publication. + ListingResponseOffers: + properties: + promoted: + type: array + description: List of promoted offers. + items: + $ref: '#/components/schemas/ListingOffer' + regular: + type: array + description: List of regular (non-promoted) offers. + items: + $ref: '#/components/schemas/ListingOffer' + description: The lists of search results. + ListingResponseCategories: + properties: + subcategories: + type: array + description: >- + Categories with counters, which can be used to refine search + results. + items: + $ref: '#/components/schemas/ListingCategoryWithCount' + path: + type: array + description: Categories path to the current listing category (breadcrumbs). + items: + $ref: '#/components/schemas/ListingCategory' + description: Information about categories. + ListingResponseFiltersValues: + properties: + name: + type: string + description: >- + Name of the option; + for NUMERIC parameters - word indicating start or end of range (i.e. *from*, *to*). + example: raty zero + value: + type: string + description: >- + Filter value. Should be used as query parameter value in the + request. This can be: + + - for MULTI and SINGLE parameters - a value identifier (e.g. KUJAWSKO_POMORSKIE option in location.province + filter), + - for other types - a value entered by user. + example: INSTALLMENTS_ZERO + idSuffix: + type: string + description: Suffix used as a second part of query parameter name to be used in the request + (the first part is the filter ID). Applicable for NUMERIC values only. + example: .to + count: + type: integer + description: Number of search results matching this filter value. + example: 123 + minimum: 0 + selected: + type: boolean + description: Indicates whether this filter value was used in the current request. + ListingResponseFilters: + properties: + id: + type: string + description: Identifier of the filter. Should be used as query parameter key, + optionally followed by idSuffix from parameter value (only for NUMERIC filters). + example: campaign + type: + type: string + enum: + - MULTI + - SINGLE + - NUMERIC + - NUMERIC_SINGLE + - TEXT + description: >- + The type of the filter: + + - *MULTI* - multiple choice filter, + - *SINGLE* - single select (dropdown) filter, + - *NUMERIC* - range of numeric values (search offers with value matching this range), + - *NUMERIC_SINGLE* - single numeric value (search offers with given value matching the range defined in offer), + - *TEXT* - filter allowing user to input any text. + name: + type: string + description: Name of the filter. + example: kampania + values: + type: array + description: Available filter values. + items: + $ref: '#/components/schemas/ListingResponseFiltersValues' + minValue: + type: number + description: Minimum valid value for filters of type NUMERIC. + example: 0 + maxValue: + type: number + description: Maximum valid value for filters of type NUMERIC. + example: 1000 + unit: + type: string + description: Unit of the NUMERIC/NUMERIC_SINGLE filter. + example: "zł" + ListingResponseSearchMeta: + properties: + availableCount: + type: integer + minimum: 0 + description: >- + The number of results available for navigation. If this number is less + than total count, the search criteria (categories, filters, etc.) should + be narrowed down to make all results available. + example: 6000 + totalCount: + type: integer + minimum: 0 + description: The total number of search results with given parameters. + example: 319203 + fallback: + type: boolean + description: >- + Indicates whether the search fallback was used. If true, no items + matching exact given phrase were found and related items are + presented. + description: Search metadata. + ListingResponseSort: + properties: + value: + type: string + description: The query parameter value which should be used for this sorting option. + example: -relevance + name: + type: string + description: The sorting option name in Polish. + example: trafność + order: + type: string + description: The order label in Polish specifying ascending or descending mode. + example: największa + selected: + type: boolean + description: Indicates whether this sorting option was used in the current request. + description: Available sort options. + OfferAdditionalServices: + type: object + description: The definition of the additional services assigned to the offer. + properties: + id: + type: string + format: uuid + description: The ID of the additional services definition. + example: 09f0b4cc-7880-11e9-8f9e-2a86e4085a59 + OffersSearchResultDto: + type: object + properties: + offers: + type: array + description: The list of seller's offers matching the request's criteria. + items: + $ref: '#/components/schemas/OfferListingDto' + count: + type: integer + minimum: 0 + description: Number of offers in the search result. + example: 1 + totalCount: + type: integer + minimum: 0 + description: The total number of offers matching the request's criteria. + example: 1234 + OfferListingDto: + type: object + description: An offer. + properties: + id: + type: string + description: The offer ID. + example: "2865624934" + name: + type: string + description: The title of the offer. + example: Buty damskie adidas + category: + $ref: '#/components/schemas/OfferCategory' + primaryImage: + $ref: '#/components/schemas/OfferListingDtoImage' + sellingMode: + $ref: '#/components/schemas/OfferListingDtoV1SellingMode' + saleInfo: + $ref: '#/components/schemas/OfferListingDtoV1SaleInfo' + stock: + $ref: '#/components/schemas/OfferListingDtoV1Stock' + stats: + $ref: '#/components/schemas/OfferListingDtoV1Stats' + publication: + $ref: '#/components/schemas/OfferListingDtoV1Publication' + afterSalesServices: + $ref: '#/components/schemas/AfterSalesServices' + additionalServices: + $ref: '#/components/schemas/OfferAdditionalServices' + external: + $ref: '#/components/schemas/ExternalId' + delivery: + $ref: '#/components/schemas/OfferListingDtoV1Delivery' + b2b: + $ref: '#/components/schemas/OfferListingDtoV1B2b' + fundraisingCampaign: + $ref: '#/components/schemas/JustId' + additionalMarketplaces: + $ref: '#/components/schemas/OfferListingDtoV1AdditionalMarketplaces' + OfferListingDtoImage: + type: object + description: The image used as a thumbnail on the listings. + properties: + url: + type: string + description: The url to the image in its original size. + example: https://a.allegroimg.com/original/05a2af/929c6dae4fb8721a8539582eb421 + SellingMode: + type: object + description: Information on the offer's selling mode. + properties: + format: + $ref: '#/components/schemas/SellingModeFormat' + price: + $ref: '#/components/schemas/BuyNowPrice' + minimalPrice: + $ref: '#/components/schemas/MinimalPrice' + startingPrice: + $ref: '#/components/schemas/StartingPrice' + SellingModeWithNetPrice: + type: object + description: Information on the offer's selling mode. + properties: + format: + $ref: '#/components/schemas/SellingModeFormat' + price: + $ref: '#/components/schemas/BuyNowPrice' + minimalPrice: + $ref: '#/components/schemas/MinimalPrice' + startingPrice: + $ref: '#/components/schemas/StartingPrice' + netPrice: + $ref: '#/components/schemas/NetPrice' + BuyNowPrice: + allOf: + - $ref: '#/components/schemas/Price' + description: The buy now or advertisement price (depending on the offer's format). + MinimalPrice: + allOf: + - $ref: '#/components/schemas/Price' + description: The minimal price for offers in auction format. + StartingPrice: + allOf: + - $ref: '#/components/schemas/Price' + description: The starting price for offers in auction format. + NetPrice: + allOf: + - $ref: '#/components/schemas/Price' + description: >- + The buy now net price computed based on tax. + Provided for informational purposes only - ignored when creating (POST) or updating (PUT). + CurrentPrice: + allOf: + - $ref: '#/components/schemas/Price' + description: The current highest bid in auction format. + MaxPrice: + allOf: + - $ref: '#/components/schemas/Price' + description: Maximum amount that user is willing to pay for the auction. + PriceAutomation: + type: object + description: The automatic pricing rule. + properties: + rule: + type: object + properties: + id: + $ref: '#/components/schemas/AutomaticPricingRuleId' + type: + allOf: + - description: >- + The field is deprecated and will be removed in the future. + To obtain rule details use the following resource with rule.id from the response. + - deprecated: true + - $ref: '#/components/schemas/AutomaticPricingRuleType' + + SellingModeFormat: + type: string + description: The selling format of the offer. + enum: + - 'BUY_NOW' + - 'AUCTION' + - 'ADVERTISEMENT' + Tax: + type: object + description: VAT tax rate. + properties: + percentage: + type: string + description: The buy now tax rate, Format 0.00. The tax is linked to the default country that corresponds to the base marketplace of this offer. + example: '23.00' + OfferTaxSettings: + type: object + required: + - rates + description: Tax settings for offer. Available settings can be found under "get all tax settings for category" resource. + properties: + rates: + type: array + description: Tax rates for offer. + items: + $ref: '#/components/schemas/OfferTaxRate' + subject: + type: string + description: The subject of taxation for offer. + example: 'GOODS' + exemption: + type: string + description: The exemption of taxation for offer. + example: 'MONEY_EQUIVALENT' + OfferTaxRate: + type: object + description: Offer tax rate for country. + properties: + rate: + type: string + description: Tax rate value. + example: '23.00' + countryCode: + type: string + description: Tax rate country code. + example: 'PL' + OfferListingDtoV1B2b: + type: object + description: Information about offer's business properties. + properties: + buyableOnlyByBusiness: + type: boolean + OfferListingDtoV1Delivery: + type: object + description: Delivery information. + properties: + shippingRates: + $ref: '#/components/schemas/ShippingRates' + OfferListingDtoV1SellingMode: + type: object + description: Information on the offer's selling mode. + properties: + format: + $ref: '#/components/schemas/SellingModeFormat' + price: + $ref: '#/components/schemas/BuyNowPrice' + priceAutomation: + $ref: '#/components/schemas/PriceAutomation' + minimalPrice: + $ref: '#/components/schemas/MinimalPrice' + startingPrice: + $ref: '#/components/schemas/StartingPrice' + OfferListingDtoV1SaleInfo: + type: object + description: Additional information about offers in auction format. + properties: + currentPrice: + $ref: '#/components/schemas/CurrentPrice' + biddersCount: + type: integer + minimum: 0 + description: The number of bidders. + example: 4 + OfferListingDtoV1Stock: + type: object + description: Information on the offer's stock. + properties: + available: + type: integer + minimum: 0 + description: The available stock value. + example: 23 + sold: + type: integer + minimum: 0 + description: The number of sold items in the last 30 days on the base marketplace. + example: 3 + OfferListingDtoV1Stats: + type: object + nullable: true + description: The offer's statistics on the base marketplace. + properties: + watchersCount: + type: integer + minimum: 0 + description: The number of users who added this offer to their watch lists. + example: 99 + visitsCount: + type: integer + minimum: 0 + description: The number of unique users viewing this offer in the past 30 days. + OfferListingDtoV1Publication: + type: object + description: Information on the offer's publication status and dates. + properties: + status: + $ref: '#/components/schemas/OfferStatus' + startingAt: + type: string + description: The date and time of activation in UTC for a planned listing. + format: ISO 8601 + example: 2019-05-29T12:00:00Z + startedAt: + type: string + format: ISO 8601 + description: The actual date and time of activation in UTC. + example: 2019-05-29T12:00:00Z + endingAt: + type: string + format: ISO 6801 + description: The date and time of a planned ending in UTC. + example: 2019-06-30T12:00:00Z + endedAt: + type: string + format: ISO 8601 + description: The actual date and time of last ending in UTC. + example: 2019-06-30T12:10:00Z + marketplaces: + $ref: '#/components/schemas/OfferListingDtoV1PublicationMarketplaces' + OfferStatus: + type: string + description: >- + The publication status of the current offer. The possible values: + + - *INACTIVE* - a draft offer + - *ACTIVATING* - the offer is planned for listing or is during the process of activation + - *ACTIVE* - the offer is active + - *ENDED* - the offer was active and is now ended (for whatever reason) + enum: + - 'INACTIVE' + - 'ACTIVATING' + - 'ACTIVE' + - 'ENDED' + OfferListingDtoV1PublicationMarketplaces: + type: object + description: Information on the offer's publication marketplaces. + properties: + base: + description: The base marketplace of the offer. + allOf: + - $ref: '#/components/schemas/MarketplaceReference' + additional: + type: array + description: Additional marketplaces, on which the offer is to be listed. + example: [ { 'id': 'allegro-cz' } ] + items: + $ref: '#/components/schemas/MarketplaceReference' + MarketplaceReference: + type: object + description: Identifies a marketplace. + required: + - id + properties: + id: + $ref: '#/components/schemas/MarketplaceId' + MarketplaceId: + type: string + description: >- + The id of a marketplace.
+ Available marketplaces can be determined using GET /marketplaces. + example: allegro-pl + OfferListingDtoV1AdditionalMarketplaces: + type: object + description: Properties of the offer for each additional marketplace. + additionalProperties: + $ref: '#/components/schemas/OfferListingDtoV1AdditionalMarketplace' + example: { + 'allegro-cz': { + 'publication': { + 'state': 'APPROVED' + }, + 'sellingMode': { + 'price': { + 'amount': '700', + 'currency': 'CZK' + }, + 'priceAutomation': { + 'rule': { + 'id': '641c73feaef0a8281a3d11f8', + 'type': 'FOLLOW_BY_ALLEGRO_MIN_PRICE' + } + } + }, + 'stats': { + 'watchersCount': 3, + 'visitsCount': 5 + }, + 'stock': { + 'sold': 2 + } + } + } + OfferListingDtoV1AdditionalMarketplace: + type: object + description: Properties of the offer for the given marketplace. + properties: + publication: + type: object + nullable: true + description: Information about the publication of the offer on the given marketplace. + properties: + state: + $ref: '#/components/schemas/AdditionalMarketplacePublicationState' + sellingMode: + type: object + nullable: true + description: Information about the selling mode of the offer on the given marketplace. + properties: + price: + allOf: + - $ref: '#/components/schemas/BuyNowPrice' + description: The price of the offer on the given marketplace. + priceAutomation: + allOf: + - $ref: '#/components/schemas/PriceAutomation' + description: The automatic pricing rule on the given marketplace. + stats: + allOf: + - $ref: '#/components/schemas/OfferListingDtoV1Stats' + description: The offer's statistics on the given marketplace. + stock: + type: object + nullable: true + description: >- + Contains only the sold stock on the given marketplace. + The available stock applies to all marketplaces. + properties: + sold: + type: integer + minimum: 0 + description: The number of sold items in the last 30 days on the given marketplace. + example: 3 + + AdditionalMarketplacePublicationState: + type: string + description: >- + The publication status of the offer on an additional marketplace. The possible values: + + - *NOT_REQUESTED* - The seller has not declared their intention to list this offer on the marketplace + - *PENDING* - The qualification process has not started; the offer is not listed yet + - *IN_PROGRESS* - We are processing whether the offer qualifies to be listed on the marketplace; the offer is not listed yet + - *APPROVED* - The offer is approved to be listed on the marketplace + - *REFUSED* - The offer will not be listed on the marketplace; the offer may be re-qualified if is corrected + enum: + - 'NOT_REQUESTED' + - 'PENDING' + - 'IN_PROGRESS' + - 'APPROVED' + - 'REFUSED' + example: APPROVED + OrderEventsList: + type: object + required: + - events + properties: + events: + type: array + items: + $ref: '#/components/schemas/OrderEvent' + description: Order events list + OrderEvent: + type: object + required: + - id + - order + - type + - occurredAt + properties: + id: + type: string + description: event id + order: + $ref: '#/components/schemas/OrderEventData' + type: + $ref: '#/components/schemas/OrderEventType' + occurredAt: + type: string + format: date-time + example: '2018-10-12T10:12:32.321Z' + description: 'Date when the event occurred' + description: Order event + OrderEventData: + type: object + required: + - buyer + - lineItems + - seller + properties: + seller: + $ref: '#/components/schemas/SellerReference' + buyer: + $ref: '#/components/schemas/BuyerReference' + lineItems: + type: array + items: + $ref: '#/components/schemas/OrderLineItem' + checkoutForm: + $ref: '#/components/schemas/CheckoutFormReference' + marketplace: + $ref: '#/components/schemas/OrderMarketplace' + description: Order event data + SellerReference: + type: object + required: + - id + properties: + id: + type: string + example: "437848322" + description: Seller identifier + OfferReference: + type: object + required: + - id + - name + properties: + id: + type: string + example: "3213213" + name: + type: string + description: 'Offer name.' + example: "Name of purchased offer" + external: + $ref: '#/components/schemas/ExternalId' + productSet: + $ref: '#/components/schemas/OfferProductSetReference' + description: Offer identifier. + OfferProductSetReference: + type: object + required: + - products + properties: + products: + type: array + items: + $ref: '#/components/schemas/OfferProductSetProductReference' + description: List of products in a product set. + example: + - id: "9d689aa5-f2ad-4bdc-bb97-6b196854e6c7" + quantity: 1 + - id: "5924a344-1620-45fe-b214-186d4902c30b" + quantity: 2 + description: If the offer was a product set, you can see a list of component products (product id with quantity). + OfferProductSetProductReference: + type: object + required: + - id + properties: + id: + type: string + format: uuid + description: Product id. + example: "5272069b-0759-4283-8ba7-7f05b416f1d9" + quantity: + type: number + format: integer + minimum: 1 + description: Product quantity in a product set. + example: 1 + description: Product element definition. + BuyerReference: + type: object + required: + - email + - login + - guest + - id + properties: + id: + type: string + description: buyer id + example: "23123123" + email: + type: string + example: "user-email@allegro.pl" + login: + type: string + example: "User_Login" + guest: + type: boolean + description: is a guest account? + example: false + preferences: + $ref: '#/components/schemas/BuyerPreferencesReference' + description: Buyer data + BuyerPreferencesReference: + type: object + properties: + language: + type: string + description: Language + example: "pl-PL" + OrderLineItem: + type: object + required: + - offer + - price + - id + - quantity + properties: + id: + type: string + format: uuid + description: Order item identifier + example: "62ae358b-8f65-4fc4-9c77-bedf604a2e2b" + offer: + $ref: '#/components/schemas/OrderLineItemOfferReference' + quantity: + type: number + format: integer + minimum: 0 + description: quantity + example: 1 + originalPrice: + $ref: '#/components/schemas/Price' + price: + $ref: '#/components/schemas/Price' + boughtAt: + type: string + format: date-time + description: ISO date when offer was bought + example: "2018-01-01T10:23:43.123Z" + description: Order item + OrderLineItemOfferReference: + type: object + required: + - id + - name + properties: + id: + type: string + example: "3213213" + name: + type: string + description: 'Offer name.' + example: "Name of purchased offer" + external: + $ref: '#/components/schemas/ExternalId' + description: Offer identifier. + OrderEventStats: + type: object + properties: + latestEvent: + $ref: '#/components/schemas/LatestOrderEvent' + description: Event statistics, currently contains only basic information about the latest event. + LatestOrderEvent: + type: object + required: + - id + - occurredAt + properties: + id: + type: string + description: event id + occurredAt: + type: string + format: date-time + example: '2018-10-12T10:12:32.321Z' + description: 'Date when the event occurred' + description: Basic information about the latest order event. + OrderMarketplace: + type: object + required: + - id + properties: + id: + type: string + description: Id of the purchase marketplace + example: 'allegro-pl' + CheckoutFormReference: + type: object + required: + - id + properties: + id: + type: string + example: "88ae369b-8f65-4fc4-9c77-bedf604a2e2b" + description: Checkout form identifier + revision: + type: string + example: "819b5836" + description: Checkout form revision + CheckoutFormStatus: + enum: + - BOUGHT + - FILLED_IN + - READY_FOR_PROCESSING + - CANCELLED + example: "READY_FOR_PROCESSING" + description: > + Describes status of the form delivery and purchase options based on payment and purchase status. + * `BOUGHT` - purchase without checkout form filled in + * `FILLED_IN` - checkout form filled in but payment is not completed yet so data could still change + * `READY_FOR_PROCESSING` - payment completed. Purchase is ready for processing. + * `CANCELLED` - purchase cancelled by buyer. + OrderEventType: + enum: + - BOUGHT + - FILLED_IN + - READY_FOR_PROCESSING + - BUYER_CANCELLED + - FULFILLMENT_STATUS_CHANGED + - BUYER_MODIFIED + - AUTO_CANCELLED + example: "READY_FOR_PROCESSING" + description: > + Type of order event. + * `BOUGHT` - purchase without checkout form filled in + * `FILLED_IN` - checkout form filled in but payment is not completed yet so data could still change + * `READY_FOR_PROCESSING` - payment completed. Purchase is ready for processing. + * `BUYER_CANCELLED` - purchase cancelled by buyer + * `FULFILLMENT_STATUS_CHANGED`: fulfillment status changed. + * `BUYER_MODIFIED` - purchase modified by buyer + * `AUTO_CANCELLED` - purchase cancelled automatically by Allegro + CheckoutForms: + type: object + required: + - count + - totalCount + - checkoutForms + properties: + checkoutForms: + type: array + items: + $ref: '#/components/schemas/CheckoutForm' + count: + type: number + format: integer + minimum: 1 + description: number of returned objects + example: 1 + totalCount: + type: number + format: integer + minimum: 1 + description: > + Number of all objects of requested status(es) available (regardless of the provided limit and offset) + example: 1 + CheckoutForm: + type: object + required: + - id + - buyer + - status + - lineItems + - surcharges + - discounts + - summary + properties: + id: + type: string + format: uuid + description: Checkout form id + example: "29738e61-7f6a-11e8-ac45-09db60ede9d6" + messageToSeller: + type: string + description: Message from buyer to seller + example: "Please send me an item in red color" + buyer: + $ref: '#/components/schemas/CheckoutFormBuyerReference' + payment: + $ref: '#/components/schemas/CheckoutFormPaymentReference' + status: + $ref: '#/components/schemas/CheckoutFormStatus' + fulfillment: + $ref: '#/components/schemas/CheckoutFormFulfillment' + delivery: + $ref: '#/components/schemas/CheckoutFormDeliveryReference' + invoice: + $ref: '#/components/schemas/CheckoutFormInvoiceInfo' + lineItems: + type: array + items: + $ref: '#/components/schemas/CheckoutFormLineItem' + surcharges: + type: array + items: + $ref: '#/components/schemas/CheckoutFormPaymentReference' + discounts: + type: array + deprecated: true + description: >- + Deprecated. This field is deprecated in favor of `lineItems[].discounts` and will be + removed in the future. + items: + $ref: '#/components/schemas/CheckoutFormDiscount' + note: + $ref: '#/components/schemas/CheckoutFormNoteReference' + marketplace: + $ref: '#/components/schemas/CheckoutFormMarketplace' + summary: + $ref: '#/components/schemas/CheckoutFormSummary' + updatedAt: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: '2011-12-03T10:15:30.133Z' + revision: + type: string + example: "819b5836" + description: Checkout form revision + CheckoutFormBuyerReference: + type: object + required: + - id + - email + - login + - guest + properties: + id: + type: string + description: buyer id + example: "23123123" + email: + type: string + example: "user-email@allegro.pl" + login: + type: string + example: "User_Login" + firstName: + type: string + description: Buyer's first name + example: "Jan" + lastName: + type: string + description: Buyer's last name + example: "Kowalski" + companyName: + type: string + description: Company name + example: "Kowalex" + guest: + type: boolean + description: is a guest account? + example: false + personalIdentity: + type: string + description: Buyer's personal identity number (PESEL) + example: "67062589524" + phoneNumber: + type: string + description: Phone number + example: "123123123" + preferences: + $ref: '#/components/schemas/BuyerPreferencesReference' + address: + $ref: '#/components/schemas/CheckoutFormBuyerAddressReference' + description: Buyer data + CheckoutFormBuyerAddressReference: + type: object + properties: + street: + type: string + description: Street + example: "Solna" + city: + type: string + description: City name + example: "Poznań" + postCode: + type: string + description: Postal code + example: "60-166" + countryCode: + type: string + description: Country code + example: "PL" + description: Buyer address + CheckoutFormPaymentReference: + type: object + required: + - id + - type + properties: + id: + type: string + format: uuid + description: Payment id + example: "0f8f1d13-7e9e-11e8-9b00-c5b0dfb78ea6" + type: + $ref: '#/components/schemas/CheckoutFormPaymentType' + provider: + $ref: '#/components/schemas/CheckoutFormPaymentProvider' + finishedAt: + type: string + format: date-time + example: '2018-10-12T10:12:32.321Z' + description: 'Date when the event occurred' + paidAmount: + $ref: '#/components/schemas/Price' + reconciliation: + $ref: '#/components/schemas/Price' + features: + type: array + items: + type: string + description: >- + Payment additional features: + - `ALLEGRO_PAY` - The payment was made using Allegro Pay. + example: + - 'ALLEGRO_PAY' + CheckoutFormPaymentType: + description: Payment type + example: "ONLINE" + type: string + enum: + - CASH_ON_DELIVERY + - WIRE_TRANSFER + - ONLINE + - SPLIT_PAYMENT + - EXTENDED_TERM + CheckoutFormPaymentProvider: + description: >- + Payment provider: + * `PAYU` - processed by PAYU operator. + * `P24` - processed by PRZELEWY24 operator. + * `AF` - processed by Allegro Finance operator. + * `OFFLINE` - offline payment. + * `EPT` - extended payment term with Allegro Pay Business. + example: "PAYU" + type: string + enum: + - PAYU + - P24 + - AF + - OFFLINE + - EPT + CheckoutFormFulfillment: + type: object + properties: + status: + $ref: '#/components/schemas/CheckoutFormFulfillmentStatus' + shipmentSummary: + $ref: '#/components/schemas/CheckoutFormFulfillmentShipmentSummary' + CheckoutFormFulfillmentStatus: + enum: + - NEW + - PROCESSING + - READY_FOR_SHIPMENT + - READY_FOR_PICKUP + - SENT + - PICKED_UP + - CANCELLED + - SUSPENDED + - RETURNED + example: "SENT" + description: > + Order seller status. The status is managed by the seller, however in some cases the seller can enable automatic change of the status in the Orders [settings](https://salescenter.allegro.com/orders/settings). + Order changes to `SENT` status when a tracking number is added to the order and the seller has enabled corresponding setting (see: [here](https://help.allegro.com/sell/en/a/sales-management-via-advanced-settings-of-the-list-of-offers-and-orders-6M9E0wr5Rt5#automatic-status-change-after-adding-a-tracking-number)). + Order can be switched to `RETURNED` status when both the buyer returns all order's items and the seller makes a refund for all of the order's items (either automatically or manually, see: [here](https://help.allegro.com/sell/en/a/how-can-i-issue-a-refund-to-the-buyer-k1wRo9wBXUx)). + The `RETURNED` status cannot be set by the seller - it changes automatically when corresponding setting is enabled in sale settings (see: [here](https://help.allegro.com/sell/en/a/how-to-use-the-orders-tab-6M9E0wO9BFw#filtering-and-searching-for-orders)). + CheckoutFormFulfillmentShipmentSummary: + type: object + properties: + lineItemsSent: + $ref: '#/components/schemas/CheckoutFormFulfillmentShipmentSummaryLineItemsSent' + CheckoutFormFulfillmentShipmentSummaryLineItemsSent: + enum: + - NONE + - SOME + - ALL + example: "SOME" + description: > + Indicates how many line items have tracking number specified. + CheckoutFormDeliveryReference: + type: object + properties: + address: + $ref: '#/components/schemas/CheckoutFormDeliveryAddress' + method: + $ref: '#/components/schemas/CheckoutFormDeliveryMethod' + pickupPoint: + $ref: '#/components/schemas/CheckoutFormDeliveryPickupPoint' + cost: + $ref: '#/components/schemas/Price' + time: + $ref: '#/components/schemas/CheckoutFormDeliveryTime' + smart: + type: boolean + description: Buyer used a SMART option + example: true + cancellation: + $ref: '#/components/schemas/CheckoutFormDeliveryCancellation' + calculatedNumberOfPackages: + type: integer + format: int32 + minimum: 0 + description: Calculated number of packages. + example: 1 + CheckoutFormDeliveryAddress: + type: object + required: + - firstName + - lastName + - street + - city + - zipCode + - countryCode + properties: + firstName: + type: string + description: Receiver's first name + example: "Jan" + lastName: + type: string + description: Receiver's last name + example: "Kowalski" + street: + type: string + description: Street name + example: "Grunwaldzka 182" + city: + type: string + description: City name + example: "Poznań" + zipCode: + type: string + description: Postal code + example: "60-166" + countryCode: + type: string + description: Country code + example: "PL" + companyName: + type: string + description: Company name + example: "Kowalex" + phoneNumber: + type: string + description: Phone number + example: "123123123" + modifiedAt: + type: string + description: Address modification date + example: "2018-01-05T10:23:43.123Z" + CheckoutFormDeliveryMethod: + type: object + properties: + id: + type: string + description: Delivery method id + example: "1fa56f79-4b6a-4821-a6f2-ca9c16d5c925" + name: + type: string + description: Delivery method name + example: "Allegro Paczkomaty InPost" + CheckoutFormDeliveryPickupPoint: + type: object + properties: + id: + type: string + description: Delivery point id + example: "POZ08A" + name: + type: string + description: Delivery point name + example: "Paczkomat POZ08A" + description: + type: string + description: Delivery point description + example: "Stacja paliw BP" + address: + $ref: '#/components/schemas/CheckoutFormDeliveryPickupPointAddress' + CheckoutFormDeliveryPickupPointAddress: + type: object + properties: + street: + type: string + description: Delivery point street name + example: "Grunwaldzka 108" + zipCode: + type: string + description: Delivery point postal code + example: "60-166" + city: + type: string + description: City name + example: "Poznań" + countryCode: + type: string + description: Country code + example: "PL" + CheckoutFormDeliveryTime: + type: object + properties: + from: + type: string + format: date-time + description: ISO date when the earliest delivery attempt can take place. + example: "2018-01-01T10:23:43.123Z" + to: + type: string + format: date-time + description: ISO date when the latest delivery attempt can take place. + example: "2018-01-05T10:23:43.123Z" + guaranteed: + $ref: '#/components/schemas/CheckoutFormDeliveryTimeGuaranteed' + dispatch: + $ref: '#/components/schemas/CheckoutFormDeliveryTimeDispatch' + CheckoutFormDeliveryTimeGuaranteed: + deprecated: true + type: object + description: >- + Guaranteed date when first delivery attempt takes place. This is always filled for Allegro One Courier delivery method. + This field is deprecated in favor of `delivery.time.from` and `delivery.time.to`. + properties: + from: + type: string + format: date-time + description: ISO date when the earliest delivery attempt can take place. + example: "2018-01-07T16:00:00Z" + to: + type: string + format: date-time + description: ISO date when the latest delivery attempt can take place. + example: "2018-01-08T18:00:00Z" + CheckoutFormDeliveryTimeDispatch: + type: object + description: Dates when delivery should be dispatched, passed to the provider. + properties: + from: + type: string + format: date-time + description: ISO date when the earliest dispatch should take place. + example: "2018-01-01T16:00:00Z" + to: + type: string + format: date-time + description: ISO date when the latest dispatch should take place. + example: "2018-01-03T18:00:00Z" + CheckoutFormDeliveryCancellation: + type: object + description: The delivery cancellation information. + required: + - date + properties: + date: + type: string + format: date-time + description: ISO date when the delivery was cancelled. + example: "2018-01-03T11:00:00Z" + CheckoutFormInvoiceInfo: + type: object + required: + - required + properties: + required: + type: boolean + description: Is invoice required by buyer? + example: true + address: + $ref: '#/components/schemas/CheckoutFormInvoiceAddress' + dueDate: + type: string + description: Due date to put on an invoice for Extended Payment Terms purchases. For other payment methods this field will be null. + example: "2021-12-01" + features: + type: array + items: + type: string + description: >- + Invoice features list: + - VAT_EU_VERIFIED - order's data is verified for VAT EU transactions. The presence of this feature means that VAT_EU number will appear in `address.company.ids` field. This feature flag is mutually exclusive with `VAT_EU_UNVERIFIED` feature. Read more: PL / EN. + - VAT_EU_UNVERIFIED - order meets the conditions of VAT EU transaction, but the Buyer's VAT_EU number is not verified. This feature flag is mutually exclusive with `VAT_EU_VERIFIED` feature. Read more: PL / EN. + example: + - 'VAT_EU_VERIFIED' + CheckoutFormInvoiceAddress: + type: object + required: + - street + - city + - zipCode + - countryCode + properties: + street: + type: string + description: Street name + example: "Grunwaldzka 182" + city: + type: string + description: City name + example: "Poznań" + zipCode: + type: string + description: Postal code + example: "60-166" + countryCode: + type: string + description: Country code + example: "PL" + company: + $ref: '#/components/schemas/CheckoutFormInvoiceAddressCompany' + naturalPerson: + $ref: '#/components/schemas/CheckoutFormInvoiceAddressNaturalPerson' + CheckoutFormInvoiceAddressCompany: + type: object + description: Setting the value to null indicates a private purchase, while any other value indicates a corporate purchase. + required: + - name + - vatPayerStatus + properties: + name: + type: string + description: Name of a company for which invoice should be issued. + example: "Udix Sp. z o.o." + ids: + type: array + description: Tax ids of a company for which invoice should be issued. + items: + $ref: '#/components/schemas/CheckoutFormInvoiceAddressCompanyId' + vatPayerStatus: + type: string + description: >- + The vat payer status: + - `ACTIVE` - user explicitly declared as an active VAT taxpayer, + - `NON_ACTIVE` - user explicitly declared as not an active VAT taxpayer, + - `NOT_APPLICABLE` - user hasn't declared the VAT taxpayer status, or it's not applicable for given address type or provided company numbers. + enum: + - ACTIVE + - NON_ACTIVE + - NOT_APPLICABLE + example: NOT_APPLICABLE + taxId: + type: string + description: Tax id. + deprecated: true + example: "111-11-11-111" + CheckoutFormInvoiceAddressCompanyId: + type: object + required: + - type + - value + properties: + type: + type: string + description: The tax id type. + enum: + - PL_NIP + - CZ_ICO + - CZ_DIC + - HU_ADOSZAM + - SK_ICO + - SK_IC_DPH + - VAT_EU + - OTHER + example: PL_NIP + value: + type: string + description: The tax id value. + example: "111-11-11-111" + CheckoutFormInvoiceAddressNaturalPerson: + type: object + required: + - firstName + - lastName + properties: + firstName: + type: string + description: Invoice receiver first name + example: "Jan" + lastName: + type: string + description: Invoice receiver last name + example: "Kowalski" + CheckoutFormLineItem: + type: object + required: + - id + - offer + - quantity + - originalPrice + - price + properties: + id: + type: string + format: uuid + description: Line item identifier + example: "62ae358b-8f65-4fc4-9c77-bedf604a2e2b" + offer: + $ref: '#/components/schemas/OfferReference' + quantity: + type: number + format: integer + description: quantity + minimum: 1 + example: 1 + originalPrice: + $ref: '#/components/schemas/Price' + price: + $ref: '#/components/schemas/Price' + reconciliation: + $ref: '#/components/schemas/LineItemReconciliation' + selectedAdditionalServices: + type: array + items: + $ref: '#/components/schemas/CheckoutFormAdditionalService' + vouchers: + type: array + items: + $ref: '#/components/schemas/LineItemVoucher' + tax: + $ref: '#/components/schemas/CheckoutFormLineItemTax' + boughtAt: + type: string + format: date-time + description: ISO date when offer was bought + example: "2018-01-01T10:23:43.123Z" + discounts: + type: array + items: + $ref: '#/components/schemas/LineItemDiscount' + description: Order item + LineItemReconciliation: + type: object + properties: + value: + $ref: '#/components/schemas/Price' + type: + type: string + enum: + - BILLING + - WALLET + description: > + Reconciliation type used in the Allegro Prices program, in which the offer is included. The following values are possible: + * `BILLING` - a reconciliation value is counted as a new entry in the billing + * `WALLET` - a reconciliation value is added to the checkout form payment + quantity: + type: integer + format: int32 + minimum: 1 + description: Quantity of reconciled items + example: 1 + CheckoutFormAdditionalService: + type: object + properties: + definitionId: + type: string + description: Additional service id + example: "CARRY_IN" + name: + type: string + description: Additional service name + example: "Wniesienie" + price: + $ref: '#/components/schemas/Price' + quantity: + type: integer + format: int32 + minimum: 1 + description: Quantity of an additional service + example: 1 + LineItemVoucher: + type: object + required: + - type + properties: + code: + type: string + description: The voucher code. + example: "Code12345" + type: + type: string + enum: + - NOTEBOOKS_FOR_TEACHERS + description: > + Describes the types of vouchers used in the lineItems. The types of vouchers can be as follows: + * `NOTEBOOKS_FOR_TEACHERS` - a voucher for teacher's notebook action. + status: + type: string + enum: + - ACTIVE + - CANCELLED + description: > + Describes the status of the current voucher. The status of voucher can be as follows: + * `ACTIVE` - an active voucher, ready to use, + * `CANCELLED` - a cancelled voucher, disabled to use. + externalTransactionId: + type: string + description: The external transaction id. The value may differ depending on the status type. + example: "sampleExternalTransactionId" + value: + allOf: + - $ref: '#/components/schemas/Price' + - type: object + description: The value of the voucher. + CheckoutFormLineItemTax: + type: object + properties: + rate: + type: string + description: The tax rate. + nullable: true + example: '23.00' + subject: + type: string + description: The subject of taxation. + nullable: true + example: 'GOODS' + exemption: + type: string + description: The exemption of taxation. + nullable: true + example: 'MONEY_EQUIVALENT' + LineItemDiscount: + type: object + properties: + type: + type: string + enum: + - BUNDLE + - UNIT_PERCENTAGE_DISCOUNT + - WHOLESALE_PRICE_LIST + - LARGE_ORDER_DISCOUNT + - TURNOVER_DISCOUNT + - COUPON + - CAMPAIGN + description: > + Describes the types of discounts used in the lineItems. The types of discounts can be as follows: + - `BUNDLE` - a bundle discount (used also for bundles with no price change) + - `UNIT_PERCENTAGE_DISCOUNT` - a MULTIPACK or CROSS_MULTIPACK discount + - `WHOLESALE_PRICE_LIST` - a wholesale price list discount (a discount for company users only) + - `LARGE_ORDER_DISCOUNT` - a large order discount (a discount for company users only) + - `TURNOVER_DISCOUNT` - a turnover discount (a discount for company users only) + - `COUPON` - a coupon discount + - `CAMPAIGN` - a campaign discount + CheckoutFormDiscount: + type: object + deprecated: true + required: + - type + properties: + type: + type: string + enum: + - COUPON + - BUNDLE + - MULTIPACK + - CROSSMULTIPACK + - ALLEGRO_PRICES + description: > + Describes the types of discounts used in the checkout form. The types of discounts can be as follows: + * `COUPON` - a coupon was used during payment + * `BUNDLE` - some items were bought as a bundle + * `MULTIPACK` - at least one item was bought with a multipack option turned on + * `CROSSMULTIPACK` - some items, each from a different offer, were bought together as a multipack + * `ALLEGRO_PRICES` - some items are included in the Allegro Prices program + CheckoutFormNoteReference: + type: object + properties: + text: + type: string + description: Seller's note for the order + example: "Sample note" + CheckoutFormMarketplace: + type: object + required: + - id + properties: + id: + type: string + description: Id of the purchase marketplace + example: 'allegro-pl' + CheckoutFormSummary: + type: object + required: + - totalToPay + properties: + totalToPay: + allOf: + - $ref: '#/components/schemas/Price' + - type: object + description: Total to pay including additional services and delivery + CheckoutFormsOrderInvoices: + type: object + properties: + invoices: + type: array + items: + $ref: '#/components/schemas/CheckoutFormsOrderInvoice' + hasExternalInvoices: + type: boolean + description: "Informs whether an invoice or a proof-of-purchase has been sent outside of Allegro platform" + CheckoutFormsOrderInvoice: + type: object + properties: + id: + type: string + invoiceNumber: + type: string + createdAt: + type: string + format: date-time + file: + $ref: '#/components/schemas/CheckoutFormsOrderInvoiceFile' + CheckoutFormsOrderInvoiceFile: + type: object + properties: + name: + type: string + uploadedAt: + type: string + format: date-time + securityVerification: + $ref: '#/components/schemas/CheckoutFormsOrderInvoiceFileSecurityVerification' + CheckoutFormsOrderInvoiceFileSecurityVerification: + type: object + properties: + status: + type: string + enum: + - ACCEPTED + - REJECTED + - WAITING + verifiedAt: + type: string + format: date-time + CheckFormsNewOrderInvoice: + type: object + required: + - file + properties: + file: + $ref: '#/components/schemas/CheckFormsNewOrderInvoiceFile' + invoiceNumber: + type: string + CheckFormsNewOrderInvoiceFile: + type: object + required: + - name + properties: + name: + type: string + CheckFormsNewOrderInvoiceId: + type: object + properties: + id: + type: string + DisputeListResponse: + type: object + properties: + disputes: + type: array + items: + $ref: '#/components/schemas/Dispute' + Dispute: + type: object + properties: + id: + type: string + description: Identifier of the dispute + example: "a38812fa-6fef-4c9c-ac06-a0952b67ba78" + subject: + $ref: '#/components/schemas/Subject' + status: + type: string + enum: + - CLOSED + - ONGOING + - UNRESOLVED + messagesStatus: + type: string + enum: + - NEW + - SELLER_REPLIED + - BUYER_REPLIED + - ALLEGRO_ADVISOR_REPLIED + buyer: + $ref: '#/components/schemas/DisputeUser' + checkoutForm: + $ref: '#/components/schemas/DisputeCheckoutForm' + message: + $ref: '#/components/schemas/DisputeFirstMessage' + messagesCount: + type: integer + format: int32 + minimum: 0 + openedDate: + type: string + format: date-time + example: "2018-02-10T12:12:12.000Z" + description: Recent date when the dispute has been opened or reopened + lastMessageCreationDate: + type: string + format: date-time + example: "2018-02-10T12:12:12.000Z" + claim: + $ref: '#/components/schemas/DisputeClaim' + required: + - id + - subject + - status + - messagesStatus + - buyer + - checkoutForm + - message + - messagesCount + - lastMessageCreationDate + Subject: + type: object + description: Subject of the dispute + properties: + name: + type: string + description: Subject name + example: "nie otrzymałem towaru po wpłacie" + DisputeClaim: + type: object + description: Buyer's claim data for the dispute. + properties: + name: + type: string + nullable: true + description: Type of the buyer's expectations for the dispute outcome. + example: "częściowy zwrot pieniędzy" + description: + type: string + nullable: true + description: Details of the buyer's expectations for the dispute. + example: "Zwrot 27 zł" + DisputeUser: + type: object + properties: + id: + type: string + login: + type: string + DisputeMessageList: + type: object + properties: + messages: + type: array + items: + $ref: '#/components/schemas/DisputeMessage' + DisputeFirstMessage: + type: object + description: Initial dispute message with text OR attachment OR both + properties: + id: + type: string + text: + type: string + attachment: + $ref: '#/components/schemas/DisputeAttachment' + author: + $ref: '#/components/schemas/DisputeAuthor' + createdAt: + type: string + format: date-time + example: "2018-02-10T12:12:12Z" + required: + - id + - author + - createdAt + DisputeMessage: + type: object + description: Initial dispute message with text OR attachment OR both + properties: + id: + type: string + text: + type: string + attachment: + $ref: '#/components/schemas/DisputeAttachment' + author: + $ref: '#/components/schemas/DisputeMessageAuthor' + createdAt: + type: string + format: date-time + example: "2018-02-10T12:12:12Z" + required: + - id + - author + - createdAt + DisputeMessageAuthor: + type: object + description: Author of the message + properties: + login: + type: string + description: Not present if role is ADMIN, SYSTEM or FULFILLMENT + role: + $ref: '#/components/schemas/MessageAuthorRole' + required: + - role + DisputeAttachment: + type: object + properties: + fileName: + type: string + maxLength: 255 + url: + type: string + description: Direct link to the attachment + example: "https://upload.allegro.pl/sale/dispute-attachments/eeed0007-4404-4176-a1eb-11d26f056c0d" + required: + - fileName + - url + DisputeAttachmentId: + type: object + properties: + id: + type: string + required: + - id + AttachmentDeclaration: + type: object + properties: + fileName: + type: string + size: + type: integer + minimum: 1 + example: 128 + required: + - fileName + - size + DisputeCheckoutForm: + type: object + properties: + id: + type: string + createdAt: + type: string + format: date-time + example: "2018-02-10T12:12:12Z" + required: + - id + - createdAt + DisputeAuthor: + type: object + properties: + login: + type: string + description: Not present if role is ADMIN or FULFILLMENT + role: + $ref: '#/components/schemas/DisputeAuthorRole' + required: + - role + DisputeAuthorRole: + type: string + enum: + - BUYER + - SELLER + - ADMIN + - FULFILLMENT + MessageAuthorRole: + type: string + enum: + - BUYER + - SELLER + - ADMIN + - SYSTEM + - FULFILLMENT + MessageRequest: + type: object + description: "Request body to add message to the dispute. Presence of text or attachment fields or both is required." + properties: + text: + type: string + maxLength: 20000 + attachment: + $ref: '#/components/schemas/DisputeAttachmentId' + type: + type: string + enum: + - REGULAR + - END_REQUEST + required: + - text + - attachment + - type + TagRequest: + type: object + required: + - name + properties: + name: + type: string + minLength: 1 + maxLength: 25 + hidden: + type: boolean + TagId: + type: object + required: + - id + properties: + id: + type: string + TagResponse: + type: object + required: + - id + - name + - hidden + properties: + id: + type: string + name: + type: string + hidden: + type: boolean + TagListResponse: + type: object + required: + - tags + properties: + tags: + type: array + items: + $ref: '#/components/schemas/TagResponse' + TagIdsRequest: + type: object + required: + - tags + properties: + tags: + type: array + items: + $ref: '#/components/schemas/TagId' + PromotionResponseDto: + type: object + required: + - id + properties: + id: + type: string + CampaignResponseDto: + type: object + required: + - id + properties: + id: + type: string + SinglePromotionCampaignResponseDto: + type: object + required: + - campaign + - promotion + - status + properties: + campaign: + $ref: '#/components/schemas/CampaignResponseDto' + promotion: + $ref: '#/components/schemas/PromotionResponseDto' + status: + type: string + enum: + - PENDING + - ACTIVE + - SUSPENDED + PromotionCampaignsResponseDto: + type: object + required: + - promotionCampaigns + - totalCount + properties: + promotionCampaigns: + type: array + items: + $ref: '#/components/schemas/SinglePromotionCampaignResponseDto' + totalCount: + type: integer + format: int64 + minimum: 0 + PromotionCampaignResponseDto: + type: object + required: + - campaign + - link + - promotion + - status + properties: + campaign: + $ref: '#/components/schemas/CampaignResponseDto' + link: + type: string + nullable: true + promotion: + $ref: '#/components/schemas/PromotionResponseDto' + status: + type: string + enum: + - REQUESTED + - SUSPENDED + - VERIFICATION + - ACCEPTED + - ACTIVE + - FINISHED + - DECLINED + CampaignRequestDto: + type: object + required: + - id + properties: + id: + type: string + PromotionRequestDto: + type: object + required: + - id + properties: + id: + type: string + CheckoutFormAddWaybillRequest: + type: object + required: + - carrierId + - waybill + properties: + carrierId: + type: string + description: >- + Supported carriers are available via shipping carriers resource. + example: "ALLEGRO" + waybill: + type: string + description: >- + Waybill number (parcel tracking number). + Cannot be empty and must be no longer than 64 characters. + example: "AD-1239134" + maxLength: 64 + carrierName: + type: string + maxLength: 30 + description: >- + Carrier name to be provided only if carrierId is OTHER, otherwise it’s ignored. + Must be no longer than 30 characters. + example: "Sample carrier" + lineItems: + type: array + description: >- + List of order line items. They must be from the order specified in the path parameter. + When list is not provided or it is empty it means that every item from an order is included in shipment. + items: + required: + - id + properties: + id: + type: string + description: >- + Identifier of an order line item. + example: "14e142cf-e8e0-48cc-bcf6-399b5fd90b32" + OrdersShippingCarrier: + type: object + properties: + id: + type: string + description: >- + Identifier of a carrier - unique to every carrier. + + + It’s highly recommended to use an identifier different from `OTHER`, because its parcel status may be updated automatically. + Carrier identifier `OTHER` is reserved for cases when seller uses a custom carrier or not yet integrated with Allegro. + name: + type: string + description: Name of a carrier. + example: "ALLEGRO" + CheckoutFormAddWaybillCreated: + type: object + properties: + id: + type: string + description: Identifier of a shipment. + example: "REhMOjEyMzQ1Njc4OTEwUEw=" + waybill: + type: string + description: >- + Waybill number (parcel tracking number). + Cannot be empty and must be no longer than 64 characters. + example: "AD-1239134" + carrierId: + type: string + description: >- + Supported carriers are available via shipping carriers resource. + example: "ALLEGRO" + carrierName: + type: string + description: >- + Carrier name to be provided only if carrierId is OTHER, otherwise it’s ignored. + Must be no longer than 30 characters. + example: "Sample carrier" + lineItems: + description: >- + List of order line items. They must be from the order specified in the path parameter. List cannot be empty. + items: + properties: + id: + type: string + description: Identifier of an order line item. + example: "31896450-2de1-11e9-bced-352ab82ad9cd" + createdAt: + type: + string + description: Date and time of the parcel tracking number registration in UTC (ISO8601 format). + example: "2019-02-18T11:46:48.264Z" + OrdersShippingCarriersResponse: + type: object + properties: + carriers: + type: array + description: >- + List of shipping carriers. + items: + $ref: '#/components/schemas/OrdersShippingCarrier' + CheckoutFormOrderWaybillResponse: + type: object + properties: + shipments: + type: array + description: >- + List of parcel tracking numbers currently assigned to the order. + items: + $ref: '#/components/schemas/CheckoutFormAddWaybillCreated' + AllegroPickupDropOffPointsResponse: + type: object + properties: + points: + type: array + description: >- + List of Allegro pickup drop off points. + items: + $ref: '#/components/schemas/AllegroPickupDropOffPoint' + CarrierParcelTrackingResponse: + type: object + required: + - carrierId + - waybills + properties: + carrierId: + type: string + description: Carrier identifier. + waybills: + type: array + description: >- + Allegro parcel tracking history for multiple tracking numbers (waybills). + items: + $ref: '#/components/schemas/ParcelTrackingHistory' + GetSaleProductsResponse: + type: object + required: + - products + properties: + products: + type: array + items: + $ref: '#/components/schemas/BaseSaleProductResponseDto' + categories: + $ref: '#/components/schemas/SaleProductResponseCategoriesDto' + filters: + type: array + items: + $ref: '#/components/schemas/ListingResponseFilters' + nextPage: + type: object + properties: + id: + type: string + description: A "cursor" to the next set of results. + example: "AoMhVAhDSexYPwUxOTA4YTMwZC02NDQ2LTRhNWUtYTU1Yy1iY2I4ZTdkNTNjYmI%3D" + ProductProposalsRequest: + type: object + required: + - name + - category + - parameters + - images + - language + properties: + name: + type: string + description: Suggested product name. + example: iPhone 5s + maxLength: 75 + category: + $ref: '#/components/schemas/ProductCategory' + images: + type: array + items: + $ref: '#/components/schemas/ImageUrl' + description: List of product images. At least one image is required. + parameters: + type: array + items: + $ref: '#/components/schemas/ProductParameter' + description: List of product parameters. + description: + $ref: '#/components/schemas/StandardizedDescription' + language: + type: string + description: Language of provided product data (name, description, parameters's values). + format: BCP-47 language code + example: 'pl-PL' + ProductChangeProposalDto: + type: object + properties: + id: + type: string + description: Product change proposal id + name: + $ref: '#/components/schemas/ProductNameProposal' + category: + $ref: '#/components/schemas/ProductCategoryProposal' + note: + type: string + description: Note about product changes proposal. + example: Some additional note to product changes proposal. + maxLength: 500 + images: + type: array + items: + $ref: '#/components/schemas/ProductImageProposal' + description: List of proposed image change statuses. + parameters: + type: array + items: + $ref: '#/components/schemas/ProductParameterProposal' + description: List of proposed product parameter change statuses. + notifyViaEmailAfterVerification: + type: boolean + description: Receive an email notification after product changes proposal resolution. + language: + type: string + description: Language of provided suggestion data. + format: BCP-47 language code + ProductImageProposal: + type: object + properties: + current: + type: string + description: Current product image url. + proposal: + type: string + description: Proposed product image url. + reason: + type: string + description: Verification message. + resolutionType: + type: string + enum: + - UNRESOLVED + - ACCEPTED + - REJECTED + description: Verification resolution type. + description: Image proposal. + ProductNameProposal: + type: object + properties: + current: + type: string + description: Current product name. + proposal: + type: string + description: Proposed product name. + reason: + type: string + description: Verification message. + resolutionType: + enum: + - UNRESOLVED + - ACCEPTED + - REJECTED + description: Verification resolution type. + description: Name proposal status. + ProductCategoryProposal: + type: object + properties: + current: + type: string + description: Current product category identifier. + proposal: + type: string + description: Proposed product category identifier. + reason: + type: string + description: Verification message. + resolutionType: + enum: + - UNRESOLVED + - ACCEPTED + - REJECTED + description: Verification resolution type. + description: Name proposal status. + ProductParameterProposal: + type: object + properties: + id: + type: string + description: Parameter identifier. + values: + type: array + items: + $ref: '#/components/schemas/ProductParameterValueProposal' + description: List of proposed product parameter change statuses. + description: Product parameter values proposal status. + ProductParameterValueProposal: + type: object + properties: + current: + type: string + description: Current product parameter value. + proposal: + type: string + description: Proposed product parameter value. + reason: + type: string + description: Verification message. + resolutionType: + enum: + - UNRESOLVED + - ACCEPTED + - REJECTED + description: Verification resolution type. + description: Parameter value proposal status. + ProductChangeProposalRequest: + type: object + required: + - name + - category + - parameters + - images + - language + properties: + name: + type: string + description: Proposed product name. + example: iPhone 5s + maxLength: 150 + note: + type: string + description: Note about product changes proposal. + example: Some additional note to product changes proposal. + maxLength: 500 + category: + $ref: '#/components/schemas/ProductCategory' + images: + type: array + items: + $ref: '#/components/schemas/ImageUrl' + description: List of product images. At least one image is required. + parameters: + type: array + items: + $ref: '#/components/schemas/ProductParameter' + description: List of product parameters. + notifyViaEmailAfterVerification: + type: boolean + description: Receive an email notification after product changes proposal resolution. + language: + type: string + description: Language of provided proposal data. + format: BCP-47 language code + default: 'pl-PL' + ProductChangesResponse: + type: object + properties: + productChanges: + type: array + items: + $ref: '#/components/schemas/ProductChangeDto' + description: List of requested product changes. + ProductChangeDto: + type: object + properties: + product: + type: object + properties: + id: + type: string + description: Product id. + changedParameters: + type: array + description: List of changed product parameters. + items: + $ref: '#/components/schemas/ChangedParameterDto' + ChangedParameterDto: + type: object + properties: + id: + type: string + description: Parameter id. + updatedAt: + type: string + description: Time of last parameter change in ISO 8601 format. + SaleProductDto: + type: object + required: + - id + - name + - category + properties: + id: + type: string + example: c9e39cae-9cb6-11e9-a2a3-2a2ae2dbcce4 + description: Product id. + name: + type: string + description: Product name. + example: iPhone 5s + category: + $ref: '#/components/schemas/ProductCategoryWithPath' + images: + type: array + items: + $ref: '#/components/schemas/ImageUrl' + description: List of product images. + parameters: + type: array + items: + $ref: '#/components/schemas/ProductParameterDto' + description: List of product parameters. + offerRequirements: + $ref: '#/components/schemas/OfferRequirements' + compatibilityList: + $ref: '#/components/schemas/SaleProductCompatibilityList' + tecdocSpecification: + $ref: '#/components/schemas/TecdocSpecification' + description: + $ref: '#/components/schemas/StandardizedDescription' + isDraft: + type: boolean + description: Flag that informs if product is waiting for resolution of basic parameters change proposal. + aiCoCreatedContent: + $ref: '#/components/schemas/AiCoCreatedContent' + trustedContent: + $ref: '#/components/schemas/TrustedContent' + hasProtectedBrand: + type: boolean + description: >- + Flag that informs if product is a part of a protected brand's assortment and its use may be restricted. + publication: + type: object + properties: + status: + type: string + enum: + - PROPOSED + - LISTED + description: >- + The publication status of the product: + - `PROPOSED` - product is proposed and can be during the review process + - `LISTED` - product is created and reviewed + productSafety: + $ref: '#/components/schemas/ProductSafetyDto' + ProductProposalsResponse: + type: object + properties: + id: + type: string + example: c9e39cae-9cb6-11e9-a2a3-2a2ae2dbcce4 + description: Product id. + name: + type: string + description: Product name. + example: iPhone 5s + category: + allOf: + - $ref: '#/components/schemas/ProductCategory' + - type: object + properties: + similar: + type: array + items: + allOf: + - $ref: '#/components/schemas/Category' + - description: 'Category in which the product can be listed for sale' + description: 'A list of similar categories in which you can sell this product.' + images: + type: array + items: + $ref: '#/components/schemas/ImageUrl' + description: List of product images. + parameters: + type: array + items: + $ref: '#/components/schemas/NewProductParameterDto' + description: List of product parameters. + description: + $ref: '#/components/schemas/StandardizedDescription' + supplier: + $ref: '#/components/schemas/SupplierDto' + offerId: + type: string + description: Offer id. + language: + type: string + description: Language of product data (name, description, parameters's values). + format: BCP-47 language code + example: 'pl-PL' + publication: + type: object + properties: + status: + type: string + enum: + - PROPOSED + - LISTED + description: >- + The publication status of the submitted product: + - `PROPOSED` - a new product proposal was created and can be reviewed + + BaseSaleProductResponseDto: + type: object + required: + - id + - name + - category + properties: + id: + type: string + name: + type: string + description: Name of the product. + description: + $ref: '#/components/schemas/StandardizedDescription' + category: + $ref: '#/components/schemas/ProductCategoryWithPath' + images: + type: array + items: + $ref: '#/components/schemas/ImageUrl' + parameters: + type: array + items: + $ref: '#/components/schemas/ProductParameterDto' + isDraft: + type: boolean + description: Flag that informs if product is waiting for resolution of basic parameters change proposal. + aiCoCreatedContent: + $ref: '#/components/schemas/AiCoCreatedContent' + trustedContent: + $ref: '#/components/schemas/TrustedContent' + hasProtectedBrand: + type: boolean + description: >- + Flag that informs if product is a part of a protected brand's assortment and its use may be restricted. + productSafety: + $ref: '#/components/schemas/ProductSafetyDto' + publication: + type: object + properties: + status: + type: string + enum: + - PROPOSED + - LISTED + description: >- + The publication status of the product: + - `PROPOSED` - product is proposed and can be during the review process + - `LISTED` - product is created and reviewed + ProductSafetyDto: + type: object + nullable: true + description: "Suggested product safety data in accordance with GPSR. **Note:** Allegro does not assume responsibility for the accuracy of this data. It is the merchant's responsibility to verify its applicability to their product." + properties: + responsibleProducers: + nullable: true + type: array + items: + $ref: '#/components/schemas/ResponsibleProducerResponse' + safetyInformation: + allOf: + - $ref: '#/components/schemas/ProductSetElementSafetyInformation' + - nullable: true + marketedBeforeGPSRObligation: + nullable: true + type: boolean + example: true + ProductCategoryWithPath: + type: object + description: 'Category in which the product can be listed for sale' + properties: + id: + type: string + description: 'Category identifier.' + example: '257931' + path: + type: array + items: + $ref: '#/components/schemas/ProductsCategoryPath' + similar: + type: array + description: 'A list of similar categories in which you can sell this product.' + items: + $ref: '#/components/schemas/ProductSimilarCategoryWithPath' + ProductSimilarCategoryWithPath: # not bound with ProductCategoryWithPath to avoid being marked as recursive + type: object + description: 'Category in which the product can be listed for sale' + properties: + id: + type: string + description: 'Category identifier.' + example: '257931' + path: + type: array + items: + $ref: '#/components/schemas/ProductsCategoryPath' + SaleProductCompatibilityList: + type: object + required: + - id + - type + description: "Compatibility list assigned to this product, based on information from TecDoc database." + properties: + id: + type: string + description: 'Id of product-based compatibility list.' + example: '460b2511-b786-47b9-9d7e-1f868728cfd6-f103931434fbf4aa06764f3df74d371df23aa138a9cd46dbe570f51af79db1c4-2' + type: + type: string + description: 'Type of compatibility list.' + default: "PRODUCT_BASED" + items: + type: array + items: + $ref: '#/components/schemas/CompatibilityListItemProductBased' + description: "List of the compatible items." + SaleProductResponseCategoriesDto: + properties: + subcategories: + type: array + description: A list of categories that contain results for given search parameters. + items: + $ref: '#/components/schemas/ProductsCategorySubcategories' + path: + type: array + description: The path of current category used as categrory filter in search. + items: + $ref: '#/components/schemas/ProductsCategoryPath' + ProductsCategorySubcategories: + type: object + properties: + id: + type: string + description: Category id. + name: + type: string + description: Category name. + count: + type: integer + description: Total number of products matching query criteria in this category. + format: int32 + minimum: 0 + ProductsCategoryPath: + type: object + properties: + id: + type: string + description: Category id. + name: + type: string + description: Category name. + ProductParameter: + type: object + required: + - id + properties: + id: + type: string + rangeValue: + $ref: '#/components/schemas/ParameterRangeValue' + values: + type: array + items: + type: string + valuesIds: + type: array + items: + type: string + valuesLabels: + type: array + items: + type: string + unit: + type: string + options: + type: object + properties: + identifiesProduct: + type: boolean + description: Product's parameter + SupplierDto: + type: object + properties: + id: + type: string + description: Supplier id. + NewProductParameterDto: + type: object + properties: + id: + type: string + rangeValue: + $ref: '#/components/schemas/ParameterRangeValue' + values: + type: array + items: + type: string + valuesIds: + type: array + items: + type: string + ProductParameterDto: + type: object + required: + - id + properties: + id: + type: string + name: + type: string + rangeValue: + $ref: '#/components/schemas/ParameterRangeValue' + values: + type: array + items: + type: string + valuesIds: + type: array + items: + type: string + valuesLabels: + type: array + items: + type: string + unit: + type: string + options: + type: object + required: + - identifiesProduct + properties: + identifiesProduct: + type: boolean + isGTIN: + type: boolean + isTrusted: + type: boolean + description: Parameter values originate directly from the manufacturer, its representative, or a trusted source. + description: Product's parameter + AiCoCreatedContent: + type: object + required: + - paths + properties: + paths: + type: array + items: + type: string + description: Each path will point to a specific field in object which is co-created by AI. + TrustedContent: + type: object + required: + - paths + properties: + paths: + type: array + items: + type: string + description: Each path will point to a specific field in the product object, indicating that given product part data originates directly from the manufacturer, its representative, or a trusted source. + SaleProductOffer: + type: object + properties: + name: + type: string + description: >- + Name (title) of an offer. Length cannot be more than 75 characters. Read more: + PL + / + EN + . + example: "Test offer name" + maxLength: 75 + payments: + $ref: '#/components/schemas/Payments' + sellingMode: + $ref: '#/components/schemas/SellingMode' + location: + $ref: '#/components/schemas/Location' + images: + type: array + items: + type: string + description: + $ref: '#/components/schemas/StandardizedDescription' + external: + $ref: '#/components/schemas/ExternalId' + sizeTable: + $ref: '#/components/schemas/SizeTable' + taxSettings: + $ref: '#/components/schemas/OfferTaxSettings' + messageToSellerSettings: + $ref: '#/components/schemas/MessageToSellerSettings' + description: Single offer data. + SaleProductOfferRequestBase: + allOf: + - type: object + properties: + category: + type: object + allOf: + - $ref: '#/components/schemas/OfferCategoryRequest' + parameters: + type: array + items: + $ref: '#/components/schemas/ParameterProductOfferRequest' + publication: + type: object + properties: + duration: + $ref: '#/components/schemas/OfferDuration' + startingAt: + $ref: '#/components/schemas/OfferStartingAt' + status: + $ref: '#/components/schemas/OfferStatus' + delivery: + allOf: + - $ref: '#/components/schemas/DeliveryProductOfferRequest' + - type: object + properties: + shippingRates: + description: You can enter the shipping rates identifier or name. + afterSalesServices: + $ref: '#/components/schemas/AfterSalesServicesProductOfferRequest' + sizeTable: + allOf: + - $ref: '#/components/schemas/SizeTable' + - type: object + properties: + name: + type: string + description: The name of the size table definition. + description: The size table information. You can enter the size tabe identifier or name. + contact: + allOf: + - $ref: '#/components/schemas/Contact' + - type: object + properties: + name: + type: string + description: The name of the contact definition. + description: Identifier of contact data for sales format ADVERTISEMENT (classified ad). You can enter the contact identifier or name. + discounts: + $ref: '#/components/schemas/DiscountsProductOfferRequest' + - $ref: '#/components/schemas/SaleProductOffer' + SaleProductOffersRequestStock: + type: object + properties: + available: + type: integer + description: >- + Quantity of this offer available for sale - how many times this offer can be sold. + Offer can be activated only with stock being greater then 0. + Setting this quantity to 0 for 'ACTIVE' or 'ACTIVATING' offer will trigger changing its status to 'ENDED'. + format: int32 + minimum: 0 + example: 99 + unit: + type: string + description: 'Stock unit' + enum: + - UNIT + - PAIR + - SET + SaleProductOfferRequestV1: + allOf: + - type: object + required: + - stock + properties: + productSet: + type: array + items: + allOf: + - $ref: '#/components/schemas/ProductSetElement' + - description: List of products sold in the offer. + - $ref: '#/components/schemas/ProductSetElementQuantity' + - $ref: '#/components/schemas/ProductSetElementResponsiblePersonRequest' + - $ref: '#/components/schemas/ProductSetElementResponsibleProducerRequestWrapper' + - $ref: '#/components/schemas/ProductSetElementSafetyInformationWrapper' + - $ref: '#/components/schemas/MarketedBeforeGPSRObligation' + b2b: + $ref: '#/components/schemas/B2b' + attachments: + $ref: '#/components/schemas/ProductOfferAttachment' + fundraisingCampaign: + $ref: '#/components/schemas/ProductOfferFundraisingCampaignRequest' + additionalServices: + $ref: '#/components/schemas/ProductOfferAdditionalServicesRequest' + stock: + $ref: '#/components/schemas/SaleProductOffersRequestStock' + delivery: + allOf: + - $ref: '#/components/schemas/DeliveryProductOfferRequest' + - type: object + properties: + shipmentDate: + type: string + format: date-time + description: >- + Shipment date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + shippingRates: + description: You should enter the shipping rates identifier or name. + publication: + $ref: '#/components/schemas/SaleProductOfferPublicationRequest' + additionalMarketplaces: + $ref: '#/components/schemas/AdditionalMarketplacesRequest' + compatibilityList: + allOf: + - $ref: '#/components/schemas/CompatibilityListManualType' + description: + 'For the `/sale/product-offers` resources you can send only definition of the MANUAL compatibility list. If compatibility list is provided for the product assigned to the offer, it will be used automatically.' + language: + type: string + description: Declared base language of the offer. + format: BCP-47 language code + example: 'pl-PL' + - $ref: '#/components/schemas/SaleProductOfferRequestBase' + SaleProductOfferPatchRequestV1: + allOf: + - type: object + properties: + productSet: + type: array + items: + allOf: + - $ref: '#/components/schemas/ProductSetElement' + - description: List of products sold in the offer. + - $ref: '#/components/schemas/ProductSetElementQuantity' + - $ref: '#/components/schemas/ProductSetElementResponsiblePersonRequest' + - $ref: '#/components/schemas/ProductSetElementResponsibleProducerRequestWrapper' + - $ref: '#/components/schemas/ProductSetElementSafetyInformationWrapper' + - $ref: '#/components/schemas/MarketedBeforeGPSRObligation' + b2b: + $ref: '#/components/schemas/B2b' + attachments: + $ref: '#/components/schemas/ProductOfferAttachment' + fundraisingCampaign: + $ref: '#/components/schemas/ProductOfferFundraisingCampaignRequest' + additionalServices: + $ref: '#/components/schemas/ProductOfferAdditionalServicesRequest' + compatibilityList: + allOf: + - $ref: '#/components/schemas/CompatibilityListManualType' + description: + 'For the `/sale/product-offers` resources you can send only definition of the MANUAL compatibility list. If compatibility list is provided for the product assigned to the offer, it will be used automatically.' + delivery: + allOf: + - $ref: '#/components/schemas/DeliveryProductOfferRequest' + - type: object + properties: + shipmentDate: + type: string + format: date-time + description: >- + Shipment date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + shippingRates: + description: You should enter the shipping rates identifier or name. + stock: + $ref: '#/components/schemas/SaleProductOffersRequestStock' + publication: + $ref: '#/components/schemas/SaleProductOfferPublicationRequest' + additionalMarketplaces: + $ref: '#/components/schemas/AdditionalMarketplacesRequest' + language: + type: string + description: Declared base language of the offer. + format: BCP-47 language code + example: 'pl-PL' + - $ref: '#/components/schemas/SaleProductOfferRequestBase' + SaleProductOfferResponseV1: + allOf: + - type: object + properties: + id: + type: string + example: "12394584234" + productSet: + type: array + items: + allOf: + - $ref: '#/components/schemas/ProductSetElementQuantity' + - type: object + properties: + product: + allOf: + - $ref: '#/components/schemas/ProductOfferResponse' + - type: object + properties: + parameters: + type: array + items: + $ref: '#/components/schemas/ParameterProductOfferResponse' + description: Product parameters in the offer. + responsiblePerson: + type: object + description: >- + Reference to the responsible person configured using + Responsible + Persons API. Note that this is a different field than responsibleProducer. + properties: + id: + type: string + example: "570c928f-39ac-4838-93bb-eb829bc2136f" + responsibleProducer: + type: object + description: >- + Reference to the responsible producer configured using Responsible Producer API. Note that + this is a different field than responsiblePerson. + properties: + id: + type: string + example: "33960380-98fe-4b3d-b69e-b261526f2730" + - $ref: '#/components/schemas/ProductSetElementSafetyInformationWrapper' + - $ref: '#/components/schemas/MarketedBeforeGPSRObligation' + category: + $ref: '#/components/schemas/OfferCategory' + attachments: + $ref: '#/components/schemas/ProductOfferAttachment' + fundraisingCampaign: + $ref: '#/components/schemas/ProductOfferFundraisingCampaignResponse' + additionalServices: + $ref: '#/components/schemas/ProductOfferAdditionalServicesResponse' + delivery: + $ref: '#/components/schemas/DeliveryProductOfferResponse' + publication: + $ref: '#/components/schemas/SaleProductOfferPublicationResponse' + additionalMarketplaces: + $ref: '#/components/schemas/AdditionalMarketplacesResponse' + b2b: + $ref: '#/components/schemas/B2b' + compatibilityList: + $ref: '#/components/schemas/CompatibilityListProductOfferResponse' + language: + type: string + description: Declared base language of the offer. + format: BCP-47 language code + example: 'pl-PL' + validation: + $ref: '#/components/schemas/Validation' + warnings: + allOf: + - $ref: '#/components/schemas/Errors' + - description: >- + Information about any problems that occurred during request processing, for example: some details + may not have been saved, but the offer creation could continue. It is advised to present + this data similarly to validation.warnings. + afterSalesServices: + $ref: '#/components/schemas/AfterSalesServices' + discounts: + $ref: '#/components/schemas/DiscountsProductOfferResponse' + stock: + $ref: '#/components/schemas/Stock' + parameters: + type: array + items: + $ref: '#/components/schemas/ParameterProductOfferResponse' + description: List of offer parameters. + contact: + allOf: + - $ref: '#/components/schemas/Contact' + description: >- + Identifier of contact data for sales format ADVERTISEMENT (classified ad); + retrieve it via GET /sale/offer-contacts. + createdAt: + type: string + format: date-time + description: >- + Creation date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + Cannot be modified. + updatedAt: + type: string + format: date-time + description: >- + Last update date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + Cannot be modified. + - $ref: '#/components/schemas/SaleProductOffer' + SalePartialProductOfferResponse: + type: object + properties: + id: + type: string + description: Offer's ID + example: "12394584234" + stock: + type: object + description: Number of times this offer can be purchased (available for include=stock). + properties: + available: + type: integer + format: int32 + minimum: 0 + example: 99 + sellingMode: + type: object + description: Offer's price information for base marketplace (available for include=price). + properties: + price: + $ref: '#/components/schemas/Price' + additionalMarketplaces: + type: object + description: Information about this offer in additional marketplaces (available for include=price). + additionalProperties: + x-additionalPropertiesName: marketplaceId + type: object + properties: + sellingMode: + type: object + description: Price information for given addtional marketplace. + properties: + price: + $ref: '#/components/schemas/Price' + SaleProductOfferStatusResponse: + type: object + properties: + offer: + $ref: '#/components/schemas/OfferId' + operation: + type: object + properties: + id: + type: string + description: 'The unique operation identifier (UUID).' + example: "b572cdd0-7f2c-4800-9165-15795bd95f3c" + status: + type: string + description: 'Status of the operation.' + enum: + - "PENDING" + - "IN_PROGRESS" + - "COMPLETED" + example: "IN_PROGRESS" + startedAt: + type: string + format: ISO 8601 + description: 'The starting date and time of operation.' + example: '2019-05-29T12:00:00Z' + description: Single opertion data. + ProductOfferBase: + type: object + properties: + id: + type: string + example: c9e39cae-9cb6-11e9-a2a3-2a2ae2dbcce4 + description: Product id. + idType: + type: string + enum: + - GTIN + - MPN + description: >- + Type of id. This field is optional. It helps in finding products more accurately. If an idType is not set, a given id is understood as a product's id. + - `GTIN` - restricts the search filtering to GTINs (Global Trade Item Number), e.g. EAN, ISBN, UPC. + - `MPN` - restricts the search filtering to MPNs (Manufacturer Part Number). + parameters: + type: array + items: + $ref: '#/components/schemas/ParameterProductOfferRequest' + description: List of product parameters. + images: + type: array + items: + type: string + example: "https://a.allegroimg.com/original/12068b/359d04074521b79df1b2807a6727" + description: List of product images. + ProductOffer: + allOf: + - type: object + properties: + name: + type: string + description: Product name. + example: iPhone 5s + maxLength: 75 + category: + $ref: '#/components/schemas/ProductCategory' + - $ref: '#/components/schemas/ProductOfferBase' + ProductSetElement: + type: object + properties: + product: + allOf: + - $ref: '#/components/schemas/ProductOffer' + description: You should enter the product identifier (UUID or EAN) or a complete product definition. + ProductSetElementQuantity: + type: object + properties: + quantity: + type: object + properties: + value: + type: integer + example: 1 + minimum: 1 + description: >- + The number of a given product included in a single offer sold as an element of a product set. + **Note:** For number of sets available in stock, use `stock.available` property. + ProductSetElementResponsiblePersonRequest: + type: object + properties: + responsiblePerson: + type: object + description: >- + Reference to the responsible person configured using + Responsible + Persons API. Provide either id or name - id will be used if both are provided. Setting + this object to null will result in no responsible person assigned to this product. + properties: + id: + type: string + example: 33960380-98fe-4b3d-b69e-b261526f2730 + description: >- + Identifier of a responsible person. + name: + type: string + description: >- + Name of a responsible person. Note that this references name of the person object, + not the name in their personal data section. + ProductSetElementResponsibleProducerRequestWrapper: + type: object + properties: + responsibleProducer: + $ref: '#/components/schemas/ProductSetElementResponsibleProducerRequest' + example: + responsibleProducer: + type: 'ID' + id: '12345678-9abc-def1-2345-6789abcdef12' + ProductSetElementResponsibleProducerRequest: + type: object + properties: + type: + type: string + default: 'ID' + example: 'ID' + required: + - type + discriminator: + propertyName: type + mapping: + ID: '#/components/schemas/ProductSetElementResponsibleProducerIdRequest' + NAME: '#/components/schemas/ProductSetElementResponsibleProducerNameRequest' + description: >- + Reference to the responsible producer configured using + Responsible + Producers API. + ProductSetElementResponsibleProducerIdRequest: + allOf: + - $ref: '#/components/schemas/ProductSetElementResponsibleProducerRequest' + - type: object + properties: + type: + type: string + id: + type: string + description: ID of responsible producer + example: '12345678-9abc-def1-2345-6789abcdef12' + ProductSetElementResponsibleProducerNameRequest: + allOf: + - $ref: '#/components/schemas/ProductSetElementResponsibleProducerRequest' + - type: object + properties: + type: + type: string + name: + type: string + description: >- + Name of responsible producer. **Note:** This refers to the name property and not + the producerData.tradeName property of responsible producer defined using + Responsible + Producers API. + example: 'your producer name' + maxLength: 50 + minLength: 1 + ProductSetElementSafetyInformationWrapper: + type: object + properties: + safetyInformation: + $ref: '#/components/schemas/ProductSetElementSafetyInformation' + example: + safetyInformation: + type: 'TEXT' + description: string + ProductSetElementSafetyInformation: + type: object + properties: + type: + type: string + example: 'TEXT' + required: + - type + discriminator: + propertyName: type + mapping: + TEXT: '#/components/schemas/ProductSetElementTextSafetyInformation' + ATTACHMENTS: '#/components/schemas/ProductSetElementAttachmentSafetyInformation' + NO_SAFETY_INFORMATION: '#/components/schemas/ProductSetElementNoSafetyInformation' + description: >- + Contains information about product's safety. + Reference Docs + ProductSetElementNoSafetyInformation: + allOf: + - $ref: '#/components/schemas/ProductSetElementSafetyInformation' + - type: object + properties: + type: + description: The option is deprecated and will be removed in the future. + deprecated: true + type: string + ProductSetElementAttachmentSafetyInformation: + allOf: + - $ref: '#/components/schemas/ProductSetElementSafetyInformation' + - type: object + properties: + type: + type: string + attachments: + type: array + items: + type: object + properties: + id: + type: string + example: 11a2df7f-8237-4625-baa2-cb7541f39946 + description: Id of the attachment. + ProductSetElementTextSafetyInformation: + allOf: + - $ref: '#/components/schemas/ProductSetElementSafetyInformation' + - type: object + properties: + type: + type: string + description: + type: string + example: 'Contains small parts' + description: Safety warnings and instructions for the product in plain text form, if the information cannot be provided through attachments. Text can't be longer than 5000 characters. + MarketedBeforeGPSRObligation: + type: object + properties: + marketedBeforeGPSRObligation: + type: boolean + nullable: true + example: true + description: Allows you to declare that the product was introduced before 13 Dec 2024 and therefore does not require GPSR data. + ProductOfferResponse: + type: object + properties: + id: + type: string + example: c9e39cae-9cb6-11e9-a2a3-2a2ae2dbcce4 + description: Product id. + publication: + type: object + properties: + status: + type: string + example: "LISTED" + enum: + - PROPOSED + - LISTED + - NOT_LISTED + - REMOVED + description: >- + The publication status of the product assigned to the offer: + - `PROPOSED` - a new product proposal was created or an existing product in the review process was selected and assigned to the offer + - `LISTED` - a reviewed product from our database was identified and assigned to the offer + - `NOT_LISTED` - no new product proposal was created nor an existing product from database was assigned to the offer + - `REMOVED` - the product review was negative or the product was merged with another product. This means that the product will soon be removed from the offer and you can assign a correct product. + + AfterSalesServicesProductOfferRequest: + type: object + description: The definitions of the different after sales services assigned to the offer. + properties: + impliedWarranty: + allOf: + - $ref: '#/components/schemas/ImpliedWarranty' + - type: object + properties: + name: + type: string + description: The name of the implied warranty definition. + example: "Implied warranty 1" + returnPolicy: + allOf: + - $ref: '#/components/schemas/ReturnPolicy' + - type: object + properties: + name: + type: string + description: The name of the return policy definition. + example: "Return policy 1" + warranty: + allOf: + - $ref: '#/components/schemas/Warranty' + - type: object + properties: + name: + type: string + description: The name of the warranty definition. + example: "Warranty 1" + DeliveryProductOfferRequest: + type: object + properties: + handlingTime: + type: string + example: PT24H + description: >- + Handling time, ISO 8601 duration format. + This field must be set to one of the following: + PT0S for immediately, PT24H, P2D, P3D, P4D, P5D, P7D, P10D, P14D, P21D, P30D, P60D. + shippingRates: + allOf: + - $ref: '#/components/schemas/JustId' + - type: object + properties: + name: + type: string + description: The name of the shipping rate. + example: "Shipping rate 1" + additionalInfo: + type: string + maxLength: 650 + deprecated: true + description: >- + Additional information about delivery. + Parameter is deprecated and will be removed in the future. + Additional information is only visible on marketplace `allegro-pl`. + example: "Example additional info" + DeliveryProductOfferResponse: + type: object + properties: + handlingTime: + type: string + example: PT24H + description: >- + Handling time, ISO 8601 duration format. + This field must be set to one of the following: + PT0S for immediately, PT24H, P2D, P3D, P4D, P5D, P7D, P10D, P14D, P21D, P30D, P60D. + shippingRates: + $ref: '#/components/schemas/JustId' + additionalInfo: + type: string + maxLength: 650 + deprecated: true + description: >- + Additional information about delivery. + Parameter is deprecated and will be removed in the future. + Additional information is only visible on marketplace `allegro-pl`. + example: "Example additional info" + shipmentDate: + type: string + format: date-time + description: >- + Shipment date: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + example: "2019-08-24T14:15:22Z" + SaleProductOfferPublicationMarketplacesResponse: + type: object + description: >- + Information about publication in multiple marketplaces.
+ See [Changes in listing offers - we will add the possibility to display offers in foreign domains of Allegro's marketplaces](https://developer.allegro.pl/news/changes-in-listing-offers-we-will-add-the-possibility-to-display-offers-in-foreign-domains-of-allegro-s-marketplaces-9gKv0RVzRTK) + for more details regarding this field + properties: + base: + allOf: + - $ref: '#/components/schemas/JustId' + description: >- + [read-only] Specifies the offer’s base service. We assign the value in the field + automatically when the offer is created and it is read-only, it will never change. + additional: + type: array + description: >- + Specifies whether an offer is visible in the additional marketplace. + items: + $ref: "#/components/schemas/JustId" + SaleProductOfferPublicationRequest: + allOf: + - $ref: '#/components/schemas/PublicationRequest' + SaleProductOfferPublicationResponse: + allOf: + - $ref: '#/components/schemas/Publication' + - type: object + properties: + marketplaces: + $ref: '#/components/schemas/SaleProductOfferPublicationMarketplacesResponse' + AdditionalMarketplacesRequest: + type: object + description: >- + Selected information about the offer in each additional service. This field does not contain information about + the base marketplace of the offer.
+ Possible values of `marketplaceId` can be obtained from `GET /marketplaces` resource.
+ See [Allegro foreign marketplaces](https://developer.allegro.pl/tutorials/listing-and-managing-offers-on-foreign-marketplaces-7GndGjeAATn) + for more details regarding this field. + additionalProperties: + x-additionalPropertiesName: marketplaceId + type: object + properties: + sellingMode: + type: object + properties: + price: + allOf: + - $ref: '#/components/schemas/Price' + description: >- + The offer price for the selected additional marketplace. The price in this field must be provided by + the seller in the correct currency, which is specified in the `GET /marketplaces` resource. + example: + allegro-cz: + sellingMode: + price: + amount: '233.01' + currency: CZK + AdditionalMarketplacesResponse: + type: object + description: >- + Selected information about the offer in each additional service. This field does not contain information about + the base marketplace of the offer. You will find all available marketplaces here. Even if the seller does not + want the offer to be visible in the additional service, we will return it in response. + additionalProperties: + x-additionalPropertiesName: marketplaceId + type: object + properties: + sellingMode: + allOf: + - $ref: "#/components/schemas/SellingMode" + description: >- + The offer price for the selected additional marketplace. + publication: + type: object + description: >- + [read-only] Contains information about the visibility status of the listing for the given service. + properties: + state: + type: string + enum: + - APPROVED + - REFUSED + - IN_PROGRESS + - NOT_REQUESTED + - PENDING + description: >- + Possible values:
+ - `APPROVED` - the offer is visible in the given additional marketplace if it is active.
+ - `REFUSED` - the offer or the seller does not meet the conditions required to display the offer in + the given additional marketplace.
+ - `IN_PROGRESS` - the process of qualifying the offer visibility in a given additional service is + in progress.
+ - `NOT_REQUESTED` - the seller has not indicated the intention of visibility in the given additional + service.
+ - `PENDING` - the seller has indicated the intention of visibility on a given additional marketplace, + but the qualification process has not started, for example, due to offer status (only active offers are subject to the qualification process). + refusalReasons: + type: array + description: Reasons for marketplace publication refusal. Empty list for not refused marketplaces. + items: + $ref: "#/components/schemas/AdditionalMarketplacesRefusalReasonResponse" + example: + allegro-cz: + sellingMode: + price: + amount: '233.51' + currency: CZK + publication: + state: REFUSED + refusalReasons: + - code: VQR009_PRICE_IN_ADDITIONAL_MARKETPLACE_MISMATCH + userMessage: 'price difference too big' + parameters: + maxAllowedPriceDecreasePercent: ["20"] + AdditionalMarketplacesRefusalReasonResponse: + type: object + properties: + code: + type: string + description: Technical code of the refusal reason + userMessage: + type: string + description: Short description of the refusal reason in natural language + parameters: + type: object + description: Additional technical parameters of the refusal reason + additionalProperties: + type: array + items: + type: string + ParameterProductOfferRequest: + type: object + properties: + id: + type: string + example: "224017" + name: + type: string + description: The name of the parameter. + example: "Manufacturer code" + rangeValue: + $ref: '#/components/schemas/ParameterRangeValue' + values: + type: array + items: + type: string + example: "4234" + valuesIds: + type: array + items: + type: string + example: "129970_850936" + description: Offer's parameter. + ParameterProductOfferResponse: + type: object + properties: + id: + type: string + example: "224017" + name: + type: string + description: The name of the parameter. + example: "Manufacturer code" + rangeValue: + $ref: '#/components/schemas/ParameterRangeValue' + values: + type: array + items: + type: string + example: "4234" + valuesIds: + type: array + items: + type: string + example: "129970_850936" + description: Parameter. + DiscountsProductOfferRequest: + type: object + properties: + wholesalePriceList: + type: object + properties: + id: + type: string + description: Wholesale price list id + example: "5637592a-0a24-4771-b527-d89b2767d821" + name: + type: string + description: The name of the wholesale price list definition. + example: "Wholesale example" + DiscountsProductOfferResponse: + type: object + properties: + wholesalePriceList: + $ref: '#/components/schemas/JustId' + OfferRequirements: + description: 'Conditions which an offer must meet to be assigned with the product, i.e. Condition parameter must be set to New.' + properties: + id: + type: string + example: "2865624934" + description: The id of the offer that can be associated with this product. + parameters: + type: array + items: + $ref: '#/components/schemas/ProductParameterDto' + AdditionalEmailsResponse: + type: object + required: + - additional-emails + properties: + additional-emails: + type: array + items: + $ref: '#/components/schemas/AdditionalEmail' + AdditionalEmail: + type: object + description: Details of a single additional email address. + required: + - id + - email + - createdAt + properties: + id: + type: string + email: + type: string + createdAt: + type: string + AdditionalEmailRequest: + type: object + required: + - email + properties: + email: + type: string + description: >- + A valid email address you want to add to your account. Maximum length of the part before the `@` sign is + 64 characters. + ClassifiedPackages: + type: object + required: + - basePackage + properties: + basePackage: + $ref: '#/components/schemas/ClassifiedPackage' + extraPackages: + type: array + items: + $ref: '#/components/schemas/ClassifiedPackage' + ClassifiedResponse: + type: object + required: + - basePackage + - extraPackages + properties: + basePackage: + $ref: '#/components/schemas/ClassifiedPackage' + extraPackages: + type: array + items: + $ref: '#/components/schemas/ClassifiedExtraPackage' + title: ClassifiedResponse + ClassifiedExtension: + type: object + properties: + description: + type: string + description: 'The classified extension description.' + example: 'Autocentrum.pl' + name: + type: string + description: 'The classified extension name.' + example: 'autocentrumExport' + title: ClassifiedExtension + ClassifiedPackageConfig: + type: object + required: + - id + - name + - type + properties: + extensions: + type: array + items: + $ref: '#/components/schemas/ClassifiedExtension' + id: + type: string + description: 'The classifieds package ID.' + example: '6174be19-56f9-484b-b72c-43b0b00785e8' + name: + type: string + description: 'The classifieds package name.' + example: 'Power' + promotions: + type: array + description: 'A list of additional promotions included in the package.' + items: + $ref: '#/components/schemas/ClassifiedPromotion' + publication: + $ref: '#/components/schemas/ClassifiedPublication' + type: + type: string + enum: + - BASE + - EXTRA + title: ClassifiedPackageConfig + ClassifiedPackageConfigs: + type: object + required: + - packages + properties: + packages: + type: array + items: + $ref: '#/components/schemas/ClassifiedPackageConfig' + title: ClassifiedPackageConfigs + ClassifiedPromotion: + type: object + required: + - duration + - name + properties: + duration: + type: string + description: 'Duration in ISO 8601 format.' + example: 'PT240H' + name: + type: string + description: 'Name of the promotion.' + example: 'emphasized' + title: ClassifiedPromotion + ClassifiedPublication: + type: object + required: + - duration + properties: + duration: + type: string + description: 'Duration in ISO 8601 format.' + example: 'PT240H' + title: ClassifiedPublication + PaymentOperations: + type: object + required: + - count + - totalCount + - paymentOperations + properties: + paymentOperations: + type: array + description: Collection of payment operations. + items: + $ref: '#/components/schemas/BaseOperation' + count: + type: integer + format: int32 + description: Number of payment operations returned in search result for the given parameters. + example: 50 + minimum: 0 + totalCount: + type: integer + format: int32 + description: Total number of payment operations for the given parameters. + example: 123 + minimum: 0 + BaseOperation: + type: object + required: + - type + - group + - occurredAt + - wallet + - value + properties: + type: + type: string + description: Type of the operation. + group: + type: string + description: The group to which the given operation type belongs. + enum: + - "INCOME" + - "OUTCOME" + - "REFUND" + - "BLOCKADES" + example: 'INCOME' + wallet: + $ref: '#/components/schemas/Wallet' + value: + $ref: '#/components/schemas/OperationValue' + occurredAt: + type: string + format: date-time + description: Date and time of the operation in ISO 8601 format. + example: "2019-05-08T09:45:00.818Z" + marketplaceId: + type: string + description: The marketplace ID where operation was made. Value may be `null` for operations not assigned to any marketplace. + discriminator: + propertyName: type + mapping: + CORRECTION: '#/components/schemas/CorrectionOperation' + CONTRIBUTION: '#/components/schemas/ContributionOperation' + PAYOUT: '#/components/schemas/PayoutOperation' + PAYOUT_CANCEL: '#/components/schemas/PayoutOperationCancel' + REFUND_INCREASE: '#/components/schemas/RefundIncreaseOperation' + REFUND_CHARGE: '#/components/schemas/RefundChargeOperation' + REFUND_CANCEL: '#/components/schemas/RefundCancelOperation' + SURCHARGE: '#/components/schemas/SurchargeOperation' + DEDUCTION_CHARGE: '#/components/schemas/DeductionChargeOperation' + DEDUCTION_INCREASE: '#/components/schemas/DeductionIncreaseOperation' + BLOCKADE: '#/components/schemas/BlockadeOperation' + BLOCKADE_RELEASE: '#/components/schemas/BlockadeReleaseOperation' + PROVIDER_REFUND_TRANSFER_CHARGE: '#/components/schemas/ProviderRefundTransferChargeOperation' + PROVIDER_REFUND_TRANSFER_INCREASE: '#/components/schemas/ProviderRefundTransferIncreaseOperation' + COMPENSATION: '#/components/schemas/CompensationOperation' + Wallet: + type: object + description: The state of the wallet after the operation. + required: + - paymentOperator + - type + - balance + properties: + paymentOperator: + type: string + description: The payment operator. + enum: + - PAYU + - P24 + - AF + - AF_PAYU + - AF_P24 + example: 'PAYU' + type: + type: string + description: The type of the wallet. + enum: + - AVAILABLE + - WAITING + example: 'AVAILABLE' + balance: + $ref: '#/components/schemas/WalletBalance' + WalletBalance: + title: MonetaryAmount + allOf: + - $ref: '#/components/schemas/Price' + - type: object + description: The wallet balance after the operation. + OperationValue: + title: MonetaryAmount + allOf: + - $ref: '#/components/schemas/Price' + - type: object + description: The operation value. + RefundDeliveryValue: + title: MonetaryAmount + allOf: + - $ref: '#/components/schemas/Price' + - type: object + description: Delivery amount for payment refund. + RefundOverpaidValue: + title: MonetaryAmount + allOf: + - $ref: '#/components/schemas/Price' + - type: object + description: Overpaid amount for payment refund. + RefundAdditionalServicesValue: + title: MonetaryAmount + allOf: + - $ref: '#/components/schemas/Price' + - type: object + description: Additional services amount for payment refund. + RefundSurchargeValue: + title: MonetaryAmount + allOf: + - $ref: '#/components/schemas/Price' + - type: object + description: Surcharge refund amount. + RefundTotalValue: + title: MonetaryAmount + allOf: + - $ref: '#/components/schemas/Price' + - type: object + description: Total amount for payment refund. + CorrectionOperation: + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'CORRECTION' + ContributionOperation: + required: + - payment + - participant + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'CONTRIBUTION' + payment: + $ref: '#/components/schemas/OperationPayment' + participant: + $ref: '#/components/schemas/BuyerParticipant' + PayoutOperation: + required: + - payout + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'PAYOUT' + payout: + $ref: '#/components/schemas/Payout' + PayoutOperationCancel: + required: + - payout + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'PAYOUT_CANCEL' + payout: + $ref: '#/components/schemas/Payout' + RefundIncreaseOperation: + required: + - payment + - participant + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'REFUND_INCREASE' + payment: + $ref: '#/components/schemas/OperationPayment' + participant: + $ref: '#/components/schemas/SellerParticipant' + RefundCancelOperation: + required: + - payment + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'REFUND_CANCEL' + payment: + $ref: '#/components/schemas/OperationPayment' + RefundChargeOperation: + required: + - payment + - participant + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'REFUND_CHARGE' + payment: + $ref: '#/components/schemas/OperationPayment' + participant: + $ref: '#/components/schemas/BuyerParticipant' + SurchargeOperation: + required: + - payment + - surcharge + - participant + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'SURCHARGE' + payment: + $ref: '#/components/schemas/OperationPayment' + surcharge: + $ref: '#/components/schemas/Surcharge' + participant: + $ref: '#/components/schemas/BuyerParticipant' + DeductionChargeOperation: + required: + - deduction + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'DEDUCTION_CHARGE' + deduction: + $ref: '#/components/schemas/Deduction' + DeductionIncreaseOperation: + required: + - deduction + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'DEDUCTION_INCREASE' + deduction: + $ref: '#/components/schemas/Deduction' + BlockadeOperation: + required: + - payment + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'BLOCKADE' + payment: + $ref: '#/components/schemas/OperationPayment' + BlockadeReleaseOperation: + required: + - payment + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'BLOCKADE_RELEASE' + payment: + $ref: '#/components/schemas/OperationPayment' + ProviderRefundTransferIncreaseOperation: + required: + - payment + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'PROVIDER_REFUND_TRANSFER_INCREASE' + payment: + $ref: '#/components/schemas/OperationPayment' + ProviderRefundTransferChargeOperation: + required: + - payment + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'PROVIDER_REFUND_TRANSFER_CHARGE' + payment: + $ref: '#/components/schemas/OperationPayment' + CompensationOperation: + allOf: + - $ref: '#/components/schemas/BaseOperation' + - type: object + properties: + type: + type: string + default: 'COMPENSATION' + OperationPayment: + type: object + title: OperationPayment + description: Payment. + required: + - id + properties: + id: + type: string + format: uuid + description: The payment ID. + example: 2e2fe432-2115-32f9-82ae-e350e7aa9ed0 + Participant: + type: object + required: + - login + - firstName + - lastName + properties: + companyName: + type: string + description: Company name. + example: Allegro + login: + type: string + description: Login. + example: User_login + firstName: + type: string + description: First name. + example: Jan + lastName: + type: string + description: Last name. + example: Nowak + address: + $ref: '#/components/schemas/OperationParticipantAddress' + SellerParticipant: + title: SellerParticipant + description: The seller's data. + required: + - id + allOf: + - $ref: '#/components/schemas/Participant' + - type: object + properties: + id: + type: string + description: The seller's ID. + BuyerParticipant: + title: BuyerParticipant + description: The buyer's data. + required: + - id + allOf: + - $ref: '#/components/schemas/Participant' + - type: object + properties: + id: + type: string + description: The buyers's ID. + OperationParticipantAddress: + type: object + required: + - street + - city + - postCode + description: Address. + properties: + street: + type: string + description: Street. + example: Grunwaldzka 108 + city: + type: string + description: City. + example: Poznań + postCode: + type: string + description: Postal code. + example: 60-166 + Payout: + type: object + description: Payout. + required: + - id + properties: + id: + type: string + description: The payout ID. + Surcharge: + type: object + description: Surcharge. + required: + - id + properties: + id: + type: string + format: uuid + description: The surcharge ID. + example: 2e2fe432-2115-32f9-82ae-e350e7aa9ed0 + Deduction: + type: object + description: Deduction. + required: + - id + properties: + id: + type: string + format: uuid + description: The deduction ID. + example: 2e2fe432-2115-32f9-82ae-e350e7aa9ed0 + TecdocSpecification: + type: object + required: + - id + description: 'Contains additional information describing products from automotive categories. + Technical specification is created based on TecDoc database and can only be + used while creating offer with assigned product to it. + Read more.' + properties: + id: + type: string + description: 'Identifier of technical specification.' + example: '470b8513-b786-b7b9-9e7e-2f848729cfd6' + items: + type: array + items: + $ref: '#/components/schemas/TecdocSpecificationItem' + description: 'Text representation of the technical specification. Provided for informational purposes only - + ignored when creating (Post) or updating (Put) compatibility list in the offer.' + TecdocSpecificationItem: + type: object + properties: + name: + type: string + description: 'Technical specification property name.' + example: 'Wersja TecDoc' + values: + type: array + items: + type: string + description: 'Technical specification property values.' + example: + - '0319' + MeResponse: + type: object + properties: + id: + type: string + description: User Id. + example: "46968690" + login: + type: string + description: User login. + example: "Client:46968690" + firstName: + type: string + description: User's first name. + example: "Amadeusz" + lastName: + type: string + description: User's last name. + example: "Iksiński" + email: + type: string + description: User's email. + example: "user-email@allegro.pl" + baseMarketplace: + type: object + properties: + id: + type: string + description: Base marketplace identifier + example: "allegro-pl" + company: + $ref: '#/components/schemas/Company' + features: + type: array + items: + type: string + description: >- + User's features list: + - `SUPER_SELLER` - Super Seller ("Super Sprzedawca") information. + - `ONE_FULFILLMENT` - Seller uses the fulfillment service provided by Allegro. + example: + - 'SUPER_SELLER' + - 'ONE_FULFILLMENT' + Company: + type: object + properties: + name: + type: string + description: User's company name. + example: "Allegro.pl sp. z o.o." + taxId: + type: string + description: User's tax identification number. + example: "5252674798" + MyBidResponse: + type: object + description: bid response + title: MyBidResponse + required: + - maxAmount + - highBidder + - auction + properties: + maxAmount: + $ref: "#/components/schemas/MaxPrice" + minimalPriceMet: + type: boolean + description: >- + This indicates if the minimal price of the auction has been met or is not set at all. A minimal price can + be set by the seller and is the minimum amount the seller is willing to sell the item for. + If the highest bid is not higher than the minimal price when the auction ends, the listing ends and + the item is not sold. + highBidder: + type: boolean + description: Is this bid currently winning? + auction: + type: object + title: AuctionDetails + description: Auction details. + required: + - currentPrice + properties: + currentPrice: + $ref: "#/components/schemas/CurrentPrice" + SellerOfferEventsResponse: + type: object + required: + - offerEvents + properties: + offerEvents: + type: array + description: The list of events. + items: + $ref: '#/components/schemas/SellerOfferBaseEvent' + SellerOfferBaseEvent: + type: object + required: + - id + - type + - occurredAt + description: The data of an event. + properties: + id: + type: string + description: The ID of the event. It can be used in the `from` parameter of the query. + example: "MTEzMjQzODU3NA" + maxLength: 256 + occurredAt: + type: string + format: date-time + description: The date and time when the event occurred, provided in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + example: "2019-06-26T15:26:43.891Z" + type: + type: string + description: The type of the event. + example: "OFFER_ACTIVATED" + discriminator: + propertyName: type + mapping: + OFFER_ACTIVATED: '#/components/schemas/OfferActivatedEvent' + OFFER_CHANGED: '#/components/schemas/OfferChangedEvent' + OFFER_ENDED: '#/components/schemas/OfferEndedEvent' + OFFER_STOCK_CHANGED: '#/components/schemas/OfferStockChangedEvent' + OFFER_PRICE_CHANGED: '#/components/schemas/OfferPriceChangedEvent' + OFFER_ARCHIVED: '#/components/schemas/OfferArchivedEvent' + OFFER_BID_PLACED: '#/components/schemas/OfferBidPlacedEvent' + OFFER_BID_CANCELED: '#/components/schemas/OfferBidCanceledEvent' + OFFER_TRANSLATION_UPDATED: '#/components/schemas/OfferTranslationUpdatedEvent' + OFFER_VISIBILITY_CHANGED: '#/components/schemas/OfferVisibilityChangedEvent' + OfferActivatedEvent: + allOf: + - $ref: '#/components/schemas/SellerOfferBaseEvent' + - type: object + required: + - offer + properties: + type: + type: string + default: 'OFFER_ACTIVATED' + offer: + $ref: '#/components/schemas/OfferEventExternalOffer' + OfferChangedEvent: + allOf: + - $ref: '#/components/schemas/SellerOfferBaseEvent' + - type: object + required: + - offer + properties: + type: + type: string + default: 'OFFER_CHANGED' + offer: + $ref: '#/components/schemas/OfferEventExternalOffer' + OfferEndedEvent: + allOf: + - $ref: '#/components/schemas/SellerOfferBaseEvent' + - type: object + required: + - offer + properties: + type: + type: string + default: 'OFFER_ENDED' + offer: + $ref: '#/components/schemas/OfferEventEndedOffer' + OfferStockChangedEvent: + allOf: + - $ref: '#/components/schemas/SellerOfferBaseEvent' + - type: object + required: + - offer + properties: + type: + type: string + default: 'OFFER_STOCK_CHANGED' + offer: + $ref: '#/components/schemas/OfferEventExternalOffer' + OfferPriceChangedEvent: + allOf: + - $ref: '#/components/schemas/SellerOfferBaseEvent' + - type: object + required: + - offer + properties: + type: + type: string + default: 'OFFER_PRICE_CHANGED' + offer: + $ref: '#/components/schemas/OfferEventExternalOfferForPriceChanges' + OfferArchivedEvent: + allOf: + - $ref: '#/components/schemas/SellerOfferBaseEvent' + - type: object + required: + - offer + properties: + type: + type: string + default: "OFFER_ARCHIVED" + offer: + $ref: '#/components/schemas/OfferEventExternalOffer' + OfferBidPlacedEvent: + allOf: + - $ref: '#/components/schemas/SellerOfferBaseEvent' + - type: object + required: + - offer + properties: + type: + type: string + default: "OFFER_BID_PLACED" + offer: + $ref: '#/components/schemas/OfferEventBaseOffer' + OfferBidCanceledEvent: + allOf: + - $ref: '#/components/schemas/SellerOfferBaseEvent' + - type: object + required: + - offer + properties: + type: + type: string + default: "OFFER_BID_CANCELED" + offer: + $ref: '#/components/schemas/OfferEventBaseOffer' + OfferTranslationUpdatedEvent: + allOf: + - $ref: '#/components/schemas/SellerOfferBaseEvent' + - type: object + required: + - offer + properties: + type: + type: string + default: "OFFER_TRANSLATION_UPDATED" + offer: + $ref: '#/components/schemas/OfferEventExternalOffer' + translations: + type: array + items: + $ref: '#/components/schemas/ChangedTranslation' + ChangedTranslation: + type: object + description: The changed translation. + properties: + language: + type: string + example: "en-US" + description: Translation language + OfferVisibilityChangedEvent: + allOf: + - $ref: '#/components/schemas/SellerOfferBaseEvent' + - type: object + required: + - offer + properties: + type: + type: string + default: "OFFER_VISIBILITY_CHANGED" + offer: + $ref: '#/components/schemas/OfferEventExternalOfferWithPublication' + OfferEventBaseOffer: + type: object + description: The data of the offer, for which the event occurred. + required: + - id + properties: + id: + type: string + example: "2865624934" + description: The offer ID. + OfferEventExternalOffer: + allOf: + - $ref: '#/components/schemas/OfferEventBaseOffer' + - type: object + properties: + external: + $ref: '#/components/schemas/ExternalId' + OfferEventExternalOfferWithPublication: + allOf: + - $ref: '#/components/schemas/OfferEventBaseOffer' + - type: object + required: + - publication + properties: + external: + $ref: '#/components/schemas/ExternalId' + publication: + $ref: '#/components/schemas/OfferMarketplacesPublication' + OfferEventExternalOfferForPriceChanges: + allOf: + - $ref: '#/components/schemas/OfferEventBaseOffer' + - type: object + required: + - external + properties: + external: + $ref: '#/components/schemas/ExternalId' + marketplaces: + type: array + items: + $ref: '#/components/schemas/OfferMarketplacesPriceChanges' + OfferMarketplacesPriceChanges: + type: object + description: Offer with marketplace data. + properties: + id: + type: string + example: "allegro-pl" + description: ID of the marketplace on which the price has been changed. + changeType: + description: Change type. One of MANUAL or AUTOMATIC. + type: string + example: MANUAL + OfferMarketplacesPublication: + type: object + description: Offer publication data. + required: + - marketplaces + - updatedMarketplaces + properties: + marketplaces: + $ref: '#/components/schemas/MarketplacesVisibility' + updatedMarketplaces: + description: List of marketplaces with updated visibility. + type: array + items: + type: string + MarketplacesVisibility: + type: object + description: Offer marketplaces visibility information. + required: + - base + properties: + base: + type: string + example: "allegro-pl" + description: Base marketplace ID. + additional: + type: array + description: Additional marketplaces information. + items: + $ref: '#/components/schemas/AdditionalMarketplacesVisibility' + AdditionalMarketplacesVisibility: + type: object + description: Offer additional marketplaces visibility information. + required: + - id + - status + properties: + id: + type: string + example: "allegro-cz" + description: Additional marketplace ID. + status: + type: string + enum: + - APPROVED + - REFUSED + - IN_PROGRESS + description: Marketplace visibility qualification status. + refusalReasons: + type: array + description: Reasons of visibility refusal. + items: + $ref: '#/components/schemas/RefusalReason' + RefusalReason: + allOf: + - type: object + required: + - code + properties: + code: + type: string + description: Refusal reason code. + parameters: + type: object + description: Refusal reason parameters. + additionalProperties: + type: array + items: + type: string + relatedReasons: + type: array + description: Related refusal reasons. + items: + $ref: '#/components/schemas/RelatedReason' + RelatedReason: + allOf: + - type: object + required: + - code + properties: + code: + type: string + description: Refusal reason code. + parameters: + type: object + description: Refusal reason parameters. + additionalProperties: + type: array + items: + type: string + OfferEventEndedOffer: + allOf: + - $ref: '#/components/schemas/OfferEventExternalOffer' + - type: object + required: + - publication + properties: + publication: + type: object + description: Information about publication of the given offer. + required: + - endedBy + properties: + endedBy: + type: string + enum: + - USER + - ADMIN + - EXPIRATION + - EMPTY_STOCK + - PRODUCT_DETACHMENT + - ERROR + - UNKNOWN + example: 'USER' + description: >- + Indicates the reason for ending the offer: + - `USER` - offer ended by the seller. + - `ADMIN` - offer ended by an admin. + - `EXPIRATION` - offer duration had expired (valid for offers with specified duration). + - `EMPTY_STOCK` - offer ended because all available items had been sold out. + - `PRODUCT_DETACHMENT` - offer ended because its link to the product was removed. Status will only occur + if the base marketplace of offer requires full productization. + - `ERROR` - offer ended due to internal problem with offer publication. The publication command responded with + success status, but further processing failed. + - `UNKNOWN` - in rare cases the reason might be unknown. + GetBadgeCampaignsList: + type: object + required: + - badgeCampaigns + properties: + badgeCampaigns: + type: array + items: + $ref: '#/components/schemas/BadgeCampaign' + description: 'List of badge campaigns.' + title: BadgeCampaigns + BadgeCampaign: + type: object + required: + - id + - name + - marketplace + - type + - eligibility + - application + - visibility + - publication + - regulationsLink + properties: + id: + type: string + description: 'Badge campaign ID.' + example: 'BARGAIN' + name: + type: string + description: 'Badge campaign name.' + example: 'Strefa Okazji' + marketplace: + $ref: '#/components/schemas/MarketplaceReference' + type: + type: string + enum: + - DISCOUNT + - STANDARD + - SOURCING + example: 'DISCOUNT' + eligibility: + $ref: '#/components/schemas/UserCampaignEligibility' + application: + $ref: '#/components/schemas/ApplicationTimePolicy' + visibility: + $ref: '#/components/schemas/VisibilityTimePolicy' + publication: + $ref: '#/components/schemas/PublicationTimePolicy' + regulationsLink: + type: string + description: 'Link to campaign Terms & Conditions' + example: 'https://na.allegro.pl/regulamin-kampania-BARGAIN' + UserCampaignEligibility: + type: object + description: 'Summary of user eligibility for participation in the campaign.' + required: + - eligible + - refusalReasons + properties: + eligible: + type: boolean + description: 'Information whether user is eligible to participate in this campaign.' + example: true + refusalReasons: + type: array + items: + $ref: '#/components/schemas/CampaignRefusalReason' + title: 'RefusalReason' + description: 'Information why user is not able to participate in the campaign.' + CampaignRefusalReason: + type: object + required: + - code + - messages + properties: + code: + type: string + description: >- + Code corresponding to the message. For more information visit the list of available codes: + PL / EN. + example: 'BB5' + messages: + type: array + items: + $ref: '#/components/schemas/RefusalMessage' + title: 'RefusalMessage' + description: 'List of refusal messages.' + RefusalMessage: + type: object + required: + - text + properties: + text: + type: string + description: 'Detailed message.' + example: 'Currency is not supported.' + link: + type: string + nullable: true + description: 'Optional link that redirects to page associated with refusal reason.' + example: 'https://na.allegro.pl/regulamin-kampania-BARGAIN' + ApplicationTimePolicy: + type: object + description: 'Time period when the campaign is open for applying for badge.' + required: + - type + properties: + type: + type: string + enum: + - ALWAYS + - SINCE + - WITHIN + - UNTIL + - NEVER + example: 'NEVER' + from: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: '2011-12-03T10:15:30Z' + to: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: '2011-12-03T10:15:30Z' + example: + type: "UNTIL" + to: '2012-12-03T10:15:30Z' + VisibilityTimePolicy: + type: object + description: >- + Time period when the campaign is visible in + My Allegro and + Sales Manager (Menedżer sprzedaży) + (it is not equal to the time period when badges are displayed on the list of offers or on the offer page). + required: + - type + properties: + type: + type: string + enum: + - ALWAYS + - SINCE + - WITHIN + - UNTIL + - NEVER + example: 'ALWAYS' + from: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: '2011-12-03T10:15:30Z' + to: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: '2011-12-03T10:15:30Z' + example: + type: "UNTIL" + to: '2012-12-03T10:15:30Z' + PublicationTimePolicy: + type: object + description: 'Time period when the badge is displayed on the list of offers or on the offer page.' + required: + - type + properties: + type: + type: string + enum: + - ALWAYS + - SINCE + - WITHIN + - UNTIL + - NEVER + example: 'ALWAYS' + from: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: '2011-12-03T10:15:30Z' + to: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: '2011-12-03T10:15:30Z' + example: + type: "UNTIL" + to: '2012-12-03T10:15:30Z' + BadgePublicationTimePolicy: + type: object + nullable: true + description: 'Time period when the badge is displayed on the list of offers or on the offer page.' + required: + - type + properties: + type: + type: string + enum: + - ALWAYS + - SINCE + - WITHIN + - UNTIL + - NEVER + example: 'ALWAYS' + from: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: "2011-12-03T10:15:30.000Z" + to: + type: string + nullable: true + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: "2011-12-03T10:15:30.000Z" + example: + type: "UNTIL" + to: "2012-12-03T10:15:30.000Z" + BadgeApplicationRequest: + type: object + required: + - campaign + - offer + properties: + campaign: + $ref: '#/components/schemas/BadgeApplicationCampaign' + offer: + $ref: '#/components/schemas/BadgeApplicationOffer' + prices: + $ref: '#/components/schemas/BadgeApplicationPrices' + purchaseConstraints: + $ref: '#/components/schemas/BadgeApplicationPurchaseConstraints' + BadgePatchRequest: + anyOf: + - $ref: '#/components/schemas/BadgePatchProcess' + - $ref: '#/components/schemas/BadgePatchPrices' + BadgeApplicationCampaign: + type: object + required: + - id + properties: + id: + type: string + description: 'Badge campaign ID.' + example: 'BARGAIN' + title: 'BadgeApplicationCampaign' + OfferBadgeCampaign: + type: object + required: + - id + properties: + id: + type: string + description: 'Badge campaign ID.' + example: 'BARGAIN' + name: + type: string + description: 'Badge campaign name.' + example: 'Strefa Okazji' + title: OfferBadgeCampaign + BadgeApplicationOffer: + type: object + required: + - id + properties: + id: + type: string + description: 'Offer ID.' + example: '987654321' + title: 'BadgeOffer' + BadgePrices: + type: object + nullable: true + properties: + market: + $ref: '#/components/schemas/BadgeMarketPrice' + bargain: + $ref: '#/components/schemas/BadgeApplicationBargainPrice' + subsidy: + $ref: '#/components/schemas/BadgeSubsidyPrices' + title: 'BadgePrices' + description: 'Provided for DISCOUNT and SOURCING campaigns.' + BadgeApplicationPrices: + type: object + nullable: true + properties: + bargain: + $ref: '#/components/schemas/BadgeApplicationBargainPrice' + title: 'BadgeApplicationPrices' + description: 'Required by DISCOUNT and SOURCING campaign.' + BadgePatchProcess: + type: object + properties: + process: + type: object + properties: + status: + type: string + enum: + - FINISHED + example: 'FINISHED' + BadgePatchPrices: + type: object + properties: + prices: + type: object + nullable: true + properties: + bargain: + type: object + properties: + value: + $ref: '#/components/schemas/BadgeApplicationBargainPrice' + title: 'BadgePatchPrices' + description: 'Required by DISCOUNT and SOURCING campaign.' + BadgeMarketPrice: + type: object + properties: + amount: + type: string + description: 'Value must be greater than minimal, decimal places aligned with market rules.' + example: '1.23' + currency: + type: string + description: 'The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). Only base currency for a given marketplace is supported, example: PLN for allegro-pl, CZK for allegro-cz, EUR for allegro-sk.' + example: 'PLN' + title: BadgeMarketPrice + description: 'Suggested market price. Calculated automatically based on the offer''s price history.' + BadgeApplicationBargainPrice: + type: object + nullable: true + properties: + amount: + type: string + description: 'Value must be greater than minimal, decimal places aligned with market rules.' + example: '1.23' + currency: + type: string + description: 'The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). Only base currency for a given marketplace is supported, example: PLN for allegro-pl, CZK for allegro-cz, EUR for allegro-sk.' + example: 'PLN' + title: BadgeApplicationBargainPrice + description: 'Bargain price. Required by DISCOUNT and SOURCING campaign.' + BadgeSubsidyPrices: + type: object + properties: + targetPrice: + $ref: '#/components/schemas/BadgeApplicationSubsidyTargetPrice' + sellerPrice: + $ref: '#/components/schemas/BadgeApplicationSubsidySellerPrice' + title: 'SubsidyPrices' + description: 'Prices that relate to the price reconciliation.' + BadgeApplicationSubsidyTargetPrice: + type: object + properties: + amount: + type: string + description: 'Value must be greater than minimal, decimal places aligned with market rules.' + example: '1.23' + currency: + type: string + description: 'The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). Only base currency for a given marketplace is supported, example: PLN for allegro-pl, CZK for allegro-cz, EUR for allegro-sk.' + example: 'PLN' + title: BadgeApplicationSubsidyTargetPrice + description: 'The price visible as the Buy Now price.' + BadgeApplicationSubsidySellerPrice: + type: object + properties: + amount: + type: string + description: 'Value must be greater than minimal, decimal places aligned with market rules.' + example: '1.23' + currency: + type: string + description: 'The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). Only base currency for a given marketplace is supported, example: PLN for allegro-pl, CZK for allegro-cz, EUR for allegro-sk.' + example: 'PLN' + title: BadgeApplicationSubsidySellerPrice + description: 'The price requested by partner.' + BadgeApplicationPurchaseConstraints: + type: object + properties: + limit: + $ref: '#/components/schemas/BadgeApplicationPurchaseConstraintsLimit' + description: 'Constraints of purchase of this offer while it participates in the campaign. Optional for all campaigns types.' + BadgeApplicationPurchaseConstraintsLimit: + type: object + properties: + perUser: + $ref: '#/components/schemas/BadgeApplicationPurchaseConstraintsLimitPerUser' + description: 'Limits of purchase of this offer while it participates in the campaign. Only DISCOUNT and SOURCING campaigns.' + BadgeApplicationPurchaseConstraintsLimitPerUser: + type: object + properties: + maxItems: + type: integer + format: int32 + minimum: 1 + description: 'Maximum number of items that one user can buy of this offer, while it participates in the campaign.' + example: 1 + description: 'Limits of purchase of this offer per user while it participates in the campaign.' + BadgeApplications: + type: object + required: + - badgeApplications + properties: + badgeApplications: + type: array + items: + $ref: '#/components/schemas/BadgeApplication' + BadgeApplication: + type: object + required: + - id + - createdAt + - updatedAt + - campaign + - offer + - process + properties: + id: + type: string + description: 'Badge application ID.' + example: '01234567-89ab-0123-456789ab' + createdAt: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: '2011-12-03T10:15:30Z' + updatedAt: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: '2011-12-03T10:15:30Z' + campaign: + $ref: '#/components/schemas/BadgeApplicationCampaign' + offer: + $ref: '#/components/schemas/BadgeApplicationOffer' + prices: + $ref: '#/components/schemas/BadgeApplicationPrices' + process: + $ref: '#/components/schemas/BadgeApplicationProcess' + purchaseConstraints: + $ref: '#/components/schemas/BadgeApplicationPurchaseConstraints' + BadgeApplicationProcess: + type: object + required: + - status + - rejectionReasons + properties: + status: + type: string + enum: + - REQUESTED + - PROCESSED + - DECLINED + example: 'PROCESSED' + rejectionReasons: + type: array + items: + $ref: '#/components/schemas/BadgeApplicationRejectionReason' + description: 'A list of rejection reasons for the badge application. Returned for process.status = DECLINED only.' + description: 'Information about processing of the application.' + BadgeApplicationRejectionReason: + type: object + required: + - code + - messages + properties: + code: + type: string + description: >- + Code corresponding to the message. For more information visit + the list of available codes. + messages: + type: array + items: + $ref: '#/components/schemas/BadgeApplicationRejectionReasonMessage' + description: 'List of messages with rejection reasons.' + title: 'RejectionReason' + BadgeApplicationRejectionReasonMessage: + type: object + required: + - text + properties: + text: + type: string + description: 'Detailed message.' + example: 'See requirements.' + link: + type: string + nullable: true + description: 'Optional link that redirects to page associated with rejection reason.' + example: 'https://allegro.pl/regulamin/pl' + BadgesList: + type: object + required: + - badges + properties: + badges: + type: array + items: + $ref: '#/components/schemas/Badge' + description: 'List of badges' + Badge: + type: object + required: + - offer + - campaign + - process + properties: + offer: + $ref: '#/components/schemas/BadgeApplicationOffer' + campaign: + $ref: '#/components/schemas/OfferBadgeCampaign' + publication: + $ref: '#/components/schemas/BadgePublicationTimePolicy' + prices: + $ref: '#/components/schemas/BadgePrices' + process: + $ref: '#/components/schemas/BadgeProcess' + BadgeProcess: + type: object + required: + - status + - rejectionReasons + properties: + status: + type: string + enum: + - IN_VERIFICATION + - WAITING_FOR_PUBLICATION + - ACTIVE + - FINISHED + - DECLINED + example: 'FINISHED' + rejectionReasons: + type: array + description: 'A list of messages with rejection reasons. Returned for process.status = DECLINED only.' + items: + $ref: '#/components/schemas/BadgeApplicationRejectionReason' + description: 'Information about badge processing.' + BadgeOperation: + type: object + required: + - id + - type + - createdAt + - updatedAt + - campaign + - offer + - process + properties: + id: + type: string + description: 'Badge operation ID.' + example: '01234567-89ab-0123-456789ab' + type: + type: string + description: 'Badge operation type.' + enum: + - UPDATE + - FINISH + example: 'FINISH' + createdAt: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: '2011-12-03T10:15:30Z' + updatedAt: + type: string + description: 'Provided in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601).' + example: '2011-12-03T10:15:30Z' + campaign: + $ref: '#/components/schemas/BadgeApplicationCampaign' + offer: + $ref: '#/components/schemas/BadgeApplicationOffer' + process: + $ref: '#/components/schemas/BadgeOperationProcess' + BadgeOperationProcess: + type: object + required: + - status + - rejectionReasons + properties: + status: + type: string + enum: + - REQUESTED + - PROCESSED + - DECLINED + example: 'PROCESSED' + rejectionReasons: + type: array + items: + $ref: '#/components/schemas/BadgeApplicationRejectionReason' + description: 'A list of rejection reasons for the badge operation. Returned for process.status = DECLINED only.' + description: 'Information about processing of the request/operation' + OfferRating: + type: object + properties: + averageScore: + type: string + description: 'Average score of offer rating.' + example: '4.0' + scoreDistribution: + type: array + description: "List score distribution with count." + items: + type: object + properties: + name: + type: string + description: "Identifier of score: 5, 4, 3, 2, 1." + count: + type: integer + minimum: 0 + description: "Count of score." + example: + [{name: "5", count: 1}, + {name: "4", count: 3}, + {name: "3", count: 1}, + {name: "2", count: 0}, + {name: "1", count: 0}] + totalResponses: + type: integer + minimum: 0 + description: 'Number of total responses.' + example: 5 + sizeFeedback: + type: array + description: "List of size feedback." + items: + type: object + properties: + name: + type: string + description: "Identifier of sizeFeedback: BIGGER, FIT, SMALLER." + count: + type: integer + minimum: 0 + description: "Count of sizeFeedback responses." + example: 0 + example: + [{name: "BIGGER", count: 0}, + {name: "FIT", count: 2}, + {name: "SMALLER", count: 0}] + FundraisingCampaigns: + title: FundraisingCampaigns + type: object + properties: + campaigns: + type: array + description: search results + items: + $ref: '#/components/schemas/FundraisingCampaign' + FundraisingCampaign: + title: FundraisingCampaign + type: object + properties: + id: + type: string + description: unique campaign identifier + name: + type: string + description: campaign name + organization: + $ref: '#/components/schemas/CharityOrganization' + CharityOrganization: + title: CharityOrganization + type: object + properties: + name: + type: string + description: organization name + ParcelAdditionalServicesAvailability: + title: AdditionalServices + type: object + properties: + cashOnDelivery: + $ref: '#/components/schemas/ParcelAdditionalServicesCashOnDeliveryAvailability' + options: + type: array + description: Delivery services. + items: + $ref: '#/components/schemas/ParcelAdditionalServicesOptionAvailability' + ParcelAdditionalServicesCashOnDeliveryAvailability: + title: CashOnDeliveryAvailability + type: object + properties: + available: + type: boolean + description: Indicates if Cash On Delivery is available as part of Additional Services for parcel creation for carrier. + expressAvailable: + type: boolean + description: Postpaid Express service available. Postpaid value is send to parcel sender in one business day after delivery. + ParcelAdditionalServicesOptionAvailability: + title: AdditionalServicesAvailableOption + type: object + properties: + name: + type: string + description: Name of option that can be passed to additionalServices for parcel creation. + example: guarantee0930 + description: + type: string + description: Brief description of option. + example: The order is guaranteed to be delivered before 09:30 am. + ParcelCreationAddress: + type: object + description: Address data. + properties: + street: + type: string + example: "Główna" + postCode: + type: string + example: "10-200" + city: + type: string + example: "Warszawa" + countryCode: + type: string + description: Country code in ISO 3166-1 alfa-2 format (two-letter code). + default: "PL" + county: + type: string + description: Required for shipments to Irleand ( county name ), United States ( state abbreviation / ISO code ), Canada ( province postal code / ISO code ) + example: "AL" + ParcelCreationAddressWithMandatoryPlace: + type: object + description: Address data. + required: + - street + - postCode + - city + properties: + street: + type: string + description: Street. + example: "Główna" + postCode: + type: string + description: Post code. + example: "10-200" + city: + type: string + description: City. + example: "Warszawa" + countryCode: + type: string + description: Country code in ISO 3166-1 alfa-2 format (two-letter code). + default: "PL" + county: + type: string + description: Required for shipments to Irleand ( county name ), United States ( state abbreviation / ISO code ), Canada ( province postal code / ISO code ) + example: "AL" + Error200: + type: object + properties: + code: + type: string + description: The error code. You can use this code when contacting us about any problems with our systems. + example: string + details: + type: string + description: >- + For some cases, this field provides more details regarding the error. This field can not be null. + example: string + message: + type: string + description: >- + A message directed to the developer of the program. This message give you some more technical details on + what exactly has happened. + example: string + path: + type: string + nullable: true + description: >- + This field will point to a specific field in object if the error is connected to a problem with such specific + field. This field can be empty + example: string + userMessage: + type: string + description: >- + The message that can be presented directly to your user. It will not contain any technical information. This + message is translated based on the value of the `Accept-Language` header. By default message in Polish is + returned. + example: string + Error400: + type: object + properties: + code: + type: string + description: The error code. You can use this code when contacting us about any problems with our systems. + example: "VALIDATION_ERROR" + details: + type: string + description: >- + For some cases, this field provides more details regarding the error. This field can not be null. + example: "Invalid value: null" + message: + type: string + description: >- + A message directed to the developer of the program. This message give you some more technical details on + what exactly has happened. + example: May not be null + path: + type: string + nullable: true + description: >- + This field will point to a specific field in object if the error is connected to a problem with such specific + field. This field can be empty + example: serviceId + userMessage: + type: string + description: >- + The message that can be presented directly to your user. It will not contain any technical information. This + message is translated based on the value of the `Accept-Language` header. By default message in Polish is + returned. + example: May not be null + Error403: + type: object + properties: + code: + type: string + description: The error code. You can use this code when contacting us about any problems with our systems. + example: "AUTHENTICATION_ERROR" + details: + type: string + description: >- + For some cases, this field provides more details regarding the error. + example: Access to the requested resource is forbidden + message: + type: string + description: >- + A message directed to the developer of the program. This message give you some more technical details on + what exactly has happened. + example: No access, more information in the regulations of the I send with Allegro service + path: + type: string + nullable: true + description: >- + This field will point to a specific field in object if the error is connected to a problem with such specific + field. + example: header.authorization + userMessage: + type: string + description: >- + The message that can be presented directly to your user. It will not contain any technical information. This + message is translated based on the value of the 'Accept-Language' header. By default message in Polish is + returned. + example: You are not authorized to perform this operation. + Error404: + type: object + properties: + code: + type: string + description: The error code. You can use this code when contacting us about any problems with our systems. + example: "ERROR" + details: + type: string + description: >- + For some cases, this field provides more details regarding the error. This field can not be null. + example: Resource not found + message: + type: string + description: >- + A message directed to the developer of the program. This message give you some more technical details on + what exactly has happened. + example: Command doesn't exist + path: + type: string + nullable: true + description: >- + This field will point to a specific field in object if the error is connected to a problem with such specific + field. This field can be empty + example: /parcel-management/parcel-pickup-request-commands/{commandId} + userMessage: + type: string + description: >- + The message that can be presented directly to your user. It will not contain any technical information. This + message is translated based on the value of the `Accept-Language` header. By default message in Polish is + returned. + example: Command doesn't exist + Error504: + type: object + properties: + code: + type: string + description: The error code. You can use this code when contacting us about any problems with our systems. + example: "UPSTREAM_SERVICE_TIMEOUT" + details: + type: string + description: >- + For some cases, this field provides more details regarding the error. + example: Timeout error + message: + type: string + description: >- + A message directed to the developer of the program. This message give you some more technical details on + what exactly has happened. + example: Error connecting to the courier company's system + path: + type: string + nullable: true + description: >- + This field will point to a specific field in object if the error is connected to a problem with such specific + field. + example: '' + userMessage: + type: string + description: >- + The message that can be presented directly to your user. It will not contain any technical information. This + message is translated based on the value of the 'Accept-Language' header. By default message in Polish is + returned. + example: Error connecting to the courier company's system + AvailablePromotionPackages: + type: object + properties: + marketplaceId: + type: string + example: "allegro-pl" + basePackages: + type: array + description: "Available base promotion packages. Only one base package can be set on an offer." + items: + $ref: '#/components/schemas/AvailablePromotionPackage' + extraPackages: + type: array + description: "Available extra promotion packages. Multiple different extra packages can be set on an offer." + items: + $ref: '#/components/schemas/AvailablePromotionPackage' + additionalMarketplaces: + type: array + description: "Available promotion packages on additional marketplaces." + items: + $ref: '#/components/schemas/MarketplaceAvailablePromotionPackages' + MarketplaceAvailablePromotionPackages: + type: object + properties: + marketplaceId: + type: string + example: 'allegro-pl' + basePackages: + type: array + description: "Available base promotion packages. Only one base package can be set on an offer." + items: + $ref: '#/components/schemas/AvailablePromotionPackage' + extraPackages: + type: array + description: "Available extra promotion packages. Multiple different extra packages can be set on an offer." + items: + $ref: '#/components/schemas/AvailablePromotionPackage' + AvailablePromotionPackage: + type: object + properties: + id: + type: string + description: "Promotion package identifier." + example: "promoPackage" + name: + type: string + description: "Promotion package name." + example: "Promo Package" + cycleDuration: + type: string + description: "Promo package cycle duration." + example: "PT240H" + PromoOptionsModifications: + type: object + properties: + modifications: + type: array + description: "Promo package modifications to be applied." + items: + $ref: '#/components/schemas/PromoOptionsModification' + additionalMarketplaces: + type: array + description: "Promo package modifications to be applied on additional marketplaces." + items: + $ref: '#/components/schemas/AdditionalMarketplacePromoOptionsModification' + PromoOptionsModification: + type: object + properties: + modificationType: + type: string + description: "Type of modification to be applied." + enum: + - CHANGE + - REMOVE_WITH_END_OF_CYCLE + - REMOVE_NOW + example: 'CHANGE' + packageType: + type: string + description: "Type of promotion package to be changed/removed." + enum: + - BASE + - EXTRA + example: 'BASE' + packageId: + type: string + description: "Promotion package identifier." + example: "promoPackage" + AdditionalMarketplacePromoOptionsModification: + type: object + properties: + marketplaceId: + type: string + example: "allegro-pl" + modifications: + type: array + description: "Promo package modifications to be applied on additional marketplace." + items: + $ref: '#/components/schemas/PromoOptionsModification' + OfferPromoOptionsForSeller: + type: object + properties: + promoOptions: + type: array + items: + $ref: '#/components/schemas/OfferPromoOptions' + description: "Promo options for seller offers." + count: + type: integer + minimum: 0 + description: 'Number of returned elements.' + example: 3 + totalCount: + type: integer + format: int64 + minimum: 0 + description: 'Total number of available elements.' + example: 256 + OfferPromoOptions: + type: object + properties: + offerId: + type: string + description: Offer identifier + example: '9991337999' + marketplaceId: + type: string + example: 'allegro-pl' + basePackage: + $ref: '#/components/schemas/OfferPromoOption' + extraPackages: + type: array + description: "Extra promotion packages set on offer." + items: + $ref: '#/components/schemas/OfferPromoOption' + pendingChanges: + $ref: '#/components/schemas/OfferPromoOptionsPendingChanges' + additionalMarketplaces: + type: array + description: "Promo packages on additional marketplaces" + items: + $ref: '#/components/schemas/MarketplaceOfferPromoOption' + MarketplaceOfferPromoOption: + type: object + properties: + marketplaceId: + type: string + example: 'allegro-pl' + basePackage: + $ref: '#/components/schemas/OfferPromoOption' + extraPackages: + type: array + description: "Extra promotion packages set on offer." + items: + $ref: '#/components/schemas/OfferPromoOption' + pendingChanges: + $ref: '#/components/schemas/OfferPromoOptionsPendingChanges' + OfferPromoOption: + type: object + properties: + id: + type: string + description: "Promotion package identifier." + example: "promoPackage" + validFrom: + type: string + format: date-time + description: >- + Date from which the promotion package is valid: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + example: "2020-01-01T00:00:00Z" + validTo: + type: string + format: date-time + description: >- + Date to which the promotion package is valid: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + example: "2020-01-01T00:00:00Z" + nextCycleDate: + type: string + format: date-time + description: >- + Date on which the promotion package will be renewed for a new cycle: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + example: "2020-01-01T00:00:00Z" + OfferPromoOptionsPendingChanges: + type: object + properties: + basePackage: + $ref: '#/components/schemas/OfferPromoOption' + PromoOptionsCommand: + type: object + properties: + offerCriteria: + type: array + description: "Offer choice criteria." + items: + $ref: '#/components/schemas/OfferCriterium' + modification: + $ref: '#/components/schemas/PromoOptionsCommandModification' + additionalMarketplaces: + type: array + items: + $ref: '#/components/schemas/AdditionalMarketplacePromoOptionsCommandModification' + PromoOptionsCommandModification: + type: object + properties: + basePackage: + allOf: + - $ref: '#/components/schemas/PromoOptionsCommandModificationPackage' + description: >- + The base package. + Available packages can be determined using GET /sale/offer-promotion-packages. + extraPackages: + type: array + description: "Extra packages to be set on offer. Omitting this parameter will preserve the packages already present." + items: + $ref: '#/components/schemas/PromoOptionsCommandModificationPackage' + modificationTime: + type: string + description: "Time at which the modification will be applied." + enum: + - NOW + - END_OF_CYCLE + example: 'END_OF_CYCLE' + AdditionalMarketplacePromoOptionsCommandModification: + type: object + properties: + marketplaceId: + type: string + example: "allegro-pl" + modification: + $ref: '#/components/schemas/PromoOptionsCommandModification' + PromoOptionsCommandModificationPackage: + type: object + properties: + id: + type: string + example: "promoPackage" + PromoGeneralReport: + type: object + properties: + id: + type: string + description: Command ID + example: '9b84e1bc-5341-45e7-837e-4250720e606f' + taskCount: + $ref: '#/components/schemas/TaskCount' + description: Command execution summary + PromoModificationReport: + type: object + properties: + tasks: + type: array + description: "Offer promotion modification tasks." + items: + $ref: '#/components/schemas/PromoModificationTask' + modification: + $ref: '#/components/schemas/PromoOptionsCommandModification' + additionalMarketplaces: + type: array + items: + $ref: '#/components/schemas/AdditionalMarketplacePromoOptionsCommandModification' + PromoModificationTask: + type: object + properties: + offer: + $ref: '#/components/schemas/OfferId' + marketplaceId: + type: string + example: "allegro-pl" + scheduledAt: + type: string + format: date-time + description: >- + Date on which the promotion modification task was scheduled: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + example: "2020-01-01T00:00:00Z" + finishedAt: + type: string + format: date-time + description: >- + Date on which the promotion modification task finished processing: Format (ISO 8601) - yyyy-MM-dd'T'HH:mm:ss.SSSZ. + example: "2020-01-01T00:00:00Z" + status: + type: string + enum: + - DONE + - ERROR + - IN_PROGRESS + example: 'DONE' + errors: + $ref: '#/components/schemas/Errors' + AllegroPickupDropOffPoint: + type: object + required: + - id + - name + - type + - services + - restrictions + - payments + - address + - opening + - carriers + description: Allegro pickup drop off point. + properties: + id: + type: string + description: Point id. You can use it in Ship with Allegro. + example: "1234567890" + name: + type: string + description: Point name. + example: "Kiosk Kolporter 001" + type: + type: string + description: Point type. + example: "PUDO" + enum: + - "PUDO" + - "APM" + services: + type: array + description: "Point services." + items: + type: object + required: + - type + properties: + type: + type: string + description: "Set of values can be extended." + example: 'PICKUP' + enum: + - 'PICKUP' + - 'DROPOFF' + restrictions: + type: array + description: "Point restrictions." + items: + type: object + required: + - type + properties: + type: + type: string + description: "Set of values can be extended." + example: 'OVERLOADED' + enum: + - OVERLOADED + description: + type: string + description: Point description + example: 'Sklep z książkami dla dzieci' + payments: + type: array + description: "Point payment type." + items: + type: object + required: + - method + properties: + method: + type: string + example: 'CARD' + enum: + - "CASH" + - "CARD" + address: + type: object + required: + - postCode + - city + - street + - countryCode + - coordinates + properties: + postCode: + type: string + description: Postal code + example: '60-166' + city: + type: string + description: City name + example: 'Poznań' + street: + type: string + description: Street + example: 'Solna' + countryCode: + type: string + description: Country code + example: 'PL' + coordinates: + $ref: '#/components/schemas/Coordinates' + opening: + type: array + description: Point working hours information. + items: + type: object + required: + - dayOfWeek + - from + - to + properties: + dayOfWeek: + type: string + description: "Day of week (ISO 8601)." + example: 'MONDAY' + from: + type: string + description: "Start hour." + example: '08:00' + to: + type: string + description: "End hour." + example: '15:00' + carriers: + type: array + description: List of carriers that can drop off/pick up packages from point. + items: + $ref: '#/components/schemas/AllegroCarrier' + AllegroParcelTrackingHistory: + type: object + required: + - waybill + properties: + waybill: + type: string + description: Waybill number (parcel tracking number). + trackingDetails: + type: object + description: Parcel tracking history if available. + required: + - statuses + - createdAt + - updatedAt + properties: + statuses: + type: array + description: List of parcel shipping statuses + items: + $ref: '#/components/schemas/AllegroParcelTrackingStatus' + createdAt: + type: string + format: date-time + example: '2021-04-14T11:30:22.163Z' + description: The start time parcel tracking recording in ISO 8601 format + updatedAt: + type: string + format: date-time + example: '2021-04-14T15:21:36.317Z' + description: Time of registration of the last shipment status change in ISO 8601 format + ParcelTrackingHistory: + type: object + required: + - waybill + properties: + waybill: + type: string + description: Waybill number (parcel tracking number). + trackingDetails: + type: object + description: Parcel tracking history if available. + required: + - statuses + - createdAt + - updatedAt + properties: + statuses: + type: array + description: List of parcel shipping statuses + items: + $ref: '#/components/schemas/ParcelTrackingStatus' + createdAt: + type: string + format: date-time + example: '2021-04-14T11:30:22.163Z' + description: The start time parcel tracking recording in ISO 8601 format + updatedAt: + type: string + format: date-time + example: '2021-04-14T15:21:36.317Z' + description: Time of registration of the last shipment status change in ISO 8601 format + AllegroParcelTrackingStatus: + type: object + required: + - occurredAt + - code + properties: + occurredAt: + type: string + format: date-time + example: '2021-04-14T15:21:36.317Z' + description: Actual shipment status change time in ISO 8601 format + code: + type: string + enum: + - "AVAILABLE_FOR_PICKUP" + - "DELIVERED" + - "IN_TRANSIT" + - "ISSUE" + - "NOTICE_LEFT" + - "PENDING" + - "RELEASED_FOR_DELIVERY" + - "RETURNED" + example: 'DELIVERED' + description: >- + Status of the shipment. + - `AVAILABLE_FOR_PICKUP` - The parcel is awaiting for pickup. + - `DELIVERED` - The parcel was delivered to the receiver / collected by the receiver. + - `IN_TRANSIT` - The parcel is on its way to the receiver. The status includes events such as acceptance of the shipment by the carrier, arriving at the hub or redirecting to another address. + - `ISSUE` - Problem with shipment. It includes events such as the parcel was refused by the receiver or was lost. + - `NOTICE_LEFT` - A notice was left because of an unsuccessful delivery attempt (for example, due to nobody was at the delivery address). + - `PENDING` - The shipment has been prepared and it is awaiting to be sent. + - `RELEASED_FOR_DELIVERY` - The parcel has been released for delivery to its final destination. + - `RETURNED` - The parcel is being or has been returned to the sender. + details: + type: string + description: Optional description for a given status, mainly intended to describe the problem with the shipment + example: 'Recipient out of reach' + terminal: + type: boolean + description: Indicates the final status, after which there should be no more status changes + example: true + ParcelTrackingStatus: + type: object + required: + - occurredAt + - code + properties: + occurredAt: + type: string + format: date-time + example: '2021-04-14T15:21:36.317Z' + description: Actual shipment status change time in ISO 8601 format + code: + type: string + enum: + - "AVAILABLE_FOR_PICKUP" + - "DELIVERED" + - "IN_TRANSIT" + - "ISSUE" + - "NOTICE_LEFT" + - "PENDING" + - "RELEASED_FOR_DELIVERY" + - "RETURNED" + example: 'DELIVERED' + description: >- + Status of the shipment. + - `AVAILABLE_FOR_PICKUP` - The parcel is awaiting for pickup. + - `DELIVERED` - The parcel was delivered to the receiver / collected by the receiver. + - `IN_TRANSIT` - The parcel is on its way to the receiver. The status includes events such as acceptance of the shipment by the carrier, arriving at the hub or redirecting to another address. + - `ISSUE` - Problem with shipment. It includes events such as the parcel was refused by the receiver or was lost. + - `NOTICE_LEFT` - A notice was left because of an unsuccessful delivery attempt (for example, due to nobody was at the delivery address). + - `PENDING` - The shipment has been prepared and it is awaiting to be sent. + - `RELEASED_FOR_DELIVERY` - The parcel has been released for delivery to its final destination. + - `RETURNED` - The parcel is being or has been returned to the sender. + description: + type: string + description: Optional description for a given status, mainly intended to describe the problem with the shipment + CategoryTaxSettings: + type: object + properties: + subjects: + type: array + description: 'A list of tax subjects.' + items: + $ref: '#/components/schemas/TaxSubject' + rates: + type: array + description: 'A list of tax rates.' + items: + $ref: '#/components/schemas/TaxRate' + exemptions: + type: array + description: 'A list of tax exemptions.' + items: + $ref: '#/components/schemas/TaxExemption' + TaxSubject: + type: object + properties: + label: + type: string + description: 'Displayable tax subject label.' + example: 'Goods' + value: + type: string + description: 'Value of subject.' + example: 'GOODS' + TaxRate: + type: object + properties: + countryCode: + type: string + description: 'A country code for which given VAT setting is defined.' + example: 'PL' + values: + type: array + description: 'Values of tax rates for given country code.' + items: + $ref: '#/components/schemas/TaxRateValue' + TaxRateValue: + type: object + properties: + label: + type: string + description: 'Displayable tax rate label.' + example: 'Poza VAT / NP' + value: + type: string + description: 'A numeric value of VAT tax rate. In case of "OUT_OF_SCOPE_OF_VAT" it is set to 0.' + example: '23.00' + exemptionRequired: + type: boolean + description: 'Exemption field must be filled out if true, otherwise is optional.' + example: false + TaxExemption: + type: object + properties: + label: + type: string + description: 'Displayable exemption label.' + example: 'Procedura marży' + value: + type: string + description: 'Value of exemption.' + example: 'MARGIN_SCHEME' + AllegroPricesAccountChangeRequest: + type: "object" + properties: + status: + type: "string" + enum: + - "ALLOWED" + - "DENIED" + example: 'ALLOWED' + additionalMarketplaces: + description: "Consent statuses on marketplaces other than the base marketplace of the account." + type: "object" + additionalProperties: + x-additionalPropertiesName: marketplaceId + type: "object" + properties: + status: + type: "string" + enum: + - "ALLOWED" + - "DENIED" + example: 'ALLOWED' + AllegroPricesAccountConsentChangeResponse: + type: "object" + properties: + status: + type: "string" + enum: + - "ALLOWED" + - "DENIED" + example: 'ALLOWED' + additionalMarketplaces: + description: "Consent statuses on marketplaces other than the base marketplace of the account." + type: "object" + additionalProperties: + x-additionalPropertiesName: marketplaceId + type: "object" + properties: + status: + type: "string" + enum: + - "ALLOWED" + - "DENIED" + example: 'ALLOWED' + AllegroPricesOfferChangeRequest: + type: "object" + properties: + status: + description: "Use it to update the consent on the base marketplace of the offer." + type: "string" + enum: + - "ALLOWED" + - "DENIED" + example: 'ALLOWED' + additionalMarketplaces: + type: "object" + description: "Use it to update the consent on marketplaces other than the base marketplace of the offer." + additionalProperties: + x-additionalPropertiesName: marketplaceId + type: "object" + properties: + status: + type: "string" + enum: + - "ALLOWED" + - "DENIED" + example: 'ALLOWED' + AllegroPricesOfferConsentChangeResponse: + type: "object" + properties: + status: + description: "Consent status on the base marketplace of the offer." + type: "string" + enum: + - "ALLOWED" + - "DENIED" + example: 'ALLOWED' + additionalMarketplaces: + description: "Consent statuses on marketplaces other than the base marketplace of the offer." + type: "object" + additionalProperties: + x-additionalPropertiesName: marketplaceId + type: "object" + properties: + status: + type: "string" + enum: + - "ALLOWED" + - "DENIED" + example: 'ALLOWED' + AllegroPricesEligibilityResponse: + type: "object" + properties: + consent: + type: "string" + enum: + - "ALLOWED" + - "DENIED" + example: 'ALLOWED' + qualification: + $ref: "#/components/schemas/AllegroPricesQualificationResponse" + additionalMarketplaces: + description: "Eligibility state on marketplces other than the base marketplace of the account." + type: "object" + additionalProperties: + x-additionalPropertiesName: marketplaceId + type: "object" + properties: + consent: + type: "string" + enum: + - "ALLOWED" + - "DENIED" + example: 'ALLOWED' + qualification: + $ref: "#/components/schemas/AllegroPricesQualificationResponse" + AllegroPricesQualificationResponse: + type: "object" + properties: + status: + type: "string" + enum: + - "QUALIFIED" + - "DISQUALIFIED" + example: 'QUALIFIED' + AlleDiscountSubmitCommandRequest: + type: object + properties: + commandId: + type: string + description: The command UUID. If empty, system generates new one. + nullable: true + example: 'c1b3f63d-d293-4333-911d-a0c1053e2c81' + input: + type: object + description: Command input. + properties: + offer: + type: object + description: Data of the offer you want to submit to the AlleDiscount campaign. + properties: + id: + type: string + description: The id of the offer. + campaign: + type: object + description: Data of AlleDiscount campaign you want to submit your offer to. + properties: + id: + type: string + description: The id of the AlleDiscount campaign. + example: 'ALLEOBNIZKA_20230209' + proposedPrice: + type: object + description: >- + The price you agree to lower to for the offer. + Must be equal or lower than requiredMerchantPrice returned in `/sale/alle-discount/{campaignId}/eligible-offers` endpoint. + properties: + amount: + type: string + description: Amount of the proposed price. + example: '19.99' + currency: + type: string + description: Currency of the proposed price. + example: 'PLN' + AlleDiscountSubmitCommandResponse: + type: object + properties: + id: + type: string + description: Provided UUID of the submit offer command or generated UUID. + example: 'c1b3f63d-d293-4333-911d-a0c1053e2c81' + input: + type: object + description: Provided submit offer command input data. + properties: + offer: + type: object + description: Offer data. + properties: + id: + type: string + description: The id of the offer. + example: '10394822344' + campaign: + type: object + description: Campaign data. + properties: + id: + type: string + description: The id of the campaign. + example: 'ALLEOBNIZKA_20230209' + proposedPrice: + type: object + description: The price you agreed to lower to for the offer. + properties: + amount: + type: string + description: Amount of the price. + example: '19.99' + currency: + type: string + description: Currency of the price. + example: 'PLN' + output: + type: object + description: Submit offer command output data. + properties: + status: + type: string + description: Execution status of the command. + enum: + - NEW + example: 'NEW' + createdAt: + type: string + description: Creation date of the command. ISO 8601 format. + format: date-time + example: '2020-08-26T12:52:04Z' + updatedAt: + type: string + format: date-time + description: Update date of the command. ISO 8601 format. + example: '2020-08-26T12:52:04Z' + AlleDiscountGetSubmitCommandResponse: + type: object + properties: + id: + type: string + description: The id of the command. + example: 'c1b3f63d-d293-4333-911d-a0c1053e2c81' + input: + type: object + description: Provided submit offer command input data. + properties: + offer: + type: object + description: Offer data. + properties: + id: + type: string + description: The id of the offer. + example: '10394822344' + campaign: + type: object + description: Campaign data. + properties: + id: + type: string + description: The id of the campaign. + example: 'ALLEOBNIZKA_20230209' + proposedPrice: + type: object + description: The price you agreed to lower to for the offer. + properties: + amount: + type: string + description: Amount of the price. + example: '19.99' + currency: + type: string + description: Currency of the price. + example: 'PLN' + output: + type: object + description: Submit offer command output data. + properties: + status: + type: string + description: >- + Status field possible values: + - NEW - command processing has not started. + - IN_PROGRESS - command is being processed. + - FAILED - processing of the command failed. Offer will not participate in AlleDiscount. + - SUCCESSFUL - processing of the command was successful. New participation was created but in some cases it still may be denied. + To make sure that the offer is participating in AlleDiscount, check the participation status in + 'GET /sale/alle-discount/{campaignId}/submitted-offers`. + enum: + - NEW + - IN_PROGRESS + - SUCCESSFUL + - FAILED + example: 'SUCCESSFUL' + createdAt: + type: string + format: date-time + description: Command creation date. ISO 8601 format. + example: '2020-08-26T12:52:04Z' + updatedAt: + type: string + format: date-time + description: Command update date. ISO 8601 format. + example: '2020-08-26T12:52:04Z' + newOfferParticipation: + type: object + nullable: true + description: Object containing info about created participation in AlleDiscount, contains the id of the created participation. + properties: + participationId: + type: string + description: The id of the participation created by submit offer command. + example: 'f9a4a70c-6db9-4473-976c-90f8df9f74e8' + errors: + type: array + items: + $ref: '#/components/schemas/ErrorsHolder' + AlleDiscountWithdrawCommandRequest: + type: object + properties: + commandId: + type: string + description: The Command UUID. If empty, system generates new one. + nullable: true + example: 'c1b3f63d-d293-4333-911d-a0c1053e2c81' + input: + type: object + description: Command input. + properties: + participationId: + type: string + description: >- + The id of the offer participation you wish to withdraw. + Participation id can be found using `GET /sale/alle-discount/{campaignId}/submitted-offers` or + `GET /sale/alle-discount/submit-offer-commands` endpoints. + example: 'f9a4a70c-6db9-4473-976c-90f8df9f74e8' + AlleDiscountWithdrawCommandResponse: + type: object + properties: + id: + type: string + description: The id of the command. + example: 'c1b3f63d-d293-4333-911d-a0c1053e2c81' + input: + type: object + description: Provided withdraw offer command input data. + properties: + participationId: + type: string + description: The id of the participation which will be withdrawn. + example: 'f9a4a70c-6db9-4473-976c-90f8df9f74e8' + output: + type: object + description: Withdraw offer command output data. + properties: + status: + type: string + description: Execution status of the command. + enum: + - NEW + example: 'NEW' + createdAt: + type: string + format: date-time + description: Creation date of the command. ISO 8601 format. + example: '2020-08-26T12:52:04Z' + updatedAt: + type: string + format: date-time + description: Update date of the command. ISO 8601 format. + example: '2020-08-26T12:52:04Z' + AlleDiscountGetWithdrawCommandResponse: + type: object + properties: + id: + type: string + description: The id of the command. + example: 'c1b3f63d-d293-4333-911d-a0c1053e2c81' + input: + type: object + description: Provided withdraw offer command input data. + properties: + participationId: + type: string + description: The id of the withdrawn participation. + example: 'f9a4a70c-6db9-4473-976c-90f8df9f74e8' + output: + type: object + description: Withdraw offer command output data. + properties: + status: + type: string + description: >- + Status field possible values: + - NEW - command processing has not started + - IN_PROGRESS - command is being processed + - FAILED - processing of the command failed. Offer will not participate in AlleDiscount. + - SUCCESSFUL - processing of the command was successful. New participation was created. To make sure that the offer is participating in AlleDiscount, request the participation status. + enum: + - NEW + - IN_PROGRESS + - SUCCESSFUL + - FAILED + example: 'NEW' + createdAt: + type: string + format: date-time + description: Command creation date. ISO 8601 format. + example: '2020-08-26T12:52:04Z' + updatedAt: + type: string + format: date-time + description: Command update date. ISO 8601 format. + example: '2020-08-26T12:52:04Z' + withdrawnOfferParticipation: + type: object + nullable: true + description: Withdrawn offer participation data. Non-null when command status is `SUCCESSFUL`. + properties: + participationId: + type: string + description: The id of the withdrawn participation. + example: 'f9a4a70c-6db9-4473-976c-90f8df9f74e8' + errors: + type: array + items: + $ref: '#/components/schemas/ErrorsHolder' + AlleDiscountListEligibleResponse: + type: object + properties: + eligibleOffers: + type: array + description: Array of offers eligible to be submitted to given AlleDiscount campaign. + items: + $ref: '#/components/schemas/AlleDiscountEligibleOfferDto' + count: + type: integer + description: Number of offers returned in page. + example: 1 + totalCount: + type: integer + description: Total number of eligible offers. + example: 1 + AlleDiscountEligibleOfferDto: + type: object + properties: + id: + type: string + description: The id of the offer. + example: '10394822344' + product: + type: object + description: Offer product data. + properties: + id: + type: string + description: The id of the product. + example: '765a6e61-b16f-4cad-bde4-8ed5d57b70a0' + basePrice: + type: object + nullable: true + description: Offer base price. + properties: + amount: + type: string + description: Amount of the price. + example: '15.88' + currency: + type: string + description: Currency of the price. + example: 'PLN' + alleDiscount: + type: object + description: AlleDiscount specific data. + properties: + campaignConditions: + type: object + description: Info if offer matches campaign requirements. + properties: + meetsConditions: + type: boolean + example: 'FALSE' + description: If true, offer matches campaign requirements and `violations` array will be empty. + violations: + description: >- + Example violations: + - NOT_ENOUGH_STOCK - offer doesn’t meet the stock requirement. + - VAT_INVOICE_REQUIRED - offer doesn’t have vat invoice enabled. + - NOT_NEW_OFFER - offer’s condition is not new (e.g used). + - OFFER_PRICE_VERIFICATION_IN_PROGRESS - we are still gathering the information about the offer price. In this case the “basePrice” field should be set to null. + type: array + items: + type: object + properties: + code: + type: string + description: Code of the violation. + example: 'NOT_ENOUGH_STOCK' + message: + type: string + description: Violation description. + example: 'NOT_ENOUGH_STOCK' + requiredMerchantPrice: + $ref: '#/components/schemas/AlleDiscountRequiredMerchantPriceDto' + minimumGuaranteedDiscount: + type: object + description: >- + Information what will be minimal guaranteed discount if offer is successfully submitted to AlleDiscount campaign. + Final discount can be higher and may change for certain campaigns. + properties: + percentage: + type: string + description: Guaranteed offer discount as a percentage. + example: '7.50' + AlleDiscountListSubmittedResponse: + type: object + properties: + submittedOffers: + type: array + description: >- + Array of offers submitted to a given AlleDiscount campaign. + This list contains all active and non active offer participations. + There can be only one submission for offer in one AlleDiscount campaign. + items: + $ref: '#/components/schemas/AlleDiscountSubmittedOfferDto' + count: + type: integer + description: Number of offers returned in page. + example: 1 + totalCount: + type: integer + description: Total number of submitted offers. + example: 1 + AlleDiscountSubmittedOfferDto: + type: object + properties: + participationId: + type: string + description: The id of the participation. + example: 'f9a4a70c-6db9-4473-976c-90f8df9f74e8' + offer: + type: object + description: Submitted offer data. + properties: + id: + type: string + description: The id of the offer. + example: '10394822344' + campaign: + type: object + description: AlleDiscount campaign data. + properties: + id: + type: string + description: The id of the campaign. + example: 'ALLEOBNIZKA_20240827_PL' + prices: + type: object + description: AlleDiscount prices data. + properties: + proposedPrice: + type: object + description: The price you agreed to lower to for the offer. + properties: + amount: + type: string + description: Amount of the price. + example: '18.22' + currency: + type: string + description: Currency of the price. + example: 'PLN' + minimalPriceReduction: + type: object + description: Minimal price reduction on the offer. + properties: + amount: + type: string + description: Amount of the price. + example: '18.22' + currency: + type: string + description: Currency of the price. + example: 'PLN' + maximumSellingPrice: + type: object + description: Maximum price for the offer after discount. Can be lower. + properties: + amount: + type: string + description: Amount of the price. + example: '21.37' + currency: + type: string + description: Currency of the price. + example: 'PLN' + process: + type: object + description: Participation processing data. + properties: + status: + type: string + description: >- + - VERIFICATION - participation is being verified. + - ACCEPTED - participation in AlleDiscount was created and has passed initial verification. Participation will stay in this status until campaign starts or if additional verification fails. + - ACTIVE - participation is active, price on the platform is lowered. Offer is participating in AlleDiscount. + - DECLINED - participation didn’t pass verification, check process.errors field for more details. + - FINISHED - participation is no longer active. + enum: + - VERIFICATION + - ACCEPTED + - ACTIVE + - DECLINED + - FINISHED + example: 'VERIFICATION' + errors: + type: array + description: >- + Possible participation errors: + - TOO_HIGH_PROPOSED_PRICE - “proposedPrice” field when submitting an offer was set higher than the “requiredMerchantPrice” of this offer. + - PRODUCT_CONFIGURATION_CHANGED - configuration of offer’s product has changed in the meantime of processing the request. + - PRODUCT_NOT_IN_CAMPAIGN - submitted offer’s product is no longer available in this campaign. + - OFFER_NOT_VISIBLE_ON_CAMPAIGN_MARKETPLACE - offer is not visible on the marketplace of the campaign it was submitted to. + - CURRENCY_NOT_SUPPORTED - currency in “proposedPrice” does not match the currency of the marketplace offer was submitted to. + - ALLE_DISCOUNT_SUSPENDED_ACCOUNT - seller submitting offer is suspended and cannot perform any action. + example: 'ALLE_DISCOUNT_SUSPENDED_ACCOUNT' + items: + type: object + description: Error body. + properties: + code: + type: string + description: Error code. + example: 'BB13' + message: + type: string + description: Error message. + example: 'Too many requests from this account.' + purchaseLimit: + type: integer + description: Limit of purchases on the offer. + example: 1 + AlleDiscountListCampaignsResponse: + type: object + properties: + alleDiscountCampaigns: + type: array + description: Array of the available AlleDiscount campaigns. + items: + type: object + properties: + id: + type: string + description: The id of the campaign. + example: 'ALLEOBNIZKA_20240827_PL' + name: + type: string + description: Name of the campaign. + example: 'AlleObniżka 27.08-10.09.2024' + type: + type: string + description: >- + Field providing info about the type of the campaign. Two possible values: + - SOURCING - no additional requirements. + - DISCOUNT - requires price lower than the lowest from 30 days, created badge has crossed out price. + enum: + - SOURCING + - DISCOUNT + example: SOURCING + visibility: + type: object + description: >- + Time period when the campaign is visible in My Allegro. + properties: + type: + type: string + description: >- + Type of campaign visibility. One possible value: + - WITHIN + enum: + - WITHIN + example: 'WITHIN' + from: + type: string + format: date-time + description: Provided in ISO 8601 format. + example: '2020-08-26T12:52:04Z' + to: + type: string + format: date-time + description: Provided in ISO 8601 format. + example: '2020-08-26T12:52:04Z' + application: + description: Time period when the campaign is open for offer submission. + properties: + type: + type: string + description: >- + Type of campaign visibility. One possible value: + - WITHIN + enum: + - WITHIN + example: 'WITHIN' + from: + type: string + format: date-time + description: Provided in ISO 8601 format. + example: '2020-08-26T12:52:04Z' + to: + type: string + format: date-time + description: Provided in ISO 8601 format. + example: '2020-08-26T12:52:04Z' + publication: + description: >- + Time period when reduced price (and possible badge if it applies for campaign) is displayed on + the list of offers or on the offer page. + properties: + type: + type: string + description: >- + Type of campaign visibility. One possible value: + - WITHIN + enum: + - WITHIN + example: 'WITHIN' + from: + type: string + format: date-time + description: Provided in ISO 8601 format. + example: '2020-08-26T12:52:04Z' + to: + type: string + format: date-time + description: Provided in ISO 8601 format. + example: '2020-08-26T12:52:04Z' + marketplace: + type: object + description: Campaign marketplace data. + properties: + id: + type: string + description: The id of the marketplace. + example: 'allegro-pl' + AlleDiscountRequiredMerchantPriceDto: + type: object + description: >- + Maximum price of offer that will be accepted in this AlleDiscount campaign. If you send submission with higher + price, it will be rejected. You can submit your offer with lower price than one indicated here. + properties: + amount: + type: string + description: Amount of the price. + example: '11.99' + currency: + type: string + description: Currency of the price. + example: 'PLN' + Interlocutor: + type: object + nullable: true + properties: + login: + type: string + example: 'AllegroLogin' + avatarUrl: + type: string + required: + - login + - avatarUrl + MessageAuthor: + type: object + properties: + login: + type: string + example: 'AllegroLogin' + isInterlocutor: + type: boolean + example: 'true' + required: + - login + - isInterlocutor + Thread: + type: object + required: + - id + - read + properties: + id: + type: string + example: '88ae369b-8f65-4fc4-9c77-bedf604a2e2' + read: + type: boolean + example: 'false' + lastMessageDateTime: + type: string + format: date-time + nullable: true + example: '2020-08-26T12:52:04Z' + interlocutor: + $ref: '#/components/schemas/Interlocutor' + ThreadId: + type: object + properties: + id: + type: string + example: '88ae369b-8f65-4fc4-9c77-bedf604a2e2' + required: + - id + ThreadsList: + type: object + properties: + threads: + type: array + items: + $ref: '#/components/schemas/Thread' + offset: + type: integer + minimum: 0 + limit: + type: integer + minimum: 0 + required: + - threads + - offset + - limit + ThreadReadFlag: + type: object + properties: + read: + type: boolean + example: 'false' + required: + - read + MessageOffer: + type: object + nullable: true + properties: + id: + type: string + example: '82398120310' + required: + - id + MessageOrder: + type: object + nullable: true + properties: + id: + type: string + example: '88ae369b-8f65-4fc4-9c77-bedf604a2e2' + required: + - id + MessageRelatedObject: + type: object + properties: + offer: + $ref: '#/components/schemas/MessageOffer' + order: + $ref: '#/components/schemas/MessageOrder' + MessageAdditionalInformation: + type: object + nullable: true + description: 'Contains optional contextual information linked to message.' + properties: + vin: + type: string + nullable: true + description: 'Vehicle Information Number (VIN) provided by sender in addition to message contents.' + example: 'JT2SV12E6F0308977' + MessageAttachmentInfo: + type: object + properties: + fileName: + type: string + example: 'exampleName.jpeg' + mimeType: + type: string + example: 'image/jpeg' + url: + type: string + example: 'https://upload.allegro.pl/message-center/message-attachments/97dc0b60-2da4-4247-92ba-b748630ba0f6' + status: + type: string + enum: + - NEW + - SAFE + - UNSAFE + - EXPIRED + example: 'NEW' + required: + - fileName + - status + Message: + type: object + properties: + id: + type: string + example: '97dc0b60-2da4-4247-92ba-b748630ba0f6' + status: + type: string + enum: + - VERIFYING + - BLOCKED + - DELIVERED + - INTERACTING + - DISMISSED + example: DELIVERED + type: + type: string + enum: + - ASK_QUESTION + - MAIL + - MESSAGE_CENTER + example: MESSAGE_CENTER + createdAt: + type: string + format: date-time + example: '2020-08-26T12:52:04Z' + thread: + $ref: '#/components/schemas/ThreadId' + author: + $ref: '#/components/schemas/MessageAuthor' + text: + type: string + example: 'Sample message' + subject: + type: string + example: 'Sample subject' + nullable: true + relatesTo: + $ref: '#/components/schemas/MessageRelatedObject' + hasAdditionalAttachments: + type: boolean + example: false + attachments: + type: array + items: + $ref: '#/components/schemas/MessageAttachmentInfo' + additionalInformation: + $ref: '#/components/schemas/MessageAdditionalInformation' + + required: + - id + - status + - type + - createdAt + - thread + - author + - text + - relatesTo + - hasAdditionalAttachments + - attachments + MessagesList: + type: object + properties: + messages: + type: array + items: + $ref: '#/components/schemas/Message' + offset: + type: integer + minimum: 0 + limit: + type: integer + minimum: 0 + required: + - messages + - offset + - limit + MessageAttachmentId: + type: object + properties: + id: + type: string + example: '97dc0b60-2da4-4247-92ba-b748630ba0f6' + required: + - id + NewMessageInThread: + type: object + properties: + text: + type: string + maxLength: 2000 + example: 'Sample message' + attachments: + type: array + items: + $ref: '#/components/schemas/MessageAttachmentId' + nullable: true + required: + - text + Recipient: + type: object + properties: + login: + type: string + example: 'AllegroLogin' + required: + - login + NewMessage: + type: object + properties: + recipient: + $ref: '#/components/schemas/Recipient' + text: + type: string + maxLength: 2000 + example: 'Sample message' + attachments: + type: array + items: + $ref: '#/components/schemas/MessageAttachmentId' + nullable: true + order: + $ref: '#/components/schemas/MessageOrder' + required: + - recipient + - text + - order + NewAttachmentDeclaration: + type: object + properties: + filename: + type: string + size: + type: integer + format: int64 + minimum: 0 + maximum: 5242880 + required: + - filename + - size + B2b: + type: object + description: 'Defines offer properties for buyers with company account (Allegro Biznes).' + properties: + buyableOnlyByBusiness: + type: boolean + description: 'If true, then only users with company account are eligible to buy given offer. + Offers buyable only by business are allowed only in selected categories. + False by default.' + example: false + MessageToSellerSettings: + type: object + description: 'Defines message to the seller settings options.' + properties: + mode: + type: string + enum: + - OPTIONAL + - HIDDEN + - REQUIRED + description: >- + Specify message to seller type. + * `OPTIONAL`: buyer is able to enter a message for the seller + * `HIDDEN`: there is no message box for the seller + * `REQUIRED`: buyer is forced to enter a message for the seller (limited to categories with `sellerCanRequirePurchaseComments` option) + example: 'OPTIONAL' + hint: + type: string + description: >- + Specify hint for REQUIRED message displayed for buyer + OfferTranslationType: + type: string + description: 'Type of content: + BASE - initial content for offer in declared offer language. + AUTO - automatic translation from BASE content. + MANUAL - manual translation provided by the user.' + enum: + - AUTO + - MANUAL + - BASE + OfferDescriptionTranslation: + type: object + description: Offer description translation + properties: + translation: + $ref: '#/components/schemas/StandardizedDescription' + type: + $ref: '#/components/schemas/OfferTranslationType' + title: OfferDescriptionTranslation + OfferTitleTranslation: + type: object + description: Offer title translation + properties: + translation: + description: Offer title translation content + type: string + type: + $ref: '#/components/schemas/OfferTranslationType' + title: OfferTitleTranslation + OfferSafetyInformationTranslation: + type: object + description: Offer safety information translations + properties: + products: + type: array + items: + $ref: '#/components/schemas/ProductSafetyInformationDescription' + title: OfferSafetyInformationTranslation + ProductSafetyInformationDescription: + type: object + properties: + id: + type: string + format: uuid + translation: + type: string + description: Product safety information translation content + type: + $ref: '#/components/schemas/OfferTranslationType' + ManualDescriptionTranslation: + type: object + description: Manual offer description translation + properties: + translation: + $ref: '#/components/schemas/StandardizedDescription' + title: ManualDescriptionTranslation + ManualTitleTranslation: + type: object + description: Manual offer title translation + properties: + translation: + type: string + description: Manual offer title translation content + title: ManualTitleTranslation + ManualSafetyInformationTranslation: + type: object + description: Manual offer products safety information translations. Updating this resource is in accordance with RFC7396 - all or nothing.' + properties: + products: + type: array + items: + $ref: '#/components/schemas/ManualProductSafetyInformationDescriptionTranslation' + ManualProductSafetyInformationDescriptionTranslation: + type: object + description: Manual product safety information translation + properties: + id: + type: string + format: uuid + description: Product id connected with provided translated content + translation: + type: string + description: Manual product safety information translation content + ManualTranslationUpdateRequest: + type: object + properties: + description: + $ref: '#/components/schemas/ManualDescriptionTranslation' + title: + $ref: '#/components/schemas/ManualTitleTranslation' + safetyInformation: + $ref: '#/components/schemas/ManualSafetyInformationTranslation' + title: ManualTranslationUpdateRequest + OfferTranslation: + type: object + required: + - language + properties: + description: + $ref: '#/components/schemas/OfferDescriptionTranslation' + language: + type: string + description: Language of the translation. + format: BCP-47 language code + example: 'en-US' + title: + $ref: '#/components/schemas/OfferTitleTranslation' + safetyInformation: + $ref: '#/components/schemas/OfferSafetyInformationTranslation' + title: OfferTranslation + OfferTranslations: + type: object + properties: + translations: + type: array + items: + $ref: '#/components/schemas/OfferTranslation' + title: OfferTranslations + SmartDeliveryMethod: + type: object + properties: + id: + type: string + description: Delivery method id + example: 2488f7b7-5d1c-4d65-b85c-4cbcf253fd93 + DeliveryMethodId: + type: object + properties: + id: + type: string + description: Delivery method id + example: 2488f7b7-5d1c-4d65-b85c-4cbcf253fd93 + SmartOfferClassificationReport: + type: object + properties: + classification: + type: object + description: Offer Smart! eligibility status + properties: + fulfilled: + type: boolean + description: Indicates whether that particular offer is currently Smart! + lastChanged: + type: string + format: date-time + description: Date of the most recent status change + example: 2017-05-17T08:36:57.292+02:00 + scheduledForReclassification: + type: boolean + description: Indicates whether that particular offer is set to be reclassified in the next 24 hours + smartDeliveryMethods: + type: array + description: Delivery methods marked with Smart! label + items: + $ref: '#/components/schemas/SmartDeliveryMethod' + example: + - id: 2488f7b7-5d1c-4d65-b85c-4cbcf253fd93 + - id: c3066682-97a3-42fe-9eb5-3beeccab840c + conditions: + type: array + description: >- + Set of conditions to be met in order for that particular offer to be Smart!. + Each condition filters out improperly configured delivery methods or checks some offer attributes. + Order of conditions matters. + Please keep in mind that this is a **PREVIEW** of an offer classification if being conducted right now - actual classification is triggered only by attribute changes and as of now it cannot be manually done on demand. + items: + type: object + properties: + code: + type: string + description: Technical condition name + name: + type: string + description: Condition name + description: + type: string + description: Brief condition description, might contain useful instructions to help making that particular condition pass + fulfilled: + type: boolean + description: Indicates whether this condition is met + passedDeliveryMethods: + type: array + description: Set of delivery methods that meet this condition. May be null if the condition does not apply to delivery methods. + items: + $ref: '#/components/schemas/DeliveryMethodId' + failedDeliveryMethods: + type: array + description: Set of delivery methods that fail to meet this condition. May be null if the condition does not apply to delivery methods. + items: + $ref: '#/components/schemas/DeliveryMethodId' + example: + - code: deliveryMethodPrices + name: Zgodność z cennikiem + description: Wymagamy aby metody dostawy były zgodne z cennikiem. + fulfilled: true + passedDeliveryMethods: + - id: 2488f7b7-5d1c-4d65-b85c-4cbcf253fd93 + - id: c3066682-97a3-42fe-9eb5-3beeccab840c + - id: 259b5c7a-9056-4c74-80ec-8bdc50cb0413 + - id: 08e2ef8e-90c8-49db-8970-d6c2773f1530 + failedDeliveryMethods: + - id: b20ef9e1-faa2-4f25-9032-adbea23e5cb9 + - id: 9081532b-5ad3-467d-80bc-9252982e9dd8 + - id: 98f86f81-0018-41c5-ac83-073a56fc7021 + - id: 5d9c7838-e05f-4dec-afdd-58e884170ba7 + - code: returnPaidBy + name: Koszty zwrotu + description: Oferta musi mieć politykę zwrotu. Zagraniczne metody dostawy są zaklasyfikowane tylko jeśli koszt zwrotu jest pokryty przez sprzedającego. + fulfilled: true + passedDeliveryMethods: + - id: 2488f7b7-5d1c-4d65-b85c-4cbcf253fd93 + - id: c3066682-97a3-42fe-9eb5-3beeccab840c + failedDeliveryMethods: + - id: 259b5c7a-9056-4c74-80ec-8bdc50cb0413 + - id: 08e2ef8e-90c8-49db-8970-d6c2773f1530 + SmartSellerClassificationReport: + type: object + properties: + classification: + type: object + description: Seller Smart! eligibility status + properties: + fulfilled: + type: boolean + description: Indicates whether that user is currently Smart! + lastChanged: + type: string + format: date-time + description: Date of the most recent status change + example: '2017-05-17T08:36:57.292+02:00' + conditions: + type: array + description: Set of conditions to be met in order for user to be Smart! + items: + type: object + properties: + code: + type: string + description: Technical condition name + name: + type: string + description: Condition name + description: + type: string + description: Brief condition description, might contain useful instructions to help making that particular condition pass + value: + type: number + description: Value of related user attribute that this condition tests. Has to be greater that threshold if present. + threshold: + type: number + description: Minimum required `value` of related user attribute. + fulfilled: + type: boolean + description: Indicates whether this condition is met + required: + type: boolean + description: >- + Indicates whether this condition is required to obtain Smart! status. + Please note that certain conditions may be required (or not) based on result of checking other conditions. + example: + - code: ratingPercentage + name: Wskaźnik poleceń + description: W przypadku braku oznaczenia Super Sprzedawca wymagamy aby sprzedawca posiadał wskaźnik poleceń powyżej określonego progu. + value: 0.783 + threshold: 0.98 + fulfilled: false + required: false + - code: ratesCount + name: Liczba unikalnych ocen + description: W przypadku braku oznaczenia Super Sprzedawca wymagamy aby sprzedawca posiadał określoną liczbę unikalnych ocen \Polecam\ w okresie ostatnich 12 miesięcy. + value: 23 + threshold: 5 + fulfilled: true + required: false + - code: superSeller + name: Super Sprzedawca + description: Posiadanie oznaczenia Super Sprzedawca pozwala wziąć udział w programie Smart! przy zwolnieniu z kryteriów \Wskaźnik poleceń\ oraz \Liczba unikalnych ocen\. + value: 1 + fulfilled: true + required: false + excludedDeliveryMethods: + type: array + description: Set of delivery methods that were excluded from Smart! classification on demand by seller + items: + $ref: '#/components/schemas/SmartDeliveryMethod' + PhoneNumberWithCountryCode: + type: object + description: Represents international phone number with country code. + required: + - countryCode + - number + properties: + countryCode: + type: string + description: Country code without neither + nor 0 prefix. + maxLength: 3 + pattern: ^[1-9]\d{0,2}$ + example: 48 + number: + type: string + description: Local phone number without prefix. + maxLength: 15 + pattern: (\d{1,15}) + example: 123123123 + FulfillmentWithdrawalAddress: + type: object + description: Represents information about address passed for withdrawal purpose. + required: + - company + - street + - postalCode + - city + - countryCode + - phone + properties: + company: + type: string + description: Delivery recipient name (required). + maxLength: 200 + example: Company Warehouse Ltd + street: + type: string + description: The name of the street, building number and so on, where the building is located (required). + maxLength: 150 + pattern: ^[^\*\%\&\^\#\@\!]*$ + example: Uliczna 7 + postalCode: + type: string + description: The code used for postal delivery purposes (required). + maxLength: 12 + example: 60-166 + city: + type: string + description: The name of the city or town (required). + maxLength: 50 + pattern: ^[^~!@#\$%\^&\*(){}\+=|:;\?\[\]]*$ + example: Poznań + countryCode: + type: string + description: The country code where the address is located (required). + example: PL + phone: + $ref: '#/components/schemas/PhoneNumberWithCountryCode' + additionalInfo: + type: string + description: Additional info which can be passed on courier label but only for parcels with larger dimensions sent not by WzA (SwA). + maxLength: 300 + example: Left doors in the warehouse. + FulfillmentRemovalPreference: + type: object + description: Represents seller preference how to handle goods that should be removed from 1F warehouse. + required: + - operation + properties: + operation: + type: string + description: Preference what kind of operation to execute on undesirable items WITHDRAWAL/DISPOSAL (required). + enum: + - WITHDRAWAL + - DISPOSAL + example: WITHDRAWAL + address: + $ref: '#/components/schemas/FulfillmentWithdrawalAddress' + AdvanceShipNotice: + type: object + properties: + items: + type: array + description: A list of product items. + items: + $ref: '#/components/schemas/ProductItem' + handlingUnit: + $ref: '#/components/schemas/HandlingUnit' + shipping: + $ref: '#/components/schemas/Shipping' + required: + - items + CreateAdvanceShipNoticeRequest: + type: object + properties: + items: + type: array + description: A list of product items. + items: + $ref: '#/components/schemas/ProductItem' + handlingUnit: + $ref: '#/components/schemas/HandlingUnit' + shipping: + $ref: '#/components/schemas/Shipping' + required: + - items + UpdateSubmittedAdvanceShipNoticeRequest: + type: object + properties: + items: + type: array + description: A list of product items. + items: + $ref: '#/components/schemas/ProductItem' + handlingUnit: + $ref: '#/components/schemas/UpdateSubmittedHandlingUnitInput' + shipping: + $ref: '#/components/schemas/UpdateSubmittedShippingInput' + UpdateSubmittedHandlingUnitInput: + type: object + description: Represents information about handling unit. + properties: + amount: + type: number + description: Number of handling units. Depending on the selected handling unit type, it's the number of boxes, pallets or packages placed in the container to be dispatched. + example: 1 + UpdateSubmittedShippingInput: + type: object + description: Represents information about package shipment. + properties: + estimatedTimeOfArrival: + type: string + format: date-time + example: '2020-08-26T12:52:04Z' + description: 'The estimated date and time of Advance Ship Notice arrival in the warehouse. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601).' + truckLicencePlate: + type: string + description: Vehicle licence plate number. + example: 'FZ12453' + courier: + $ref: '#/components/schemas/Courier' + thirdParty: + $ref: '#/components/schemas/ThirdParty' + AdvanceShipNoticeResponse: + type: object + properties: + id: + type: string + format: uuid + description: An UUID identifier of ASN. + example: 71529ad2-2265-4e15-b76b-c17025d848f7 + displayNumber: + type: string + description: A human friendly identifier of ASN. + example: A-210310-0000002 + status: + $ref: '#/components/schemas/AdvanceShipNoticeStatus' + createdAt: + type: string + format: date-time + description: 'The date and time of Advance Ship Notice creation. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601).' + example: '2020-08-26T12:50:04Z' + updatedAt: + type: string + format: date-time + description: 'The date and time of last Advance Ship Notice update. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601).' + example: '2020-08-26T12:52:04Z' + items: + type: array + description: A list of product items. + items: + $ref: '#/components/schemas/ProductItem' + handlingUnit: + $ref: '#/components/schemas/HandlingUnit' + labels: + $ref: '#/components/schemas/Labels' + shipping: + $ref: '#/components/schemas/ShippingExtended' + submittedAt: + type: string + format: date-time + description: 'The date and time of Advance Ship Notice submission. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601).' + required: + - id + - displayNumber + - status + - createdAt + - updatedAt + - items + CreateAdvanceShipNoticeResponse: + type: object + properties: + id: + type: string + format: uuid + description: An UUID identifier of ASN. + example: 71529ad2-2265-4e15-b76b-c17025d848f7 + displayNumber: + type: string + description: A human friendly identifier of ASN. + example: A-210310-0000002 + status: + $ref: '#/components/schemas/AdvanceShipNoticeStatus' + createdAt: + type: string + format: date-time + description: 'The date and time of Advance Ship Notice creation. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601).' + example: '2020-08-26T12:50:04Z' + updatedAt: + type: string + format: date-time + description: 'The date and time of last Advance Ship Notice update. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601).' + example: '2020-08-26T12:50:04Z' + items: + type: array + description: A list of product items. + items: + $ref: '#/components/schemas/ProductItem' + handlingUnit: + $ref: '#/components/schemas/HandlingUnit' + labels: + $ref: '#/components/schemas/Labels' + shipping: + $ref: '#/components/schemas/ShippingExtended' + required: + - id + - displayNumber + - status + - createdAt + - updatedAt + - items + AdvanceShipNoticeList: + type: object + description: The list of Advance Ship Notices. + properties: + advanceShipNotices: + type: array + items: + $ref: '#/components/schemas/AdvanceShipNoticeResponse' + count: + type: number + description: A number of Advance Ship Notices in response. + example: 1 + totalCount: + type: number + description: A number of Advance Ship Notices in total. + example: 1 + required: + - advanceShipNotices + - count + - totalCount + AdvanceShipNoticeStatus: + type: string + description: The Advance Ship Notice Status. + enum: + - DRAFT + - IN_TRANSIT + - UNPACKING + - COMPLETED + - CANCELLED + example: DRAFT + SubmitCommandInput: + type: object + description: Represents input of the Advance Ship Notice submit command. + properties: + advanceShipNoticeId: + type: string + format: uuid + description: The Advance Ship Notice identifier. + example: 123a08d7-ab9b-460d-b9cb-d6ed64b3a018 + required: + - advanceShipNoticeId + SubmitCommandOutput: + type: object + description: Represents output of the Advance Ship Notice submit command. + required: + - status + properties: + status: + type: string + description: The command status. + example: RUNNING + discriminator: + propertyName: status + mapping: + RUNNING: '#/components/schemas/SubmitRunningCommandOutput' + SUCCESSFUL: '#/components/schemas/SubmitSuccessfulCommandOutput' + FAILED: '#/components/schemas/SubmitFailedCommandOutput' + SubmitRunningCommandOutput: + allOf: + - $ref: '#/components/schemas/SubmitCommandOutput' + - type: object + properties: + status: + type: string + default: 'RUNNING' + SubmitSuccessfulCommandOutput: + allOf: + - $ref: '#/components/schemas/SubmitCommandOutput' + - type: object + properties: + status: + type: string + default: 'SUCCESSFUL' + SubmitFailedCommandOutput: + allOf: + - $ref: '#/components/schemas/SubmitCommandOutput' + - type: object + required: + - errors + properties: + status: + type: string + default: 'FAILED' + errors: + $ref: '#/components/schemas/Errors' + SubmitCommand: + type: object + description: The submit command. + properties: + id: + type: string + format: uuid + description: The identifier of command. + example: 71529ad2-2265-4e15-b76b-c17025d848f7 + input: + $ref: '#/components/schemas/SubmitCommandInput' + output: + $ref: '#/components/schemas/SubmitCommandOutput' + required: + - input + Product: + type: object + description: >- + The product data. + properties: + id: + type: string + description: The product identifier. + format: uuid + example: a1520fab-7801-4832-9ccd-fb068c707a74 + required: + - id + ProductItem: + type: object + description: Groups together product and quantity. + properties: + product: + $ref: '#/components/schemas/Product' + quantity: + type: number + description: The quantity of the product. + minimum: 1 + maximum: 1000000 + example: 1 + required: + - product + - quantity + HandlingUnit: + type: object + description: Represents information about handling unit. + properties: + unitType: + type: string + description: The unit type of Advance Ship Notice. Available values - BOX, PALLET, CONTAINER. + example: BOX + amount: + type: number + description: Amount of unit type. Not required when ASN status is DRAFT. When unit type is BOX or PALLET then it means how many handling units will be sent. When unit type is CONTAINER then it means how many handling units inside a container will be sent. + example: 1 + labelsType: + type: string + description: Not required when ASN status is DRAFT. Available values - ONE_FULFILMENT, NONE. When unit type is CONTAINER labelsType can not be set to ONE_FULFILMENT. + example: ONE_FULFILMENT + Labels: + type: object + description: Represents created labels. + properties: + fileUrl: + type: string + description: An URI to file containing labels. + example: 'https://api.allegro.pl/fulfillment/678453232' + Shipping: + type: object + description: >- + Represents information about package shipment. + + Constraints: + * for method OWN_TRANSPORT: truckLicencePlate, estimatedTimeOfArrival and countryCode are required. + * for method COURIER_BY_SELLER: courier, estimatedTimeOfArrival and countryCode are required. + * for method THIRD_PARTY_DELIVERY: thirdParty, estimatedTimeOfArrival and countryCode are required. + required: + - method + properties: + method: + type: string + description: The delivery method of the Advance Ship Notice. Not required when Advance Ship Notice in DRAFT status + example: COURIER_BY_SELLER + discriminator: + propertyName: method + mapping: + OWN_TRANSPORT: '#/components/schemas/OwnTransportShipping' + COURIER_BY_SELLER: '#/components/schemas/CourierBySellerShipping' + THIRD_PARTY_DELIVERY: '#/components/schemas/ThirdPartyDeliveryShipping' + ShippingExtended: + type: object + description: >- + Represents information about package shipment. + + Constraints: + * for method OWN_TRANSPORT: truckLicencePlate, estimatedTimeOfArrival and countryCode are required. + * for method COURIER_BY_SELLER: courier, estimatedTimeOfArrival and countryCode are required. + * for method THIRD_PARTY_DELIVERY: thirdParty, estimatedTimeOfArrival and countryCode are required. + * for method ALREADY_IN_WAREHOUSE: estimatedTimeOfArrival and countryCode are required. + required: + - method + properties: + method: + type: string + description: The delivery method of the Advance Ship Notice. Not required when Advance Ship Notice in DRAFT status + example: COURIER_BY_SELLER + discriminator: + propertyName: method + mapping: + OWN_TRANSPORT: '#/components/schemas/OwnTransportShipping' + COURIER_BY_SELLER: '#/components/schemas/CourierBySellerShipping' + THIRD_PARTY_DELIVERY: '#/components/schemas/ThirdPartyDeliveryShipping' + ALREADY_IN_WAREHOUSE: '#/components/schemas/AlreadyInWarehouseShipping' + OwnTransportShipping: + allOf: + - $ref: '#/components/schemas/Shipping' + - type: object + properties: + method: + type: string + default: 'OWN_TRANSPORT' + truckLicencePlate: + type: string + description: The licence plate of the truck that will deliver the shipment. + example: FZ12453 + estimatedTimeOfArrival: + type: string + format: date-time + description: 'The estimated date and time of Advance Ship Notice arrival in the warehouse. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601).' + countryCode: + type: string + description: Country code in ISO 3166-1 alpha-2 format (two-letter code), which means the country from which Advance Ship Notice is sent. + CourierBySellerShipping: + allOf: + - $ref: '#/components/schemas/Shipping' + - type: object + properties: + method: + type: string + default: 'COURIER_BY_SELLER' + courier: + $ref: '#/components/schemas/Courier' + estimatedTimeOfArrival: + type: string + format: date-time + description: 'The estimated date and time of Advance Ship Notice arrival in the warehouse. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601).' + countryCode: + type: string + description: Country code in ISO 3166-1 alpha-2 format (two-letter code), which means the country from which Advance Ship Notice is sent. + ThirdPartyDeliveryShipping: + allOf: + - $ref: '#/components/schemas/Shipping' + - type: object + properties: + method: + type: string + default: 'THIRD_PARTY_DELIVERY' + thirdParty: + $ref: '#/components/schemas/ThirdParty' + estimatedTimeOfArrival: + type: string + format: date-time + description: 'The estimated date and time of Advance Ship Notice arrival in the warehouse. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601).' + countryCode: + type: string + description: Country code in ISO 3166-1 alpha-2 format (two-letter code), which means the country from which Advance Ship Notice is sent. + AlreadyInWarehouseShipping: + allOf: + - $ref: '#/components/schemas/ShippingExtended' + - type: object + properties: + method: + type: string + default: 'ALREADY_IN_WAREHOUSE' + estimatedTimeOfArrival: + type: string + format: date-time + description: 'The estimated date and time of Advance Ship Notice arrival in the warehouse. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601).' + countryCode: + type: string + description: Country code in ISO 3166-1 alpha-2 format (two-letter code), which means the country from which Advance Ship Notice is sent. + ThirdParty: + type: object + description: Represents shipping details from third party. + properties: + name: + type: string + description: Third party name. + example: 'Company ABC' + orderNumber: + type: string + description: Third party order number. + example: 'Order.2022.10.12.Allegro.1F' + Courier: + type: object + description: Represents courier details of shipping. + properties: + id: + type: string + description: Supported courier ids are ALLEGRO, DB_SCHENKER, DHL, DPD, DPD_SK, INPOST, ORLEN, POCZTA_POLSKA, SUUS, UPS. If requested courier is not supported then use OTHER value and provide courier name in name field. + example: 'DPD' + name: + type: string + description: Courier name to be provided only if id is OTHER, otherwise it's ignored. + example: 'Some Courier' + trackingNumbers: + type: array + description: List of tracking numbers. + items: + type: string + example: [ "00340433982034779798", "12340433982034779888" ] + TaxIdRequest: + type: object + properties: + taxId: + type: string + description: User's tax identification number. + example: '5252674798' + TaxIdResponse: + type: object + properties: + taxId: + type: string + description: User's tax identification number. + example: '5252674798' + verificationStatus: + type: string + description: Tax identification number verification status. Only the ACCEPTED status allows you to send products to the Allegro Warehouse. + example: 'ACCEPTED' + StockProductList: + type: object + description: Represents the current stock for the seller. + properties: + stock: + type: array + description: List of products with their quantity. + items: + $ref: '#/components/schemas/StockProductItem' + count: + type: number + description: Number of returned products. + example: 1 + totalCount: + type: number + description: Total number of available products. + example: 10 + StockProductItem: + type: object + description: Groups together product and its quantity. + properties: + product: + $ref: '#/components/schemas/StockProduct' + quantity: + $ref: '#/components/schemas/StockQuantity' + sellingStats: + $ref: '#/components/schemas/StockSellingStats' + reserve: + $ref: '#/components/schemas/ReserveInfo' + storageFee: + $ref: '#/components/schemas/StockStorageFee' + offerId: + type: string + description: Identifier of the offer currently attached to the product. + example: '10000000015' + StockProduct: + type: object + description: The product. + properties: + id: + type: string + description: The product identifier. + format: uuid + example: 712fa46c-7d4a-4ba0-b094-b5d1d4f6155d + name: + type: string + description: The product name. + example: iPhone 5s + gtins: + type: array + description: List of product's GTIN numbers. + items: + type: string + example: [ "2746650558857", "1859832948337" ] + image: + type: string + description: The product image. + example: 'https://5.allegroimg.com/original/003358/a4f5dbb14d24971aff2ca5afb5d5' + StockQuantity: + type: object + description: Represents stock quantity. + properties: + onOffer: + type: number + description: >- + A number of items which are available on the current active offer for the product. + example: 4 + available: + type: number + description: >- + A number of items in a warehouse available for sale. The amount is taken from the current active offer, + or in case there is no active offer, it shows the amount that will be available on offer after it will + have been created. + example: 4 + onOrder: + type: number + description: >- + A number of items already bought but not shipped. These are items in unpaid and paid orders + that waiting for courier pickup. + example: 4 + onHold: + type: number + description: >- + A number of items in a warehouse not available for sale (e.g. due to damage). + example: 4 + StockSellingStats: + type: object + description: Represents selling stats of given product in merchant's stock. + properties: + lastWeekAverage: + type: number + description: Moving daily sales average calculated for last week (7 calendar days before current day), rounded to integer using "half up" logic. Doesn't include sales for current day. Note that this number is not stable and might change between subsequent requests due to e.g. cancellations of orders within the calculation period. + example: 4 + lastThirtyDaysSum: + type: number + description: Total sales for the last 30 calendar days. Doesn't include sales for current day. Note that this number is not stable and might change between subsequent requests due to e.g. cancellations of orders within the calculation period. + example: 200 + StockStorageFee: + type: object + description: Information about storage fee for a given product in merchant's stock. + properties: + status: + type: string + description: | + Status of the storage fee. + * NOT_APPLICABLE - fee for yesterday has not been charged and there are no available items of the product. + * INCLUDED_IN_SERVICE_PRICE - fee for yesterday has not been charged and there are available items of the product. + * CHARGED - the fee has been charged on seller's billing. + * PREDICTION - prediction of upcoming fee, based on yesterday selling stats and quantity. + enum: + - NOT_APPLICABLE + - INCLUDED_IN_SERVICE_PRICE + - CHARGED + - PREDICTION + feeStatusAt: + type: string + description: >- + Date when the fee was charged. Normally we return the data for the day before. However, due to asynchronous + nature of fee update process, which are calculated overnight, it is possible to have some outdated entries + when querying during fee recalculation process. This value allows to ensure that you work on the most + recent data. + example: 2023-02-17 + details: + type: object + description: Details about charged storage fee. Only present in case of CHARGED status, null otherwise. + properties: + feePayableAt: + type: string + description: >- + Predicted date when the fee will be charged based on quantity and average sales. + Only present in case of PREDICTION status, null otherwise. + chargedItemsQuantity: + type: number + description: >- + Number of items, for which storage fee was charged. For example seller might have 20 items in total, + but only 3 of them are stored longer than free storage period, so the fee is applied only for them. + example: 3 + amountGross: + type: number + description: Total gross amount of the charged fee. + example: 123.45 + currency: + type: string + description: Currency in which the fee was charged. + example: PLN + ReserveInfo: + type: object + description: Contains information about amount of reserve and its sufficiency for next days. If status is set to NOT_ENOUGH_DATA value of will not be sent. + properties: + outOfStockIn: + type: number + description: Prediction of number of days in which inventory will be sold out. + example: 14 + status: + type: string + description: >- + Gives information about inventory, that can not be expressed using `outOfStockIn` property. Can be one + of the given values: NOT_ENOUGH_DATA - not enough data to calculate sufficiency, + LOW_STOCK - inventory quantity will run out soon (in 14 days or less) + NORMAL - prediction can be calculated, EXCESS_ONE_YEAR - amount of inventory will not be exhausted + in (approximately) one year threshold. + enum: + - NOT_ENOUGH_DATA + - LOW_STOCK + - NORMAL + - EXCESS_ONE_YEAR + AvailableProductsList: + type: object + description: The list of available seller's products. + properties: + products: + type: array + description: List of products. + items: + $ref: '#/components/schemas/AvailableProductResponse' + count: + type: number + description: Number of returned products. + example: 1 + totalCount: + type: number + description: Total number of available products. + example: 1 + AvailableProductResponse: + type: object + description: The product. + properties: + id: + type: string + description: The product identifier. + format: uuid + example: 712fa46c-7d4a-4ba0-b094-b5d1d4f6155d + name: + type: string + description: The product name. + example: iPhone 5s + gtins: + type: array + description: List of product's GTIN numbers. + items: + type: string + example: [ "2746650558857", "1859832948337" ] + image: + type: string + description: The product image. + example: 'https://5.allegroimg.com/original/003358/a4f5dbb14d24971aff2ca5afb5d5' + ReceivingState: + type: object + properties: + updatedAt: + type: string + format: date-time + description: 'The date and time when report was updated last time. Provided in [ISO 8601 format](link: https://en.wikipedia.org/wiki/ISO_8601).' + example: '2020-08-26T12:50:04Z' + stage: + type: string + description: Stage of Advance Ship Notice receiving + enum: + - IN_PROGRESS + - COMPLETED + example: COMPLETED + displayNumber: + type: string + description: A human friendly identifier of Advance Ship Notice. + example: A-210310-0000002 + content: + type: array + description: The list of products with receiving status. + items: + $ref: '#/components/schemas/ReceivingEntry' + ReceivingEntry: + type: object + properties: + expected: + type: integer + minimum: 0 + description: Expected product quantity. + example: 10 + product: + $ref: '#/components/schemas/Product' + received: + type: array + items: + $ref: '#/components/schemas/ReceivingStatus' + ReceivingStatus: + type: object + properties: + quantity: + type: integer + minimum: 0 + description: Product quantity. + example: 10 + receivedType: + type: string + description: Received item condition. + example: SELLABLE + enum: + - SELLABLE + - DAMAGE + - REJECT + reasonCode: + type: string + description: The reasonCode indicates the condition of the product after unpacking. For sellable product is given the reasonCode SELLABLE. + For a product that is not suitable for sale receives a code specifying a detailed reason for rejection, e.g. "DAMAGED_IN_TRANSPORT" or "NO_BARCODE" + example: SELLABLE + enum: + - SELLABLE + - DAMAGED_CARRIER_CLAIM + - DAMAGED_IN_TRANSPORT + - NO_BARCODE + - PRODUCT_NOT_ACCEPTABLE_IN_FULFILLMENT + - SHORT_EXPIRY_DATE + - UNACCEPTABLE_HAZMAT + - UNACCEPTABLE_PRODUCT_SIZE + - UNACCEPTABLE_PRODUCT_VARIANT + - UNSCANNABLE_BARCODE + FulfillmentOrder: + type: object + properties: + orderId: + type: string + description: order identifier + example: 'dd4bbba0-d692-11ec-9eac-2d3687b9fed8' + parcels: + type: array + items: + $ref: '#/components/schemas/FulfillmentOrderParcel' + FulfillmentOrderParcel: + type: object + properties: + waybill: + type: string + description: Waybill number (parcel tracking number). + example: 1Z8332YF6895912532 + items: + type: array + description: List of parcels' items + items: + $ref: '#/components/schemas/FulfillmentOrderParcelItem' + FulfillmentOrderParcelItem: + type: object + properties: + productId: + type: string + description: Product identifier + example: '0e810d4a-bbee-495c-8979-866bb06d3904' + quantity: + type: integer + description: Number of items placed in a parcel + example: 1 + serialNumbers: + type: array + description: List of serial numbers of included items + items: + type: string + example: '4CE0460D0G' + expirationDate: + type: string + description: Expiration date of all items associated by quantity + format: date + example: "2020-05-01" + offerId: + type: string + description: Offer identifier + example: '10000000003' + AllegroCarrier: + type: string + enum: + - UPS + - ALLEGRO_ONE_KURIER + - DPD + AllegroMarketplaces: + type: object + properties: + marketplaces: + type: array + description: List of marketplaces in allegro + items: + $ref: '#/components/schemas/MarketplaceItem' + MarketplaceItem: + type: object + properties: + id: + type: string + description: Marketplace id + example: "allegro-pl" + languages: + type: object + description: Languages available for that marketplace + properties: + offerCreation: + type: array + description: Languages in which you can create offer + items: + $ref: '#/components/schemas/MarketplaceItemLanguage' + offerDisplay: + type: array + description: Languages in which buyer can see the offer + items: + $ref: '#/components/schemas/MarketplaceItemLanguage' + currencies: + type: object + description: Currencies available for that marketplace + properties: + base: + $ref: '#/components/schemas/MarketplaceItemCurrency' + additional: + type: array + description: List of other currencies available for that marketplace + items: + $ref: '#/components/schemas/MarketplaceItemCurrency' + shippingCountries: + type: array + description: List of delivery countries for that marketplace + items: + $ref: '#/components/schemas/MarketplaceItemShippingCountry' + MarketplaceItemLanguage: + type: object + properties: + code: + type: string + description: BCP-47 language code + example: "pl-PL" + MarketplaceItemCurrency: + type: object + properties: + code: + type: string + description: ISO 4217 currency code + example: "PLN" + MarketplaceItemShippingCountry: + type: object + properties: + code: + type: string + description: ISO 3166 country code + example: "PL" + ReceiverAddressDto: + description: Receiver address data with optional point ID. + allOf: + - $ref: "#/components/schemas/AddressDto" + - type: object + properties: + point: + type: string + description: Pick up point id. You can get it from order or directly from courier service. + example: A1234567 + ShipmentPickupAddressDto: + description: >- + Optional pickup address with optional drop-off point. If empty, then sender object will be used. + Parameter is deprecated and will be removed in the future. + Pickup address should be provided when requesting Pickup. + deprecated: true + allOf: + - $ref: "#/components/schemas/AddressDto" + - type: object + properties: + point: + type: string + description: Drop off point id. You can get it directly from courier service. + example: A1234567 + SenderAddressDto: + description: Shipment owner data. This address will be provided on label and will be used to operation return. + allOf: + - $ref: "#/components/schemas/AddressDto" + - type: object + properties: + point: + type: string + description: Drop off point id. You can get it directly from courier service. + example: A1234567 + PickupAddressDto: + description: >- + Optional pickup address with optional drop-off point. + If empty, then pickup address from Shipment object will be used. + allOf: + - $ref: "#/components/schemas/AddressDto" + - type: object + properties: + point: + type: string + description: Drop off point id. You can get it directly from courier service. + example: A1234567 + AddressDto: + required: + - street + - city + - countryCode + - postalCode + - email + - phone + type: object + description: Address object + properties: + name: + type: string + description: Person name. Name or Company are required. + example: Jan Kowalski + company: + type: string + description: Company name. Name or Company are required. + example: Allegro.pl sp. z o.o. + street: + type: string + example: Główna 30 + postalCode: + type: string + example: 10-200 + city: + type: string + example: Warszawa + state: + type: string + description: Required for shipments to Ireland( county name ), United States ( state abbreviation / ISO code ), Canada ( province postal code / ISO code ) + example: AL + countryCode: + pattern: '[A-Z]{2}' + type: string + description: Country code in ISO 3166-1 alfa-2 format (two-letter code). + default: PL + email: + type: string + description: Email address. For receiver, must be a valid buyer email generated by Allegro (eg. hamu7udk3p+17454c1b6@allegromail.pl). + example: "email@mail.com" + phone: + type: string + description: Cell phone + example: '500600700' + point: + type: string + description: Pickup point id. You can get it from order or directly from courier service. + example: A1234567 + ShipmentCreateCommandDto: + required: + - input + type: object + properties: + commandId: + type: string + example: 14e142cf-e8e0-48cc-bcf6-399b5fd90b32 + description: Command UUID. If empty, then system generate new one. + input: + $ref: >- + #/components/schemas/ShipmentCreateRequestDto + CashOnDeliveryDto: + required: + - amount + - currency + type: object + properties: + amount: + pattern: \d+[.,]\d{1,2} + type: string + description: Postpaid value + example: "2.50" + currency: + pattern: '[A-Z]{3}' + type: string + description: ISO 4217 currency code. + example: "PLN" + ownerName: + type: string + example: "Jan Kowalski" + description: "Bank account owner." + iban: + type: string + example: "PL48109024022441789739167589" + description: Bank account number. + InsuranceDto: + required: + - amount + - currency + type: object + properties: + amount: + pattern: \d+[.,]\d{1,2} + type: string + description: Additional parcel protection value + example: "23.47" + currency: + pattern: '[A-Z]{3}' + type: string + description: ISO 4217 currency code. + example: "PLN" + PackageRequestDto: + required: + - height + - length + - type + - weight + - width + type: object + properties: + type: + pattern: DOX|PACKAGE|PALLET|OTHER + type: string + description: 'Available values: PACKAGE|DOX|PALLET|OTHER' + length: + $ref: >- + #/components/schemas/DimensionValue + width: + $ref: >- + #/components/schemas/DimensionValue + height: + $ref: >- + #/components/schemas/DimensionValue + weight: + $ref: >- + #/components/schemas/WeightValue + textOnLabel: + type: string + description: "Additional information on the package label." + ShipmentCreateRequestDto: + required: + - deliveryMethodId + - sender + - receiver + - packages + type: object + properties: + deliveryMethodId: + type: string + description: Id of delivery method, chosen by buyer in order. + example: c3066682-97a3-42fe-9eb5-3beeccab840c + credentialsId: + type: string + description: ID of merchant agreement, registered in WZA. Value should be read from /shipment-management/delivery-services. For Allegro Standard methods, this field should be null. + example: c9e6f40a-3d25-48fc-838c-055ceb1c5bc0 + sender: + $ref: '#/components/schemas/SenderAddressDto' + receiver: + $ref: '#/components/schemas/ReceiverAddressDto' + pickup: + $ref: '#/components/schemas/ShipmentPickupAddressDto' + referenceNumber: + type: string + description: "Shipment identifier in own system. Example: `Ordering number`." + example: abcd1234 + packages: + type: array + items: + $ref: >- + #/components/schemas/PackageRequestDto + insurance: + $ref: >- + #/components/schemas/InsuranceDto + cashOnDelivery: + $ref: >- + #/components/schemas/CashOnDeliveryDto + labelFormat: + pattern: PDF|ZPL + type: string + description: Label file format. + enum: + - PDF + - ZPL + additionalServices: + type: array + description: List of additional services. + items: + type: string + description: Additional service ID. List of available services is located as sub-resource in /shipment-management/delivery-services. + example: ADDITIONAL_HANDLING + additionalProperties: + type: object + description: Key-Value map defining non-standard, carrier specific features. List of the supported properties is located as sub-resource in /shipment-management/delivery-services. + additionalProperties: + x-additionalPropertiesName: additionalPropertyId + type: string + + ShipmentCancelCommandDto: + required: + - input + type: object + properties: + commandId: + type: string + example: 14e142cf-e8e0-48cc-bcf6-399b5fd90b32 + description: Command UUID. If empty, then system generate new one. + input: + $ref: >- + #/components/schemas/ShipmentCancelRequestDto + ShipmentCancelRequestDto: + required: + - shipmentId + type: object + properties: + shipmentId: + type: string + example: ba88f0fb-acf3-438a-877e-580da50c0874 + ShipmentIdsDto: + required: + - shipmentIds + type: object + properties: + shipmentIds: + maxItems: 2147483647 + minItems: 1 + type: array + items: + type: string + example: ba88f0fb-acf3-438a-877e-580da50c0874 + PickupCreateCommandDto: + required: + - input + type: object + properties: + commandId: + type: string + example: 14e142cf-e8e0-48cc-bcf6-399b5fd90b32 + description: Command UUID. If empty, then system generate new one. + input: + $ref: >- + #/components/schemas/PickupCreateRequestDto + PickupCreateRequestDto: + required: + - pickupDateProposalId + - shipmentIds + type: object + properties: + shipmentIds: + maxItems: 2147483647 + minItems: 1 + type: array + items: + type: string + example: ba88f0fb-acf3-438a-877e-580da50c0874 + pickupDateProposalId: + type: string + description: Internal pickup proposal ID + example: '2023071210001300' + address: + $ref: '#/components/schemas/PickupAddressDto' + PickupDateProposalDto: + required: + - id + - name + type: object + properties: + id: + type: string + description: Internal pickup proposal ID + example: '2023071210001300' + name: + type: string + description: Human readable name of pickup proposal + example: 2023-07-12 10:00-13:00 + description: + type: string + description: Additional information for pickup proposal + example: "Odbiór A" + PickupProposalsRequestDto: + required: + - shipmentIds + type: object + properties: + shipmentIds: + maxItems: 2147483647 + minItems: 1 + type: array + items: + type: string + example: ba88f0fb-acf3-438a-877e-580da50c0874 + readyDate: + type: string + description: Date when shipments will be ready. + example: "2020-01-01" + address: + $ref: '#/components/schemas/PickupAddressDto' + PickupDateProposalsDto: + type: object + properties: + shipmentId: + type: string + example: ba88f0fb-acf3-438a-877e-580da50c0874 + proposalItems: + type: array + items: + $ref: >- + #/components/schemas/PickupDateProposalDto + PickupProposalsResponseDto: + type: object + properties: + proposals: + type: array + items: + $ref: >- + #/components/schemas/PickupDateProposalsDto + address: + $ref: '#/components/schemas/PickupAddressDto' + LabelRequestDto: + required: + - shipmentIds + type: object + properties: + shipmentIds: + maxItems: 2147483647 + minItems: 1 + type: array + items: + type: string + example: ba88f0fb-acf3-438a-877e-580da50c0874 + pageSize: + type: string + description: Label page format. Only for PDF file. + enum: + - A4 + - A6 + cutLine: + description: Put additional cut lines. Only for PDF file with A4 size. + type: boolean + PackageDto: + type: object + properties: + waybill: + type: string + description: Waybill number (carrier tracking number). + type: + type: string + enum: + - DOX + - PACKAGE + - PALLET + - OTHER + length: + $ref: >- + #/components/schemas/DimensionValue + width: + $ref: >- + #/components/schemas/DimensionValue + height: + $ref: >- + #/components/schemas/DimensionValue + weight: + $ref: >- + #/components/schemas/WeightValue + textOnLabel: + type: string + description: "Additional information on the package label." + ShipmentDto: + type: object + properties: + id: + type: string + example: ba88f0fb-acf3-438a-877e-580da50c0874 + deliveryMethodId: + type: string + description: Id of delivery method, chosen by buyer in order. + example: c3066682-97a3-42fe-9eb5-3beeccab840c + credentialsId: + type: string + description: ID of merchant agreement, registered in WZA. For Allegro methods, this field is null. + example: c9e6f40a-3d25-48fc-838c-055ceb1c5bc0 + sender: + $ref: '#/components/schemas/SenderAddressDto' + receiver: + $ref: '#/components/schemas/ReceiverAddressDto' + pickup: + $ref: '#/components/schemas/ShipmentPickupAddressDto' + referenceNumber: + type: string + description: "Shipment identifier in own system. Example: `Ordering number`." + example: abcd1234 + packages: + type: array + items: + $ref: >- + #/components/schemas/PackageDto + insurance: + $ref: >- + #/components/schemas/InsuranceDto + cashOnDelivery: + $ref: >- + #/components/schemas/CashOnDeliveryDto + createdDate: + type: string + description: Shipment creation date + canceledDate: + type: string + description: Shipment cancellation date. Only for canceled shipments, in all other cases is null. + carrier: + type: string + description: ID of carrier which carries out a shipment + labelFormat: + type: string + description: Label file format. + enum: + - PDF + - ZPL + - EPL + additionalServices: + type: array + description: List of additional services. + items: + type: string + description: Additional service ID. List of available services is located as sub-resource in /shipment-management/delivery-services. + example: ADDITIONAL_HANDLING + additionalProperties: + type: object + description: Key-Value map defining non-standard, carrier specific features. List of the supported properties is located as sub-resource in /shipment-management/delivery-services. + additionalProperties: + x-additionalPropertiesName: additionalPropertyId + type: string + transport: + type: array + description: List with identifiers of the carriers that take part in the transport of this shipment. Often it is a single value list, when only one carrier is involved. There are shipments where multiple carriers are used to deliver the package, mainly in a case of international shipments, then there will be two or more values. + example: ["InPost", "WEDO"] + items: + type: string + description: Name of the carrier company. + example: DPD + pickupAvailable: + type: boolean + description: Information about pickup order option availability for this shipment. True if it is possible to order a pickup for given shipment. + CreateShipmentCommandStatusDto: + type: object + properties: + commandId: + type: string + example: 14e142cf-e8e0-48cc-bcf6-399b5fd90b32 + description: Command UUID + status: + type: string + enum: + - IN_PROGRESS + - SUCCESS + - ERROR + errors: + type: array + description: List of errors. Available only, if operation finished with ERROR. + items: + $ref: '#/components/schemas/Error400' + shipmentId: + type: string + description: Generated shipment ID. Available only, if operation finished with SUCCESS. + example: ba88f0fb-acf3-438a-877e-580da50c0874 + CancelShipmentCommandStatusDto: + type: object + properties: + commandId: + type: string + example: 14e142cf-e8e0-48cc-bcf6-399b5fd90b32 + description: Command UUID + status: + type: string + enum: + - IN_PROGRESS + - SUCCESS + - ERROR + errors: + type: array + description: List of errors. Available only, if operation finished with ERROR. + items: + $ref: '#/components/schemas/Error400' + shipmentId: + type: string + description: Generated shipment ID. Available only, if operation finished with SUCCESS. + example: ba88f0fb-acf3-438a-877e-580da50c0874 + CreatePickupCommandStatusDto: + type: object + properties: + commandId: + type: string + example: 14e142cf-e8e0-48cc-bcf6-399b5fd90b32 + description: Command UUID + status: + type: string + enum: + - IN_PROGRESS + - SUCCESS + - ERROR + errors: + type: array + description: List of errors. Available only, if operation finished with ERROR. + items: + $ref: '#/components/schemas/Error400' + pickupId: + type: string + description: Generated internal pickup ID. Available only, if operation finished with SUCCESS. + example: 14e142cf-e8e0-48cc-bcf6-399b5fd90b32 + carrierPickupId: + type: string + description: Generated Carrier Pickup ID. Available only, if operation finished with SUCCESS. + example: A10234234523 + AdditionalServiceDto: + type: object + required: + - id + - name + properties: + id: + type: string + description: ID of additional service. + example: ADDITIONAL_HANDLING + name: + type: string + description: "Translated name of service: 'Non-standard parcel' | 'Niestandardowa przesyłka'." + example: Non-standard parcel + description: + type: string + description: Optional description of service. + AdditionalPropertyDto: + type: object + required: + - id + - name + - description + - required + - readOnly + properties: + id: + type: string + description: ID of the additional property. + example: 'SENDING_CODE' + name: + type: string + description: "Translated name of the additional property: 'Sending code' | 'Kod nadania'." + example: 'Sending code' + description: + type: string + description: Translated description of the additional property. + example: 'Code required to send the shipment' + required: + type: boolean + description: Defines if the additional property is mandatory or optional. + example: false + readOnly: + type: boolean + description: If 'false', the additional property value can be set in request, 'true' means that it is set by carrier and will be available only in /shipment-management/shipments/{shipmentId} response. + CashOnDeliveryLimitDto: + type: object + description: Definition of cash on delivery specification for method. If null, then COD is not supported. + properties: + limit: + type: number + description: Maximum value + example: 50000 + currency: + type: string + description: "Supported currency: 'PLN' | 'CZK" + example: PLN + default: PLN + paymentType: + type: string + description: "Type of payment: Money transfer to merchant bank account or internal wallet payout" + enum: + - MONEY_TRANSFER + - WALLET_TRANSFER + forceRequireIban: + description: "Defined that COD required IBAN for process shipment. If true, then request of shipment creation without IBAN will be rejected." + type: boolean + DeliveryServiceDto: + type: object + description: >- + Primary object for Ship with Allegro. It's strongly related to delivery-method selected by buyer + in purchase process and represent how shipment will be delivered. Delivery services contains set + of features like cash on delivery support, additional parcel protection, additional services used to shipment creation. + properties: + id: + $ref: >- + #/components/schemas/DeliveryServiceIdDto + name: + type: string + description: >- + Name of delivery service.
+ For Allegro Standard method, name of service will be exactly same and occurs only once: eg. 'Allegro Courier DPD'.
+ For merchant's controlled method, name is concatenation of method name and credential name: eg. 'Courier DPD (My agreement)'. + example: Allegro Courier DPD + carrierId: + type: string + example: DPD + additionalServices: + type: array + items: + $ref: >- + #/components/schemas/AdditionalServiceDto + additionalProperties: + type: array + items: + $ref: >- + #/components/schemas/AdditionalPropertyDto + owner: + type: string + description: "Define delivery method type. ALLEGRO - Allegro Standard. Client - Merchant carrier agreement" + enum: + - ALLEGRO + - CLIENT + marketplaces: + type: array + description: "List of marketplaces supported by service" + items: + type: string + example: "allegro-pl" + packageTypes: + type: array + description: List of supported package types + items: + type: string + enum: + - DOX + - PACKAGE + - PALLET + - OTHER + cashOnDelivery: + $ref: >- + #/components/schemas/CashOnDeliveryLimitDto + insurance: + $ref: >- + #/components/schemas/LimitWithCurrencyDto + features: + description: A map of service-specific features. List of key will be builded per services. + type: object + additionalProperties: + type: string + DeliveryServiceIdDto: + type: object + properties: + deliveryMethodId: + type: string + description: Id of delivery method, chosen by buyer in order. + example: c3066682-97a3-42fe-9eb5-3beeccab840c + credentialsId: + type: string + description: ID of merchant agreement, registered in WZA. For Allegro Standard methods, this field is null. + example: c9e6f40a-3d25-48fc-838c-055ceb1c5bc0 + DeliveryServicesDto: + type: object + description: List of all available delivery services for merchant. List will be unique for each merchant. + properties: + services: + type: array + items: + $ref: >- + #/components/schemas/DeliveryServiceDto + LimitWithCurrencyDto: + type: object + properties: + limit: + type: number + description: Maximum value + example: 50000 + currency: + type: string + description: ISO 4217 currency code. Currency code depends on marketplace, e.g. PLN for allegro-pl, CZK for allegro-cz. + example: 'PLN' + WeightValue: + required: + - value + - unit + type: object + properties: + value: + type: number + description: Weight value, provided in a string format to avoid rounding errors. + example: 12.45 + unit: + type: string + nullable: true + description: Weight unit. Currently only `KILOGRAMS` is accepted. + enum: + - KILOGRAMS + DimensionValue: + required: + - value + - unit + type: object + properties: + value: + type: number + description: Dimension value. + example: 12 + unit: + type: string + nullable: true + description: Dimension unit. Currently only `CENTIMETER` is accepted. + enum: + - CENTIMETER + ResponsiblePersonResponse: + type: object + properties: + id: + type: string + format: uuid + description: Responsible person ID. + example: "fee43309-8761-43f9-9cfd-a43e539a0fc5" + name: + type: string + description: Internal name of responsible person in dictionary (visible only to you). + example: "Person responsible for batteries" + maxLength: 50 + personalData: + type: object + description: Responsible person personal data. + properties: + name: + type: string + description: Name of responsible person. + example: "Responsible person company name" + maxLength: 200 + address: + $ref: '#/components/schemas/ResponsiblePersonAddress' + contact: + $ref: '#/components/schemas/ResponsiblePersonContact' + CreateResponsiblePersonRequest: + type: object + properties: + name: + type: string + description: >- + Internal name of responsible person in dictionary (visible only to you). + Can't start or end with whitespace. + Can't contain whitespaces other than space. + Can't contain multiple spaces in a row. + example: "Person responsible for batteries" + maxLength: 50 + personalData: + type: object + description: Responsible person personal data. + properties: + name: + type: string + description: >- + Name of responsible person. + Can't start or end with whitespace. + Can't contain whitespaces other than space. + Can't contain multiple spaces in a row. + example: "Responsible person company name" + maxLength: 200 + address: + $ref: '#/components/schemas/ResponsiblePersonAddress' + contact: + $ref: '#/components/schemas/ResponsiblePersonContact' + UpdateResponsiblePersonRequest: + type: object + properties: + id: + type: string + format: uuid + description: Responsible person ID. + example: "fee43309-8761-43f9-9cfd-a43e539a0fc5" + name: + type: string + description: >- + Internal name of responsible person in dictionary (visible only to you). + Can't start or end with whitespace. + Can't contain whitespaces other than space. + Can't contain multiple spaces in a row. + example: "Person responsible for batteries" + maxLength: 50 + personalData: + type: object + description: Responsible person personal data. + properties: + name: + type: string + description: Name of responsible person. + example: "Responsible person company name" + maxLength: 200 + address: + $ref: '#/components/schemas/ResponsiblePersonAddress' + contact: + $ref: '#/components/schemas/ResponsiblePersonContact' + ResponsiblePersonAddress: + type: object + description: Responsible person address. + properties: + countryCode: + type: string + description: Code of responsible person country (ISO 3166). + example: "PL" + enum: + - AT + - BE + - BG + - HR + - CY + - CZ + - DK + - EE + - FI + - FR + - GR + - ES + - IE + - LT + - LU + - LV + - MT + - NL + - DE + - PL + - PT + - RO + - SK + - SI + - SE + - HU + - IT + street: + type: string + description: Street and number. + example: "Wiśniowa 1" + maxLength: 200 + postalCode: + type: string + description: Postal code. + example: "00-000" + maxLength: 20 + city: + type: string + description: City. + example: "Warszawa" + maxLength: 100 + ResponsiblePersonContact: + type: object + description: "Contact to responsible person. At least one of the following fields is required: `email` or `formUrl`." + properties: + email: + type: string + description: Email of responsible person. + example: "some@email.com" + maxLength: 50 + phoneNumber: + type: string + description: Phone number of responsible person. This field is optional. + example: "123123123" + maxLength: 30 + formUrl: + type: string + description: URL address to contact form. + example: "https://example.com/contact" + maxLength: 80 + ResponsibleProducerResponse: + type: object + properties: + id: + type: string + format: uuid + description: Responsible producer ID. + example: "fee43309-8761-43f9-9cfd-a43e539a0fc5" + name: + type: string + description: Internal name of responsible producer in dictionary. + example: "Company responsible for producing product." + maxLength: 50 + producerData: + type: object + description: Responsible producer data. + properties: + tradeName: + type: string + description: Name of company, first name and last name or trade name of company responsible for producing product. + example: "Trade name of responsible producer" + maxLength: 200 + address: + $ref: '#/components/schemas/ResponsibleProducerAddress' + contact: + $ref: '#/components/schemas/ResponsibleProducerContact' + CreateResponsibleProducerRequest: + type: object + properties: + name: + type: string + description: >- + Internal name of responsible producer in dictionary (visible only to you). + Can't start or end with whitespace. + Can't contain whitespaces other than space. + Can't contain multiple spaces in a row. + example: "Company responsible for producing product." + maxLength: 50 + producerData: + type: object + description: Responsible producer data. + properties: + tradeName: + type: string + description: Name of company, first name and last name or trade name of company responsible for producing product. + example: "Trade name of responsible producer" + maxLength: 200 + address: + $ref: '#/components/schemas/ResponsibleProducerAddress' + contact: + $ref: '#/components/schemas/ResponsibleProducerContact' + UpdateResponsibleProducerRequest: + type: object + properties: + id: + type: string + format: uuid + description: Responsible producer ID. + example: "fee43309-8761-43f9-9cfd-a43e539a0fc5" + name: + type: string + description: >- + Internal name of responsible producer in dictionary (visible only to you). + Can't start or end with whitespace. + Can't contain whitespaces other than space. + Can't contain multiple spaces in a row. + example: "Company responsible for producing product." + maxLength: 50 + producerData: + type: object + description: Responsible producer data. + properties: + tradeName: + type: string + description: Name of company, first name and last name or trade name of company responsible for producing product. + example: "Trade name of responsible producer" + maxLength: 200 + address: + $ref: '#/components/schemas/ResponsibleProducerAddress' + contact: + $ref: '#/components/schemas/ResponsibleProducerContact' + ResponsibleProducerAddress: + type: object + description: Responsible producer address. + properties: + countryCode: + type: string + description: Code of responsible producer country (ISO 3166). + example: "PL" + pattern: '[A-Z]{2}' + street: + type: string + description: Street and number. + example: "Wiśniowa 1" + maxLength: 200 + postalCode: + type: string + description: Postal code. + example: "00-000" + maxLength: 20 + city: + type: string + description: City. + example: "Warszawa" + maxLength: 100 + ResponsibleProducerContact: + type: object + description: "Contact to responsible producer. At least one of the following fields is required: `email` or `formUrl`." + properties: + email: + type: string + description: Email of responsible producer. + example: "some@email.com" + maxLength: 50 + phoneNumber: + type: string + description: Phone number of responsible producer. This field is optional. + example: "123123123" + maxLength: 30 + formUrl: + type: string + description: URL address to contact form. + example: "https://example.com/contact" + maxLength: 80 + TurnoverDiscountRequest: + type: object + properties: + thresholds: + type: array + description: List of thresholds to apply to cumulated turnover. + items: + $ref: '#/components/schemas/TurnoverDiscountThresholdDto' + TurnoverDiscountListDto: + type: array + description: List of turnover discounts for marketplaces. + items: + $ref: '#/components/schemas/NullableTurnoverDiscountDto' + NullableTurnoverDiscountDto: + type: object + description: Turnover discount for a marketplace. + properties: + marketplaceId: + type: string + description: Marketplace ID. + example: "allegro-business-cz" + status: + type: string + nullable: true + description: Turnover discount status. + example: 'ACTIVATING' + enum: + - "ACTIVATING" + - "ACTIVE" + - "DEACTIVATING" + - null + definitions: + type: array + nullable: true + description: Definitions currently active or active in the future. + items: + $ref: '#/components/schemas/TurnoverDiscountDefinitionDto' + TurnoverDiscountDto: + type: object + description: Turnover discount for a marketplace. + properties: + marketplaceId: + type: string + description: Marketplace ID. + example: "allegro-business-cz" + status: + type: string + description: Turnover discount status. + example: 'ACTIVATING' + enum: + - "ACTIVATING" + - "ACTIVE" + - "DEACTIVATING" + definitions: + type: array + description: Definitions currently active or active in the future. + items: + $ref: '#/components/schemas/TurnoverDiscountDefinitionDto' + TurnoverDiscountDefinitionDto: + type: object + description: Turnover discount definition. + properties: + cumulatingFromDate: + type: string + format: date + description: First day of cumulating turnover against definition. + example: "2024-12-01" + cumulatingToDate: + type: string + format: date + nullable: true + description: First day when cumulating turnover against definition is no longer happening. If empty - cumulating turnover will be continued indefinitely. + example: null + spendingFromDate: + type: string + format: date + description: First day of applying discount from this definition based on cumulated turnover. + example: "2025-01-01" + spendingToDate: + type: string + format: date + nullable: true + description: First day when applying discount from definition is no longer happening. If empty - applying discount will be continued indefinitely. + example: null + createdAt: + type: string + format: date-time + description: Creation date of the definition. + example: "2024-11-16T10:12:32.321Z" + updatedAt: + type: string + format: date-time + description: Last update date of the definition. + example: "2024-11-16T22:41:12.523Z" + thresholds: + type: array + description: Turnover discount thresholds. + items: + $ref: '#/components/schemas/TurnoverDiscountThresholdDto' + TurnoverDiscountThresholdDto: + type: object + description: Turnover discount threshold. + properties: + minimumTurnover: + type: object + description: The minimum turnover that the buyer is required to accumulate in order to receive a discount for the next month. + properties: + amount: + type: string + description: Amount of the minimal turnover. The fractional part must be absent or equal to 0. + example: '4000' + currency: + type: string + format: ISO 4217 + description: The currency provided as a 3-letter code in accordance with ISO 4217 standard (https://en.wikipedia.org/wiki/ISO_4217). Must meet the base currency for the marketplace. + example: 'CZK' + discount: + type: object + description: Discount obtained by user after reaching turnover threshold. + properties: + percentage: + type: string + description: Discount percentage value. The fractional part must be absent or equal to 0. + example: '5' From eb69a1d77e2c6691a3967487b53a3f65b6e51d75 Mon Sep 17 00:00:00 2001 From: wtx-labs Date: Mon, 23 Jun 2025 12:54:38 +0200 Subject: [PATCH 2/3] Github workflows --- .github/settings.xml | 19 ++++++ .github/workflows/maven-central.yml | 98 +++++++++++++++++++++++++++++ .github/workflows/maven.yml | 39 ++++++++++++ .github/workflows/release.yml | 34 ++++++++++ 4 files changed, 190 insertions(+) create mode 100644 .github/settings.xml create mode 100644 .github/workflows/maven-central.yml create mode 100644 .github/workflows/maven.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/settings.xml b/.github/settings.xml new file mode 100644 index 0000000..6cc0fe2 --- /dev/null +++ b/.github/settings.xml @@ -0,0 +1,19 @@ + + + + + github + ${env.MAVEN_USERNAME} + ${env.MAVEN_PASSWORD} + + + central + ${{env.OSSRH_USERNAME_TOKEN }} + ${{env.OSSRH_PASSWORD_TOKEN }} + + + + \ No newline at end of file diff --git a/.github/workflows/maven-central.yml b/.github/workflows/maven-central.yml new file mode 100644 index 0000000..3116191 --- /dev/null +++ b/.github/workflows/maven-central.yml @@ -0,0 +1,98 @@ +name: Publish to Maven Central + +on: + push: + tags: + - 'v*' + branches: + - 'feature/release-*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + + - name: Setup GPG + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: | + echo "Setting up GPG..." + mkdir -p ~/.gnupg + chmod 700 ~/.gnupg + + # Debug: Sprawdź długość klucza + echo "GPG_PRIVATE_KEY length: ${#GPG_PRIVATE_KEY}" + + # Debug: Sprawdź początek klucza (bez ujawniania tajemnicy) + echo "GPG_KEYNAME: $GPG_KEYNAME" + echo "GPG_PASSPHRASE length: ${#GPG_PASSPHRASE}" + echo "First 10 chars of GPG_PRIVATE_KEY: ${GPG_PRIVATE_KEY:0:10}" + + # Tepporary write key for debug + echo "$GPG_PRIVATE_KEY" > private.tmp + echo "File content (first line): $(head -1 private.tmp)" + + # Import key + echo "Importing GPG key..." + gpg --batch --import private.tmp || echo "Import failed!" + rm private.tmp + + - name: Configure Maven + run: | + mkdir -p ~/.m2 + cat > ~/.m2/settings.xml << EOF + + + + central + ${{ secrets.OSSRH_USERNAME_TOKEN }} + ${{ secrets.OSSRH_PASSWORD_TOKEN }} + + + + + central + + true + + + gpg + ${{ secrets.GPG_PASSPHRASE }} + + + + + EOF + + - name: Build and Publish + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME_TOKEN }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD_TOKEN }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }} + run: | + echo "Starting Maven build and deploy..." + mvn clean deploy -P release \ + -Dmaven.javadoc.skip=false \ + -Dmaven.deploy.skip=false \ + -Dgpg.keyname=$GPG_KEYNAME \ + -Dgpg.useagent=false \ + -Dgpg.passphrase=$GPG_PASSPHRASE \ + -Dmaven.test.failure.ignore=false \ + -DaltDeploymentRepository=ossrh::default::https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ \ + -DrepositoryId=ossrh \ + -Dusername=$OSSRH_USERNAME \ + -Dpassword=$OSSRH_PASSWORD diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..70ddbe7 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,39 @@ +name: Build and Publish + +on: + push: + branches: [ main ] + tags: + - 'v*' + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: 'maven' + - name: Build + run: mvn clean install -Dmaven.javadoc.skip=true + - name: Create Release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: | + target/*.jar + target/*.pom + target/*.asc + target/*.md5 + target/*.sha1 + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..88a5062 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: 'maven' + + - name: Build with Maven + run: | + mvn -B clean package -DskipTests + mvn -B javadoc:javadoc + mvn -B source:jar + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + name: From 774a14c63d9c90875eedad72b929ed21f0945b96 Mon Sep 17 00:00:00 2001 From: wtx-labs Date: Mon, 23 Jun 2025 12:56:00 +0200 Subject: [PATCH 3/3] Javadoc update --- src/main/java/pl/wtx/allegro/AllegroApiClient.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/pl/wtx/allegro/AllegroApiClient.java b/src/main/java/pl/wtx/allegro/AllegroApiClient.java index 0340c74..9b56234 100644 --- a/src/main/java/pl/wtx/allegro/AllegroApiClient.java +++ b/src/main/java/pl/wtx/allegro/AllegroApiClient.java @@ -16,6 +16,10 @@ *

* By default, it ignores unrecognized fields in API responses to improve robustness. *

+ * + * @author WTX Labs + * @see https://github.com/wtx-labs/allegro-rest-api-client-java + * @license MIT */ public class AllegroApiClient extends ApiClient {